Tuesday, 16 October 2012

Bubble Shield

Shields are probably my most favorite part of Supreme Commander and other futuristic games.  They invoke a hidden part of my SciFi core which makes me very happy :)
An image I found at media.moddb.com.  It shows how well Supreme Commander rendered shields - transparent but  still has a shape and electromagnetic like properties.

I just got the "Bubble Shield" working the other week.  It took a huge overhaul of the way items work.  I implemented an "interceptor" style framework that works like this:
  • Interceptors will be called in a filter chain fashion (invoking each one in order and then returning back through the chain).
  • Interceptors will be collected in a list when an item is used from the actor (user of the item), board (the environment around the actor), and the target (the one to use the item on).
  • Typically interceptors will provide:
    • Actor: Time, Update on Use
    • Board: Line of Sight, Range Check, Console, Audio, Accuracy
    • Target: Damage Modifiers, Health
  • Interceptors can be injected or modified to add additional functionality for mods.
  • Interceptors usually modify an "invocation" object instead of the actual items or units.  This allows things like shields to reduce the damage before it is calculated in the target's health.  Cloning the item might also be another good approach.
1st implementation of a "Scottonian" Bubble Shield.

The basic factors for creating a shield can be narrowed down to:
  • cost per turn - The time units used while shield is active.
  • cost per activation - Time units used to activate the shield.
  • charge time - Time it take for the shield to become active.
  • activation time - How low the shield will remain active.
  • damage - How much damage the shield can absorb.
  • in/out probability - The probability of damage to the item's wearer and how much accuracy is changed while the shield is active.
For now, the "Scottonian" bubble shield behaves as follows:
  • cost per activation = 5
  • charge time = 2
  • activation time =  4
  • damage = 2
The shield is a damage modifier, so damage is first subtracted from the shield and the remainder is passed to the target.

The Game

In a previous post I alluded to a game I was working on but didn't talk about the game itself.  I'll slowly be describing it over several posts.  It is meant to be a multiplayer, squad, tactical, turn-based game.  It has fog-of-war, usable items, vehicles, cloning of units, multiple worlds, A.I., and many fun objectives.

The theme of the game is currently using Stargate SG-1.  It isn't public yet, so I didn't see any harm in making the engine fun and engaging while it is still in the very early stages.  In the picture, you can see the controls on top, a friendly unit on the left and a Jaffa on the right.  The dark colored tiles indicate the fog-of-war.  The map is a Goa'uld ship.
Objectives
I've decided to start with some simple core objectives:
  • Versus - Standard team games that are scored on kills and last man alive.
  • Horde mode - Wave after wave of enemies come at you until you can't take it anymore.
  • King of the Hill - Protect a specific location for a certain amount of time.
  • Location - Get some or all of your team members to the indicated location.
  • Mission - Units always start in a specific location and the objective depends on the mission.  A less procedurally generated objective, but gives a standardized test of skill for you and your friends.
Cloning Units
I think this feature is very interesting, but in no way unique because some games like Eve use the concept.  The principle is that players build up experience and spends so much time on units - only to have them killed by a silly mistake.  Well, in X-COM these deaths could be avoided by saving the game, but this isn't interesting.  Some would even consider it cheating because it has no cost to the player, can be done as often as the player wants, and has no analog to real life.  Eve got around this by allowing the player to pay credits to "save" unit's memories and DNA as a "clone".  Basically, a save point that covers all the negative affects - if the player can afford it.

Time Units
The game currently uses time units to perform actions like moving or using an item.  The new XCOM game doesn't use these at all, but provides a subset of actions that can occur each turn, much like Flotilla.  I don't think division and subtraction is as hard as Firaxis thinks it is to strategy, but I will concede that it make these games more fun for the general player.  I've played the new XCOM game and I will stick with time units for now.

Maps
Maps are built in a "Map Builder" web application that is part of the main deployment.  Emily has been making a lot of the maps that I use today: Mother Ship, Arena, Medieval Planet, Longest, and SGC.  Maps are composed of a grid and each tile has "attributes" that add things like walls, spawn points, etc.