Search This Blog

Friday, September 26, 2014

Arcade Influences and CREEPY SPACE

CREEPY SPACE!

In the biographical book Masters of Doom, John Camarack was quoted as saying "...the player should be afraid all the time..."

http://en.wikipedia.org/wiki/Masters_of_Doom

John Camarack and John Romero were said to be dead against a "Doom Bible" or definite story line --which explains the lack of cut-scenes in the game.  Games had cut-scenes before Doom.

A story should be the story of the player and it should happen in the game because of what happens during the game... at least in this kind of game.

I think the first space horror survival kinda game was really SINISTAR.  Sinistar was the Freddy Kruger/Jason Vorhees/Chucky of space.  I mean just look at him!


When he gets assembled and says "Beware I live!"  it was f#%$% terrifying!  Normal weapons don't affect him at all, he bashes asteroids out of the way like they're nothing, he moves faster than you and if (when) he touches your ship, he eats it.

The relentless single-minded purpose of the workers, the constant fear of the warriors... and the inevitable nightmare of Sinistar's incarnation, along with the loneliness and small-ness of the player in relation to the infinite seeming space that goes beyond the screen and even beyond your scanner range made the story of this game very intense --without having a story. 

If you're familiar with Sinistar, you'll see the game mechanics of Captain Zero owe a lot to Williams' 1982 masterpiece.  If you've played that and the PC version of Star Control, and arcade games like Strike Force and R-TYPE, then you know where Captain Zero is coming from.



STRIKE FORCE!

...or at least where I hope it's coming from.

In Captain Zero, there's a darker, colder, spookier section of space.  A place where ships go but never come back.  Where the husks of their destroyed spaceships come back to life to destroy anything around them.  



There's  a machine/monster called the DemiLich with bright red eyes.  If they fix on you directly... well ever see the end of Raiders of the Lost Ark?  Very uncomfortable. You'll need a really good dermatologist after that.   


Friday, September 12, 2014

Damage Collector & Callback Explosions Oh-and a Shader Effect

Damage Collector

When you get hit, a bullet, or impact delivers its damage to your "damageTaken" variable --and nothing happens --until the Damage Collector gets wind of it --which it does about once a second.

In this game, I wanted damage to be more than just yourHealth - BulletDamage when a bullet hits you. When you start talking about regenerating shields, armor, and systems damage --followed by smoke, sparks flying and maybe parts flying off, it starts to get more complicated.

To follow the Single Responsibility Principle and keep my code manageable I created an event that fires each second to go through all ships and assess their damage and figure out what happens to them.  This Event is called the Damage Collector.

This is gonna cost ya, pal...
To handle Shields is pretty simple. Take the damage out of shields first... if that's all used up, take the rest out on the armor --which is a little more complicated... no more armor?  Well now I'm gonna have to verify you have photon bolt coverage on your insurance policy! Things can potentially get interesting here.

Armor doesn't suck up damage the way shields does.  After all you could get hit in the armor in the exact same spot a couple of times and start taking real damage --or get hit in a critical spot--a weak point in the armor.  So Armor is more of, well, armor, than a shield.  Damage has much more chance of hitting armor as it does of causing internal damage... but you can still get killed with full armor and just a few choice insults to your ship. The good news is Armor doesn't necessarily go down when it gets hit.  There's a good chance it will deflect the bad energy like a yoga class with no damage at all.

I used to play Star Fleet Battles...  their damage system is great.
Which squares are the red-shirts?
After all the shooting, the damage was doled out either randomly or the player got to decide where to take the hits.  Different parts of the ship had different amounts of hit-points --squares on this picture, and when those were all used up, they would no longer function --or in the case of generators or weapons, work to the extent that they're not damaged.

The point is, now that I have a single place where all damage is figured out, I'm free to make it as complicated as I want behind the scenes.   

None of this complexity should involve the player much --it should always feel like an 80s shoot-em-up arcade game.  I don't want to bog the action down too much in minutia --I'm loathe to allow the player to set forward vs aft shields for example or repair things beyond very basic aggregate systems.  Like Shields Armor and Engines. And then only then briefly between action.  This is an action game. 

But I loved it in Wing Commander when parts of the HUD became cracked and sparky and inoperable and you had to limp home, barely surviving a mission-- and I want to capture that skin-of-your-teeth feeling in Captain Zero if possible.

Cracks in your windshield? Call EasyGlass! The Windshield Specialists!

So I'd like to have cracks in the player's view, and maybe parts of the hud broken off and sparkie or have the scanner show video noise and be cracked... stuff like that.  If the player is damaged, I want him or her to know it!

Callback Explosions

The Function object in Construct 2 is a very powerful programming tool.  It allows recursion, facilitates encapsulation and abstraction, and, because you can call functions by their name--even if that name is stored in an instance variable of an object-- a little reflection as well.  This allows cool programming tricks like late-binding and callbacks.  Things you would need delegates to do in, say, c#, you can do easy in Construct 2 with a function call. 

I can send a parent "explode" function a string containing the name of some or other specific minor or effect explosion functions for it to call based on whose doing the exploding.  Thus functions can easily call functions named explicitly in their parameters.  Instead of different ships having different explosion effects, I have them pick from a buffet of explosion effects --they can mix and match.

Shader Effect

One platter in that explosion  buffet is a cool shader effect that warps space in an expanding circle giving the idea of expanding gas or a shock wave from the explosion.  Oooo.  Aaaah. 


Saturday, September 6, 2014

Predictive Aiming

AI is never finished...only abandoned..


For testing reasons I have made a red circle visible where the enemy thinks you are going to be when his bullet might hit you.  This way it can lead you.   I know there is  "turret" object that has built in aiming but I did this myself with math. 

It basically takes its distance from you and your direction and speed times a constant and predicts your future X and future Y.

To be more accurate at different distances, I took that FutureX and FutureY and ran it through again to get a new distance which will be closer to the actual distance where you're going to end up and did the equation again to get a new more accurate Future X and Future Y.

Really this is a poor man's calculus.  I'm using basic algebra, but I should be getting the integral of the first equation instead of running it twice.  But I'm not quite that math smart... and it works pretty darn good right now!



Before the predictive aiming, he couldn't hit you at all if you were moving any way except toward or away from him... now he hits you most of the time.  He's a big meany head! 

What I'd like to do is a more human-like approach with turrets.  Instead of trying to predict where you're going to be I want them to use trial and error.  They shoot the first time at where you *are... then look at which way they missed and just turn a little in that direction and keep shooting till they hit.

Like the old 1979 Battlestar Galactica turrets shooting at cylons...


Tuesday, September 2, 2014

Attack of the Swarmers!

Really liking the how the swarmer turned out.  They come out when you blow up pods... a -la Defender.  Yes I rip-off my influences!  Wait till I start on the "Sinistar" I mean "My own original game scenario" level!