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 / Here's A way to optimize your collisions

Author
Message
BoB Vila
22
Years of Service
User Offline
Joined: 27th Feb 2003
Location: United States
Posted: 6th Mar 2003 14:27
I was about to goto sleep yesterday and I thought of a way to get a little more bang for your buck so that those of us who need to add insane ammounts of collisions can do it without killing the FPS.

First make a integer Counter.
ColExe = 1

Then in your main loop divide up your collisions:
If ColExe = 1 Then Check Collisions 1 - 100
ColExe = 2
If ColExe = 2 Then Check Collisions 101 - 200
ColExe = 3
If ColExe = 2 Then Check Collisions 200 - 201
ColExe = 1

Since as long as you are moving at over 15 frames a second, it would be impossible for a human to tell since the collisions are still being handled with Mili Second Accuracy.

Then you could take this a step further and do priorities for your collision using 2 Variables. That way you could have collisions that are only checked once every 6 frames or longer (whichout messing up your high priority collisions) This could be useful for things like opening doors, and the like. Since they could even be opened on a 1 second or 2 second delay and it would still seem natural.

Anyways, this has probably been done before, but I just throught I'd throw it out there because it may be useful to someone out there who hasn't thought of it yet.
Kangaroo2
22
Years of Service
User Offline
Joined: 26th Sep 2002
Location: United Kingdom
Posted: 6th Mar 2003 15:32
Yes I was already doing this, but nice idea, and it works well Nice1 I'm sure some1 will find this useful

Coming Soon! Kangaroo2 Studio... wait and quiver with anticipation! lol
[email protected] - http://www.kangaroo2.com - If the apocalypse comes, email me
Rob K
Retired Moderator
22
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 6th Mar 2003 22:04
I do it quite often if necessary but normally I do collision checks with the main character every loop but collision checks with other objects in the world in alternate loops.

Current Project: Retro Compo. Entry.

Login to post a reply

Server time is: 2025-05-18 22:57:55
Your offset time is: 2025-05-18 22:57:55