I'm in the process of teaching myself game development, and I'm trying to learn 3D, and started on a basic 3D game. The actual problem I've encountered is with level design, I'm using cubes all over the world to define the levels.
This is how my level file is like.
# P stands for Player # F stands for Floor # N stands for Cone pointing North # E stands for Cone pointing East # W stands for Cone pointing West # S stands for Cone pointing South # G stands for goal sphere # The initial direction of the camera !NORTH # The message rendered on each level @Use WASD keys to move Blox @Use SPACE key to jump FFF FFFFF G FFFFFFF FFF FFF FFF FFF F FFF FFF FFF FFF FFFPFFF FFFFF
This works, and I can render my game, but the problem is it lags on low power machines. When using individual cubes, I have 17 vertices per each one. I'm rendering the meshes through
GL_TRIANGLE_STRIP. This is how the level is in the game.
And what I want to do, is instead of designing the level one cube at a time, I want to combine multiple small cubes into some large cubes, making the level look like this instead.
And next, I designed the sphere (it's the goal in the game) in Blender and it reports that there are 1984 vertices in that model, which I'm loading into my game via OBJ format. I'm using mesh to mesh collisions in the game (that too as a learning experience) and this game as it is now is lagging by 10-15 FPS on my 3 year old laptop which can play GTA IV at a good frame rates.
So I clearly know I'm going in a wrong direction, but I'm not sure how to implement this in a correct way. This is the information that I got on my desktop and my laptop respectively.
On my desktop:
My desktop is a gaming PC, with an i7-4790k running at 4 GHz and a GTX 750 Ti GPU and 16 GB DDR3 RAM. It runs my game at 60 logic cycles per minute and 30 render cycles per minute. The task manager is saying that my application is using 17% of the CPU and 96 MB of memory.
On my laptop:
My laptop is a Lenovo G400s, with an i5, GT 720M GPU and 4 GB of ram. It runs my game at 60 logic cycles per minute and 25 render cycles per minute. The task manager is saying that my application is using 82% of the CPU and 92 MB of memory.
After looking at the data above, I'm very sure that the issue is in the level design, but I also wonder how large cube world games such as MineCraft keep to manage such high FPS?
What are the other areas I should look into to improve this performance? Any tips are very much appreciated.
Thanks in advance.