Monday, December 15, 2014

Engineering II - Final Project - "Just Keep Swimming"

Engineering II - Final Project - "Just Keep Swimming"


ZIP LINK

JustKeepSwimming.zip

Write-Up
Overall Game - "Just Keep Swimming"

The game is downloadable above in ZIP form. Extract it and run the executable. You can alter the screen size and resolution using the settings.ini file.

The final content for the project is a 3rd person "runner", in the form of a humanoid fish character swimming to infinity, dodging items in the world. If you collide with any item, except for the orange pyramid, you take damage and the screen goes red. If you take too much damage, the screen goes black.

If you collide with the orange pyramid you increase your score in the top-right corner of the screen. I didn't include a win condition, but the idea would be to reach a certain number of points, and then you win.

If the screen goes black, press Alt+F4 to close the window. Double click on the executable file to re-run the game.

The game is to emulate the games Gradius and Vinyl.

Technical Write-Up
Game Controls and Restrictions

Use the arrow keys (Up, Down, Left, Right) to move the character about the screen. The character cannot speed up or slow down. Press the "M" key to stop being invincible and then you are capable of taking damage. You will see the change by the change of the fish humanoid's material from orange to a bluish color.

The camera is static, because I didn't want to add matrix rotations into the engine. The entities in the scene, besides the fish humanoid, are actually moving towards the screen, while the fish character is static. These entities are moved to a positive Z position in the distance when the pass behind the camera.

The image below shows the fish character in-game while still being invincible:



Fish Man Mesh
The mesh was created in Maya, and was my first attempt at an organic looking humanoid character. I added a scales material to the model. The model's head and neck, as well as the arms and shoulders, had to be altered to get the humanoid character to be in a horizontal swimming position.

I have included an image from Maya of the original model, and the altered model:



Don't look too close at the second image, as the neck of the fish humanoid may be slightly broken.

Mesh Pointers
The meshes in the game were stored as pointers for the entities in the game, and allows the meshes to be shared, or altered on the fly. The game uses the multiple meshes to be duplicated on different entities.

The additional meshes used are shown below:


The meshes included a cube, sphere, pyramid, cylinder, plane, and a sphere with inverted normals as a sky-dome.

The sky-sphere created a simple boundary for the world, visually, rather than altering the far plane value until it looked decent.

Material Pointers
The materials in the game were stored as pointers for the entities in the game, and allows them to be shared, or altered on the fly. The game uses the multiple materials to be duplicated on different entities. In the first image you will see the orange material, blue material, sand material, and two different water materials on the planes.

The materials used on the ceiling and floor planes have their UVs altered on the fly, to further the effect that the character is moving forward.

Debug Lines
I implemented the use of Debug Lines to allow simple view of objects in the world. I primarily used this for the fish humanoid, so I could find the appropriate screen boundaries for character placement.

The image below shows the red debug line I placed on the character:



To activate the debug lines press the "P" key to toggle it.

Collision Detection
For simple implementation with my current code, I used a simple spherical collision for the fish humanoid with all other objects in the scene.

Game UI
I added the name of the game in the top-left corner, and the score in the top-right corner. This can be seen in the first image of this technical write-up.

I also added the "Blood UI", which is for when the character takes damage, and the ambient and directional lighting have red value added to them.

The image below shows this effect:


Shader Water Effect
I added a water shader effect to the in-game, affecting all 3D objects in the scene, not the UI or sprite elements. You will notice that the lighting on the character appears to be changing from front to back and left to right. The initial idea was to sample a gray-scale texture of the surface water material and alter the gray-scale of the colors of the objects in the world by that value.

I wasn't able to add another sampler to the shader, because the compiler kept removing it. I was able to side-step this by using the existing sampler and altering the 3D lighting effects with each objects own material. It achieved a similar effect to what I wanted, and it looks pretty good.

Realized Learning Moments
The sampler issue described for the shader was the biggest issue I had while working on this. It was interesting to hear the comments from others suggesting that "The entire image is faked in some way, so the fact that it uses it's own material, is fine."

That was an interesting learning moment.

I will still be working on altering my existing game engine to further work with the existing rendering content I developed. I don't personally have an interest in learning more complicated lighting, like specular lighting, or ambient occlusion, but I really enjoyed creating the water shader effect. I may look into more shader effects in the future.

Time Used

Reading: 0.5 hours

Write-Up: 0.5 hours
Technical Write-Up: 2.0 hours
Coding: 9 hours

No comments:

Post a Comment