Main Menu Touch Up


No major updates this week just more bug fixes, art fixes, main menu fixes, and fixes fixes fixes.  If I'm being honest, it feels like I'm starting to burn out a bit, but the end is so close I can almost taste it, and that's the main thing keeping me going.  I also managed to finally get past some of the hardest bugs I've ever had because they've been silently plaguing this project from its inception, so let's dive into it!

Art

True to form, art has taken center stage this week and my oh my have we made some improvements.  Ref has been iterating the main menu with me and we are doing well in getting it up and running.  I think we finally have the layout and scaling of all the main characters, as well as nice silouettes for the extra enemies on the side.  I also finally nailed down the right reference resolution so it scales well on all screens (800x450) and even fixed some bugs with the resolution settings that have been blurring a lot of my sprites and keeping them from being pixel perfect (or closer to it.)

We are still missing proper lighting but I got the normals working on the main character and Voynich! I've been working on adding a fun little effect where moving your cursor also moves the light source so you get to see those shadows swiveling about.  I think it's kind of nice, and I can't wait to start animating the enemies so the whole menu jiggles and reacts to the player.

There's still a lot of work to do from animation to VFX, but we are making slow and steady progress.  I think this adds a lot of character to the game and keeps all of the art consistent, which is definitely worth doing.

Programming

On the programming side, it has all been bug fixes, but I want to brag about two bugs that I caught this week.  Like I said, both were plaguing my game since inception and they had to do with the notorious object pools.  

I've always been a bit skeptical about my implementation of object pools because I made them serializable using scriptable objects.  This means that I am able to drag and drop pools that entities use and make them inside my project folder so they can be loaded in at will.  The reason I've been so skeptical is because it's almost too good to be true.  I was always worried that something about the initialization is wrong or creating duplicates or not cleaning my pools up on scene change, but this week I found out that in fact all of those worries were not a real problem.  The real problem was double referencing.

The problem started when I found certain attack patterns disappearing mysteriously and out of the blue.  In my test environment, the enemy would execute them no problem every single time, but when I played a full round of the game, the same attacks would get silently "swallowed" or even worse just be the wrong attack entirely.  This was a real head scratcher to me, so I decided to revisit my pooling code and figure out what was going on.  

It turned out that there were 2 things I didn't know about object pools that bit me in the butt.  The first was that there was no internal check for making sure that when you release and object that it is in play to begin with.  There is a way to turn that check on, but it's a debug feature and not recommended for performance reasons.  When I did activate it, I found that my objects where lighting up red all over the place, and there were lots on instances where my objects would be released multiple times in a row!  This was a problem because instead of just ignoring them, like I assumed it did (since the object was already disabled) what was actually happening is that it kept adding New references to that object to the object pool stack.  This was extremely dangerous because it meant that it could feed a duplicate reference of an object that was already in play.  

Think of it this way, if you shoot a "bullet" object from your gun, but then fire another one again right away, my object pooler was feeding it a "new" bullet from the pool but it was actually the same one that was already in flight.  This wasn't an error because the gun expected a bullet, but instead of generating a new bullet to fire, it was taking hte one that was already in flight and reinitializing it! To solve this I implemented a hashset in my object pool scriptable object that tracks which objects where in play, and made it so the release function would first check the hashset to see if the object was active.  If it didn't, then it would ignore the object instead of releasing it a second time.  This fix had a little bit of performance overhead, but the moment it was in place, it fixed a ton of bugs! No more messy broken attack patterns!

The next bug I fixed had to do with the attack patterns changing mid fight.  This one wasn't as bad as the first but also insidious.  It turned out that one of the my attack patterns that an enemy was using, was "releasing" it's explosions into the wrong pool.  This was okay because both pools were handling gameobjects, so the pools didn't care what was released into them.  This caused my second enemy which appeared later to request an object from it's pool and it was the object that the first enemy snuck into its pool.  

Now, although this was an easy fix, I also want to brag a little bit that this never threw any errors :) It goes to show that my attack pattern script was doing a good job of making interchangeable interfaces that other explosions could be initialized by different attack pattern managers! Jokes aside though, I fixed this and future proofed against having this issue again by making sure that each object pool has a unique id, and game objects gotten from the pool will carry that unique id.  if they are accidentally released into the wrong pool, they will error out because their ids don't match that of the other pool!

Next week

Next week I'm going to continue fixing bugs and sharpening the main menu.  I feel like it's been the same thing every week, but I'm seeing how important this is.  There are so many little bugs that I need to deal with before the game is ready to playtest, and I want to finish them before I get people's opinions, otherwise they will fixate on them like I have and not be able to enjoy the game!

Files

_MasterProjectBuilds.zip 181 MB
7 days ago

Get Bloodmoon Survivors

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.