Wednesday, October 5, 2011

58 – 3D Week 2 in review

Wow! I have been working on the 3D engine for two weeks now. 

Let’s start with performance. It is OK. But there are still a lot of things to add to the engine, and when you add things performance will drop. There is no way around it. So I improved current performance: I get an extra 10 to 50 FPS on the same scene after this change. 

Mesh generation is divided into two kinds: meshes that have different LOD levels and ones that have only one. Stone tiles have only one, so in consequence meshes formed by stone blocks are now only generated when you change levels. The other type is updated as needed on camera movement. 

This caused some extra strain on the CPU since we generate larger areas less frequently. So now sections cache some parts of them that remain consistent between level changes and it is fairly smooth now but it will never work perfectly smooth with huge level gaps. This did not work in 2D so it won’t work in 3D where there is more work. But this is a small problem in extreme cases. 

Taking this opportunity I rewrote the basic terrain mesh generator to a shorter and considerably more elegant solution. I did lose the ability to have different grass levels, but this is only temporary. Multiple grass levels were cosmetic anyway. The important thing is that the new generator is great. 

I also tried to increase general visual quality and also create some contrast. Even though floors and walls made out of the same materials should look the same, I use different textures with the same color to give better contrast to the scene and wall borders have different color than floor borders: 

What do you think? Is it easier to tell what is going on? I wonder how I can better increase the contrast and clarity. Can it be done by texture work alone? 

So terrain generation is done for now. For next week I’ll merge the 3D engine package with the DwarvesH package to finalize the 3D transition. 

I’ll leave you with this sample of random starting locations:


  1. Sweet! Now just some gameplay videos :P

  2. Just shut up and take my money already!

  3. You could try to introduce fog to improve contrast. With OpenGL (are you using it?) it should be fairly easy to include and could be combined with the darkening feature. Also with textures, have you tried to put multiple textures into one texture, let's say for grass? This way you could reduce the texture setups/swaps.

  4. That's a really good improvement. Before that I did struggle to see what layer was what in your videos. That makes it so much easier!

    I think you can make it even more distinguishable with some light and shadow to bring out the depth.

  5. To Anonymous:

    I am using Irrlicht which abstracts away the underlying 3D platform and I can switch between OpenGL, DirectX and software rendering. I am mainly developing with DirectX in mind because OpenGL has never worked for me and probably never will, but on the right computer OpenGL should work acceptably. So maybe I can release a Linux version too someday.

    I though about fog for hiding distant landscape. I don't know how you could use fog to increase contrast? Add more fog the lower the level is from your current one?

    And I don't know how to add multiple textures to the same mesh. Any hint is appreciated, even if it is for OpenGL.

    To BrewStew:

    Thanks! I had the same problem before and I am starting to be happy with the new renderer. I will continuously improve quality at a slow pace, but right now I'm focusing on picking up where I left of before the 3D port.

    I need to learn to do lighting and shadows before I can try it, but I really do want shadows and variable light conditions in tunnels so sometimes dwarves need to carry a source of light. Dwarves and demons have low light vision, but I want some cases where this will not be enough. Don't forget that I do not know too much about 3D. This is the first time I am truly using it and this is the most advanced 3D engine I have ever created :).

  6. Much nicer. It's far easier to tell what's going on. Where did you get the music for your second video?

  7. r u going to do rivers,water bodies?

  8. To Bryan:

    It is called Wallpaper by Kevin MacLeod, from 2011.

  9. To Anonymous:

    Sure, in a future version.