Heroes Dev Log #2: Engine Refactoring

Heroes Dev Log #2: Engine Refactoring

September 11, 2023


Hey all!

Had a great last week where I got a TON of engine refactoring done. I ended up finishing the refactoring I mentioned last week where I pulled all the logic to the client so that we could have simpler client ↔ server communication code and better performance (don’t need to go to the server as often) and also switched to a command pattern that makes any update to the game state a command (has a number of really valuable properties too).

After all that engine refactoring, I was on a roll and ended up doing several other big engine refactors too 😄.

The first big change I made building a new concept in the engine called “lifecycle hooks.” Now in the engine at any step in the process we can insert functions that run and modify the state based on what’s happened so far. Not only does this help simplify the code, but it’s also something that will let creators define how their game works in more powerful ways (like a supercharged version of scripting).

As we build out Heroes we want to make a clear distinction between Heroes the game and the AI RPG engine that powers it. The Heroes game will be a fantasy RPG game akin to DnD, but the engine will support any type of RPG genre, customizable by creators. In the Heroes the game there will be attributes like strength and wisdom and skills like fire magic and bows, but creators could define any types of attributes and skills they want to exist in their own game depending on their genre and setting.

Along with that we actually also just added health, mana and stamina to the game! Now your actions have a lot more consequences and you have more realistic constraints. You can’t constantly spam actions that take a lot of mana and stamina, and there are real consequences to things that hurt your health. It’s really cool to see the way the AI also lets you refill those. It can flexibly determine that things like resting / sleeping, drinking a magical well, or consuming food or potions can all heal those. It’s made a lot of things much more realistic and players have talked about how they finally actually rest and eat food because there’s a reason too now.

And in line with our goal of separating the engine and the game, health / mana and stamina are all implemented in an abstract way in the engine that we call “character resources.” In Heroes the game those resources are health / mana / stamina. But in another game (for example a survival game) they could be hunger / sleep / thirst / temperature. Or it could be whatever you can imagine!

What’s Next

Thinking about what’s next, we had a really interesting play test this week with one of my friends who hasn’t tested Heroes before. He was blown away that things and didn’t expect things to work as smoothly and as well as they did and felt like it was the first time that he really was the protagonist (and could decide who he was).

But he also told me “This was honestly a 9/10, but I think right now I would play it for a day or two and maybe not much past that, because it feels like there isn’t a longterm story or broader world that I’m a part of.”

I think his feedback was spot on. AI Dungeon could only do a fun very short loop that was action by action, trying something and seeing what the AI would say. Now with Heroes we’ve gotten to the point where it can do a fun quest by quest loop, giving fulfillment over a much longer time span, but there still isn’t a broader really longterm story that can bring epic meaning to what you’re doing. I think that will be critical to making the experience really fun, and having a broader world that you’re exploring will be an important part of that (hence me asking all you your thoughts on locations and world structure.) I’m also realizing that I’ve getting caught up in a lot of little small improvements over the last week and while I do need to keep doing the some of smaller things and refining heroes (the details do matter), it’s really important for me to be focusing on answering the biggest unknown questions. And right now how we do those two things, longterm plot and world structure are the biggest unknowns for me in how the game will be structured. Excited to dive into that over the next week!

Let me know what thoughts you have for how longterm story and narrative might work! How do we give epic long term meaning while still letting the player shape the story and go in their own direction (as opposed to a predefined path).

– Nick

We’d love to hear your feedback about Heroes, so please share any and all questions, comments, or ideas with us!

Join the discussion on Discord →