Posted February 02, 2025 by adantede
Data Structures! (Wait, don’t run, this is actually cool.)
This is the part of the game that never changes. It’s like the Evil Overlord’s sacred tome of knowledge—etched in dark runes (or, in this case, dark data tables).
global.UnitTemplates
– This contains every unit’s base stats, abilities, and item slots. If I need to know what a goblin is, I ask this list.
global.ItemTemplates
– A list of every item that could possibly exist in the game. Rusty swords? Check. Unholy relics of the damned? Check. A stick? Surprisingly, also check.
These are immutable truths. They do not change. They are the Law of the Dark Realm.
Here’s where things get spicy. This layer tracks actual gameplay changes—damage, XP, gear, and whether or not your goblin lost his sword in a fit of incompetence.
global.PlayerParty
– The minions under your control, their stats, gear, XP, and emotional baggage.
global.CurrentEncounter
– The enemies currently trying to ruin your day.
global.Inventory
– All the sweet loot you’ve picked up, including things you definitely shouldn’t have.
Everything in this layer can change at will. Your minions take damage, get stronger, or—let’s be honest—die horrifically and drop their items on the battlefield.
These are the actual moving, fighting, spell-slinging creatures that exist during combat.
obj_minion
– Player-controlled minions, animated and battle-ready.
obj_enemy
– The forces of good, complete with holy swords and an unreasonable hatred of your shenanigans.
When combat begins, we summon these objects from the Mutable List, let them fight, then save the survivors (if any) back into the list when the battle is over.
Right, so we’ve got three big categories, but how do we move things between them? Enter the Three Great Machines of the Dark Lord’s Factory:
Example: Rolling a new goblin for your party.
var new_goblin = UnitMinter("goblin", { current_hp: 60 }); ds_list_add(global.PlayerParty.minions, new_goblin);
Example: Sending a goblin into combat.
var unit_data = global.PlayerParty.minions[| i]; UnitFactory(unit_data);
Example: Saving a minion after battle.
var unit_data = ds_list_find_value(global.PlayerParty.minions, ds_list_find_index(global.PlayerParty.minions, instance.guid, "guid")); unit_data.current_hp = instance.current_hp;
📌 Refactor Existing Code: Move all units/enemies into UnitTemplates
and ItemTemplates
.
📌 Test The Packer: Make sure dead minions don’t awkwardly resurrect when a battle ends.
📌 Implement Dynamic Enemy Scaling: Because beating up baby knights isn’t fun forever.
📌 Save/Load Implementation: Ensure that the game state persists between sessions (nobody wants a reset goblin army every time they quit).