I remember this, I was walking to the shops at 7 am and thought to myself, “I want to make a game about a space station”. After my shop I went back and got right to work napping, after that I started working on the game.
In this game you are in charge of evacuating a space station, you can only oxygenate and power two rooms in the station at once and it takes time to move power around.
The main trouble with this one was the fact I made the game able to read any size station from a file, it took a lot of time to get it working, so it would detect all the airlocks and rooms properly, it kept randomly breaking and not detecting the rooms properly. I ended up just making it make every black pixel a room and every red pixel an airlock, then just merging the close by ones, which worked well.
This was the project where I finally got A* path finding working, as before it was broken. got it all working after re-writing it again and again and going through the tutorial video I was watching over and over again.
So, from what I understand it, how A* is supposed to work is each node will have a value of it’s distance from the start, a value of it’s movement cost and a value of the estimated total movement cost (All the other movement costs up until now + the movement cost). Then a total score value, which is the movement cost + the distance cost.
Then there are two lists, open and closed, it then puts the start node in the open list. The algorithm then checks the surrounding 8 tiles, calculates their values and puts the one with the lowest score in the closed list, it then sets the surrounding squares parent to the one it’s currently on.
If the one it’s found is the goal, it back tracks through the parents until it reaches the goal, then that’s the path.