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 / Need help with collisions

Author
Message
Imerion
21
Years of Service
User Offline
Joined: 13th Oct 2003
Location:
Posted: 12th Aug 2004 01:42
Hello! I am currently making a game in Darkbasic. I have managed to create a huge city where the player can walk around. It has mouselook and other neat stuff. However, when I use the built in collision routines, the game gets unbearably slow. (There are two rem-ed lines. Un-rem them and it gets extremely slow). I have heard that it is much better to use math-collision but I don't know how to do it with as many objects as this. I just want to check if object 999 collides with any other object. Could someone tell me how to do that or give me some routin which makes it work? I would be very grateful! Thanks a lot.
Also, I have seen that there is some kind of DLL that can be used, but it costs and I did't understood how to use it. (Tried the demo).
Btw, I have added a goto in the beginning which skips the intro.
Imerion
21
Years of Service
User Offline
Joined: 13th Oct 2003
Location:
Posted: 14th Aug 2004 01:29
Please. I really need help with this. I won't ask more stuff, I promise!
chilledoutjohn
21
Years of Service
User Offline
Joined: 10th Aug 2003
Location:
Posted: 14th Aug 2004 09:29 Edited at: 14th Aug 2004 09:33
G-Day I had/have soooo many problems with collision as well like many others i guess i supose the problems so old no-one can be arsed to help any more, anyway heres what i bodged together, its not as good as sliding collision but its prety simple to understand and does the job

(see the source button underneith)

player represents your player object number, just replace player with your player object number in your case object 999 i think

to check if object collides with any other object just use the code:

if object collision(player,0)>0
print "object collided!!!"
endif

just stick that puppy in your loop somewhere and i think it should help, im a bit of a noob me-self so if anything dont work......

hope that helps
Sir Spaghetti Code
20
Years of Service
User Offline
Joined: 12th Jul 2004
Location: Just left of Hell
Posted: 14th Aug 2004 09:36
You know, I am not in Nuclear Glory's pocket or anything, but his collision system is awesome! And it doesn't slow the program down at all! I tried very hard to use the DB collision, but after about 20 or so objects, it slowed down to a crawl. The NG collision system is only $15 and you can try out a demo if you want. Only limitation is that it will stop working after a few minutes in the demo, but you will get the idea. Here is the link:http://www.nuclearglory.com/ngc.php I got it and I am happy, so I am simply spreading the word!

"I attribute the quarrelsome nature of the Middle Ages young men entirely to the want of the soothing weed."
-Jerome K. Jerome(1859-1927),Writer
Emperor Baal
21
Years of Service
User Offline
Joined: 1st Dec 2003
Location: The Netherlands - Oudenbosch
Posted: 14th Aug 2004 10:17
You can use Math if you really dont want to spend cash on a dll...
If it's a simple square city, it will be a piece of cake. If it has bridges, round parts, etc... it will be a bit harder



Hop a long
21
Years of Service
User Offline
Joined: 12th May 2004
Location: The Code Dump
Posted: 14th Aug 2004 12:32
Your game looks interesting. I really only ran over it quick to find the two lines you commented out. Does the game collision work even though it is slow? It might not be coded correctly. How many objects do you really have? It's impossible to tell since you are loading levels built in Magic World. Lastly, can you divide up your collision checking according to where the character is in the city. Moniter where the player moves. He can probably be near only a few objects at a time.
bibz1st
22
Years of Service
User Offline
Joined: 2nd Jan 2003
Location:
Posted: 14th Aug 2004 20:54
I also cannot recommend NG's DLL enough, once it is set correctly you can forget about it and concentrate on the game, as for the cost it is a lot of hassle free colliding for VERY little money, go on you know you want to...
Imerion
21
Years of Service
User Offline
Joined: 13th Oct 2003
Location:
Posted: 15th Aug 2004 06:00
I tried that DLL, and it does seem fine, but it won't work in my version of DB. I also tried to update it but it didnät work. I have the special version which they gave out to schools some time ago. I can't load DLLs in it and the latest patch won't work. It says it can't find out which version I have.

Yes, the collision works, but it is extremely slow on my P4 2.6 Ghz computer with a GForce 4 card...
As for my city its pretty big and has about 600 objects. Most are cubes but some are spheres and so on.
I could try math collision, but I don't know how... Thats why I asked.
Lightning Eye
20
Years of Service
User Offline
Joined: 14th Aug 2004
Location:
Posted: 16th Aug 2004 19:02
NUCLEAR GLORY COLLISION CODE!

Ur...

run, megaman, run!
Emperor Baal
21
Years of Service
User Offline
Joined: 1st Dec 2003
Location: The Netherlands - Oudenbosch
Posted: 16th Aug 2004 20:19
Imerion, go to my site (click on the <web> button below my sig)



Imerion
21
Years of Service
User Offline
Joined: 13th Oct 2003
Location:
Posted: 17th Aug 2004 02:29
Ah, thanks! Ill check it out!

Login to post a reply

Server time is: 2025-05-25 16:40:22
Your offset time is: 2025-05-25 16:40:22