game videogames

Ok, today I got my data structure sorted that will hold all the moves and move related accessories that the program will need upon confirmation of that turn’s moves. It looks like a bunch of numbers (and, well, you’re not wrong), but lemme walk you through what they mean (from left to right):

  • ID of the owner of the move - obviously important when I need to do stuff like damage calculation, since I’ll need the owner’s attack stats + others. This is the ID of the object where those variables are stored
  • BattleID - most likely just for my reference, it’s the slot that character is in (0-4 for players, 5-14 for enemies/npcs)
  • Character speed - the speed statistic, which I’ll need for sorting the data structure to determine who moves in what order
  • Attack type - an enum corresponding to the type of move (aka, whether it’s an attack, defense, item, or escape attempt).

Everything below is needed only for attack and item type moves:

  • Attack/item ID - the unique ID in the respective database, needed to look up basically everything about what the attack does, including the associated script reference, animation, etc
  • Ally/enemy - whether the ability is targeting an ally or enemy, just as a quick binary value so I don’t need check if target id is less than 5 for allies or 5+ for enemies
  • Targets - This is a 2D array containing the object ids of all targets selected by the AOE, and the number of times they were selected. As attacks will be doing more damage if you have more of the enemy covered by the AOE, it’s important to know this! It won’t be double damage if you have 2 cells compared to one, but it’ll be something extra as a bonus for good positioning!
  • X value - the x position on the enemy grid
  • Y value - the y position on the enemy grid
  • P value - the player index

Just a note for the last 3, I’ve captured the coordinates of the attack separately from the targets, as I’ll need to know these if an enemy dies mid-turn. If everyone shoots at the same robot and your first character defeats it, it’d be quite annoying to have the rest of your characters shoot into space and not hit anything. Therefore, if an enemy dies and it’s a single target attack, your attacks will automatically be directed at an enemy of the same type (if available and within the attack’s potential radius). If it’s an AOE, it’ll just hit empty space!

…And after writing that, I realised I need to save all the valid cells to the move data structure, otherwise I’ll have to calculate the valid cells from scratch and I don’t want to do that! I’ll add that in tomorrow I guess and then work on shifting from one player to the next (and going backward too)!