The Lenzmaker Project


Lenzmaker Project is a Game Engine geared toward creating vast open game worlds with procedural content.

Platforms: Cross platform (Windows, Linux, Android – Working on it. ūüôā )

Written with: C/C++, OpenGL/GLSL, wxWidgets, DirectSound, OpenAL,  Python

Architectural pattern: Interface-based programming.

API Documentation:






The beginning

Somewhere around year 2007, I embarked the journey for a game project, the development plan included both game as well as the game engine.¬† Using a third party engine was not in my plan as¬†most of the commercial engines were not affordable for me during that time.¬† The free and the open source ones were good, since they are open source I had no idea when the authors of these frameworks discontinues their work.¬† Some of these Engines comes up with GPL license, integrating which may attract trouble at the time we bring it into the market as a commercial product.¬† Other than this legal stuff, what motivated me to write a game engine from the scratch is that the freedom it gives us to customize the source code according to the needs.¬† Almost all the commercial game engine’s are general purpose frameworks geared towards creating all genre¬†of games.¬† Having control over the whole thing let us specifically customize the required features at the fundamental level to create some stuff, possibly an out of the box stuff like Minecraft or No Man’s Sky.¬† But writing things from scratch seems hard, time consuming, still its a thrilling experience.¬† However, adopting a 3rd party engine is an ideal choice when there is a tight “Time to market” constraints.¬† During the development phase, there were many situations I felt like quitting.¬† Once I quit and completely disconnected from it. Later, there were some wake up calls, and it put myself back on track.¬† If you wish to know the development effort required for writing your own game engine, then have a look at these posts on Quora and get demotivated ūüôā

There are people exists on earth who is aware of hardships of climbing mount Everest, still they find joy in accomplishing it.

Experiments in MSDOS

The following is a screenshot from 3D Engine sample, created in MSDOS. It was created more than a decade back.¬† And it was the beginning of whole journey. It was written in Borland Turboc++ 3.0, using graphics.h header drawpoly, fillpoly functions :).¬† The projection algorithm used in this was derived using the Lensmaker’s formula.¬† This is how the project got its name.

You can find more details here.





Moving to Windows

Meanwhile, I switched to graphics programming in the Windows platform using Direct3D.¬†Sample Lowpoly game level¬†Started with writing a small 3D rendering library using Direct3D.¬† The initial version was a capable of loading and rendering 3D models from ASE(Ascii Scene Export) format.¬† Since the rendering API is Direct3D,¬† the library was almost glued to the Windows platform only.¬† Making it cross platform was not a big concern at that time because Linux based desktops/entertainment systems weren’t common as nowadays.¬† PCs were the most widely used systems by gamers. There were no Android and iPhones, no such bigger mobile market as on today.¬† But things have changed since Google entered the mainstream.¬† Nokia doomed.¬† Android emerged and penetrated the market.¬† The video game industry¬†gained momentum.¬† This made me to add OpenGL renderer to the engine since it is there in most of the Linux based systems including Android.¬† Porting to the Linux platform was done within the last couple of years.¬† Porting to Android platform using NDK is still pending.

The whole project consists of an Engine framework, sprite based font generator tool, command-line helper utility, some exporter addons for Blender and a level editor which I call the¬†Lenzmaker World Studio.¬† It was an addition I made in the last year as I badly felt the necessity of it.¬† Coding for game content creation wasn’t a great idea.¬† Though, the engine’s focus is on static/dynamic procedural content, the role of the Level Editor is to review and tweak whatever content generated¬†by the algorithms.¬† The development of the editor is still evolving as I keep updating it whenever I need a new feature.

Now I use this editor to create game levels by assembling the basic components such as the ground mesh, predefined set of scene geometries like trees, stones, rocks, grassfields and place them randomly in the scene.¬† Save it and load the level file into the game.¬† Place the characters at random places, setup its visual form by providing a static or animated skin mesh.¬† Setup colliders and¬† pluggable AI modules to drive the characters.¬† To work on characters and their behaviors, there is another tool I’ve created which I call a¬†Character Studio, and it is not documented here.

Bare Minimum World

The following demo video shows a basic workflow for creating a simple bare minimum game world.


What data does a Game World contain?

The game level has too many heterogeneous objects associated each other.  Scenegraphs are a hierarchy consisting of cameras, lights, meshes, sounds as well as their individual transformations in space. Every game character or a static object in the game uses a scene graph to represent its visual appearance.  There is another part of the game character which represents its physical volume characteristics.  This is used for collision detection and response calculations.  The navigation meshes marks the walk-able path for the player as well as NPCs.  NPCs AI use the navigation mesh in path finding calculations.  The World Layout View given in the left side shows the game level contents.  We can select and modify individual element properties.  Also we can export/extract individual elements into files and reload/reuse them somewhere else.

Engine features in brief

Below you can find the details about the engine features in brief. Some of these features are vast and deep and the explanation of which is beyond the scope of this post.¬† Also, many of these features still need improvements and I’m currently working on it.

Procedural Content Generation/Object instancing

Object instancing is widely used term in the procedural content generation.  This is used for randomizing generation of static geometry such as foliage, cityscapes, rock scapes..etc.  Also its being used for generating characters(enemy units) having the same traits.

Robust NPC life cycle management

There is an interesting analogy related with the character life cycle within the game world to that in the real world.  Conceptually life is created backstage and pushed to the world, symbolizing the miracle of birth.  After death, everything goes back to the source.  We can see this analogy in modeling the characters and its interactions with the world here.  Once the character enters the world, the system start rendering it, process its AI and other motor system activities. When its health drops to zero(due to damage by opposite powers), system shuts down its mind(AI processing) and slowly stops rendering and frees up the resources.

Serialization Pipeline

The engine is having a robust serialization pipeline in place. Every object can be easily flattened and sent through the wire.  There is an smart factory interface which can load and reconstruct the game objects back from the serialized data.  Load the data from anywhere, be it from local drive or from network.

Streaming Level Data

For larger game levels of bigger than system RAM size, the engine can be configured to load the levels with streaming enabled.¬† ¬†When streaming is enabled, the engine loads only the portion of the world that player currently sees.¬† ¬†As the player advances his movements, new contents are loaded and the old one’s are freed.¬† This maintains an optimal memory footprint during game play.¬† Also it reduces the initial loading time as the minimal things can be loaded first.

Skeletal Animation

Supports skeletal animations through ISkeletalMesh interface.

Checkpoints and Regions

We can insert named bookmark/checkpoints in the game map to quickly navigate to those locations.  Also regions (as spherical bounding volumes) enables to mark specific area within the map to trigger certain events within the game.  Eg, when a live unit enters the region, it notifies the enemy units to gather around that region.

Visual Debugging API

Visual debugging interfaces to draw shapes around spatial objects.

Materials & Shaders

Developers can customize the appearance of visual elements by tweaking its¬†material properties.¬† Every material has its physical surface characteristics identified by certain scalar parameters.¬† Also they include diffuse, bump map textures as well as shaders.¬† User’s can edit these shaders using the editor to customize/override the rendering output.


Collision detection and response

All the scene objects exposes bounding volume and support motion constraints.   When an object is linked to a motion constraint, its movement is controlled in space.   The constraint itself check and resolve collisions automatically.  Also we can attach colliders (specific geometric shapes such as line segment, ray, boxes, spheres) to test collisions with its surroundings.

Level of Detail(LOD) Control

Multiple resolutions of the same geometry can be set to a game object so that the rendering switches to the lower resolution meshes to reduce CPU/GPU load.

Hardware Abstraction

Provides hardware abstraction for filesystems, sound, high resolution timers and input devices.¬† The engine make use of the platform’s best services in the underlying layer to yield best performance.

Audio System

Support 3d Sound.  In the underlying layer, the engine uses DirectSound in Windows platform, and OpenAL in Linux.

Post Processing Filters

Can apply various image filtering¬†operations¬†such as color grading, bloom…etc to the final output.¬† This feature is currently under development.

In-Game Console Commands

There is an in-game console provided which can accept commands and modify the objects during the game play.  Provided for debugging/testing purpose.  The command shell interface provided in the API handles these commands in the underlying layer.  Game object that supports these command and control capability must implement ICommandHost interface and register themselves with the command shell.

In-Game GUI System

There is an in-game GUI system provided by the engine. There is no WYSWYG editors yet.

Lenzmaker Blender Extensions

As of now, Lenzmaker engine does not support creating or editing meshes from the scratch.¬† Had to depend upon 3rd party modeling packages to get things done.¬† Currently I use¬†Blender to create 3D models and import them to the game scene.¬† When I started this project, I’ve been using 3dsMax to create the models.¬† I discontinued Max because I found Blender more convenient to create exporter addons as scripting in Python is pretty straight forward.¬† In Max, we have to code it, compile/build and copy it to the plugin directory.¬† Debugging such a plugin was just another headache.¬† I Blender, I have written exporter addons as well as some helper menu’s to export and optimize the 3D models for the engine.¬† Activate/Enable these addons from Blender User Preferences window. The Lenzmaker¬†export menus will appear right under File->Export.







The .lmm(Lenzmaker Mesh) format contains a single mesh selected while exporting from Blender, with its world transformations discarded.  The .lms(Lenzmaker Scene) format contains the entire scene graph as a whole.  The exported scene graph consists of cameras, lights and meshes, Armatures(In case of skeletal animations), keyframes used in the scene.  Developers can import these scene graphs into the game, and manipulate individual elements.

Leave a reply

Your email address will not be published.

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>