91
DF General Discussion / Re: 3Dwarf beautification project
« on: October 12, 2008, 12:32:05 pm »How to put this ... I'm pretty much doing all of that already. ^^Apologies
You can check a post from me on that topic here: http://forums.somethingawful.com/showthread.php?threadid=2917631&userid=125080&perpage=40&pagenumber=2#post350470768
Summary: I was completely off-base and apparently trying to for-loop through 15000 items per render call is a tad too much. I'm not exactly sure what i can do about that yet. Maybe it's the fact that on each loop instance it instances a new copy of the array index, but in the end i'll figure something out.
Also, VBOs scare me. Working in Perl i can't use ANY c++ examples, since the syntax is slightly different and the variable typing radically so. Aside from that i've also been unable to find a simple enough example to go in and experiment with, since all examples seem to be "let's draw this uber-complex shit with VBOs", instead of "how do i draw a single triangle with VBOs?".
Display lists are nice and easy. They have begin, end, a number, and that's it.
I suspect using VBOs would still give you some advantage but as you say they may be more difficult to use from Perl. One thing to consider using display lists is that I believe they are optimized more efficiently by the driver (ie straight to VBOs) when they contain only geometry calls (no state changes). This might be something to try.As for the objects, I can think of one or two methods to reduce your overhead that should be simpler than normal frustum culling etc., although I'm basing this on a guess that they are stored similarly to constructions. If this is the case then they are ordered by tile coords (z then x then y if i remember correctly). This immediately allows you to skip multiple items in a single tile, since they will all be consecutive. As you also know which tiles are visible you should also be able to limit drawing to visible objects, especially by z level culling. To avoid iterating through the whole list to find certain coords I would suggest using a binary search, which is what Toady uses in DF.
As you can tell, I have an interest in the subject but I'm just trying to help so please don't take offense if I'm telling you stuff you already know
At some point I'll have a look at the code and see if I can help but not knowing Perl is a bit of a hinderance there.Edit: And if it helps, here is my (limited) knowledge of the construction/building structure:
offset, length, field
0x0 WORD x-coord
0x2 WORD y-coord
0x4 WORD z-coord
0xC WORD stone matgloss index (ie. 192 = bauxite) of contruction material
I never got as far as working out how none-stone constructions worked.
;