Friday, September 30, 2011

LL3DLGLD – 10 – Slice 'Em Up!

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:

5 comments:

  1. That's REALLY impressive! Good Job!

    what fps were you getting without fraps? I notice you were in the 30's most of the time with it recording.

    I'm also curious to know your pc specs for comparison to my own.

    PS I was lucky to notice this blog post, you didn't tweet it to give me a nudge :P

    ReplyDelete
  2. forgot to mention. I'm quite profficient with Blender/GIMP so would be happy to oblige with the 3D models and textures. If you want an alpha tester too I'd be happy to help also.

    what sort of things do you need modelling? poly count? filetype? texture rez?

    ReplyDelete
  3. To BrewStew:

    The FPS can be seen in the first second of the video, around 170. Then it goes down to 60 and finally to 30. Without FRAPS I am getting anywhere from 80 to 200 FPS and in very spartan scenes 500+.

    But I wrote a new high(er) quality renderer today that dropped FPS quite a bit.

    I test on 3 machines right now with different specs, but since I am using only low level 3D (no lights, shadows, shaders), performance is almost identical. I guess a low end GPU can do almost as much low end work as a high end CPU, but not vice-versa.

    Because of the more special requirements of a 3D engine I will not get away without releasing at least a tech demo soon. Something that people can download, play around for a few minutes an tell me if it works for them. I can already tell that the engine does not work with OpenGL 1.4.0 and probably even older versions.

    I can load any mesh that Irrlicht can load, but right now I am not loading any meshes so I can't tell you which format I am going to use or what resolution. Too soon. Give it one more week at least.

    But in principle I am willing to try out anything you (or anybody else) may have to see how it looks and behaves.

    Thank you!

    PS: But I did tweet it...

    ReplyDelete
  4. I'll also be happy to throw in a few 3d still models for stuff like furniture, workshops, etc.

    I promise to put more effort into them than I did the engravings :-)

    ReplyDelete
  5. Hey, don't sweat it! Those engravings are still around, as part of one of the two third party mods available out of the box!

    http://dwarvesh.blogspot.com/2011/08/pre-alpha-3-day-17-more-stone-power.html

    ReplyDelete