Monday, September 14, 2009

First steps

In this post, I show a few screenshots. They will give you an idea of what's already done. That is not much and it doesn't look impressive but I'm quite happy: I think it's a good start for something that could be actually fun to play.



The first picture shows a (crude) scene, two cubes and a small triangle (on the top of one the cube). The color of the faces are given by their orientation. For instance, a face facing right is red. That's really not impressive, right? But from a technical point of view, this means I got the scene from Blender into my program. The scene is done in Blender then exported using the OBJ format. A small Haskell program is used to convert the OBJ data into C code, suitable for use with OpenGL (so the scene is hard-coded in the program at this stage).



The second picture shows the same scene. Just as before there is no texture but a GLSL shader is used to compute a very simple per-pixel lighting. This is the first time I write a shader so it is another small step.



This last picture would be more interesting in a video, or better given in a executable program. This is again the scene of the previous screenshots but slightly modified to add stairs and a slope. The camera is controlled like in most FPS: the mouse is used to look around and the WASD keys are used to move forward, backward, and strafe left and right. The camera is located in the center of a sphere for the collision-response algorithm. This makes possible to climb the stairs or the slope, and prevent going through the walls.

The collision-response is not very nice: climbing the stairs makes the camera move too much slower. Something already good is how the camera slides along the walls. If you're moving mostly parallel to the wall you'll go as fast as usual but if you move perpendicularly, you'll come to a halt.

The last interesting thing is invisible. It is the possibility to know which triangle is intersected by a ray fired by the camera through the center of the view, and what is the intersection point. This will become handy when weapons are introduced in the game.

No comments:

Post a Comment