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 / Newton Physics and Large Levels Help

Author
Message
Derekioh
17
Years of Service
User Offline
Joined: 1st Feb 2009
Location:
Posted: 7th Aug 2011 02:02
So I want to use Newton Physics for my FPS game because I like the way it works and its simple to use. Just one problem: How do you apply a static body to a level I've created? Serialization takes WAY to long to load for small levels and I need to help. Is there a way to make the level (one file) a static object to check collisions against? or is there a better way?

Matty H
17
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 7th Aug 2011 02:09
Dark DynamiX(PhysX wrapper) has the ability to save triangle meshes to file and they load up pretty fast, check it out in the WIP.

Although I understand you may not be looking to change physics engines for your game, just thought I would let you know about an alternative

Derekioh
17
Years of Service
User Offline
Joined: 1st Feb 2009
Location:
Posted: 7th Aug 2011 02:37
Okay, ill look into that. But if someone has a solution to my problem or some advice, that would be great

Thanks though Matty H

Dar13
18
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 7th Aug 2011 05:44
What I do with my levels is I take the main part of it(the part the player would be colliding with) and create a custom tree collision object which I then serialize to an external file. I don't know how long is too long for you, but a relatively small level(3000 polygons) takes a minuscule amount of time to load for me.

tiresius
23
Years of Service
User Offline
Joined: 13th Nov 2002
Location: MA USA
Posted: 7th Aug 2011 07:33
Yes, are you actually Serializing and saving the tree collision to disk? It should be fast loading.


A 3D marble platformer using Newton physics.
Derekioh
17
Years of Service
User Offline
Joined: 1st Feb 2009
Location:
Posted: 8th Aug 2011 00:35
hmmm...well the last time I tried doing something like that, a relatively small (less then 2000 polys I think it was) took almost thirty seconds on a disc and just on the computer. Any ideas?

Derekioh
17
Years of Service
User Offline
Joined: 1st Feb 2009
Location:
Posted: 8th Aug 2011 04:04
Well I realized that my levels were a lot more then 3000 polygons...that explains a lot. anyway, i guess my next question is whats the best way to serialize them and get them on the screen quickly and efficiently?

tiresius
23
Years of Service
User Offline
Joined: 13th Nov 2002
Location: MA USA
Posted: 8th Aug 2011 05:12
How many polygons are on the level? You're not giving concrete numbers.

If you serialize the level, how big is the file it produces?

Do you use the UnOptimized function? Scale version? Limb flag?

Again, the importance is in the speed of loading, not the speed of saving.


A 3D marble platformer using Newton physics.
Derekioh
17
Years of Service
User Offline
Joined: 1st Feb 2009
Location:
Posted: 8th Aug 2011 17:43
well, the one that took around 5 seconds to serialize had 3,491 polygons. and that was a very, very simple level. another simple level, was 4,741 polygons with a time of loading around 15-20 seconds (after saving the serialization), but that I think was due to trees. I was working on a project and the 3D models of mine used 3DS Max, but obviously didnt take into a count the poly count.

As for the other variables:

UnOptimized: Yes
Scale Version: Not sure what you mean.
Limb Flag: everytime I time I try that it during saving, it crashes the save program.
THe size of the 3,491 serilzed file: 69 kb
The size of the 4,741 serilized file: 150 kb

tiresius
23
Years of Service
User Offline
Joined: 13th Nov 2002
Location: MA USA
Posted: 8th Aug 2011 21:42
I can't see how loading a 150kb serialized tree can take anywhere near that long. Did you time before and after the call to load the tree from serialization? Can we see some code on how you are loading the level?


A 3D marble platformer using Newton physics.
Derekioh
17
Years of Service
User Offline
Joined: 1st Feb 2009
Location:
Posted: 8th Aug 2011 23:24
yeah, i checked and it took me 23 seconds to load it. my code for loading the level is this:



As you can see, its not that complex

tiresius
23
Years of Service
User Offline
Joined: 13th Nov 2002
Location: MA USA
Posted: 9th Aug 2011 05:23
And which part takes how long? I've heard 3ds format is notorious for being poorly supported, and slow. Sorry but I have no idea how a tree collision that small, can take that long to load.


A 3D marble platformer using Newton physics.
Dar13
18
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 9th Aug 2011 06:27
Have you tried just loading the serialized file and timing that? If you've only done it with the .3ds object loading then it might be the .3ds object not the serialization. It's taken upwards of 1-2 minutes for me to load a .3ds animated character.

revenant chaos
DBPro Master
19
Years of Service
User Offline
Joined: 21st Mar 2007
Location: Robbinsdale, MN
Posted: 9th Aug 2011 14:34
If it is the .3DS format that is causing the slow loadtime, you could try converting it to .DBO
before anything else and see if it helps.
Derekioh
17
Years of Service
User Offline
Joined: 1st Feb 2009
Location:
Posted: 9th Aug 2011 22:32
okay, maybe thats the problem. I'll try converting it to .dbo and tell you guys my results when I get home from work.

Derekioh
17
Years of Service
User Offline
Joined: 1st Feb 2009
Location:
Posted: 11th Aug 2011 16:04
holy cow that loads so much faster! thanks! Now I know to stick with either .dbo or if I need to .x. Thank you guys very much

Login to post a reply

Server time is: 2026-07-10 15:30:57
Your offset time is: 2026-07-10 15:30:57