Monday, December 26, 2011

First Implementation

For this first implementation loop I started with the map setup and control of the ship. I'm using temporary assets here for the sake of quick iteration. The ship comes from a FreshEngine PSP sample I did a while back.


I'm testing first on a city setting, simply because it is modular by nature and will help me defining the game constraints. I choose to use a 1 unit for a bloc of the city. So I can quickly and easily build large cities. I built 2 buildings blocs and one ground bloc in Maya and then exported them as static objects.

In Tiled, I created a test map using small 64x64 pixels icons for each of the tile. I export the map in the CSV format (Coma Separated Values).

I then wrote a small xml parser in lua to extract the values and generate the map in a lua table with each tile index.

At load time, I load the CSV file (a few kilobytes), generate the table and simply instanciate my static objects depending on the index in the table, and voila the map is generated in a few miliseconds.


My first implementation of the ship control was in Lua so I could validate the functionnality. Now it's all in C++ and is much faster.

I'm using constraints to drive the ship so I can introduce some delay by simply changing the strength of the constraints on each axis. The camera is also constraint to the ship (using aim and position constraints).

Controling an object in camera space requires to take care of a few things.

In order to control the ship at even speed whatever the camera view, I need first to project the camera front vector onto the XZ plane otherwise the speed of the ship would vary depending on the camera pitch.

As my camera will not roll, I can take the camera Right vector as is.

Then I can modulate the stick vector by these projected camera vectors.

Next I need to check for the length of the vector not being greater than 1. It can happen when the stick is in diagonal because the diagonal is longer than each separate stick axis. If that's the case, I need to limit the length to 1.

To switch altitude, I simply change the altitude of the position constraint of the ship and the engine smoothly interpolates (weights inependently set on each axis) the ship position.

Here are some screenshot from the PSP version:
This is when flying at the upper altitude (1 unit). So the ship can fly above the buildings.

And now, when pressing the altitude switch button, it goes to the lowest level (.3 units):

Notice how the camera is now almost vertical to allow a better readout of the situation and enable the player to easily fly around the buildings.

I also change the camera field of view (FOV) so the view gets almost orthogonal when the ship is at the lowest altitude. This completely change the perception of the game and makes you fell more involved in this view. It will be useful when interacting with ground objects.

The shadow really helps to read the flying altitude. I don't have the shadow yet on the PC and PS3 versions since I need to write some Cg shaders first. On PSP the shadows is managed by the engine and doesn't require writing shaders since it's all fixed pipeline. I'll do that later.

Next post, shooting, collisions and bonuses.

Sunday, December 4, 2011

Story and Mechanics

As I'm planning to develop a personal specific universe for this game (as opposed to using the Zaxxon one) I need to develop a story around my game.

My story summary for now is the following:

'A week ago, invaders attacked the earth. Given their supperior technology, they defeated coalition forces in no time. They made all human prisonners, but one guy escaped. During his escape he found some special weapon. Now he wants to fight the aliens back and free earth from their hold.'

Let's first give a tentative name to the game (I need it for my project folder anyway). I need to convey the spirit of the game which I'd like to be somewhat tongue-in-cheek and kitch.

Key words I've assembled are: Invaders, aliens, revenge, aftermath, fight back, conflict, universe, galaxy, space, star, battlefield, earth, attack, freedom, mankind, unwelcomed, the clearout, species, roswell, area 51, armageddon.

Another important thing is to comme up with a name that is unique and has not been used anywhere else. Some google search will help, but generally the longer the name, typically with a subtitle, the least chance you have to get sued.

So I came up with this:

'Invasion Aftermath, Mankind's Revenge.'

Note this could be read as 'I'AM Revenge'.

Let's now talk a little about the game mecanics.

My planned process it to iterate around a prototype to remove risks and validate mecanics.

Here's my first process loop (essentially focussing around the 'toy'):

  • Is my control pleasant and intuitive?
  • Can the player easily understand the height of the ship?
  • Is it intuitive and easy to shoot static objectives on ground and in mid air?
  • Same for moving objectives?
  • I'm quite fluent with Lua, but can I implement and integrate custom functionnalities in C++ when I need higher performance ?
  • Do I have a fully functionnal and convenient pipeline for quickly building dozens of levels?
The first mecanics I'll implement are the ship control and the camera.

I'm a huge fan of SuperStardustHD (developped by Housemarque), and although my camera will be in perspective (as opposed to top-down in SDD) I do like the screen-space control scheme. It's a well acknowledged way of controling a character and it has been there since Mario64.

So to move the ship, you use Left analog stick. Relative to the screen.

That is something very different from Zaxxon, because here you'll be able to move in any direction on the XZ plane. This will allow for some specific gameplay patterns and could potentially allow for exploration mecanics. Great if the levels are potentially huge.

Also I need to control altitude change. In order to reduce complexity, I will assign a button to switch altitude. This way, I can avoid difficult situations where the ship would not be alligned with ennemies or item height. So we have two heights, low and high. I will then be able to design ennemies/traps..etc specifically for each height, and some might also be able to change height just like the player.

As the camera will always look pretty much toward the same direction, I do not plan to give control over the camera. It will be essentially automatic. I need however to give enough room around the ship in order to ensure sufficient visibility for the player. In other word, the camera will be quite distant.

That means I'll need some close-ups during cinematics or whatever, to create some binding between the ship/main character and the player. I think it's important for player 'involvement' and suspention of disbelief. I'll leave that for later, as I focus now on the core mecanics.

Allright, next post first control implementation and screenshots!