ID:78912
 
Keywords: design
Well, looks like I'm returning to work on my project. Perhaps replacing my chair with The Taskmaster was the cause, or perhaps I just needed a week off.

Upon returning to my project, I realize that the very first thing I need to do is simplify. Basically, I've got a GUI structure that works like this right now:
  1. A player "assumes control" of a vehicle.
  2. The appropriate "assume control" procedure goes through the contents of the mob for /obj/functions and generates corresponding /obj/hotkeys
  3. The player now selects a hotkey and double-clicks somewhere on the map. This triggers the obj/hotkey to queue a obj/function on the vehicle's ActionQueue.
  4. The vehicle runs through its action queue every second via its ongoing HeartBeat() proc. If it has actions queued, it performs them by invoking procs off of the /obj/functions it has queued. (These /obj/functions also contained the current plan to perform them, as well as AI that generates these plans.)
  5. If the vehicle is out of functions in its action queue, the /mob Heartbeat() assesses its situation and chooses a new action to queue. If it's under the control of a player, it does not perform this assessment, and merely idles.
This extremely convoluted method worked and worked well. However, it remained just that: extremely convoluted. I realized that trying to add the functionality I would need would be like pulling teeth. I had forgotten the KISS principal I was attempting to adhere to, and instead was basically testing this mechanism out to see if it worked, and now I had my answer.

A better approach is to try to work within the conventions of what I've been given as much as possible. My new design calls for this:
  1. /obj/functions are simply replaced with verbs/procs located on the appropriate mobs. There's no longer any object bloat floating around inside of the mob inventories.
  2. The action queue simply exists inside the individual mobs' Heartbeat() procs.
  3. Any hotkeys generated will correspond to the verb list of the mobs. (They are necessary because the stat panel isn't in my game.)
A really cool feature

I've decided that this will be a game you can play three different ways, depending on which faction you choose.
  • If you choose the hive-like aliens, you never take control of a single unit, but rather you simply designate things to be done and this is automatically allocated between the members of the hive. Think: Dwarf Fortress.
  • If you choose the human-like colonists, the game plays out as a standard real-time strategy game. Think: Space Castle or Gold Guardians (the BYOND games). Except it's all on a large persistent space with aliens and mercs harassing you.
  • If you choose to play an independent mercenary, the game plays out like the "vehicle war" concept I had at the beginning, with upgradable vehicles. Think: Tanks (the BYOND game).
Of course, that I've decided to make such a radical change may be a large part why I'm gutting so much code.

This tri-game focus might sound like it conflicts with my earlier KISS statement, but actually I think I've got the idea well enough in hand that it should be doable. It's one of those "too cool of an idea not to do" circumstances.