Sunday, April 22, 2012

PSP Jeep

Today, a post that has nothing to do with my game project.

Untapped potential

This small Jeep project is an exercise that I give to my second grade students @ HEAJ (Video Games Group).

The project makes use of various techniques in order to achieve the best possible rendering of a CJ-7 Jeep on the PSP using FreshEngine. A second exercise will come later where this jeep is placed inside a small game level designed and created for this purpose.

In a way, I think exercises like these also demonstrate how there is always untapped potential in a platform. That unfortunately is a reality of gaming hardware, they become obsolete before being pushed to their limit.

Actually, I think there's no limit but the imagination. Look at some of the latest C64 demos (from Booze Design for instance) and how new creative techniques can make this 30 years old machine do things that we though would never be possible.

So enough talk, here's a small video of the result of my small PSP Jeep project:

Making the PSP Jeep

One of the constraint was to make it fully functional for later use in an actual map. So movable parts had to be setup correctly and animation-ready.

Also I asked for the engine to be modeled so that if we crash the jeep into an obstacle, the hood could be opened and the engine revealed. The bottom of the jeep also had to be rendered realistically. All had to be done within a 4500 triangle budget with as few UV splits as possible.

On PSP, achieving nice environment reflections for the car paint and mirrors is challenging. One of the reason being that there is no real reflection mapping available in the hardware gpu. Instead it is capable of computing UV coordinates based on the result of lighting computations (shade mapping). So playing with bended normals and attaching shading lights to the camera can do the trick.

With this exercise, I explain to the students how to use multiple pass texturing with a custom blending equation to combine the environment texture with the color texture using the alpha channel of the same texture as a reflection mask:


The constraints for the two textures were as follow:

64x64 texels texture for environment, 512x512 texels texture for Jeep with alpha channel used as reflectivity mask for envmap. Both textures quantized to 8bits/texel.

I could have ask to split the jeep into color matching parts and assign each part to a 4 bits texture (16 colors) for the most aggressive optimization, but I thought it would be too much for them to handle. So I went for a single atlas texture with all the parts together and 8 bit quantization (256 colors). That's more in line with current texture compression techniques (like DXT1) where there is no global color constraint and you usually go for a single atlas. I might split and optimize my texture at some point to get the most out of the bandwidth and cache hits.

Anyways, here's what was asked:

Env map (here zoomed 2x):

Texture color channel:

Texture alpha channel:

Of course all has to be rendered @ 60 frames per second. Again, YouTube doesn't do justice to the smoothness of the animation. Also, it has been grabbed in interlaced mode because my grabbing hardware doesn't support 480p, so the actual quality is much higher than the one in the video.

I added some full-screen AA and bloom to make it shine. There's a fixed cost for these effects and the jeep in itself doesn't cost as much as what can be seen in the video (rather around 5 ms in close-up). Thus AA and bloom cost won't be added twice when I'll place the jeep in the level. I've got plenty of headroom for a nice environment @ 60 FPS.

Right now the animation is procedural. At some point, I'd like to set it up with dynamics so I can drive inside the map. That'll be for later if I can spend some time on it.

Software used: Maya, 3dCoat, Lua, FreshEngine PSP.

Hope you enjoyed it. As always, feel free to comment.

Thursday, April 12, 2012

First WIP video !


As can be seen in the Tiled screenshot in my previous post, some new aliens were placed in the maps, ready to be implemented. I made these to guard some areas where I'll be able to place more objectives later on. So I called those Sentinels.

So the idea is to have them move around, as if they were guarding the area. When the player enters the area, they turn on some laser, pivot toward the player and start tracking him down. Then their reaction is based on that laser sighting that triggers a blast when the player crosses the laser.

I needed to have the laser to follow walls so the player could hide behind a wall and not being touch by the laser. I use a ray that is casts against the environment and allows me to compute a scale factor for the laser mesh so that it scales to the exact distance to the wall. Here's my Sentinel setup:

The lower collision sphere is used for the Sentinel navigation (collision with the environment) while the upper sphere is a trigger that is used when the Sentinel is being shot at. There's also a cylinder trigger inside the laser mesh.

Video, yay !

I thought it would be nice for you to see the thing actually running (at last), so here it goes ! This first video has been grabbed on PC (using FRAPS). You can see the latest enhancements added to the project, mainly the shadows now integrated on PC as well. This helps a lot in feeling the height of objects. This also includes a quick Cg shader that I wrote to display basic textures and lighting, just for the sake of testing.

The game (and the video) is actually running at 60 Hz but YouTube is unfortunately unable to handle that for now. Please watch the video in 720p.

Hope you enjoyed this post, feel free to comment.

Sunday, April 8, 2012

The second coming

So long dear PSP.

After testing a new control scheme, I finally decided to stop support the PSP for my game and fully embrace twin stick control. It makes shooting at things a lot more precise and controllable and removes any of the previous frustration. It's a lot more fun to shoot stuff around.

My current controller layout is as follow:

Left stick -> move ship in screen space
Left shoulder -> switch altitude plane

Right stick -> shooting direction
Right shoulder -> intended to be used for weapon change, not yet implemented

So basically, movement control on the left side and weaponry on the right side. Sounds simple enough.

Note that I do not plan to use secondary shoulder buttons as these do not exist on the VITA, and I want my controls to be as universal as possible. So I'll use the common denominator of all current (and hopefully future) platforms.

Ditching the PSP incidentally makes life much simpler in term of development because the PSP was in my pipeline the only console to not support programmable shaders, and it was also a lot less powerful than the newer platforms cpu-wise.

I will now have to write a basic Cg shader that will be used during my early development stage and replace the old fixed-pipeline shaders with this one. Remember, the eye candy will come later, so will the fancy shaders :)

I have to say it saddens me to stop making this game on the PSP, it's such a great little platform. I will keep working on the PSP for teaching at the school though. I will post soon some of the latest stuff I've done on it, mostly for fun.

Level building improvement

As I said in my previous post, the only thing missing for a flexible level building pipeline was to support layers in Tiled, that's done now. I also support various tile sizes (through support of different tilesets) so now I can add large pieces to my environment. This will be useful for creating huge natural environment (Canyon, mountains... you name it).

You can see I can now superimpose objects to the ground elements, which allows for many combination. For instance the new fire element can be placed either on small or large ground tiles.

Second loop: Mid-term gameplay

Now that the the Toy is working just fine, I need to start thinking about the player's mid-term objectives. This will be the main theme of my second loop:

  • Develop others and more rich enemy behaviors so that the player can use his skills at controlling the ship, and use the environment elements to his advantage
  • Create mid-term objectives, such as saving humans or collecting special items
  • Implement success and failure conditions to develop a real sense of accomplishment
  • Implement 'story' mode with level dependence and progress through a series of levels
  • Develop new dynamic environment elements such as doors
  • Manage level boundaries
  • Integrate difficulty levels

Oh, and next post, I'll try to have some video of the game up and running. Thanks for reading and happy Easter.