Virus Alert

No, not the Weird Al song, in Rx. This was another one of those days where it was tricky to find some time to get some coding done on this (ironically, work days work better than days off, go figure), but I did manage to get some stuff done. In fact, this entry will be a little short since it’s late and I have to get up super early for work in the morning to do some after-maintenance testing.

I had to include an emergency engine patch when I realize that I forgot to expose width and height properties from the Actor class; whoops.

This shortfall was noticed when I modified the level editing code so that you can click on the segments on the left in order to select which one to insert; I figured since I kept trying to do it, that meant I should probably allow it.

Once that was done, I dove into generating viruses into the bottle. For this I looked at some info in this wiki page to get a handle on the algorithm used. Essentially it makes sure that the color distribution for all of the viruses is more or less even with a bit of random variation, and that they can’t be placed in positions such that matches are created right off the bat without the player doing anything.

I ran out of time shortly after I started this, so for now all it actually does is insert viruses into the bottle up to the maximum allowed height in the bottle (which is based on level). It’s smart enough to find a blank space to insert the virus, but that’s about it. Occasionally it generates a layout that doesn’t have a lot of initial matches, but usually it doesn’t.

The task for tomorrow shall be to try and implement this more fully, and possibly tune it a bit. It just so happens that I picked a virus bottle size that matches with the NES version (I think) but once everything is said and done, I may want to tweak the distributions a little bit. We’ll see.