Small Update about a Big UpdateIt's been about a little over a week since I've posted but I've been insanely busy tearing the game apart, re-writing code, re-building game mechanics....
The next update to the demo is getting enormous... I don't know how it happened but after the feedback I just decided to rip it all apart, have a nice long think, and then slowly piece it back together. Here is the list of updates going in to the new demo (v3.0) coming out
sometime in the next few weeks:
- re-balanced ship movement/aiming/shooting (code almost completely re-written)
- re-written enemy behaviors (all enemies are now using Unity Physics, more about this in the 'Technical' section below)
- enemies are now affected by "knock-back" from being shot
- re-balanced/re-written enemy spawn system and procedural room creation
- added obstacles that now spawn in the rooms to vary the rooms a lot more (all enemies react to obstacles appropriately)
- steeper camera angle (thanks
bigosaur!), much easier to see now especially with the faster game play
New Game Mechanics- new
Warp Crystals: picking up 3 Warp Crystals unlocks the warp to the next Sector
- HP pickups that replenish ship hit points, occasionally spawn on room completion
-
Ship Components (previously named just "buffs") now immediately affect your bullets (confusing/annoying usage of energy no longer necessary)
- energy is now used for the new
Hyper Speed mechanic (pulling the trigger makes your ship enter Hyper Speed, slowing time around you for a little while allowing you to dodge and fire much faster)
I'll be giving more updates as the demo gets closer, and then a final update on release. Stay tuned!
Some Techical Mumbo-jumboThis section is for other code nerds like me. If you hate code, avert your eyes. Re-writing the Enemy CodeWhen originally writing the enemy code, my only thought was speed; write as many unique enemies as fast as I could to see what works and what doesn't. With that being said, all enemies were written without a base Enemy class. That means every enemy was unique, with lots of copy and paste code; a bit like using chewing gum to hold your car's engine from dropping out onto the street while driving... a bit messy and ill-advised. Also, if the enemy needed to move, I moved it's transform. If I needed the enemy to glide around the room, I did the math "by hand", so-to-speak, and moved their X and Z coordinates all the while checking to make sure it never left the current room's boundaries. It was a pain in the ass.
The other day I finally got the courage and created a base Enemy class complete with virtual functions like "MoveTo", "SetMoveDirection", "Damage", "Kill", among others. On the game-play side of things, I no longer touch the transform component of the enemies and instead completely rely on the Unity Physics engine for movement using calls to rigibody.MovePosition(). This allows smooth reactions to physical objects in the room as well as "knock-back" from player bullets.
The downside I've found is that Unity's physics are mean... You have to work very hard to please the physics gods
In other words, it's a pain in the ass now for a whole new set of reasons. To combat this, I've written a series of "sanity checks" that ensure the enemies stay within the confines of the playing field for the player to shoot and don't get stuck on things or end up outside the map, for example. Here's a snippet from the sanity check function in the Enemy base class:
float m_leftGroundLevelStartTime = -1;
// returns true if sanity checks passed, false if failed
protected virtual bool SanityChecks()
{
// off ground (un-killable)
if( m_rigidbody.position.y > 1.1f )
{
if( m_leftGroundLevelStartTime < 0 )
m_leftGroundLevelStartTime = Time.time;
// off the ground for > 10 seconds, failed.
if( Time.time > m_leftGroundLevelStartTime + 10.0f )
return false;
}
This sanity check tracks how long a given enemy has been off the playing field and if it's being an idiot, it fails. Failing the above sanity check results in an instant death for the enemy.
That's it for now, let me know if this technical section was at all interesting and I'll keep doing it. Or, let me know if there's other stuff you'd like me to bring up in my next post (design, art, sound). I'll be back soon with another update -Alex