Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Potential Visibility Set

Author
Message
tomjscott
18
Years of Service
User Offline
Joined: 18th Aug 2005
Location:
Posted: 21st Dec 2005 18:36
How does PVS work in Dark Game? I searched the documentation and it only mentions it in the Introduction section that says it is a feature of the engine. If I have a terrain and populate it with hundreds of trees, rocks, and shrubs, will Dark Game manage it so that my frame rate doesn't grind to a halt? Also, is there a way to set a visibility range for objects so that only closer objects are visible?
Sephnroth
21
Years of Service
User Offline
Joined: 10th Oct 2002
Location: United Kingdom
Posted: 21st Dec 2005 22:35
I wasnt aware there was any portal system in the db engine EXCEPT when dealing with BSP, they are obviously bsp portals and bsp isnt very good

If you fill a terrain with lots of objects it will surely grind, you will have to look after this type of thing yourself. You can indeed set the max draw range of the camera using

dbSetCameraRange ( float fNear, float fFar )

Near being the minium distance to draw and far being the furthest. 1 is the default minium, I recommend keeping that as 1. 3000 you can set to whatever you like, as far as im aware it works in db units - play for a good result.

However, unless you create your levels with your max draw distance in mind (lots of corners, turns, etc) then you will see a nasty "edge" of the world thing going on. One way to combat this is to enable fogging (dbFogOn()), setting the fogging distance to say 5 units smaller than the camera range (dbFogDistance(fDistance)) and colouring the fog the same colour as the backdrop (dbFogColor(iCol)). This creates a nice smoothing between the fog and the backdrop and is much easier on the eyes than just a sudden edge of the world. I find it doesnt work too well if the fog isnt the same colour as the backdrop though, you can colour the backdrop with dbColorBackdrop() - note I can never remember wether dgsdk uses the word Color or Colour so if one command doesnt work try the other version of the word

Again, however, if you are intending to put in lots of things like grass etc then chances are you want a different draw distance on the grass/trees than you do the actual world - thats how it works in most games I see.

What you want to do there is create some sort of handler (function or class) to look after vegitation. When you add a peice of grass to the world have it add the object id of that grass to an array which holds all the info about it. Then write a function called something like CalculateVegitation() or something which takes the player position and calculates which vegitiation should be shown or hidden.

you will want to run through all the grass etc using a for loop and do a few checks. On the simplest of levels the first thing you want to do is check if its even on screen - you can use dbObjectInScreen(object_id) to see if it is. If it isnt then its behind you or something and you can happily call dbHideObject() on it to get some of your FPS back. The 2nd check I would do is a distance check. You want to decide the maxium distance you will draw vegitation in, turn it into a constant like MAX_GRASS_DRAW or something. Then use a distance check like this:



to check if the distance between the vegitations position and the player's is within the limit - if so then show the object, if not then hide it. This will get you alot of speed.

Note - i included my fsqrt function for the distance check which performs a much faster square root operation making the distance check less intensive - however it may still be faster to use vecter maths - I never have and havnt researched it but its something im going to have to do in the future

Par from that it all depends on your game what other types of optimisations you want to make. Maybe you could make a MAX_VEG constant so you only draw a maxium amount of vegitation regardless of how close to you it all is, I dunno.

Hope all that helps

tomjscott
18
Years of Service
User Offline
Joined: 18th Aug 2005
Location:
Posted: 21st Dec 2005 23:12
Thanks for all the information. Although I only needed to know if it did these things for me or not. I have code of my own to manage the culling, range checking, etc. I was hoping that I wouldn't have to integrate it though. It would have been nice if Dark Game had these features built-in as most robust game engines do.
Smithy
19
Years of Service
User Offline
Joined: 8th Dec 2004
Location: Switzerland
Posted: 22nd Dec 2005 09:22 Edited at: 22nd Dec 2005 09:25
The description of the engine clearly says that it has:
-Potential Visibility Set (PVS)
-Nodetree Optimisation

Also, IIRC inside the header files of the Basic3D commands, you'll find commands for portals:
dbSetStaticPortalsOn/Off, dbBuildStaticPortals;

I am helpless, I would like to know if those things are done autom. or only with BSP's.

Generally, I would really like to see a doc that explains how the engine/rendering works. (so we can optimise our codes to fit the rendering process etc)

Any chance for help/doc?

//Awards: Best DM at NeverwinterConventionIII (NWCon3)
//Sys: Pentium IV 3200E/Prescott;800Mhz FSB;HT;WinXPPro;ATIR9700PRO;1024MB RAM(2x512MB"DualChanneled";VC++7.net;Delphi6;ADSL512;

Login to post a reply

Server time is: 2024-05-06 21:48:28
Your offset time is: 2024-05-06 21:48:28