Saturday, October 19, 2013

When you shoot something with a rocket...

...it should ragdoll gaily through the air.

Tired of those yellow pills just disappearing when you shoot them?  Well, no longer!  Yes, that's right - ragdoll pill corpse physics have been added to ZOMG Rockets!

Introducing corpses was actually fairly simple.  It was just a matter of disabling input and AI on death, adding (and enabling) a collider on your weapon (to stop the cute little pill corpses from rolling forever), and setting rigidbody.freezeRotation to false for that endearingly haphazard final flight.  The result?  Instant hilarity.
A job well done
As an added bonus, when you die you leave behind this sobering reminder of your mortality:

For extra laughs, try using the Repulsor on corpses.  As usual, you can play the latest version here:  http://www.kongregate.com/games/CodeBison/zomg-rockets

Tuesday, October 15, 2013

Scoring Update

I've put a new version of ZOMG Rockets! up on Kongregate.  What's changed?

UI changes - mostly new font:

Kongregate API tracking of:
  • High scores (level and game)
  • Kill streaks
  • Level completion times
The game actually ends (3 lives - once you're done, you're done).

You can play it here.

Adding support for the Kongregate stats API was actually remarkably simple.  After setting the stats you want to track on the Kongregate site, there are two steps:

There's a single function call to link to the Kongregate API at game start:
Application.ExternalEval( "if(typeof(kongregateUnitySupport) != 'undefined'){" + " kongregateUnitySupport.initAPI('ExternalAPI', 'OnKongregateAPILoaded');" + "}" ); And then a single call for each event you want to report:
Application.ExternalCall("kongregate.stats.submit", eventName, eventValue); eventName is any string, and eventValue is any non-negative integer.

PS:  If you know why my code blocks are word wrapping even though I've set white-space: pre, please tell me! :)

Wednesday, October 9, 2013

It's Alpha Time!

Yes, that's right - ZOMG Rockets! has entered alpha.  Things have changed a fair bit since the last update.  Where before we had a leisurely stroll through an outdoor cube world that involved lazily lobbing rockets at things, what we've got now is more of an up-close knock-down-drag-out rocketfest.

As you can see, there's a lot more close-quarters action.  Enemies are rendered as allbrights, for the vision impaired (this one's for you Joe).

There's also a new weapon, the repulsor:

Careful, don't kill yourself with it - ricochets are not to be taken lightly.

Other than the new and shiny, there are a lot of internal adjustments.  Those who know Unity will see the telltale signs of a Pro trial.  When the trial expires later this month, we'll be going Pro.  The shiny effects will be nice, but I'm just as excited by things like the profiler.

Here's a random grab bag of changes in the new release:

  • Improved enemy AI
  • New rocket launcher graphics
  • New weapon - Repulsor
  • Ambient sound
  • Random internal level generator
  • New textures
  • Improved lighting
  • Scorekeeping
  • Tracking for kills, deaths, time and score
  • Fight in the void of space
  • Improvements to character controller and motor
The changes are exciting, but there's still a lot to do before it's really solid.  Try out the latest build here and let us know what you think.  Comments and suggestions are always welcome.


Sunday, September 8, 2013

What good are rockets without something to shoot?

Enemies are here!

Yes, that's right - there's stuff to shoot now.  Defeat the rocket launcher-toting yellow pill capsules (aka placeholder graphics) before they get you!  Here's a quick summary of what's been changed with the Junk Engine in general, and ZOMG Rockets! in particular:

Junk Engine Changes

Added a fixed-size mode to the world manager

When in fixed-size mode:
  • The map has a finite size defined in chunk intervals
  • The entire map is loaded all at once
  • Gameplay is paused during world load, and the player gets a birds-eye view of construction
  • Boundaries are placed around the world to prevent actors from leaving (though you can shoot rockets off into the sunset if you want)

Added NPCs

The Game Manager now supports spawning of NPCs.  Spawning behaviour so far is very simple.  The level defines an initial number of enemies, along with a minimum active number, and the total number of NPCs for the level:
  • The initial number of NPCs are spawned after level load (or immediately, if the level isn't in fixed-size mode)
  • If the number of active NPCs drops below the minimum, additional NPCs are spawned
  • When the number of total NPCs that have been spawned meets the defined total, spawning stops
NPCs have basic AI support through the AI class.  Currently this is a simple state machine, with more advanced behaviour to come later.

ZOMG Rockets! Changes

ZOMG Rockets! has been changed to use fixed size worlds, and has basic victory and defeat conditions.  Yes, it's possible to get your ass handed to you by a Dr. Mario reject:
As usual, you can try the latest build here.

Sunday, September 1, 2013

Out With The Old (Character Controller)...

It's about character...

I wasn't entirely happy with the FPS character controller that comes stock with Unity.  While it does a good job of giving you an FPS-style feel (near-instant acceleration, turning on a dime, etc), it removes the opportunity for a bunch of physics-style gameplay as a result.  It was also total crap for smooth climbing in a cube-based world, and for some reason was often not detected properly by the block colliders.  For ZOMG Rockets!, I wanted all the physics-y fun of pure physics objects, FPS-style control, and smooth auto-climbing of one-block incremental height terrain.  So obviously something had to be done.
So I built a new character motor and input controller.  I tried to interfere with the built-in physics of the object as little as possible.  This was a bit tricky, since some of the characteristics of your standard FPS controller are decidedly against the laws of physics.  Here's how I put it together:

  • The character's attempted movement direction is entered as an impulse vector.
  • Force is applied every frame based on the current velocity compared to the maximum defined velocity and the impulse vector.  More force is applied when you're moving slower, or moving in a different direction (>90 degrees difference) than the direction you're trying to move in.
  • To speed directional changes, if grounded (standing on a surface), velocity is reduced by 20% each frame.  To allow ragdolling and being knocked around by explosions, this is suppressed temporarily when hit by an explosive blast.  It's a bit of a hack, but it works pretty well.
  • During each frame, rays are cast in the intended move direction.  If there is ground ahead higher than the player's feet, but below the maximum step height, the player object is moved up part of the way toward the new height each frame.  This is the only direct manipulation of position that is done by the controller, and it is only applied if the character is near stationary, or attempting to move in the direction it's already going.
The overall result feels pretty natural, and should serve pretty well.  And since it's using a standard capsule collider and rigidbody, it interacts beautifully with other objects for block collisions and explosion ragdolling.  I also managed to resolve the "falling through the world while building under your feet" bug (I hope - let me know if you still see it).

...and explosions

I also made a couple of adjustments to explosions.  The explosive force has been expanded and tapered somewhat - explosions now throw things around slightly outside their damage zone, and apply that force in a slightly diminishing fashion (full force at center, half force at the outside edge).  This results in more ragdolling, without being ridiculous (during testing, I accidentally set the explosion force so high I lost sight of the ground when I got launched).

Cave-ins are looking better than ever:


As always, you can play the latest build here.

Friday, August 23, 2013

Physics Updates

Today is "Physics Improvement Day" - I've made changes to character control and block physics.

Character Controller

The character controller has been adjusted to allow autoclimbing up to single block height.  No more pressing SPACE like a demented rabbit just to climb hills.  I've also tweaked movement speeds and gravity caps.  It still needs some work, but the behaviour now feels a lot better (at least to me).

Block Destruction

I've also adjusted block destruction in a couple of ways.  First, blocks have densities that match their strength.  So basically, the stronger a block is, the harder it is to knock out of the way.  This isn't realistic in the strictest sense, but it allows for some interesting gameplay.  For example, walls made of hard blocks will be tougher to knock down.  Your first shot will probably knock several blocks free from the terrain, but tough materials probably won't move much.  This means you can actually put up a barrier and it has a hope of standing against a couple of shots.
The second change to block destruction is the size blocks spawn at when knocked loose.  They have a greater tendancy to be full sized now, allowing for that experience of battering bricks out of a castle wall instead of having them all disintegrate.  As an added bonus, cave-ins are much more impressive.  This will make caving in tunnels a lot more effective way to hurt opponents once physics-based player damage is in.

There's still a lot to do before it's an actual game, but it's coming along nicely.


Thursday, August 22, 2013

The Junk Engine

So what's this "Junk Engine" thing anyway?

The Junk Engine is what I'm calling the vector/block-based game engine I'm creating.  I suppose it's not an engine in the truest sense, since it's being built in Unity3D.  So I guess Unity3D is the engine, and Junk is a framework.  But I'm going to call it an engine anyway.

So the idea is that I'm going to continue to build and refine Junk as I go, building a series of games with it.  My ultimate goal is a procedurally generated, "infinite" persistent multiplayer RPG (not MMO - I'm not that crazy).  I'm envisioning something along the lines of Cube World, Block Story, and a splash of Unlimited Adventures.

So that's the ultimate goal, but I'm not starting there (I like to actually finish stuff).  Along the way, I'm going to be building multiple games with Junk as I add new features.  The first game on the list is a rocket arena style shooter thing (dev build playable here).  I plan to keep it nice and simple, probably with two-stage matches.  The idea is to allow a couple of minutes to build defenses, then go nuts on your opponent.  The only weapons available will be rockets and the terrain.  The next game after that may be a first-person zombie roguelike, depending on how the rocket-y awesomeness turns out.


Sunday, August 18, 2013

So I was playing this game...

I was playing this game called Cube World not too long ago, and enjoying the hell out of myself (if you haven't tried it, you should - it's fun!) when I was hit with the (apparently irresistible) urge to make something out of voxels.  Voxels are really hot right now (wear oven mitts), thanks largely to Notch and Minecraft.  Of course, there are several other voxel related games out there (EQ Next anyone?), and there's the whole argument about whether some of them are really using voxels at all.  But all that aside, the Infiniminer/Minecraft/etc style block engine is really popular now for what I see as primarily one reason - freedom.  There are several forms this freedom comes in, and two main ways it expresses itself:

  1. Player Freedom
    This is what allows the player to build and destroy live in these games, altering the world to a degree that's more or less unprecedented prior to this.  This alone is powerful enough that there is an entire genre of games with this as their central feature.  Minecraft is a solid example of this.  Minecraft became wildly popular as a game before its feature set really included anything else.
  2. Developer Freedom
    The other expression of freedom is on the developer side.  Due to several of their basic characteristics, voxel/cube-based games lend themselves quite well to procedurally generated content.  This is of particular benefit to smaller studios that might not have the manpower to put out a lot of handcrafted content.  A solid world generation algorithm can let them focus on interesting gameplay and new features, rather than the hundredth QA run through the game's intro level.
So what do you do with all this freedom?

I don't know what you do with it... but I'm doing this.

More coming soon.