After finishing up with the Terraria clone I decided to look into pathfinding and how I could make AI units move across my game worlds. After some research I found the A* algorithm. It wasn’t very suitable for Terraria as it seemed to only work on grids so I decided to create a new project just for this.
I had worked on basic grids before so I wanted to give the aesthetics a bump by making the game render isometrically. This ended up being harder than I had expected at the start of the project but after some rearranging some maths equations (and a lot of trial and error) I had the ability to display the map isometrically and find which tile the mouse was hovering over.
The magenta ‘ER’ tiles shown in the featured image show the path created by my implementation of the A* algorithm. I had decided that I wanted 8 directional movement but I forbid diagonal movement through a wall corner as I figured the unit would clip with the wall in the movement otherwise.
While this project was a fairly simple one, it lay down the requirements for my next project: an ascii art rpg.
Comments are closed.