After The Jam - Major Performance Improvements!


Well, it took me about two weeks to get back to tinkering with the game, but... hurricane.  Whaddagonnado?

I was only without power for about 2 days, but between prepping for it and recovering I wasn't even thinking about the game for a while.  What got me cracking it open again was seeing that I MAJORLY screwed up my build, and the game was basically unplayable on some systems.  I knew it was rough in my build, but still playable.  However, I had a major issue with scrolling and character generation I was not aware of until I saw a stream of my game.  They weren't tied to DELTA and were using short timers to fire off with inconsistent results.

In the stream the screen scrolled to fast for the guildes to keep up, and the game generated too many characters overall, eventually crashing the game.

Sunday evening I opened up Godot for the first time in over a week, and I set out to solve this and some other problems.  First I metered the scroll speed to delta, and then adjusted it so that it matched about what I was timing on my system.  Then I updated the Guildie and Mosnter generators to have their probabilities metered by delta as well.

The result is a nice and consistent rate of scrolling and generation no matter the system speed.  And I know this because:

It got it up on HTML!  I can't update the game until the Jam is over, which voting has been extended.  So I created a test version of the game and with a bit of work and tweaking got the HTML version up and running.  More adjustments to the Director to keep the game flow correct, and set the music fades to work with Delta as well.

Now for the most exciting part - I made a separate major improvement to performance.  I was not sure what was causing the slow down issues when you reached about 50 guildies on screen.  The main issue was lag, and missing animation - particularly the MainTank sword swing.  Obviously there were a lot of potential culprits, but I found the major issue and fixed it!

So when designing the List system that basically gives the characters their game vision, I pretty much threw it together and got it working on a few characters without much thought for performance.  The main issue here was that the Game Manager and each Character were creating a multi dimensional Dictionary for every character AND every item... EVERY SINGLE GAME LOOP - potentially 60 times a second.  From Scratch.

Even if the character was in the middle of an action with their ability to make a decision turned off, it still generated a list of other characters and items for the turned off behavior functions to use... every process cycle of that action.

To solve this I now have the GameManager keep a timer variable (not a timer node - not reliable enough for short times) that will turn on make_lists as an exported flag for a loop.  This flag will let the GM and characters generate their lookup lists this loop and will turn off on the next and reset the timer.  Right now its set for .33, and it adds delta to the timer every loop.

So now its gone from polling every 1/60 a second to every 1/3.  The improvement to performance was immediate and massive.  I raised the Guildie cap from 50 and choppy to 100 and flawless.  There was no notable change in character behavior and no errors occurred from using the "stale" list.

I was worried about making more complicated behaviors with massive numbers when the game was struggling at 50 guildies and the simplest behaviors possible.  Now I feel like I can explore adding new abilities and improve movement.

Tested all these improvements on HTML and it works like a charm.  So for the next two weeks I am going to start work on a Post Game Jam version of the game.  First I want to keep finding ways to optimize performance, so that when I add more to the game I will be able to actually run it smoothly.  Secondly, I would like to complete some of the "if I have time" items that I DID NOT have time for, like more Guildie types, variations on the types we have, a minor attack for Guildies, projectile arrows, more abilities, more enemy types, an improved boss fight, character type counts, an actual victory / fail screen, tuning and polish....

For now though, I am very excited for the next few weeks, and to put out a much improved and actually FUNCTIONAL version of the game!


Edit:

Here is a link to the HTML test version.  I still want to be judged on the buggy version I submitted, but I feel bad so many people are getting a non-functional experience.  I will update the main game page with this version when the Jam is over.

https://averagedrafter.itch.io/guildieshtml

Get Guildies

Leave a comment

Log in with itch.io to leave a comment.