Wednesday, 18 July 2012

(Game Dev) How a simple room looks like

The basic idea of the rooms is simple: We have a prefab that contains the floor, top, walls and the walls with doorway. Everything is placed precisely, so the connection between rooms are seamless (tested, worked). If my generator founds out there is no neighbor at the south side, it will disable the southern doorway game object in Unity and it will enable the southern wall object.

All of these walls and other miscellaneous room elements has to be light mapped. The reason is simple. There is no runtime lightmap generation so we have to pre-calculate lightmaps as always. Real-time only lighting should be very expensive for an older computer. We have to do this on the walls with doorway and on the simple walls even if we don't render them. (We don't know, when the program has to render the wall or door, and when it doesn't have to.)

The pictures below show the most basic room setup. Textures are not final, they're for testing only.

Basic room model for dungeon
Basic room with 2 doors. Check out the layers on the right. left and upper walls are hidden, while left and upper doorways are shown. This is, what the program exactly does, based on a simple algorithm.

Room model layers in 3ds max
Layers in 3ds max. Different elements are in different layers for easier editing and viewing.

Room model picture with object list
The very basic room with all the meshes rendered in 3ds max. You can see both walls and walls with the doorways at the same position.