00:00
00:00
MountFujiSoftware
Developer of real time strategy and city builder games, I like to develop my games from scratch, drawing every asset and coding in my free time

Game developer

Italy

Joined on 9/2/24

Level:
1
Exp Points:
0 / 20
Exp Rank:
> 100,000
Vote Power:
1.00 votes
Rank:
Civilian
Global Rank:
> 100,000
Blams:
0
Saves:
0
B/P Bonus:
0%
Whistle:
Normal
Trophies:
1

MountFujiSoftware's News

Posted by MountFujiSoftware - 5 hours ago


When I get a negative feedback about how 535 performs, the most common issue is about units' pathfinding.

This was implemented using a very simple script that updated the direction at every step analyzing the solid object around the moving character, and while it was ok for most of the situations, it lacked precision in more long and complex paths. 

I'm now implementing a new movement and pathfinding system based on the Dijkstra algorithm (Flow field), subidividing the map in small cells (32x32 pixels each) and calculating the path from the start.

It's still work in progress and I know it will take a lot of time to implement, but here you can see the first results:


So, each time a solid object (a building or a resource like a tree) is added/removed from the map the system creates a grid like this one, called cost field: green cells are free and have a cost of 1, while red cells are in collision with a solid object and have a cost of 1000, like the image below (old one btw, the new algorithm is even more precise)

iu_1369854_23552780.webp

Then, on this field a second one, called "goal field" each time an instance has to be moved on another position. The goal field, for each cell, calculates the distance to the goal cell. It looks like this:

iu_1369855_23552780.webp


The final field (the flow field itself) is calculated on the goal field, giving for each cell the direction (in degrees) to follow in order to reach the destination on its shortest path avoiding solid object.

iu_1369856_23552780.webp


Then, when the unit approaches the goal cell, the system switches to the traditional "step towards" system, which it's still more precise on short distances.

Right now it only works on a "point a to point b" situation, I hope to implement it in more scenarios as soon as possible! :)


Tags:

1