I have crossed the threshold of building code for prototyping to playing with prototyping! During this sprint, I returned to Itch.io and picked up some new game assets to play with, specifically sprites with attack, idle, hit, and death animations. A trip to Game-Icons to make a skull hit sprite. I split my new strange characters into two teams and set them at each other! In Last Age of Sorcery, you play a Vancian-styled wizard in a world hostile to wizards. The wizard can have a retinue. These members aren’t controlled directly by the player. In combat encounters, they will have auto-battler-like qualities. That is what this prototype is about. What does combat feel like, how much auto-battler, and how much player control? What are the game mechanics, how much stats and mechanics to show?
Let’s break it down. In the scene above, we have, from left to right, three Enemies, a Player-allied NPC, and the Player. When I end the turn from the keyboard, all the Enemies are triggered to submit actions and select targets. The GM class sorts all the actions by the included initiative values (some are random, some are hardcoded) and executes them individually. At the end of the round, if any NPC state is dead, the Game loop cleans them up. Next round!
Combat Mechanics
In this version, every actor hits. Defenders have a Hit Save to make; this is just to make the hit markers and the death animation calls happen. I initially tested with an odd-even test. I was upgrading the logic to how armour saves work in Warhammer 40k miniature games, a simple D6 die roll, high is good, but then became a 2D6 + modifiers logic — because I can, in Powered By The Apocalypse style, do this:
- 10+ Safe, no harm done.
- 7–9 Hit, show hit marker and animation
- 6- Dead. Show two hit markers and do the death loop.
I’ll continue to stub out mechanics this way for this sprint. In future sprints, I can see myself changing the logic to try other mechanics, like maybe that 40K save. My mechanics shortlist includes D10 dice pool mechanics inspired by Cold City RPG and Sorcerer RPG. OLD BX D&D with phased combat, maybe Magic, Missiles, Movement, Melee 🤷🏾♂️
Game Objects
There is the Actor class from which we get the Player and NPC child classes. Enemy objects are the bad kids of the NPC class. That’s it. It’s Components and Commands all the way down. Components add functionality to Actors. Movement, Harm, Animation, Collider, and Decorations are all components. Right now, all the NPCs have the Harm component; the player does not and can not “die”. Commands are actions; today, there are the Attack and Cast actions.
Game Loop
This is the traditional Process Input, Update, and Render loop. I also have a Turn Loop that ever-so-lightly touches the Game Loop, and it processes actions. Actions change state, i.e., movement and animations. The Game Loop does some light pacing for the Turn Loop — but I think I can refactor it so it doesn’t need to. There are a lot of refactorings I’m resisting doing because it’s not necessary for this prototype. I could make a factory to create the different NPCs; OnAction, and OnEvent have a lot of overlap, and I can refactor that. I could include a scene or level manager instead of letting the main Game class do it all. Audio?! Gamepad controller?!
Experience and understanding are what I’ll take away from this prototype. Not the code. We, code-slingers, know each rebuild, each iteration we make better and faster than the previous because we now understand a thing. But mostly, I just wanted to name the NPC factory class The Beastiary!
I intend to circle back to play with Lua, DragonRuby, and Defold — maybe RayLib. I could likely be further along using those tools… 🤷🏾♂️ I figured I could get my C++ dev chops back working on prototypes, figuring stuff out before I tackle the main thing. And do tackle the main thing! I’ll say it again. Do the Big Main Thing, your dream game. Don’t wait. Don’t do small pong clones and tic-tac-toe remakes. Do the main thing. You know how to eat an elephant, right?
It’s also #TurnbasedThursday; go check out some cool Turn-based games in development!