Happy Accidents: Life, the Universe and Everything.

Sometimes, when you’re coding, you make mistakes.  Sometimes, those mistakes are really horrible, sometimes, they’re not a big deal.

Tonight, when working on my powerup spawner (aka: pupSpawner, which, I guess in a way = bitch), I kept getting a note that my index was out of bounds.  I figured this had to do with my code to increment to the next powerup.  I was correct.

In the process of trying to figure out what the value was getting set to I used Unity’s Debug.Log feature.  GOD I LOVE THAT THING.

So, I found it.  I found the answer to the problem.  Not just the index out of bounds exception, no…

The answer to life, the universe and everything.

Ladies and Gentleman, I would like to present to you the screenshot of the night my computer arrived upon that great cosmic answer as foretold in the book of prophecy by Douglas Adams:


In honor of this occasion, I would like to present a little awesome ditty from the eighties by that great band “Level 42”



Already I keep thinking of all the little things that make a game really *work*.

So many of the things I plan on implementing are little polish things.

Last night I did some resizing of elements, trying to give more room to the black hole to grow, trying to give more space, but if I did, the rotation didn’t feel right.  There’s a certain feeling when rotating around a circle that feels right.  Too large a radius and it feels loose, or that you’re moving some big lever.  Too small, and well, you won’t be having a particularly long game when the black hole in the center doesn’t have much room to grow.

In the end, I left it mostly alone, and merely shrank the initial size of the black hole.  It’s little things like that feel (and it’s still not perfect… I’m not sure what I can do to tweak it – I’ll get feedback from my more experienced friends once I am ready for polishing).

When I get hit – I have a little explosion effect on the ship, but that’s not much of an effect.  It’s better than none.  But shaking the camera, that feedback, it adds to the sensation of something BIG happening.  Add in some “gasping” breath sounds for extra startle effect now and then.

A heartbeat the speeds up to have sympathetic rhythm occurring in the player.  Even if it’s not fully noticed, it does have an effect.  The small condensation/fog effect I want, broken window effect.  All these little signs are cumulative.

Beeping – that’s another common one.  Probably the most commonly implemented thing.  The stress a good beep can add to a game is enough to drive one nuts.  Such tension.  Right near the end, just knowing you only have a little bit of time left.  Make it speed up so it feels like you’re really close to biting the dust…

All that stuff?  Really getting it to work well and sync together?  That’s polish.  Implementing that properly, getting it to work together as a cohesive vision, smoothly changing from one thing to another, signals to the player about the game that are more covert than overt.  Well, beeping is pretty overt, but in general, a total collection of cues can add a full depth of feeling to a game that would otherwise be rather ordinary.  That doesn’t mean one should just release an ordinary game with “polish”, but making a game without polish is, frankly… phoning it in.  And despite the name of my “company”, phoning it in is NOT something I actually want to do.

It takes time to get these things right, it’s a sort of craftsmanship, certainly an art, an aesthetic judgement.  Something one can intuit and something one can refine and hone through practice and experience.

Since I am just starting this journey, this is something I look forward to learning and expanding upon.

Powerup System Concept 1

I modified a few things in my game this weekend.  I made the black hole much smaller at the game start — it was radius 12, now I have it at radius 1.  This allows for a quite a few more waves.  I also have single-shot/manual fire implemented.

Currently the game increases the wave number every 10 radius of the black hole.

OK, after thinking about it this weekend, along with playing with the game a whole bunch tonight, my first iteration of the powerup system:

First – the powerups will have variables to track whether they have yet to spawn, whether they are currently “in play” (i.e. flying around), whether they have been caught by the player (and thus “active”) or whether they were eaten by the black hole (and thus not consumed by the player – with no chance to be picked up/consumed).  If a player misses a powerup, when it dies, it will “release” itself to be re-spawned ASAP.

To start —

1) Player starts having to manual fire a low level bullet.

2) At radius 5 a random asteroid upon generation is given the “autofire” powerup.

3) If player catches this, they then receive a “spreadshot” powerup at radius 15.

4) At 25 they receive a non-spreadshot medium bullet, then spreadshot again, then eventually a non-spreadshot heavy/fullpower bullet, then spreadshot again.

This comes after testing out various scores after various point in the game with different powers/spreads of bullets.  I’m not sure the exact points, of course, but I think this is the route I’ll go.  I could also do autofire->bullet up->bullet up-> spread -> spread -> spread.  The issue there is that at that point when I get the spreads, the earlier levels benefit more from a lot of low-level spread due to how I have the scoring implemented.  If I wait on spread until much later, the benefits don’t come as much and the game is WAY harder later (I could tweak other things, of course).

The only issue is that I think if a player has a spreadshot, they want to keep a spreadshot, and it sucks to lose it to revert to a single-fire medium, even though the medium is stronger.

What I *did* notice, however, was that when it switched from spread to single fire yellow, I have it set to increase the fire rate on the single shots (technically, I reduced the fire rate of the spread shot to compensate for the increase in bullets).  So, psychologically, when I switched I did do a little mental perk of “oh, I’m going faster shooting now!”  So even though I lose a spread shot, it did have a little compensation to make up for it.  I might even tweak it so the fire rate is faster yet (as it doesn’t feel much like a boost to the overall power)

Those are the main weapon powerups I have available at this point in code (just in terms of ability to turn them on/off – again – not spawning any powerups)

I also have a health-up icon ready to be used for a powerup.

The other thing I plan on doing is figuring out how to have a “comet tail” effect on asteroids that do have the powerups, so players know which ones to aim for to get the powerup.  I goofed with some particles tonight, but need to figure out how to get the tail blowing backwards consistently.

I’m still quite new and learning all the issues surrounding vectors and transforms and such, and even though unity has nice things such as “transform.forward” and “transform.up” for example, it’s still just a bit confusing to me, because I think sometimes thinks aren’t exactly up or down, but in some range between them all.

Regardless, my next goal is to implement a structure/system for keeping track of the spawned powerups.  Once I get that, I can work on spawning them at various points in the game and checking if they’re already in effect or not and if so, remove them from the spawn-pool so I can go to the next powerup.  And if they haven’t been caught, then try to respawn again until the player gets it.

I also think I’m going to go back and re-add the heartbeat effect as well as a breathing effect (maybe).  The breathing I’m imagining long deep shallow breaths that mostly stay long and deep, unless an asteroid gets quite close, and if it hits, a “panic” response of hyperfast breathing and rapid pulse effect that will slow down a bit over time.

I played a bit with a camera shake effect script and it wasn’t quite what I was looking for.  I’ll figure something out.  I may not want to put it in, but I think I would like to see how it would look when the ship is hit and the camera shakes from an overhead view.  I also want to figure out how to add a slowly breaking glass effect.

So many little things, in theory each of these shouldn’t take much more than a week on any single feature (going at a relatively slow pace), but each one for me is learning something new about how to implement a new thing (camera shake, cracking glass effect (and maybe a fogged-glass effect if I can add that, too)) but for now, keep pushing on the basics.