Raycasting - 3D rendering engine

Running the project

I have focused my work on the raycasting engine, so the HUD is basic but offers all necessary options. The main menu is the one below, it can be launched at anytime by pressing the menu key of your device:
You can:
  • Select a map among the five available maps.
  • Enable or disable music and fx sounds and also define their volume.
  • Enable or disable textures for floor and ceil.

For this project only five maps are available, but it is possible to embed many maps because a map size is only about 8kb.

When the main menu is opened while a map is loaded, if you don't change the map number then your current position is kept (only the other options will be changed).

By clicking on the Controls button, from the main menu, you open the submenu that allows you to assign the hard key for each actions (use an item or open a door, run, turn left and turn right).

Simply select the action (the red circle indicates which action is currently selected) and press the hard key that you want it to be assigned to that action.

Why disable floor and ceil textures, why disable the music?

The music is rendered by an ARM callback routine that is a midi synthesizer, such an operation can consume over 30% of cpu time and so slow down the frame rate. The technique used for applying texture on floor and ceil uses a rotation matrix that needs four multiplications per pixel and thus also decreases the frame rate. So, I have decided to give options to make the application running on mid-range devices.

Playing with

Basically, you just have to assign hard keys and then load a map. You can move inside each map by using the keys and/or the stylus (which is only used for easily turning left or right).

Some details

I can't provide all the explanations about all codes. Both the HB++ code and the C code of the raycasting engine are quite long and hard but well commented. The HB++ code is mainly used for memory allocations and for loading the textures, maps, sounds and so on. For that project I have choosen to embed all these resources as binary resources within the project but it is possible to make them available as Palm OS databases (all provided classes can do that). Once the memory chunks are allocated and the resources are loaded, a timer event is periodically called and executes the raycasting ARM routine.

I will try to take time to write an article with more details.

Making your own maps

In the download section you will find a short documentation about the use of the map editor.