[Starlight] Starting to look like a TBS! (Patreon)
Content
I'm not sure if it's coincidence or natural that the hardest parts of both the combat and the battle system were front-loaded, but whatever the case it only took me a handful of days to knock this one out! I'll explain how.
RPG Maker doesn't actually have any latent pathfinding function. Its options are usually to follow a specified route, which is balls if you're coming from or going to various places or if things might get in your way, or to do something generic like 'move towards player' and inevitably get stuck on the first rock they encounter.
Unlike older RPG Makers, RMMV uses script plugins... so I just went and pulled a pathfinding one that someone made. Easy peasy. With that, I can immediately direct any game character to any place or any unit on the map in one command or less. It cares about obstacles. It cares about people in its way. It's wonderful.
(an' lemme tell ya, I'm gonna be sorely missing that feature when I go back to eventing Reborn and having to account for step-by-step movement routes...)
The above map is something i made to test the pathfinding and make sure it had those key elements. Orange-haired gal is just a pathfinding bot.
"Go to spot 5,8, pathslave."
"Yes, mistress."
Then I took the pathfinding method and turned it inside out. We use a loop to check every tile on the map that is in natural range of the selected unit's move stat, and then check each of those tiles with our pathfinder to see if we can -actually- get to them in X moves or less, or if anything is in the way. I call this True Distance to a target. If the true distance is too far, we don't draw the tile. The surviving tiles are stuffed into an array, and then drawn on a cell-sprite layer that i carved out of RMMV's mouse support visuals.
I've tested this up to 15 move range which is frankly way more than we'll ever need, and it works like a charm-- shown above is 5. I have a few approaches to take to try and optimize the method, since I'm caring about lag from the get-go and there is a small half-second delay when using a huge range, but it's not really noticeable for moderate ones like the above. Still room for improvement.
So how about the rest of this map?
- Mr. Kingy was a tool to test the True Distance checker in isolation, whereas the NPC I click on tests it in context of selecting a target.
- Headband chick (who's sprite I made Ego out of) sets up the TBS scene and turns the player character into the cursor.
- The other two NPCs are bots to go into the Combat scene, which y'all have already scene.
- The diamond shapes in particular were for me to see how the move-range dealio would respond to being trapped in an area. It gave me an infinite loop at first, then it lagged, then it was finding paths to spaces that didnt exist. Now it behaves.
Next up-- structuring out the player/enemy turns. Nothin' to it, but to do it~
Files
Previews only