Post news Report RSS Complete Pathfinding Overhaul

Advanced pathfinding and local avoidance is coming to Assembly RTS, a real-time strategy game with deep customization mechanics. Discover seemingly endless possibilities. Assemble your perfect army and conquer the enemy! Build a base, gather resources and persist in a hostile, arctic new ice age.

Posted by on

Welcome to a new devlog for Assembly RTS, the physics-based real-time strategy game!

IndieDB Header Image 001


Hello fellow strategy game enthusiasts!
Since my last devlog, I've been rewriting the pathfinding and local avoidance from the ground up.

hovercraft moves forward

The Old Pathing Solution

The poor pathfinding performance in my game was bugging me lately.
Ordering a unit to the other end of the map could cause a severe lag.

To combat this, I tried making the code asynchronous,
which means that the calculations had time to run in the background until the next simulation tick (33 milliseconds). In theory, without causing any visible lag.

However, I had made a stupid mistake- I assumed that the pathfinding algorithm couldn't possibly take more than 33 milliseconds to complete. After finishing my changes to the code to make it asynchronous, I discovered this this still wasn't enough time for the pathfinding algorithm to complete its job.

After making this change to the code, unacceptable freeze-ups were still a thing.
I was not about to defer the calculations for 66 milliseconds or longer...

The pathfinding library I had previously used (from the Unity asset store) served its purpose as a quick proof-of-concept solution at the time, but no more!

New Pathfinding Logic

A different, more performant solution was needed, so I decided to rewrite the pathfinding from scratch, and to include local avoidance logic on top (local avoidance prevents units from running into each other).

I had a good experience implementing the physics simulation for Assembly RTS using the Rust programming language, which is why I started implementing a pathfinding solution utilizing the same language.

Following some initial setbacks I tried my hand at implementing the pathfinding using Unity's HPC# language instead, but it is quite restrictive.

After overcoming the initial challenges the next day, I stuck with writing the code in Rust again.
In fact, sticking to Rust allows me to incorporate the physics colliders of the environment directly into finding the best path around obstacles.

However, Rust has some strict coding rules, and for prototyping purposes this was costing me precious development time.

Later on I decided to write some of the logic in a separate C# project first, which I will translate back into Rust code at a later time.

Visualization of a Theta* pathfinding algorithm I've been working on:pathfinding demo


I'm still not done with this topic, but I'm confident that my solution will be far superior to what was before, a very basic and poorly performing pathing solution.

That's all for this devlog, I hope you found it interesting.
Assembly RTS, the strategy game with deep customization mechanics can be wishlisted on Steam!

Post comment Comments
Guest
Guest - - 692,649 comments

Looks good.

Reply Good karma Bad karma+1 vote
FlightFight Author
FlightFight - - 35 comments

Thanks!

Reply Good karma+1 vote
Guest
Guest - - 692,649 comments

Wow!!

Reply Good karma Bad karma+1 vote
Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: