It has been a very long time, but I have some progress to share that I honestly should have shared months ago. Last time, I stated that I had planned to work on the mob movement, which I did and I also worked on and completed Pathfinding! Specifically, I was able to write a working implementation of the A* algorithm. But getting there was not easy...

Still loosely following the LazyDevs Pico-8 roguelike tutorial, I decided that once I got it working that mobs were being added and drawn, I could move on to the mob movement. The movement itself was actually pretty simple. The part I struggled with was implementing the pathfinding. Or rather, implementing pathfinding that was fast. I started with the simplest solution which was to conduct a breadth-first search on the tiles surrounding a target until the starting point was found. I found this to be really slow at first. To be precise, the queue implementation I wrote at first was really slow to remove elements. Once I implemented a circular queue the speed improved greatly, but as I tested more than one mob, it became noticeably slower. At first I "cheated" by using Full during the pathfinding but I didn't like that and set out to find a faster pathfinding algorithm. Enter A*. I found a really nice and straightforward tutorial in Python here that I translated into Axe. And with help from Xeda and E37 over on Omnimaga with implementing a min heap, I present to you, working A* pathfinding!

It's unoptimized at the moment but it is already faster than the breadth-first search pathfinding I was doing originally and its still in 6MHz mode. Now that I have some time to work on this I currently working on adding more to the backend of the AI. With that, I'm doing a soft rewrite of the procedural generation to change how I store the room data to make it easier for me to work with as well as adding room exit data so that the game can know when either the player or a mob enters/exits a room. This work will help me later because I also plan to implement a simple finite state machine that chooses the targets for the AI to pathfind to.
Last thing of note: I've decided that Citadel is a much better name for the game besides Slime Slayer since I've been designing a variety of different enemies besides slimes and I think it captures the feel I'm going for. As always, thanks for reading and any and all feedback is greatly appreciated! More progress on the way!
Looks fantastic and the pathfinding is making a real difference.

This would be valuable for others I imagine too.
Good job on the pathfinding! I like how smooth and good this looks like. Smile
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 2 of 2
» All times are UTC - 5 Hours
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum