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.

DarkBASIC Professional Discussion / Test Results... Found a solution to object slowdown

Author
Message
Orgull
21
Years of Service
User Offline
Joined: 21st Oct 2002
Location: Canada
Posted: 24th Oct 2002 05:14
Hi! I tried a technique once with DB that didn't work, so I thought I try it with DBPro, and for a change, it works like a charm! You know how your framerate drops into the molasses range if you have too many objects in use at one time, even just a few hundred and everything turns into syrup. Well I had this idea that if you delete objects that are not in use, ie. well outside the current visual range, you could build a world with thousands of objects, but only show the relevant ones. Complex from a programming standpoint, but it does work around the problem of slowdown quite effectively.

The problem was, in DB, if you created a hundred objects, then deleted them and created a hundred more, etc. the system eventually ground to a 1fps halt. The technique was useless. But in DBPro, it works! Here are some test results...

I made a short test program in 1024x768x32 using cube objects textured with a 256x256 texture. (ash01.bmp from the original DB texture pack) I built a hundred textured cubes, placed them randomly in the world, and then moved the camera through them. (system stats: P4 1.3ghz/256 MB SDRAM@133mhz/GeForce4 MX420 w. 64 MB SDRAM) Here's my results, listed in FPS...

Program start: 209
All cubes in view: 140
Moving through cubes: 46-170

Then I realised I was an idiot and changed to SYNC ON and added a FAST SYNC to the end of my main loop...

Program start: 209
All cubes in view: 130
Moving through cubes: 88-341 (Holy cow!!!)

Then I built, textured and positioned 100 cubes, deleted them, and built 100 more...

Program start: 215
All cubes in view: 151
Moving through cubes: 99-341

For the final test I built 10,000 cubes, textured and placed, then deleted them one by one with the DELETE OBJECT command (took several minutes to run that) then I built 100 new cubes, textured and placed. Results...

Program start: 189
All cubes in view: 157
Moving through cubes: 110-341 (Great!!!)

Now that I know that building huge numbers of objects and deleting them doesn't affect performance in DBPro (it sure did in DB) I'm going to try writing an engine that only loads relevant objects (wish me luck) on-the-fly so to speak. If anyone else would like to experiment with this technique, please do, I think it might be an effective solution to the slowdown problem.

I apologize for the length of this post, but I wanted to give proof that this idea can work... and I hope to find solutions to problems rather than just complaining about them. Kudos to the DBPro team for making the DELETE OBJECT command work this time. I'm impressed. Ten thousand objects created and deleted with no effect on performance!!! This could really lead to something...

Megaman X
21
Years of Service
User Offline
Joined: 21st Oct 2002
Location: Sweden
Posted: 24th Oct 2002 05:22
Cool test Have u tryied to hide the objects instead of delete them?
Orgull
21
Years of Service
User Offline
Joined: 21st Oct 2002
Location: Canada
Posted: 24th Oct 2002 05:53
Yes... Hide has no effect if you build 10,000 cubes and hide them, DB still has to keep track of them... so, frozen molasses flowing uphill on Jupiter. Goo thinking though!
Lazzarus
21
Years of Service
User Offline
Joined: 19th Sep 2002
Location:
Posted: 24th Oct 2002 12:40
Have you tried it with anything more complicated than a cube? A model.x? Won't the speed of loading a object be a bit of a problem?

I hope you can get it to work as I've 500 objects (all needed) in the world I'm created which was fine until I turned the automatic collision on. Now I'm just east of the big red spot!!!

Freddix
AGK Developer
21
Years of Service
User Offline
Joined: 19th Sep 2002
Location: France
Posted: 24th Oct 2002 13:10
If you want you can accrue the power of your idea by making a progressive deleting and creaion.
each frame , youonly delete a maximum of 1 objet and create 1 .
Kohai of UWDesign
21
Years of Service
User Offline
Joined: 12th Sep 2002
Location: France
Posted: 24th Oct 2002 15:09
Just to let you know, but UnderWare 'Visible World' app is a system that handles this for you ...

To be released soon ... ( Beta testing has started )
exLRT
21
Years of Service
User Offline
Joined: 30th Aug 2002
Location: Belgium
Posted: 24th Oct 2002 15:31
This should be build in DB Pro (as it is supported by some cards like the GeForce4)

Ulric
ASUS A7M266 - AMD Athlon 1.4GHz - 512MB DDR266 - CreativeLabs GeForce4 Ti4600 - Windows XP Pro SP1
Reece
21
Years of Service
User Offline
Joined: 29th Aug 2002
Location: UK
Posted: 24th Oct 2002 16:27
Hide and Show objects has worked a treat for me in DB.
I intend to use Clone Object in place of constant loading of objects with DBPro, when patch 37 comes out.

Great idea about progressive deletion freddix.
Orgull
21
Years of Service
User Offline
Joined: 21st Oct 2002
Location: Canada
Posted: 24th Oct 2002 20:36
Yes Freddix, that's what I had in mind. Now to see if it can be coded!

Freddix
AGK Developer
21
Years of Service
User Offline
Joined: 19th Sep 2002
Location: France
Posted: 24th Oct 2002 20:57
In fact , theorically , I should apply that technic to 3DMapEditor in a next release.
I use the capabilitie to make zones that touch others
and Make Active/Inactive objects in zone depending on the zone distance between observator and Zone or another system that make 2 consecutives zones visibles ( from camera to farest ) and enable/disable a zone and it's objects depending on the zone you enter or leave . . .
ChipOne
21
Years of Service
User Offline
Joined: 12th Sep 2002
Location: Canada
Posted: 24th Oct 2002 21:02
Ulric: this isn't built into any graphics card. a card cannot arbitrarily delete an object.

I'm suprised to learn though that hiding doesn't do anything, and not entirely convinced that it is the case. I use hiding in DBPro in a couple of scenarios and it works a treat for getting framerates up.

If I'm not mistaken, HIDEing an object would pull it out of the cull/draw tests, and therefore should increase performance. Surely this has to be less expensive, computationally, than DELETEing and MAKEing the objects over and over.

What do your tests look like?

-= i only do what my rice krispies tell me to do =-
Orgull
21
Years of Service
User Offline
Joined: 21st Oct 2002
Location: Canada
Posted: 24th Oct 2002 22:46
Your right ChipOne, hide does improve performance significantly, but only when you're dealing with small (3-digit or less) quantities of objects. Try building a world like the one in Morrowind with, I don't remember for sure but the number 700,000 scenery objects sticks in my head. In Morrowind BTW, the LithTech engine does exactly what Freddix is suggesting, it loads objects as the player approaches, and deletes objects as the player gets farther away. As I mentioned, it's a little spaghetti-inducing from a coding point of view, but the performance gains are worth the effort.

I have some new ideas on how to do this in DBPro, now I have to go run some more tests!!

Login to post a reply

Server time is: 2024-04-23 19:30:53
Your offset time is: 2024-04-23 19:30:53