A tiny Engine

This started as a university project which I extended later.

scr6

The small engine generates terrains of different shape, size and surface texture, based on any bitmap files provided for it. The concept of the game is not really fancy. You try to find the best path to the target from the start point (both random and on 2 opposite edges of the terrain.) and try to beat your high score or compare to the best suggestion by the computer. Best path is defined as the one with minimum climbing in total.
Move path
Some characteristics of it:

  1. Programmed in C++. Though the multi-threaded functionality is basically pure C.
  2. Somehow Multi-platform. Same code compiles and runs on Windows and Linux (and theoretically on Mac but I haven’t tried it since early versions). This is achieved in part by (but not limited to) the use of the STL library.
  3. OpenGL-based and uses separate compiled shaders for various objects.
  4. Most things are defined in headers. This is not a full engine with editors and everything. But it is easily modifiable with little or no need of adjustment on the actual code.
  5. Different look by using a different bitmap[This is change of one line in the header. The terrain has quarter of the previous one’s polygons but everything for the looks and gameplay is adjusted by the program.]

  6. Light source and camera are movable (one might call it dynamic but I’d rather not use the term since the constraints I have put in place for their move.)
  7. camera and light

  8. For lighting, some of the normals are calculated automatically like in case of the generated terrain itself. But some objects use normal maps (textures).
  9. A* path-finding (built specifically for the purpose, not from a prefab library) to compare the user’s chosen path to the one used by the computer.
  10. Calculated path
    [The green area is the places checked by the A* algorithm. The Yellow area would have been the next candidates for the path if the optimal path (blue) was not already found.]

  11. Fairly satisfactory performance. The screenshots you see here have around 270,000 visible polygons in viewport and fps never drops below 30 on an old computer with a 1.7GHz CPU, although it uses a custom mesh class containing various std::vector structures to improve code readability.
  12. It uses a simple level of multi-threading. While the user is playing, the computer spends a second or 2 to calculate the best path behind the scene without a hiccup on the user experience.

You wanted to see my code so you are here!