[BzLog 6]: It's all about Optimization


Hi there

In the last week, we have been working really hard (besides on new features) on optimizations in the game's performance. Today i'll let you know the main problems we've been through this and how we are fixing them.

Right now, the most fps-consuming place in the game is on battles with tons of units, which if you are fighting against zombies it's actually pretty normal (even more if you are playing the hard level as a ranger and you are in late-game).

                                          

AI improvement

The most consuming part of the battle is (without a doubt) the AI from your troops, raiders and/or zombies. They need to know a lot of information before they can decide what to do and this is usually where it takes most of the time (paths, line of sight, friendly fire, take covers, etc) and what we could improve the most was the pathfinding (Finding a path from point A to point B avoiding all obstacles). Just because we have a lot of units at the same time, we decided to use a different pathfinding (from the usual pathfinding that Unity uses) that could improve performance, but the counter part was the paths were a bit choppy and hitting stuff that moved in a weird way wasn't fun.

           

So we decided to remove this pathfinding and stick with Unity's systems, which actually led to better paths and, to our surprise, better performance. This change allowed us to raise the amount of units a battle could have.


Physics Improvement

One term most of you are probably familiarized with are "hitboxes" or what it's actually called "colliders" (The box that "collides" with stuff and take damage). In order to have accuracy with shots' hits we needed to have up to 8 or 10 hitboxes for every unit (Chest, head, legs, arms, etc). This is fine as long as you don't move them or you don't have a ton of them. You can think that 8 or 10 for unit it's not that much, but having in mind a battle can have up to 150-200 units at the same time. this means 1000-1500 colliders (which it's something that Unity doesn't like).

                                                           

The way we decided to solve this was to change dynamically the amount of colliders a unit have. If it's really far away and not doing much, we don't really care what is actually hitting it, so we leave it a simple collider, but if the unit is in front of you, we change to a complex collider with up to 8-10 hitboxes so you can keep headshooting and dealing those sweet +300 dmg. This actually uses more rules to manage how the colliders change and makes sure that the player doesn't notices this. And with this we lower the number of colliders from 1K to 200.


Results

Before the patch we released a few days ago, you could only have 100 "real" units on the battlefield. Even if you are fighting vs 500, they will appear on rounds of 100 (So the game could actually be playable). Now the number raised to 300 (it can actually be higher, but we decided to leave room for low-tier PCs). Even with this, there's still room from improvement using some of the latest Unity's features like ECS (Entity Component System) and Job System (Which allow us to use multiple threads to improve game performance), Hopefully, in future patches, we will let you know how all of this evolve and make a better experience!

Don't forget to join us on Discord!

Project BlockchainZ - Discord

Files

Project BlockChainZ [Concept Game] 237 MB
8 days ago
Project BlokChainZ MAC [Concept Game] 332 MB
8 days ago

Get Project BlockchainZ

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.