Devlog - 2: Health & destruction


Devlog - 2: Health & destruction

I've been working lately on incorporating health for anything that can be damaged and destroyed.

These are:

  • Buildings
  • Units
  • Base block

With the basic AI already in-game that can build and a basic unit AI that will attack whatever you have built, it was an opportune time to get the last piece of the puzzle in.

As you can see it still needs some work, both on the attack location and distance. But it works, there's also a lot of destruction art to be drawn now but that can wait a bit.

There's still some refactoring to do on this and a few other systems, I might do some in the next few days so there might not be visual changes, but I'll still post updates :)

Tech side

If you've reached here and are interested in a bit more of the tech side on how things work I'll give a small overview in this section. I'll try to make this a standard for all my devlogs going forward.

So to incorporate health I just made all things that can be damaged inherit from a HealthObject that has max health, current health, and methods to change it and call a virtual destroy method if health falls lower than 0. It also implements an interface so those that search for things to damage don't actually get the whole object but just search for the interface and use it.

Units ping services that have all player buildings and all player base blocks. Then they proceed to attack the closest one with an attack cooldown when they reach the destination.

I already have plans to improve this in the future, but for now I think it's fine to start getting all the features and mechanics in. At least in a basic and rudimentary fashion for now.

Leave a comment

Log in with itch.io to leave a comment.