Dev Journal: Internal Logic

I’m deep in the process of building Project Wild One’s AI overhaul, but that’s required a lot of smaller support projects along the way. I’ve been working on a lot of different parts, and I think it might be about time to shift focus again so I can get a new update put together sooner rather than later. There’s a lot to talk about, so let’s get into the thick of it!

AI and understanding

In my last public dev journal, I talked about the major categories of work that need doing to get this new system on its feet. Looking back now, numbering them was a little optimistic since I have to sort of bounce between several of them as I refine my ideas of how it will all work, but let’s use that as the basis to establish some terms. Once all the more abstract concept work of “how do you even make this happen” is out of the way, there are three major categories of work to building systems like this one: Core work, building the raw logic and connections hardcoded into the game; Content work, writing out all the actual ideas, the mushy emotional stuff and all their eventualities in spreadsheets; and Infrastructure work, building functions to parse those spreadsheets, turn them into the configurations the game will use, and fill in everything the Core needs to interact with the Content.

This is more or less the system I used building the main Text Output system– all the main text output’s descriptions of the action (well, ~95% of them) are stored in spreadsheets with instructions for when and how to use them. This allows for a lot more flexibility and man-hour-efficiency both in writing content and in making changes to the mechanics involved, because you don’t have to touch actual code to write narrative and you don’t have a bunch of narrative in the way of your code. That’s also why the old AI system and the current NPC generation systems get so few changes, because they’re both all hardcoded together in one big mess of content and logic.

I’ve been working steadily on the Core and Infrastructure for the AI overhaul since the last update stopped making trouble for me. As a reminder, I’m focusing on just the input systems for AI currently– to try and get it to a working, testable state as soon as possible, I’m focusing on just one chunk of the planned new AI system at a time, and I’m going to try and mash a richer system of understanding what’s happening in the game into the old AI for starters. There are many more layers of the AI system than that planned, but if you want to know more about that, check my previous public journal!

That said, even just this first step has required basically building a large portion of the fundamental systems that most or all later sections of the AI will use for the Core. I’ve been planning out and prototyping a specific system of modular logic objects –you might call them the neurons– for taking and interpreting inputs that will form the foundation for most of the AI stuff to come. Hopefully that means later sections will be less of a bear once all these pieces are built and ready, but it does mean that even this first chunk is a lot of work all on its own.

Well, making the jump from rough concept to actual, working code has meant many different layers of discovering that small things I took for granted will actually be immensely complicated to implement. I’ve had to stop, step back, and reassess my ideas many times throughout this development, and sometimes I’ve been so worried about figuring out the right way to handle things that I’ve let it slow me to a stop. But I’ve been playing with abstract concepts for a long time already before this, and I’ve had to push myself to take the plunge at times even if I’m not totally confident it will work. I’m still worried that some of the systems I’m developing might prove to have some critical, fundamental flaw and I’ll have to go back to the drawing board with them, but I’m learning a lot and making progress on many fronts just putting everything to code that I can. It’s been tough work, and it’s often felt overwhelming, but I’ve mostly managed to keep my head on straight and push through.

That said, working on all these systems have made me realize there’s a lot of overlap between the work I’m doing and what I’ve done before, and that I might be able to reuse those systems with some modification. That brings us to…

Logic Upgrades

I was very proud of my Text Output system when I built it, partly because it has a pretty versatile system for storing parsed formulae at its core: it can read certain switches, math, and variable calls from spreadsheets and store them as efficient instruction packets at runtime so that the game can “process” instructions that aren’t even hardcoded. It knows that if I put X special text in the sheet, it should run Y method or compare value A to value B in Z way to decide what text to use.

This is also the system that will hopefully open the door to easy modding/user-made content down the line, by the way! When I have the time and the details have solidified, I should be able to write up a guide for how to make your own sheets, and hopefully set up a way for the game to read user content at runtime and incorporate it into the game.

But looking back at it recently, I realized that this logic system I made was still a little bulky and inflexible, that there was a lot of copy-paste code, and making additions to it was a lot of work. And I needed something very similar to this system to sort of build the synapses to my neurons! If I was going to use this system as part of the AI Core, it was going to need a lot more added to it!

So the last few weeks, I’ve been overhauling that logic system to make it much more flexible in the kind of input and output it can handle, both currently and in the future. Adding new types of input, new types of formulae, all of it is much easier now, and I’ve adapted the system to read the AI system’s internal data formats as well. I’ve already expanded the options for parsing formulae from Text Output sheets, and it’ll be stupid easy to add more as they come to mind now, so this has also opened the door to more variety and more “intelligently generated” content for the main text output from here on!

But that’s not the only system that needed some work…

Parsing Upgrades

Much like the AI system, building that text system required Core, Content, and Infrastructure work. I started getting my head around parsing sheets into game content with Project Voice, but I built a much more robust parser as Infrastructure for the text system in PWO. I’m proud of the work I did there, but most of it was made specifically for the text output sheets.

I know that the AI system is going to need to pull a lot of specs from sheets, so I’ve gone through and separated the primary sheet parser into a standalone class that eats sheets and spits out organized data. This should make it much easier both to build the AI system’s Infrastructure and to transfer other systems in PWO to this divided arrangement… like the NPC generation system. That brings us to where we are now.

Where We Are Now

As I write this, I have the game running itself in the background so I can check for any issues with the big changes I’ve made to its insides. If I’ve done my job right, there should be no visible change– I’ve replaced a lot of the guts with better, more versatile code to better handle changes in the long haul with no lost function.

We’re closer to AI, but it’s still going to be a long time before I can bring even the first chunk of the AI online, and it’s been a while since the last release. So at this point, I’m thinking it’s time for another “partway update”: the Text Output system is more powerful than ever, and it might not be too much work to convert NPC generation at this point. I’ve had a lot of requests regarding what NPCs you run into in a game, and I think this switch could make a lot of those more practical to implement.

Honestly, I mostly want to just keep trucking on this beast until I actually have something to show for the AI itself, but I know folks want updates as often as they can get them, and it’s true it might be good for me to take breaks and work on different things before I burn myself into a hole again. Expanding the game’s text output content will mean doing a little actual writing again too, which will be a nice change of pace! And I figure it will make the game more rewarding for everyone to play if I can create more complex and nuanced text, with less repetition and more recognition of what exactly is going on from moment to moment.

So that’s my plan for the moment. Take advantage of the side changes I’ve made to enrich the game in a few more visible ways and show off at least a little of the work I’ve gotten done so far, so I can ship a decent update before too long and get a bit of a break from the depths of AI. It’s still going to take some time putting all that together and testing it to make sure it doesn’t break on you, but hopefully I can keep it to a short diversion before we’re back at the AI!

If you’re ever feeling impatient to see the new content sooner, or want to help shorten my dev cycle, consider becoming a playtester! I still call them “proofers” since it used to be mostly proofreading, but while we’re deep in the mechanical development it’s much more about finding bugs and generally improving player quality of life. If that sounds interesting at all, please take a look!

That’s all I’ve got for now. Thanks for reading, and I hope your holidays are happy!

1 thought on “Dev Journal: Internal Logic”

  1. honestly game seems like it’s gonna be sick af, but i’m enjoying your dev journals probably as much as i’ll enjoy the final product. i love to see people getting into fun coding projects that push their comfort level, so your transparency and explanations of your thinking are really appreciated. you’ve done awesome work and i’m excited to see where you go with it next

Leave a Reply

Your email address will not be published.