I was pretty much decided not to post today. I had enough posts for this month, well over quota and I'll be out of town for the weekend. But I ended up recording a few videos, so I might as well get it out of my system
I implemented vertical level slicing. You couldn't really play if the world wouldn't be represented as if sliced at your current level, not even with 3D. To make things more manageable, the map cursor is bound to you current level. I really need to implement some visual aid that will guide you on how high up your cursor is when moving it in the air and not on a solid surface. Also, replacing the cursor with something else that is not a white box could help a lot I think.
Normally I would go into detail, giving some instructions on how to do slicing, but this topic is self explanatory, especially since I do not slice in the middle of a level. Even if I would, slicing is very simple since I am using a horizontal plane intersection as the slicing point.
Current level slicing is a fairly common feature found in a number of games. I also implemented a second slicing layer bellow the current level, which is always a fixed amount below the current one. This fixed amount can be changed with Page Up/Page Down, even though these keys would be better suited for level select. This second slice level is not that common and it has two uses: sometimes it can help with keeping you focused on a portion of the map, but the real reason is performance. If you don't have enough juice in your machine, decrease the distance between the planes.
I also smoothed out camera movement and except for an awkward disorientation after changing from top down/isometric to full 3D fly camera, I am fairly happy with it. Tree LOD needs to be adjusted a little.
I added a few statistics on the screen, as FPS, total number of triangles the scene is composed of and the number of triangles that actually get sent to the GPU. As said, currently the engine is not smart enough to cull the triangles that are behind the camera, so all the triangles of the scene are processed. Some are still culled automatically, but once I can exclude these triangles from the entire rendering process I expect a noticeable FPS increase. But FPS is good. FRAPS reduced it to 60 and then 30 in the video, but without it I can't really complain. When I get my hands on a weaker computer I can give you more info.
I also greatly improved stability. The 3D engine used to crash a lot. Now I had hours without a single crash. It used to crash due to something happening in the Irrlicht code and I think it is related to the reference counting memory manager from Irrlicht. Out of all the memory management schemes reference counting is probably the most stupid, and Irrlicht version is particularly poorly designed in my honest opinion as a professional. Reference counting at its best frees you of the burden of manual memory management. But with the scheme from Irrlicht, you exchange manual memory management for manual reference count babysitting. I want to keep this blog family friendly, but I am so close to showing Irrlicht a more interesting vocabulary choice in written form.
With these new changes, the engine is ready to tackle all shape related issues. The stuff I do with the shape (what stone is inside) is not fully implemented yet, but the engine can now handle any world of any shape and the code is ready for the next step: becoming a client of DHCore. DHCore is my semi general use game library specialized in this genre of games (which I want to make available in some form or another someday when I have the time; now I need to catch up on my schedule because of the unplanned 3D conversion). The 3D engine does not use DHCore yet, but DwarvesH (the game) and its editor use it. So once the 3D engine becomes a client of DHCore, all the functionality from DwarvesH should work out of the box with the new 3D engine. Theoretically. I have a feeling that it is going to need an intense QA period. Oh, and I need some 3D models.
Here is a video with the slicing mechanism in action. This will be the last video/content that does not use DHCore: