Game
Vitality

7 years ago

Item Equip revamp!


Hey everyone! We’ve had a little update hiatus as over the last 10 days, i’ve been working on re-engineering a few core components of the game. My focus has been on cleaning up the Item equip system, most importantly with regard to how animation works.

Previously, adding new weapon types was very clunky, as it required hacky modification of some base animation code that existed inside the player object. This setup wasn’t ideal and was one of the earlier systems built for the game. This difficulty in adding new weapon and item equip variety made it difficult for us to be creative with new items that changed the way the mechanics worked, namely, items which required an animation state were tricky to add.

Examples of this are items like the bow and arrow. Given that there are multiple states this animation can be in (Draw, Hold, Fire), those had to be accounted for inside the player code and it all got a bit too messy to work with. The system was therefore re-designed to simplify the system so that when a player had an item equipped, any player animation state was governed by an ItemEquip object for the corresponding item.

This meant that no matter what item we may add in the future, the sky is the limit :)!

We also took this opportunity to add a number of other neat features to the system:

  • Tools are now also managed by item equip objects, including how they interact with the world. This means that tools can now implement different mechanics easily. Such as having certain tools be able to break multiple blocks simultaneously, change block types, etc;

  • New opportunities for creative utility items. The fishing rod will be one of the first added, however other items such as grappling hooks, harpoons, lanterns, etc; can now be implemented with relative ease!

  • Networking will also be far easier for items, given they are now wrapped up in their own auto-network-synced object!

  • Similarly, visualisation for items will be very very easy to add, including particle effects, lighting and more!

  • Finally! The part I am most excited for is what this means for AI! Using the similar idea of passing control from the “player” to the ItemEquip, we can do the same for implementing AI behaviour inside the ItemEquip object. I’m really excited for this because it means that it is now easy for us to add custom AI behaviour routines for each different type of equip.

An extended note on AI:

Given that all weapons function using “player input”, weapon behaviour is both very easy to sync over the network, but it also means that the AI behaviour does not need much special code inside the weapon. The weapon can remain exactly as-is and the AI script for that weapon simply acts as a behaviour modifier for that AI by simulating input for the AI player.

The reason this is so nice is because it massively simplifies the problem of writing custom AI code for NPCs, because we can simply just override a sub-set of the NPCs behaviour when it is in a given state, without having to alter the way the base AI works in any way!

Programming and learning in general

I wanted this rather long update on a final note: it always amazes me how much there is to learn and improve. I definitely get excited every time we come up with a better approach to solve a difficult problem.

Previously, i’ll admit that combat and the Item Equip system was quite intimidating to work on before, simply because I felt like it was a bit stuck, and I didn’t feel comfortable working on it. Spending time coming up with this new approach, and a new style of organising code has definitely helped in multiple areas in the project. The same structural ideas have started to exist elsewhere in the project, including how systems such as random world events and quests can also override AI behaviours and other systems in the game.

We will continue to post updates and more as we start implementing more of these fun and interesting items!

  • Manta Games



2 comments

Loading...

Next up

Who brought the marshmallows? 🔥🔥🔥

Windmills!

NPC Shops

Into the Mines! - Medieval Mineshaft Generation

The end of an era... 🦖☄️💥🔥

World Map

Really happy with the results of new lighting system! :D

Medieval Town - Generation progress

Improved lightning and thunderstorms! Longer video (with sound) here: https://www.youtube.com/watch?v=DHSL9U4Jy-E

The Ol' Tavern - Medieval Age Town gen