1. Coloniser
  2. News
  3. Optimizing Endeavors - Part 2

Optimizing Endeavors - Part 2

[p]Salutations, Colonisers!
[/p][p]In the last dev diary, we talked about teaching Coloniser what information to send to each player and just as importantly, what not to send.
[/p][p]But there’s another side to that problem.
[/p][p]Before the game can decide who should know something, it first has to answer a much simpler question: What’s actually nearby?
[/p][p]RTS games constantly ask questions like:[/p]
  • [p]“Which enemies are within attack range?”[/p]
  • [p]“What resources are close to this villager?”[/p]
  • [p]“Who should this tower shoot at?”[/p]
[p]Without any optimization, the only way to answer those questions is by checking every entity against every other entity. With large matches, that quickly turns into tens of thousands of distance checks every tick, even when most of those entities are nowhere near each other. That kind of work adds up fast - especially once AI, combat, and abilities all start asking the same questions at the same time.
[/p][p]To fix this, we implemented a system called spatial partitioning.
[/p][p]Instead of treating the world as one giant list of entities, the game divides the map into smaller regions and keeps track of what’s where. That way, when a unit asks “what’s near me?”, the game only looks in nearby regions instead of scanning the entire world.
[/p][p]In Coloniser’s case, this means a query that used to check thousands of entities now typically checks a few dozen. Essentially, this means the same result, but radically less work on the processing side
[/p][p]Units in Coloniser are always moving, so the system needs to handle change efficiently.
[/p][p]To do that, we use a structure that allows entities to move slightly without constantly rebuilding the world layout. Units can reposition freely within their local area, and the system only updates things when it really needs to.[/p][p]
We also split the world logically:[/p]
  • [p]moving things like units and animals[/p]
  • [p]mostly static things like buildings and resources[/p]
[p]Each is handled in a way that makes sense for how often it changes. It might not seem like a big deal, but this system quietly powers a lot of gameplay like: soldiers finding enemies, towers choosing targets, healers looking for injured allies, colonists searching for resources and area-of-effect damage finding valid targets. Instead of each unit doing its own expensive search, the game batches these queries together and processes them efficiently in parallel. The result is AI that reacts quickly without eating up performance.
[/p][p]Spatial partitioning helps the game find relevant entities quickly.
Interest Management decides which of those results are actually sent to each player.
[/p][p]This is where the two systems come together. Together, they allow Coloniser to run large battles efficiently, keep AI responsive, avoid unnecessary work and scale to bigger maps and player counts. Here is how the game behaves with spatial partitioning and interest management applied:[/p][previewyoutube][/previewyoutube][p]There are still some improvements we have to do in these two areas, but we are very close. And you know what’s cool about all this? These are all under the hood improvements. Aesthetically, you won’t see any change. However, you will feel it: smoother performance, fewer spikes, AI that keeps up even when things get chaotic.
[/p][p]And it gives us a much stronger foundation for everything that comes next. You’ll see this with your own eyes with the upcoming demo, but more on that soon. And if you want to try it even sooner, be sure to request the playtest on our store page.[/p][p][/p][p]We’re still not done with dev blogs, so stay tuned![/p][p][/p][p]Cantos Games[/p][p][/p][p]Discord Youtube Reddit X/Twitter Bluesky Instagram Facebook[/p]