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.

Dark GDK / Sparky's Sliding Collision Slowdown

Author
Message
BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 3rd Nov 2013 22:26
I'm using Sparky's for collision detection in my project. Due to frequently uneven terrain, I've been using a SphereSlide approach with the sliding collision coordinates (I tried just using a sphere, but corners caused a lot of erratic movements, sometimes propelling the player over tall obstacles). This was working great when it was just the player character. Now, however, I turned on checking for all of the other characters in the world (ie non-buildings and non-world), so that they will fall with gravity and, eventually, be able to move autonomously.

My problem is that running the checks for one or two other objects slows me down considerably. I've tried iterating thing my existing characters, running the movement code (at this point it just handles gravity) for only one character per cycle. Unfortunately, this makes the game very jittery and unplayable.

Does anyone have any suggestions on how to circumvent this? Or is the fact that I'm getting such a slowdown with only a few checks indicative of inefficient coding on my end and I should be looking into things?

Thanks!

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
Mr Bigglesworth
16
Years of Service
User Offline
Joined: 4th Mar 2008
Location:
Posted: 4th Nov 2013 03:26
If you could post some of your code with these collision checks we could look them over, but it might just be to slow. What are your computer specs?
BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 21st Nov 2013 18:13
Sorry for the delay, definitely thought I had already replied.

CPU is Dual Core AMD A4
Graphics is GeForce 9500 GT (it's a bit older)
4 gig memory

After some experimenting, I realized that it was mostly due to my incredibly large landscape model, which used polygon collision. Restricting the size made me able to get up to 8-10 other object loaded and checked.

So I'm going to have to implement some mechanics to limit what objects are being checked against, perhaps even checking boxes for building collision until you hit the door, then check polygon collision for the interior, or something.

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
tiffer
18
Years of Service
User Offline
Joined: 6th Apr 2006
Location: Scotland
Posted: 24th Feb 2014 02:22
The simplest thing to do is to check the distance between the player and the object before including it in collision checks. Or if you want to get fancy. Split the map (logically) into zones and then you just need do calculate whatever zone the player is in and then check collisions respectively.

Cwatson

Login to post a reply

Server time is: 2024-11-18 21:38:49
Your offset time is: 2024-11-18 21:38:49