In the old days, I worked on a tile-based game where characters moved on a grid, sort of like fire emblem. The enemies were programmed to always move towards the main character, but my programming basically involved a lot of casework and was reaaaally time consuming to have them walk around obstacles and such. Now I’m trying to implement the A* algorithm, which is apprently the most efficient 2d pathfinding algorithm.

Things to do
While it seems like one project, there’s actually quite a bit to do. Given a map and two tiles on it, I’d like to generate an image corresponding to the shortest path between the points points. Using the C programming knowledge I learned from class last quarter, my general high IQ when it comes to figuring shit out, and a lot of Google, this should be a lengthy but straightforward task.

First things first
I need to be able to generate an image of a map first. I’ve learned how to print pixels to a text file in the form of a .ppm image, so that’s what I’ll be doing. This will involve
– reading a text file of integers corresponding to a map
– converting the integers into an array to describe the map
– turn each tile on the map into a rectangle of pixels, and print this into a .ppm file
For maximum compatability with later steps (and future projects!), everything will be flexible, meaning:
– support for different length of tiles in each row
– support to add new kinds of tiles (easy since we just use a different integer)
– ability to change size of tiles

Looking onward
After I finish this first step, I’ll be ready to implement the A* algorithm. This will read a text file of a map, then return a text file of which tiles to highlight. I’ll then use a map to image function similar to what I’m creating, but with added functionality to apply highlights to tiles, and generate the final image.

To Work!

Part 2: Reading and Displaying Boards of Tiles
Part 3: Writing the A* Algorithm
Part 4: Source Code


One thought on “A* Pathfinding – Intro

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s