Today I begin logging the development of my entry for the TIGSource Assemble Compo Part 2. I don’t have a name for the game yet but it is going to be a first-person 3D dungeon crawler inspired by classic games like Eye of the Beholder and Lands of Lore. I plan to code it in C++ using the SDL, OpenGL and LUA libraries. With some luck I should be able to finish it by the deadline.
Development started today using a simple game template/engine I created for my game projects. The first step was to render a first-person dungeon view like the ones used on the games cited before. After some experimenting, I chose to position the camera one tile behind the position of the player using a field of view of 45 degrees. Using those settings, the player can see if there is a wall to his left or right and he also can see a part of the tile he is currently standing on. To avoid doing camera position adjustments as the player moves, the player and the camera are positioned around the origin of the coordinate system and the world is translated and/or rotated according to the player actions.
At the moment, the dungeon level is represented by a multidimensional array of tiles. The first-person renderings are generated by traversing this array checking for non-wall tiles and rendering the adjacent walls for those tiles.
On the next step I spent some time hunting for some textures on the entries for the Assemblee Part 1. As there are not a lot of high resolution textures, I chose to use 16×16 textures for walls, floor and ceiling. In the end I managed to find good textures for 7 different dungeon settings.
Those textured-mapped walls are looking nice but generally dungeons are dark and not all lighted up like that. So I started fiddling around with the OpenGL lighting capabilities and managed to achieve a darker look. Basically, I created a non-directional light with ambient and diffuse components and adjusted the linear and quadratic attenuation factors. The light is also positioned at the same position of the player so I don’t need to keep it moving as the player moves.
The next steps were simpler and consisted on rendering the dungeon floor and ceiling and modifying the code to support the different dungeon settings.(dungeons with different textures, dungeons that have no ceiling, dungeons with higher walls, etc.)
Finally, I added some interaction to the game by allowing the player to move around the dungeon. As I said before, moving around the dungeon is as simple as verifying if the destination position is not a wall and translating/rotating the world to reflect the player movement. So I end this first log with a short video showing the player moving around a dungeon.