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 / collision for LOTS of objects

Author
Message
Sephnroth
21
Years of Service
User Offline
Joined: 10th Oct 2002
Location: United Kingdom
Posted: 1st Nov 2005 04:49
i was helping a friend work on a chuchu rocket like game - it uses my map editor which exports one solid object for the world to perform collision against. Obviously because its one solid object with other objects walking over it box collision on the world is no good, but polygon collision was predictably too slow. so i quickly wrote him a function using intersect object for his lil mice (in chuchu the mice walk and when they hit a wall then turn 90 degrees) which was alot faster but the fps still compeltly dies with 15 or more mice on the board.

Anyone who has played chuchu rocket will know 15 mice is not nearly enough, especially for multiplayer! Any tips on how you could have alot of 3d objects (low poly) walking around a simple map and colliding with walls without destroying your fps?

OSX Using Happy Dude
20
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 1st Nov 2005 10:42
I presume using NGC is not possible ? In which case, if, everything is at a fixed horizontal and vertical position, then you could cheat by using the grid position (to checking whats in front/behind etc).

If the level isn't at fixed positions that you may have to create your own line of sight routine.

Come to the third DarkBasic Pro Sci Fi Con - Less than 2 weeks to go!
Blog:http://spaces.msn.com/members/BouncyBrick/
Web Site:http://www.nicholaskingsley.co.uk
MiR
20
Years of Service
User Offline
Joined: 13th Jul 2003
Location: Spain
Posted: 1st Nov 2005 11:47
Wouldn´t it be best to use an array to store the grid? With a certain number representing a block another number representing a chuchu etc? It would be much faster than checking for collisions.

My signature has been erased by me because it's LARGE.
Thank you for the votez!1!
Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 3rd Nov 2005 01:53
Simple 2D box collision should be good enough for that, no?

Tempest - P2P UDP Multiplayer Plugin - 45% - Integration is going well!
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 3rd Nov 2005 04:05 Edited at: 3rd Nov 2005 04:06
Or use some major culling, I recommend splitting your map up into 4 or more sections, checking if any mice are even within the extents of these sections, if not then dont check for collision with those sections. That should reduce the intersections by 1 fourth atleast, then only detect for collision when mice are moving, and finally use a split amount of collision checks per sync (eg 1st sync check for collision between mouses 1 to 10, 2nd sync check for mouses 11 to 20, then go back to the 1st checking 1 to 10, back and forth back and forth.

Using these methods along with other lag reducers htat dont have to do with collision (Hiding mice and objects not on the screen, not showing polygons that aren't facing the screen, storing often used calculations in variables like positions and angles, etc) should jack your FPS up quite a bit.

Sephnroth
21
Years of Service
User Offline
Joined: 10th Oct 2002
Location: United Kingdom
Posted: 3rd Nov 2005 04:15
Thanks for all the responses to this

@ruccus - the world is one big object. The deal with a chuchu is it walks forward and if it hits something then it turns 90 degrees and continues working - the idea of the game is "a bit" like lemmings. But it meant only ONE intersection was ever nessiary, chuchu to the world. However, the game require hundreads of fuzzlers at once, thats when it gets heavy. Hiding unseen objects etc though is always good practice

-
I did suggest a grid collision to him but one of the main arguing points when i was telling him to go 3d (hes only done 2d uptill now and i thought it would do him some good to get his teeth stuck into some simple 3d) was saying he wouldnt have to bother with tile collision anymore XD

In the end he actually came up with a varient on my code that seems to be doing the job well, im quite proud of him! Noting that a fuzzler (chuchu, mouse, whatever) walks in a streight line only and turns when it hits something he took my intersect code but made it cast a line the length of the level. Then he stores the distance returned into a var in his chuchu type which gives him a nice var saying how far until the next wall. he then decreases the dist var by the speed of the fuzzler every time it moves and when its < 0.0 he turns the fuzzler and then performs another intersect.

Wish I had thought of it, now only one collision check is made and only whenever the chuchu (sorry for calling them different things, HE calls them fuzzlers) turns around. On my pc running his little test program i have over 30fps with around 320 wandering around the screen so not too bad

Login to post a reply

Server time is: 2024-04-26 17:58:06
Your offset time is: 2024-04-26 17:58:06