In my last entry, I ended with saying that I was going to watch another quill18 tutorial on YouTube, and as expected, I came away with lots of new information, as well as an algorithm for pathfinding, which you can see in today’s GIF.

Last week, I had some rudimentry movement in place, as a placeholder. Now, the character/unit/ally/whatever is now actually following a set path of tiles calculated using Djikstra’s Algorithm. I won’t go into all the technical details (if you care, follow the link), but I think this illistration below does a good job of showing exactly what is going on:

The starting point is the south west point, the destination is the north east point. From the starting point, or node, if you will, it continues to branch out towards all surrounding nodes, and when it finds the destination, it will then calculate the shortest path to said node.

On the wikipage, there is some pseudocode, which quill18 used to create his method in his tutorial. I happily took advantage of the work he did for everyone, and integrated it into my Pathfinder class pretty easily. Within a few hours, I was generating paths of nodes (which was easy enough to translate to my TileData class, since it’s more or less the same thing… in fact, I should combine the classes, but I’m rambling now…) to make use of whenever I selected where the character should move. Taking those generated nodes, I simply iterated over them, node by node, and had the character transition from tile to tile. Pretty simple stuff.

Oh, and those red tiles you see pop up at the end? That’s just some other prototyping work I did to indicate where the character can attack once they’ve finished their move. I’ll get back to that at some point.

Now, some people might be screaming, “Why are you using that algorithm? Why not A*?!!!”. Well, it’s mostly because quill18 decided to not use A *, and because I actually had restraint for once, and decided to simply get something working. Without a doubt, A * is the better solution. And when the time comes, I’ll implement it as well.

Finally, just wanted to end on where my head is at right now. In short, I’m in a good place. My Destiny days seem to be behind me, and I’m finding more and more that I just want to come home, eat dinner, hang out with the family, and once they’re off to bed, come down to the man cave to work on the game. Plus there’s the time I have on the train.

There’s also a co-worker of mine who is also working on a game using Unity. We have our little “Motivation Monday’s”, which sort of gives me a reason to knock out a lot of work over the weekend so I don’t come up empty handed while we show off what we’ve done. Speaking of the weekend, last weekend was certainly my most productive thus far. It felt like 2006! I think I put in 6-7 hours total on Saturday, another 2-3 on Sunday.

I’m also experienced enough to know (and if you have read my journal, or continue to read this, you’ll either know how often I say, or will notice how often I’ll say it in the future) that this is the normal peaks and valleys of the emotional state of a game developer. Things are going great right now. I’m energized. I’m focused. I’m hungry. Maybe next week, I won’t be any of those things. That’s why when I feel like this, I just get it in. No bullshit, no distractions, just good old fashion work.

Till tomorrow…