Kingdom Of Galanor

From our thread on the Unity Forums

In my last update, I forgot to mention the headache I faced trying to save the waypoint data in the NPC custom inspector. As I was working with an array I couldn’t use the SerialisedObject system for that part, so I was using Undo.RecordObject, but during testing, I found that Undos were causing the array element order to get mixed up.

It took me a while to discover that I needed to use Undo.RegisterCompleteObjectUndo instead to avoid this happening. Which was great, but then the exact same code that was now working perfectly in my test scene completely failed to save the data in my actual game scenes!

I spent nearly a day trying to figure this out until I stumbled across the nugget of information that scene instances of prefabs also need to have PrefabUtility.RecordPrefabInstancePropertyModifications used on them to make sure the changes are saved to the underlying scene object. (My test scene wasn’t using an instance of a prefab for the NPC object, unlike my game scenes.)

There again, the Unity documentation regarding this is either missing completely or not that easy to find. Such a pain!

Anyway, that aside, I’ve added extra functionality to the NPC pathing system that now makes it possible to simulate them entering and leaving buildings (or anything in the map for that matter). Waypoints can now be configured to pause the NPC for a given amount of time when reached and optionally hide the NPC when paused, and also optionally warp to the next waypoint.

Demo video of this (speeded up 6x)

I haven’t made it so that NPCs can actually travel to other maps, because even though it’s possible the amount of work involved would far out way the usefulness of it.

Two update posts in 3 days, I’m on a roll 🙂

Kingdom Of Galanor

From our thread on the Unity Forums

Wow! Didn’t realise it had been so long since my last post! Still, there’s been a lot of work going on, mainly in relation to custom editors and tools that will help with content creation.

I’ve beefed up the NPC Editor so adding NPCs to maps is all done via a custom editor window and their appearance and roles (vendor, trainer, etc. etc) are completely configurable via the editor window and custom inspectors. I’ve also made it better synchronised with the Quest system, so now any changes to NPCs in scenes will automatically update the quests data to keep everything properly linked and it even prevents accidental deletion of NPCs that are linked to quests.

I’ve also given NPCs the ability to patrol and made a waypoint designer for the editor. This presented a bit of a challenge early on because I used the Handles.PositionHandle method to make it so that I can drag the path nodes in the editor and I wanted to be able to know which handle was currently selected so that I could use that information to do inserts and deletions.

The problem was that there wasn’t an obvious way to know which handle had been clicked on. I trawled through numerous posts and the seemingly best option was to make a note of the waypoint node index when the handle was actually moved, but this wouldn’t allow me to click select them (without having to move them), which is what I really wanted.

However, just as I was about to settle for that I stumbled across this polyline editor on the community wiki which seemed to be using handles exactly how I wanted, with insert and delete. So a quick root around in the code and I found the answer.

I do a for next loop of all the nodes in the waypoint array and include this code in the loop.

Which works exactly how I wanted it to. However, it would have been nice to have a more obvious way to accomplish this, or at least an example in the Unity docs for the Handles class, as I’m guessing it’s probably quite a common requirement when using handles.

I’ve also made it so that nodes automatically snap to the terrain surface when created and moved, and it also gives visual feedback at design time if any node is placed in a position that can’t be navigated to.

Here’s a couple of images showing the path editor in action.

Valid path, all segments are yellow.

Path with an unreachable node, segments become red following the invalid node.

To finish, here’s a short video of the village of Fernville which will be the starting area for new characters. Still work in progress, but it should give an idea of how it’s going to look eventually.

Kingdom Of Galanor

From our thread on the Unity Forums

Had a bit of a wind down for a couple of weeks over Christmas, but since the last post, we’ve tracked down and squished a number of minor bugs, added weapon model switching linked to currently equipped weapon and added a mini-map.

Kingdom Of Galanor

From our thread on the Unity Forums

Finished the major functionality of the quest editing system, it can add and remove quests and quest chains, rename them, assign starter and turn-in NPCs, add/remove/configure objectives and NPC set dialogue text. References to linked quests are automatically updated when quests are renamed or deleted.

The entire quest structure is saved as a binary asset which is loaded at run time by the QuestManager.

Still to be added are functions for filtering and searching quests by name, zone, starter/turn-in NPC, objective type etc. etc. This will become increasingly necessary as the number of quests in the game increases.

Kingdom Of Galanor

From our thread on the Unity Forums

KoG is progressing nicely, we added a lot of content over the past month or so. It’s now got various types of NPCs, including vendors, quest NPCs and professions trainers.

We’ve implemented the quest system, which is story driven and supports multiple types of quest objective, including but not limited to talk to/take item to another NPC, kill a number of mobs, kill mobs to collect drops, search for and find collectable items, explore an area, etc. etc. Each quest can have multiple objectives made up of a combination of any of the available objective types.

Quests can be part of a longer chain, and some are repeatable daily.

We’ve implemented a lot more professions, there’s currently 17 different professions with more to come. All of the useful items in the game (potions, food, armour weapons) can be made, and as the profession skill increases, things like armour and weapons will have a chance to be better quality, with better stats.

Some more screenshots…

Exploring the local caverns

I wonder what’s on the other side of this portal…

Playing with my new combat skill

NPCs with quests

Quest dialogue example

Professions UI

Gathering some ingredients

WIP Room interior

Kingdom Of Galanor

From our thread on the Unity Forums

Been working on the UI and just finished implementing draggable windows. Here’s a quick video demonstrating that, plus some of the other features we’ve been working on such as the bank and vendor windows.

Kingdom Of Galanor

From our thread on the Unity Forums

Implemented dropping items from your inventory onto the ground. Other players or yourself can pick them up again, and they disappear after 2 minutes. Not yet implemented is a popup window that shows the content when you mouse over the package on the ground.