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.

Monday, September 7, 2009

Introducing Alphaner

Hi! I've started to write a FPS. Hoping it will evolve nicely, I've decided to blog a bit about its development. The code is in a very early state and there is no artwork yet. Also it had no name until now. As the titles of this newly created blog and very first post suggest, the name of the project is Alphaner. ('Alpha' just means 'initial' and 'ner' are the three last letters of 'container'. Containers are kind of glorified crates, and crates are so commonplaces in FPS games... In fact, what would be a FPS without crates?)

In the coming days I will post a few screenshots I've done as I wrote the present code. I want to make that code more flexible (to make things easier later on for me) so I've a bit of work without visible progress to do. And I have to complete the build process to produce binaries for distribution. At this stage, I don't plan to open source the code. This is something I keep wondering about and the conservative answer is to not open the code, until I change my mind. Nevertheless, I will probably publish the code of some tools if the need arises to write them.

If you wonder how this game is written: I use C, Haskell, OpenGL and GLSL. I also use Cairo for the 2D overlay. (And if you wonder why C and not C++: I intend to use C for the low-level part and Haskell for the rest and it is simpler to write bindings against C than against C++.) I will (or at least try to) produce 3D artwork with Blender. I use Linux but Windows binaries are planned.