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 http://wiki.unity3d.com/index.php/PolyLineEditor 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.

Kingdom Of Galanor

From our thread on the Unity Forums

The majority of the framework for the professions and manufacturing system is now in place.

To work, you go the area in which the item you want to gather can be found for basic items, or for advanced items (armour, weapons, potions etc.) you go to the associated building for that profession and then you select the item from the list of products you can currently make/gather and your character starts working.

You can’t perform any other actions on a character whilst it is working, however, you can switch to another character or exit the game and when you come back your work session will have continued while you were away (courtesy of our proprietary, ahem! Temporal Phase Adjustment Technology) and you’ll be presented with a report of what you made during that time. However, it can be quite relaxing actually just sitting there and watching it tick away 🙂

Typically, low-level items can be gathered quite quickly, but higher level items will take considerably longer to produce and may require rare drops as one or more of the ingredients. Whilst lower level items will be available to buy from NPCs higher level items will only be available from mob drops or professions.

The benefit of making things like armour and weapons yourself is that as your skill in the profession increases you will have a chance to make better quality versions of the items than those that you can gain from mob drops, with better stats and higher durability.

Kingdom Of Galanor

From our thread on the Unity Forums

It’s been just over a month since my last update and there’s been a fair bit of progress during that time.

The combat system feature list is pretty much complete now.

  • It supports melee and cast spells to single and multiple targets, which can cause damage or healing. Healing can be targeted at the caster and other targets.
  • In combat and out of combat skills are supported.
  • Skills can be set to allow particular target types e.g. Friendly targets, enemy targets or self only.
  • The attack system is generic and the same code is reused for player, pet and mob attacks.
  • As well as attacks, buffs can be cast, which can increase any the available stats for a configurable number of rounds.
  • Buffs can also apply heal over time and mana recovery over time during combat.
  • Skills can be set to be available in combat only, out of combat only, and both.
  • Cooldown system, mainly for out of combat casting. Cooldown persists between sessions in real time.

Out of combat heal

Skills can be dragged onto the skill bar and arranged in the ways that best suits you.

We’ve also done a fair bit of work on the underlying system for handling in-game items and we’ve got a flexible system in place to control all the various item attributes that things can have (name, icon, weight, description, usage effects etc. etc.)

We’ve handled this using mainly composition and interfaces, as we felt it gives us greater flexibility and cleaner code when compared to using inheritance.

The inventory system is 90% finished too and although it was designed primarily to handle the player’s collection of items, the same core code will be used to handle anything that needs to work with game items e.g. the player loadout.
Weapons and armour can have stat bonuses in multiple stats and consumable items can be used to heal/recover mana or apply stat buffs that have a limited duration.

Inventory and player loadout (WIP)

We’ve also implemented exp. gain and levelling for both characters and pets and unlocking of skills based on level. Some skills will be unlocked in different ways.

Levelup!

On level up, some stat gains will be allocated by the system and some will be awarded to the player to distribute in whichever way they like.

We’ve also done a lot of work on the drop system, which allows us to set loot tables for entire areas and also for the mobs themselves. On completion of a successful fight, the area and mob loot tables are combined and the drop probabilities are calculated. Specific drops can be limited in quantity and/or made a guaranteed drop. Armour and weapon area drops will be generally low quality, whereas boss mob drops will be higher quality with proportionately higher stats.

Combat result dialog (WIP)

Hopefully, we should have a working implementation of the workskills/production system for the next update.

As always any comments/suggestions are very welcome.

Kingdom of Galanor

From our thread on the Unity Forums

Implemented single and multi-target caster attacks, here’s a quick video demonstration.