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.

Newcomers DBPro Corner / is it possible to get 8000+ objects on screen at the same time? without lagg

Author
Message
T4r4ntul4
14
Years of Service
User Offline
Joined: 1st Jan 2010
Location: close to my pc
Posted: 28th Apr 2011 00:03
is it possible to get 8000+ objects on screen at the same time?

*without lagg*

iam still busy with my project, but i hit the limitations of the dbpro engine i think...

if i make a structure with 1000+ objects in it and i look to it, my frame rate drops to 30fps or even lower. maybe i do a too big project with the engine.

some ideas?
kamac
13
Years of Service
User Offline
Joined: 30th Nov 2010
Location: Poland
Posted: 28th Apr 2011 00:07 Edited at: 28th Apr 2011 00:09
Use some optimization. I am not sure, but try using set object cull command for all the objects with flag set to 1(?). Also, try using fog. I'll search for another options.

Edit@

Try decreasing your object's polygons if they're heavy.

T4r4ntul4
14
Years of Service
User Offline
Joined: 1st Jan 2010
Location: close to my pc
Posted: 28th Apr 2011 00:13 Edited at: 28th Apr 2011 00:14
i thought of fog, but if someone makes a tower/building/whatever you will not see the whole building. i need a workaround for that.

set object cull: i will look into that



edit: no not heavy, they are just boxes with a texture.
kamac
13
Years of Service
User Offline
Joined: 30th Nov 2010
Location: Poland
Posted: 28th Apr 2011 00:20 Edited at: 28th Apr 2011 00:23
Also, try using exclude object off/exclude object on command! Simply exclude objects that are in long distance from player, and include them again if they get close . That should do.

So basically make the away-objects less detailed.

T4r4ntul4
14
Years of Service
User Offline
Joined: 1st Jan 2010
Location: close to my pc
Posted: 28th Apr 2011 00:30 Edited at: 28th Apr 2011 00:33
Quote: "So basically make the away-objects less detailed."


hmm, how to make a box less detailed?

edit: i dont think exclude object off/exclude object on will work, because it is a building game, so if i need to use it, i need per grid a array for the objects in that area, or something like that.
Quel
15
Years of Service
User Offline
Joined: 13th Mar 2009
Location:
Posted: 28th Apr 2011 01:03
Well, that would be the whole purpose of fog, to not to be able to see all of it. What else did you think?

Anyways, as a pro 3d artist i can say that the following phrase: "a structure with 1000+ object in it" certainly shows how you have little feel about the physical limits of anything, not only dbpro.

You don't import a structure into a game containing hundreds or even thousands of separate objects. Even in the most advanced engines, you need to collapse the whole thing into one, weld vertices and delete unnecessary polys.

-In.Dev.X: A unique heavy story based shoot'em ~12%
-CoreFleet: An underground commander unit based RTS ~15%
-TailsVSEggman: An Sonic themed RTS under development for idea presentation to Sega ~15%
T4r4ntul4
14
Years of Service
User Offline
Joined: 1st Jan 2010
Location: close to my pc
Posted: 28th Apr 2011 01:08
tested it now with the culling: 3200 objects with 48fps on a geforce 800GT

hmm its better, but iam still not happy.

with pick object my fps drops dramatically down. if iam not pointing at an object my fps is 48, if i point at a object it goes down to 7... thats not good at all.

iam thinking to rebuild my entire game into another engine
i think dbpro is not capable of what iam trying to do.

thnx kamac for the help.
T4r4ntul4
14
Years of Service
User Offline
Joined: 1st Jan 2010
Location: close to my pc
Posted: 28th Apr 2011 01:15 Edited at: 28th Apr 2011 01:16
Quote: "Well, that would be the whole purpose of fog, to not to be able to see all of it. What else did you think?"


i would think, if someone made a nice structure, he would see all of it.

Quote: "Anyways, as a pro 3d artist i can say that the following phrase: "a structure with 1000+ object in it" certainly shows how you have little feel about the physical limits of anything, not only dbpro."


hahaha lol iam not, being a 3d artist myself, i know how to build up a 3d model in ONE piece.

Quote: "You don't import a structure into a game containing hundreds or even thousands of separate objects. Even in the most advanced engines, you need to collapse the whole thing into one, weld vertices and delete unnecessary polys.
"

its a building game... a building game comes with separated parts.

but thnx for your 2c.
Dar13
16
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 28th Apr 2011 05:25
Quote: "is it possible to get 8000+ objects on screen at the same time?"

Yes.

Quote: "*without lagg*"

No, and perhaps not even with a very powerful C++ engine like OGRE or irrlicht(then again, I've never tried).

Quote: "with pick object my fps drops dramatically down."

Yes, and any equivalent in any other engine will also be a fps-drainer. That is why you optimize your code to do the pick object as little as possible. If you don't need to know what object you're looking at until the user clicks his mouse, then don't call pick object until the user clicks his mouse.


baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 28th Apr 2011 10:46
You could also take a look at the "Dark Imposters" plugin matty halewood is working on here:
Dark Imposters

@Quel, please try to be respectful when you speak to other forum users. Not everyone here is a "Pro" like you. You may not realise this but in your post here you sound very patronising and more than a little rude. If you want people to respect your views you could try not pointing out how much cleverer you are and just give out the good advise you are more than capable of giving. I say this with total respect for your abilities!

T4r4ntul4
14
Years of Service
User Offline
Joined: 1st Jan 2010
Location: close to my pc
Posted: 28th Apr 2011 12:46
Dar13:
Quote: " If you don't need to know what object you're looking at until the user clicks his mouse, then don't call pick object until the user clicks his mouse."

thats just the problem, my system needs to know what object he is looking at, otherwise i cant build nothing. but iam gonna try to change that.

baxslash:
Quote: "You could also take a look at the "Dark Imposters" plugin matty halewood is working on here:
Dark Imposters"

thats a great plugin, will follow that progress.
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 28th Apr 2011 14:08
Hi there. Time ago, I made my own function to simulate to have thousands of trees on a landscape. There was really just 50 objects, but with the help of fog and repositioning objects around the camera, the effect was ok. Wherever I go, I could see many trees around me, and if I turned back, the trees where in the same place, as the system reposition them in correct place again. It wasn`t just ramdom, as when we turn back we see the trees again where they were.

My function was something like this:



I hope it can help some one.

Cheers.

I'm not a grumpy grandpa
Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 28th Apr 2011 16:18 Edited at: 28th Apr 2011 16:19
I think the more important question is why would you need so many separate objects on the screen at one time? Such a situation requires specific optimization of the engine, which most engines probably aren't designed for.



Support a charitable indie game project!
kamac
13
Years of Service
User Offline
Joined: 30th Nov 2010
Location: Poland
Posted: 28th Apr 2011 17:10 Edited at: 28th Apr 2011 17:11
I'd rather make small areas on your place which are surrounded of some images from other areas. To make it clear:

X,X,X,X,X
X,X,O,X,X
X,X,X,X,X

Every X is an area such as:



A . is an empty space, | and - are bounds of the area, @ is some building. Now, every X is an area as i metioned above, so you make an screen shot (with get image command) of that city from view of your area. Like:





The ^ is where you position camera in direction facing that city. Actually you're browsing throught the second city, but you want an screenshot of how the first city looks when you try to look on it. You make Screnshot of it when looking in that direction. When you make 4 surrounding areas screens and position them in 4 directions of your area, you can have around 500 objects in one area (or less, depending how you want).


I know it's very complicated... But it's an alternative . You can also not make that screenshots and just make areas.



Or use method that Notch used in his minecraft. Group every object on the whole map and when you want to make some changes, it simply edits the blocks. I mean, i don't know your game
But it would actually work.

KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 28th Apr 2011 18:35
There is also Kaedroho's LOD plugin

For PICK OBJECT you could also store the result in a variable, and only call PICK OBJECT to update it every 5 or 10 frames. That should speed it back up.

That's one of the best suggestions I can give for optimizing in DBPro. Don't call anything every loop unless you absolutely have to. Most things will work just as good, if not better, if they are called every 3rd, 5th, or 10th loop.

Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 28th Apr 2011 20:13 Edited at: 28th Apr 2011 20:16
Quote: "That's one of the best suggestions I can give for optimizing in DBPro. Don't call anything every loop unless you absolutely have to. Most things will work just as good, if not better, if they are called every 3rd, 5th, or 10th loop."


Amen! It's always good to add code (at some point) to see when each routine is called to determine just how efficient our code really is... I like to use IanMs CONSOLE and LOG commands.



http://www.matrix1.demon.co.uk/Matrix1Utils_Help/Matrix1Util_11_index.html

http://www.matrix1.demon.co.uk/Matrix1Utils_Help/Matrix1Util_10_index.html

T4r4ntul4
14
Years of Service
User Offline
Joined: 1st Jan 2010
Location: close to my pc
Posted: 28th Apr 2011 23:18
@chafari
thnx for the idea, but repositioning the objects for my project is not really the best option i think.

@benjamin
because i was building in the sandbox what i now have, and just a small structure already have 1000 objects, and my plans where to make it multiplayer, so i figured it needs many objects on the screen.

@kamac
it looks like minecraft indeed, but the build objects are very different.
like the chunks he has, maybe i need that too.

@kistech
LOD is a nice idea. but isnt it the same like dark imposters plugin?
and indeed i need to improve the pick object code part. but how do i skip that many loops?


so basically i need all sort of 3d optimizing in my code like: LOD, culling, dark imposters, and split up the world to smaller chunks.

some screens for better understanding:



Wyldhunt
15
Years of Service
User Offline
Joined: 27th Sep 2009
Location: The Dark Side
Posted: 28th Apr 2011 23:19 Edited at: 29th Apr 2011 00:48
Edited for Content

Quote: "my system needs to know what object he is looking at, otherwise i cant build nothing."

I don't know how your game is set up, but this is how I'd do it if it worked like your standard building game:

Player clicks on an object to select it.
Pick Object is used to grab the object and objects location.
Selected objects Object Number and Location are stored in an array.
Repeat
... As the player moves the object, the array updates based upon the mouse movement or other input commands.
... Reposition the selected object to the new location stored in the array.
Until the player clicks the mouse again, which empties the array or repicks a new object.

In the case of timers to prevent a check every loop, here's the easiest way I know.


An alternate form that would allow you to call some code on a true set timer instead of basing it on your FPS would look more like this:


I'm at work right now, so I don't have DBP available. My code likely has typos and such since I'm doing it all from memory.
Jimpo
19
Years of Service
User Offline
Joined: 9th Apr 2005
Location:
Posted: 29th Apr 2011 00:39
You don't need every piece of those buildings to be a separate object. You could just use one object and add to it as you build.

T4r4ntul4
14
Years of Service
User Offline
Joined: 1st Jan 2010
Location: close to my pc
Posted: 29th Apr 2011 01:22
Quote: "You don't need every piece of those buildings to be a separate object. You could just use one object and add to it as you build."


how would i do that?
Jimpo
19
Years of Service
User Offline
Joined: 9th Apr 2005
Location:
Posted: 29th Apr 2011 01:45
It's probably the best solution speed wise, but it might be a bit tricky for a beginner. Check out the vertexdata commands and play around with constructing objects from code. From there, you can turn your base building parts into meshes and add them to the vertexdata as needed and position them through code.

KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 29th Apr 2011 18:12
Quote: "and indeed i need to improve the pick object code part. but how do i skip that many loops?"


Set a global variable, call it "Loops" if you want.



Wyldhunt
15
Years of Service
User Offline
Joined: 27th Sep 2009
Location: The Dark Side
Posted: 29th Apr 2011 19:12
@KISTech
Are you sure that'd work?

In your example, Loops is already an int. So, you're saying to run the loop any time 5/10=5/10 or 8/10=8/10.
Either they'll both round to 0 or 1 or whatever, but it seems like they'll both be the same.
If you used Loops#, you'd be closer. But since the engine estimates bools, you run the risk of the loop never running. I'm not sure how close they have to be for an = to consider them the same. I do know that if you have Loops#=10 and print Loops#, you'll output something like 10.003425.

That's why I set mine up the way I did in the above post. To make sure that it always hits when it's supposed to.
KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 29th Apr 2011 21:06 Edited at: 29th Apr 2011 21:13
Ok, I forgot to specify that Loops is a float.

I'm not really sure how close it has to be either, but since you are always incrementing by a whole number, it's apparently close enough to work. I've not had any problems doing it that way, and the concept as a whole no matter how you decide to do it will save you TONS of processing time.

I had done it the way you show before, but I switched to this because I ended up with to many variables to track everything.

Also, DarkImposters is another form of LOD, but you can use LOD at a closer distance, and still move and rotate the object. I think DarkImposters is headed for that "live update" ability. Like many others I'm waiting and watching to see what happens.

T4r4ntul4
14
Years of Service
User Offline
Joined: 1st Jan 2010
Location: close to my pc
Posted: 30th Apr 2011 00:17
@jimpo
iam gonna start a test project and will figure it out, how that would work... but if i get that to work, how would go the textures? from what i understand from your idea is that you combine 2 objects to 1 object, right? and if its 1 object i can rotate or whatever i want to do with it?

any snippets you can advise me?

@wyldhunt
iam gonna experiment with it.

@kistech
nice, didnt know how to do, but now i know
Neuro Fuzzy
17
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 30th Apr 2011 01:02
@kistech
My preferred way of doing this is by checking if

loops mod 5 = 0

It's a bit more straightforward w/ an understanding of the modulo command.


Tell me if there's a broken link to images in a thread I post, and I'll fix 'em.
WLGfx
17
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 30th Apr 2011 03:25
Similar to the Dark Imposters plugin, to speed up rendering time you could replace some of the objects with just a rectangle (two triangles and possibly just 4 vertices) and make it face the camera. At least for objects in the distance that you're not likely to be clicking on it should speed things up a tad. Also Set Camera Range might help.

Warning! May contain Nuts!
Wyldhunt
15
Years of Service
User Offline
Joined: 27th Sep 2009
Location: The Dark Side
Posted: 30th Apr 2011 05:43 Edited at: 30th Apr 2011 09:18
@Neuro Fuzzy
I never noticed that DBP had a mod command.
If that works, then that would be much simpler.

For those not familiar with the mod command:
It divides the two numbers and returns only the remainder. It ignores any whole numbers.
So, if it works the way I assume that it would...
loops mod 6 would divide the loops variable by 6 and only return the decimal place.
2 mod 6 = .33
4 mod 6 = .66
6 mod 6 = .0 (The 1 is ignored since it is a whole number)
12 mod 6 = .0 (The 2 is ignored since it is a whole number)
15 mod 6 = .5 (The 2 is ignored since it is a whole number)

I assume that loops would have to be a float? You haven't had any issues with the estimated floats never being equal to 0?

I think I'll run some tests to see how close 2 numbers must be for = to consider them equal. That should prove interesting.

EDIT:
MOD doesn't work quite the way I guessed, but close. It returns the remainder.
So...
From the DBP help file:
Quote: "11 MOD 2 equals 1
A MOD B equals the remainder of the division between A and B"
KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 30th Apr 2011 17:31
I got curious, so here's a little test.



The result I get is only whole numbers, but since it's a float the first part of the comparison would render a decimal portion when Loops isn't evenly divisible by the desired number. So no risk of it not hitting the desired number of times.

Wyldhunt
15
Years of Service
User Offline
Joined: 27th Sep 2009
Location: The Dark Side
Posted: 30th Apr 2011 20:12 Edited at: 30th Apr 2011 20:57
For anyone interested, here's what I found concerning floats and = in DBP:
For starters, the old estimating issue seems to have been improved somewhere along the way.

will print 10 with no decimal.

will print 10.100000 and then random numbers. Plenty accurate.
If Var=10.2, you get 10.199999 and then random numbers.

The = appears to only care about the whole number and the tenths place matching. So,
10=10.099999
10<>9.999999 (Even though this is more equal than the last)

still works even though 10.2 rounds down. If I subtract 0.000001 from Var#, they are no longer equal. I'm guessing that the 10.2 is being estimated in the engine along with Var#, and thus they both match.

The short version:
Two numbers are equal as long as their whole numbers and tenths place match and the second number is at least as large as the first number.
The internal estimation does not appear to have any serious effect on equality.

EDIT:
And KISTech wins both on post time and timers.
MOD still seems like an interesting choice, but you'd need to be careful with your numbers chosen to prevent unintentional code running.

That could be prevented by careful use of numbers, of course.
Jimpo
19
Years of Service
User Offline
Joined: 9th Apr 2005
Location:
Posted: 30th Apr 2011 22:36
Quote: "loops mod 6 would divide the loops variable by 6 and only return the decimal place.
2 mod 6 = .33
4 mod 6 = .66
6 mod 6 = .0 (The 1 is ignored since it is a whole number)
12 mod 6 = .0 (The 2 is ignored since it is a whole number)
15 mod 6 = .5 (The 2 is ignored since it is a whole number)"

There is a difference between remainder and number after the decimal. Mod works like this:
2 mod 6 = 2
4 mod 6 = 4
6 mod 6 = 0
12 mod 6 = 0
15 mod 6 = 3

Quote: "iam gonna start a test project and will figure it out, how that would work... but if i get that to work, how would go the textures? from what i understand from your idea is that you combine 2 objects to 1 object, right? and if its 1 object i can rotate or whatever i want to do with it?

any snippets you can advise me?"

Search vertexdata in the forums to find some examples of how to manipulate objects through code.

The idea is that instead of having multiple objects placed next to each other to look like a single object, you would only have 1 object created at runtime from how the user constructs it. Your prefab building pieces can be meshes (load mesh/make mesh from object) and you would add them to the single objects vertexdata as needed (add mesh to vertexdata). From there you can position the vertices to the correct spot.

For textures, if all your prefabs use the same texture, then there is no extra work. Otherwise, there are different ways to do multiple textures. You can create a master texture, which is just a single image that combines all your textures into one tiled image, like a 2d tileset. Or you can try multi-texturing (set blend mapping on).

T4r4ntul4
14
Years of Service
User Offline
Joined: 1st Jan 2010
Location: close to my pc
Posted: 2nd May 2011 01:45
ty all, for the ideas and some code, i need a lot to do
Agent
20
Years of Service
User Offline
Joined: 7th Sep 2004
Location: Sydney, Australia
Posted: 3rd May 2011 07:15
What? I never knew that floats are not precisely accurate. I've been using DBPro for going on eight years and use floats all the time and I've never encountered this estimation thing. My equality comparisons have always worked just as expected and I've never seen anything other than an exact output when I display the contents of floats.

How strange!

Wyldhunt
15
Years of Service
User Offline
Joined: 27th Sep 2009
Location: The Dark Side
Posted: 3rd May 2011 07:54
@Agent
That's not a DBP thing. It's a Floating Point thing. It trades accuracy for speed and the capability to handle larger formulas.
There are different methods of handling floating point operations, but none of them are perfect. DBP appears to use the more accurate system of floating point. As my tests showed, there will only be a few specific times when comparing floats will fail.
You can learn more here:
http://en.wikipedia.org/wiki/Floating_point#Accuracy_problems

Most often, you'll just get a slightly incorrect answer from many math intensive calculations which make use of them.

I was just curious about the equality thing so that I'd understand exactly how close it needed to be. Knowing that the equals comparison looks like:

may prove important. Usually it won't, unless you're using very small numbers, in which case the estimated floating points may become more of an issue any way...

Login to post a reply

Server time is: 2024-11-16 21:58:54
Your offset time is: 2024-11-16 21:58:54