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 Discussion / Collision slowing game speed

Author
Message
KYP
21
Years of Service
User Offline
Joined: 5th May 2005
Location: 01110000
Posted: 28th Dec 2007 00:22 Edited at: 28th Dec 2007 00:23
Hi all.

I designed a level for Mr. Bear and Nutt in Milkshape and loaded it in DBC. To make Mr. Bear's collision with it accurate, I used "set object collision to polygons", and the program ran fine.

I wanted to get Mr. Bear to automatically jump to the top of whatever ground he was on, so I did this. (in the loop)



With object 11 being Mr. Bear.

I ran the program again, and Mr. Bear stayed at the top of the object all the time, but the fps had dropped to about 12.

Is there a way to get an object to jump to the top of another object without having to test for collision over and over and over? Thanks in advance.


A signature has modded your eraser because of it's many resolutions.
Wait, that's not right...
TDK
Retired Moderator
23
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 28th Dec 2007 02:52
You could have a variable called 'FloorLevel' and use the collision command to set it when the character moves.

Once the variable is set, your code can prevent the character from dropping below whatever FloorLevel is set to without further collision tests.

However, when the character is moving, there's no way to avoid testing for collision or the character would not be able to go up and down hills.

TDK_Man

KYP
21
Years of Service
User Offline
Joined: 5th May 2005
Location: 01110000
Posted: 28th Dec 2007 06:45
That'd work because it's a platformer. I could test for the new "FloorLevel" every five loops or something.

Thanks!


"Bonjoo!"
A quote from Taylor Quinton Velvety Cummings.
jason p sage
19
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 28th Dec 2007 15:53
You could also add some code to combine the methods - more work - but faster frame rates might be the pay off. I don't know your game.. but... if your level is a grid'ish layout, it wouldn't be to hard to make a function that recorded the heights of each "flat" cell. If Mr. Bear within the square - height is known. For Cells that have angles - you could use collision, and or work in ATanFull or just check for ground height is applicable - and lastly resort to collision for these areas with slants.

KYP
21
Years of Service
User Offline
Joined: 5th May 2005
Location: 01110000
Posted: 28th Dec 2007 19:24 Edited at: 28th Dec 2007 19:25
Hey, that's a good idea! Would take some work, though. Especially since the level is fairly large. Thanks, though!


"Bonjoo!"
A quote from Taylor Quinton Velvety Cummings.
jason p sage
19
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 28th Dec 2007 20:07
You're welcome.

I'm the first to like a quick simple solution - but what I recommended might help, as you seem to appreciate, in the long run!

The Frutrum Limb culling (occlusion variety) I just did - was a pain to convert from a dbpro example - (not that that bad) but when all that code was working - seemingly ALOT more code - well - that code ran MUCH faster than trying to render extra unseen poly so it boosted frame rates ALOT. (Depending on view direction) but STILL!

Libervurto
20
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 29th Dec 2007 00:51
@KYP
Do you have to use polygons for collision? That will eat up FPS
maybe you should used cubular (if thats a word) collision and if that returns a 1 then switch to polygons for more accuracy

KYP
21
Years of Service
User Offline
Joined: 5th May 2005
Location: 01110000
Posted: 2nd Jan 2008 03:38
@Obese

That's a good idea! It might not work very well with the level I have in mind, though.


"Bonjoo!"
A quote from Taylor Quinton Velvety Cummings.
jason p sage
19
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 4th Jan 2008 20:30

Login to post a reply

Server time is: 2026-07-05 21:34:12
Your offset time is: 2026-07-05 21:34:12