Tag Archives: Dijkstras

Game AI – C++ Graphs and Pathfinding

This was an assignment I had been looking forward to, It was time to learn about AI! Unfortunately it was less like the matrix and more like complex Ideas and plenty of looping through lists.

You can download and view the final here

New concepts included:

  • Graphs
  • Nodes
  • Path finding algorithms and their implementation

Learning about these path finding algorithms was fascinating, how they differ and how they can be implemented for game mechanics.

Alongside the implementation of these algorithms was the structure of the program itself, I learnt a lot about modular design in the way classes are structured.

Presentation is key

Agents finding a path between selected nodes

Writing on the wall

I wanted a nice UI to give information to the user, this required a font library to be installed. While I respect the power of C++ having to spend a chunk of time to do something as simple as display text is never going to be fun.

Drawing the line

Another feature that I often take for granted is drawing lines… if you want anything above a single pixel line. Say a nice thick line with a subtle fall of gradient,  you have to go and create that yourself, enjoy!

Math Library

This project used my own math library from previous projects, after using almost every over a few projects it’s pretty solid. (Building my own allowed me to approach Monogames matrice library with confidence in a later project)

Debug lines

For both this and the previous projects I have learnt that debug lines and debug images are so very helpful, I had debug circles around every agent, and lines showing there intended direction. This kind of visual debugging allowed me to hone in obviously bad behavior.

As with all my learning projects A big thank you to all my Mentors, you know who you are.