SUNKEN COST FALLACY

As my expectations fluctuate wildly between dreams of finishing this project and fears of dying of covid-19 because I went to a grocery store, time keeps ticking. And so I tick with it, stomping bugs with metaphorical boots and scraping off bug guts on a very real doormat.

Whatever man, nobody is reading this

Shut up, invisible spies that live in the attic! I am mentally pretty ok all things considered for the most part. So here’s the state of the Super Slam Dunk Touchdown Xbox One Release / Season Mode Update / I don’t know I need a marketing person I’m so tired.

Word up

Bugs

I’m at the point with the Pre-Platform Beta where I’m just squashing bugs and creating save points so I can retest. There’s a lot of testing and I have a little stair stepping exercise thing so I do that while playing so it’s kind of my hamster wheel. The body wants to move and isolation sucks. Bugs. Fixing. Right.

This is the spreadsheet. It changes a lot.

My Pre-Platform bugs are close to single digits. I move things to the “critical ASAP” category as I focus on them. By breaking it into smaller chunks I don’t go completely insane.

Here’s some bugs that I fixed

Cleanup on aisle everything

Another task while I fix bugs is cleaning up 3 bad habits and crud from years of developing the same project in a vacuum:

  1. Throwing away strings
  2. Null checks
  3. Debug.Log statements

Strings

This is basic CS-101 stuff, don’t waste memory. It’s easy to forget when your project is running at 60fps and you have gigs of RAM. But this crud adds up and I’ve been scraping it off as I see it and even searching for more abuses. The worst pattern is this:

// Update is called once per frame
void Update()
{
   renderer.sprite = GetSprite("mrSprite_" + frame + "-layer_" + layer + "-sprite");
}

Every frame multiple strings are getting created and thrown away just to get a sprite back. So in many cases I’ve replaced it with something like this:

Dictionary<int, List<string>> spriteFramesByLayer = new  Dictionary<int, List<string>>()
{
   //layer 1 
   {1, new List<string>() { 
      "mrSprite_0-layer_1-sprite", 
      "mrSprite_1-layer_1-sprite",
      "mrSprite_2-layer_1-sprite" }
   },

   //layer 2
   {2, new List<string>() {
       "mrSprite_0-layer_2-sprite",
      "mrSprite_1-layer_2-sprite",
      "mrSprite_2-layer_2-sprite" }
   },
};

// Update is called once per frame
void Update()
{
   //no new strings!
   renderer.sprite = GetSprite(spriteFramesByLayer[layer][frame]);
}

Null checks

Anywhere I can I’m replacing a null check with a boolean flag. Objects that have nullable properties are given an “HasValue” flag. Instead of checking for null before each use, I modify the HasValue flag when it is set. In many cases, these were “lazy initializations” that populated the null values and then never would be null again so managing the flags was minimal.

public static bool HasScript { get; private set; } 
private static SomeSingleton script = null; 
public static SomeSingleton Script 
{ 
   get { return script; } 
   set 
   { 
      script = value;
      HasScript = script != null;
   }
} 

Debug.Log and Debug.LogFormat and Debug.LogWarning and Debug.LogWarningFormat

A lot of times Debug.Log is used in, well, debugging so you can get information from a specific part of the code that isn’t working right. The LogFormat variant is great because it works just like string.Format().

Unfortunately if you don’t clean up your messes this stuff accumulates, clogs the logs and affects performance. See the image to the right! I’m somewhere between bad about cleaning this up and really bad about cleaning this up.

There’s a lot more of these and I will go on a crusade to get rid of them all before release. No code example because that’s super boring.

The quest for pants

As much as I try to resist doing anything that isn’t bug squashing, I couldn’t help but color the baseball player’s pants. I love the look of the white pants uniform, but it creates some confusion as to what team he’s on sometimes.

Brotherhood of the pant

It works pretty well because the 2ndary color is still white for a lot of teams, and the extra bit of visual information can help him stand out.

Stability

The builds have been pretty solid so far and no issues yet with the new file system changes. This all points to things going smoothly on the Xbox but we’ll have to see. I’ll keep at it and keep updating the blog every month for my own sense of accountability. One day at a time.

One Comment

Add a Comment