Well damn, look at that! I’m back, and it didn’t take a few months. Maybe I can keep things going this time 🙂

So, keeping with my rough bullet list of things I wanted to work on, I started the initial work on pathfinding for the characters/units in the game. Actually, before I could even do that, I had to take the spaghetti code I currently had, and try to break it up into logical pieces, so I could then implement a basic state machine to control everything going on. As of now, I have the following states defined:

public enum GameState {
    PLAYER_TURN,
    PLAYER_MOVE_SELECTION,
    PLAYER_MOVE,
    PLAYER_SHOW_ATTACK_INDICATORS,
    PLAYER_ATTACK_SELECTION,
    COMBAT_MENU,
}

This has changed many times in the past week, and I’m sure it will continue to change as time goes on. What might make sense as a single state ends up making more sense as two. Or, sometimes I fold up two into a single one. It’s all over the place right now, and that’s okay, since I’m learning as I go.

Once I had this set up, before I started looking at actual pathfinding logic, I just wanted to test out moving the character from one tile to the other. I already had a pretty decent idea of what I wanted to do (having previously done similiar work while doing contract work on The Shadow Sun).

I basically needed to do 2 things:

  1. Create a function that would slowly move from one tile to another, over x seconds

  2. Make said function a coroutine that is called from the state machines Update() method.

Using my previous experience, I was able to cook something up pretty quickly. But, as you can see from today’s GIF, the character isn’t following a path towards the final tile. It’s just going right to it.

And that’s exactly what I’ll be working on next. Integrating true pathfinding. Lucky for me, quill18 has a youtube series on it that I’m going to watch tonight. I had previously watched his series on tilemap creation, so I’m expecting some good stuff.

Till tomorrow…