Home Artists Posts Import Register

Content

Greetings everyone! Ha... Penis jokes...

So today's post is going to delve into some techy topics and lessons learned, and not so much actual game content. Still, hopefully everyone will find something worth reading here.

Let's dive in!

The Problem

So anyone who's seen the code in one of the recent pre-alphas knows what the engine for the new NPC comment system looks like. Effectively, I've written an extremely long chain of conditional branches and switches checking for a variety of player conditions then selecting a comment at random to suit the dialogue.

This repeats for every mood, meaning each comment will have 6 different conditional trees in order to generate the appropriate dialogue... Plus an addition 3 for family variants!

By the time I'd finished the base 6 moods the function had exceeded 3,200 lines of code, with another 1,000 lines coming for the family variants... And that's JUST for outfit comments!

At the rate I was going, the finished product was going to be sitting at at least 30,000 lines of code. It was an efficiency nightmare, and I could see all the complications that were going to arise from me working this way. What if I needed to make a basic fundamental change to the engine? I'd probably have to go through and update hundreds of lines of code just to apply that change system-wide!

The Solution

I had to change course, which is exactly what I'm doing now.

Over the last few days, I've been moving all the content from the original engine into a array-based database, and converting the engine itself into a means to reference and call that database. So, instead of a long chain of conditional checks, I have a big, wide data set! See? Stupid title is relevant... and also stupid.

Anyway, going this route means I can assign multiple tags to any given comment, allowing it to be called for a variety of reasons rather than just one at a time. For efficiency's sake, this means I only need to have a single entry for a comment that would be called for more than one mood or reason, and in allowing for that kind of easy crossover, the result will be a wider variety of comment possibilities.

What this means for everyone is that adding comments and comment variations to the engine will take significantly less time and allow for easier variations when applicable. It also means that any tweaks I may need to make to the engine will be trivial!

The Impact

At this point, I'm about 50% finished with porting all the existing comments over to the new database. I should have it 100% done by the end of the week, at which point I'll release an updated pre-alpha build. Once that's done, I should be churning out dialogues and pre-alphas much more quickly.

As it is, I'd rather take a minute to slow down and hit a speed bump now, than to keep going full speed only to hit a concrete wall later on!

Additionally, patrons can expect a patron build to drop in the second half of February showcasing much of the new system!

Thank you all for your continued feedback and support. I think this is gearing up to be an exciting update cycle!


Comments

Princess Narii

Yes very smart to dunk everything in to a database. Expecially with choices i think this provide you with most possible sollutions of requesting specific dialogs

Anonymous

Making me tired just reading it! Hope the transition keeps going smoothly, and as always.... Keep up the good work!

Tommi

I don't really know anything about code, but your description definitely makes it seem like a much more efficient design. Kind of like a table of conditions vs possible dialogue. Thanks for all of your hard work!

mpop

I do know something about coding and this is extremely sensible. Great job.

Anonymous

Sigh, Times are tough.

Anonymous

Not sure what kind of database you use. In my opinion, a JSON file could be a good choice.

westane

It could be, if the engine I was using was capable of referencing external files...