[Starlight] AI 2: Brimstone Boogaloo (Patreon)
Content
we'll get there.
when we last left our heroine, she said something about working more with the combat scene to make it more dynamic. well it turns out she's a damn liar because she did like one more thing there and then realized it didn't make sense to do the rest yet. still, here's another gif:

- you can see the attacker's on the left now. the combat scene now updates in reponse to the orientation of the battlers on the battlefield. don't worry, i'll be sure to make a clear way to tell which one is the player/attacker as we keep going.
- went ahead and update the astra thing i described last time to include at least one more visible model already
- you can see that the track now quickly spits the initial hitblocks forward at the beginning of combat. since switching to wide screen, that made the start of combat too slow, so this is a way to compensate. game flow and speed is a high priority; i'm looking to minimize player wait time at all opportunities.
ok so that's actually like three things and i lied again. it happens.
so, the next thing i was going to implement was going to be dynamic track updates for various things like enemy counters, but i realized it doesn't make sense to do that until player dodging is done, and i realized it's easiest if i don't do that until there's something to dodge.
which means that the enemy AI has suddenly shot to the top of the priority list. this is actually great because AI is the last thing missing before this can be considered a playable, if barebones, battle system.
so, what do we need to do for AI? well, firstly we need our enemies to actually stop being player controlled and start being enemies.

ok, easy, enemies no longer selectable, move range shows all red properly. player cursor frozen on enemy turns, game now knows how to cycle through units per each turn and pass to the next.
we're set
first thing's first, the enemy needs to know how to move its units. we can already do that very easily for anything within the unit's move range, so great, but the issue that it needs to know which way to go in order to get to a target that isn't within its move range. so the first big wall, predictably, is distance pathfinding.
so, how to pathfinding algorithm? heck if i know tbh, but the internet says this one called A* is pretty good. and wouldn't you know it, our implementation for unit movement grid is already halfway to being that. shout out to therrester for helping me out with that in the past. so, we've cloned that method and built out a new one just for this.
but, turns out, the next step for converting it to the full algorithm happens to deal with movement costs per tile.
so i guess we gotta implement that now. well, okay.

done. this is another thing i wasn't expecting to do for a while, but it also turned out to be much easier than i expected. cool.
so it's those mountains there, if you haven't guessed. like forests in fire emblem, each one takes an additional movement point to step across. you can see at the top that the movement grid is updated for them properly... and thus our pathfinding is too. great.
reminder that the mountain graphics, like the rest of the tiles and charsets, are just placeholders too. they won't actually be mountains anyway
finally, we toss in a heuristic to help it find the best paths quickly and cut down on processing time as much as possible aaaaaaaand we're more or less set. the goal is the light spot at the bottom, and the spaces to the right of it:

our method right now moves the enemy units all in one go just so i can see the path they want to follow, but naturally we'll cut that up and limit it to the turn-by-turn movement grid later.
it isn't perfect, but it is good enough for me to continue forward and tweak as we go.
and so AI Hell begins anew, with an extra entendre. fortunately i'm much more optimistic about this AI for several reasons:
- i'm writing it, so i actually know how it all works and how to fix it without having to rewrite 80% of it
- it's not for a battle system as stupidly overcomplicated as pokemon
- i'm actually getting to the AI at the start rather than instead of 16/19 episodes into development, so there's a lot less 'catch up' involved.
pray for my soul when my hopes are inevitably dashed into the ground.
--
not much progress on reborn lately. i intend to atone for this sin by starting and finishing a legendary quest in one (1) day. it worked for mirage tower.
༼ つ ◕_◕ ༽つ GIVE FLOW ༼ つ ◕_◕ ༽つ