About a month ago I finished implementing the core framework for the game engine. My goal for this month was to create a small demo which would showcase what the engine can do and most importantly, to find code bugs in the engine. I have to admit; I found more bugs than I would have liked. However, I was able to fix 90% of them.
While creating the demo, I took inspiration from these images:
I decided to create similar 3D models using Blender. I combined the scenery from each image and imported them in the engine as shown in the video below.
The demo is very simple. It starts off with the rocket bouncing up and down colliding with the ground. The camera is set to follow this bouncing movement. As I press the button, the rocket starts flying upwards until it collides with several asteroids. After each collision, the rocket & asteroid respond by moving in opposite directions. After several collisions, gravity takes over the rocket and forces it to come down to the ground. The rocket bounces several times with the ground as it collides.
More details about the engine
The purpose of this first demo was to showcase the physics engine, especially the Collision Detection System, Shadows, Individual material Rendering, Camera movement and Digital Asset Loader.
Digital Asset Loader
The engine can read 3D models created in Blender. To do so, I wrote a Python script which exports all the attributes of a 3D model to a file. The engine parses the data in this file and loads the attribute data into the GPU of the iOS device. As of now, the python script outputs the data to the terminal as is shown below.
Individual Material Rendering
I am not an artist, and I can't design beautiful hand-painted textures.
Moreover, I wanted to create a game engine that would render multiple materials colors and not need to attach a texture to a model (if I don't want to). So I made sure that the engine can render multiple materials per 3D models. For example, the engine renders the mountain with all three different materials (green, dark purple and white).
Having Shadows in the engine was a must. It took me a while to get it right, especially since I was forced to modify the camera and light space matrices (I had them backward in the beginning.) Shadowing is done using the Shadow Mapping technique.
Collision Detection System
By far, the most complicated part of a game engine. Developing a collision detection system takes a lot of time and a lot of redos. During this demo, I ended up modifying the Convex-Hull algorithm needed for collision detection. As you can see from the video, the engine can detect collision between any convex objects and it computes the correct collision response.
I'm going to develop more demos with the sole purpose to find more code bugs. This is going to be my focus until the end of the year. I hope that by the end of December I have decent beta version.