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 / Weapon speed

Author
Message
QuothTheRaven
21
Years of Service
User Offline
Joined: 2nd Oct 2002
Location: United States
Posted: 3rd Feb 2003 00:36
I'm trying to make an instantaneous weapon, and a very fast machine gun type weapon, with the bullets using sliding collision.

Each bullet is a little sphere. How do I make that detect where it hits instantly after it's fired without slowing down the program? One collision detection takes a drains a lot of speed.

And how would I go about making a bullet move reaaaaly fast, but not instantly? If it goes too fast, it will go through objects because it skips more length than the object is thick, and never actually checks for the collision. And I can't use a cylinder because sliding collision does not allow for rotated objects, or at least does not work when they are rotated. A cylinder would have to rotate with every angle you fired. Any help?
freak
21
Years of Service
User Offline
Joined: 20th Jan 2003
Location:
Posted: 3rd Feb 2003 00:47
I would check collision instantly when you click your mouse button. You could code your own collision object (just one polygon) and set collision to polygons. I don't think there's a need to use a bullet object, I don't think you actually see a bullet when you shoot (a bullet moves so fast, with 30fps the bullet wouldn't be visible anymore after the first frame)

QuothTheRaven
21
Years of Service
User Offline
Joined: 2nd Oct 2002
Location: United States
Posted: 3rd Feb 2003 00:52
freak you're speaking gibberish to me. A collision object? Set collision to polygons? I've never heard of this in DBP...
freak
21
Years of Service
User Offline
Joined: 20th Jan 2003
Location:
Posted: 3rd Feb 2003 01:03
this is a DB Classic forum...

a collision object= the object that you use to check the collision, to check if you hit another player or another object

that collision object is (in my proposal) just one polygon, which is hided (=unvisible)

because it's mostly too heavy to check collision for a non-primitive object, db makes a 'collision box' around the object, to check collision with (that's much faster than having to chech each poly of the model)
but because (in my proposal) there's only one polygon, it could be even faster when you let DB check collision on each polygon. therefor, there's the command SET COLLISION TO POLYGONS (I think that it's that, I'm not sure, just search the index on 'polygons'

that one collision polygon I mean, is one that's very tall, and in the same line of the barrel of your gun

QuothTheRaven
21
Years of Service
User Offline
Joined: 2nd Oct 2002
Location: United States
Posted: 7th Feb 2003 04:35
ok, so I make the 1 polygon object (I have to wait till I can use 3ds max at my school) about the size of a bullet trail. I use code to place it facing the same way the barrel is.

How do I stop it from going through a wall? will it work if I dont make a collision box (everything else uses sliding collision boxes) and only use set collision to polygons? Would scaling it affect the collision or not?

And does anyone know how to keep a decent weapon bullet speed that's fast? If its too fast it just skips through objects...
freak
21
Years of Service
User Offline
Joined: 20th Jan 2003
Location:
Posted: 8th Feb 2003 12:22
you don't have to model that 1 polygon object, you can just code it in DB (I think it's a command startin with make object ...)

hmm to make your object not go trough walls... that was someting I didn't tink of

maybe you should actually better use a bullet object after all, but that could be a one poly object that's hidden (I don't think you can see a machine gun bullet flying, you just have to add some plain with a fire animation at the end of the gun's barrel - if that's possible in DB, I don't kow)

The Darthster
21
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 8th Feb 2003 21:45
You can do all your collision in one go, using a for next loop to determine when the bullet collides with something. This is rather slow however, but is accurate and instantaneous.

Once I was but the learner,
now, I am the Master.
QuothTheRaven
21
Years of Service
User Offline
Joined: 2nd Oct 2002
Location: United States
Posted: 9th Feb 2003 00:39
yes darth, but I am really aiming for speed. I dont want to have to do 5 collisions in a loop just for one bullet, that would be very harsh on the engine.
freak
21
Years of Service
User Offline
Joined: 20th Jan 2003
Location:
Posted: 9th Feb 2003 22:13
maybe you could use a longer (let's say 20 times the length of a bullet), unvisible, 1 poly object to check collision... you just move that object (which simulates the bullet) like you should move a bullet and check collision... because the object's longer you don't need to do that many collision tests (10x less collision tests if that object is 10x longer than a bullet)

QuothTheRaven
21
Years of Service
User Offline
Joined: 2nd Oct 2002
Location: United States
Posted: 10th Feb 2003 00:25
first off, no way to stop that from going thru a wall.

Secondly, sliding collision doesnt allow for rotated objects
Killer Sponge
21
Years of Service
User Offline
Joined: 27th Nov 2002
Location: United Kingdom
Posted: 10th Feb 2003 12:51
Really You Need an accurate line of Site( The Tightest one there) then using movable static objects(sure it is done, its in one of the new tutorials) and round the player,enemys,walls, (with static collision boxes(which can actually be, NOT STATIC(go figure) they can be rotated) you can use the line of sight command, thus meaning you can calculate the finish up point of the bullet with nothing in between. DONE instentanius bullet, no models or nething!


(WUD BE LONG, LONG, LONG CODE THO)

See what you can do!

Killer Sponge
21
Years of Service
User Offline
Joined: 27th Nov 2002
Location: United Kingdom
Posted: 10th Feb 2003 12:52
Oh, apologize about spellin mistakes, English was neva my strong point even if it is my first language!

freak
21
Years of Service
User Offline
Joined: 20th Jan 2003
Location:
Posted: 10th Feb 2003 14:08
first off, no way to stop that from going thru a wall. yes it does, after that bullet object hitted a wall, you have to make the collision not be checked anymore (don't know if this sentence was good english)

trager
21
Years of Service
User Offline
Joined: 5th Feb 2003
Location: United Kingdom
Posted: 10th Feb 2003 14:38
Check the code snippets section look for a post called collision test tutorial it demonstrates instantaneous collision detection between 2 objects regardless of speed.

For simplicity its 2D but you could easily tweak it for 3D

QuothTheRaven
21
Years of Service
User Offline
Joined: 2nd Oct 2002
Location: United States
Posted: 10th Feb 2003 15:25
trager that code is only for one wall that you know the position of. Obviously there will be many objects that need collision checking in my game, so sadly that code snipit does not help.

and while killersponge's english makes me angry, looking into the line of sight examples may be quite helpful...
trager
21
Years of Service
User Offline
Joined: 5th Feb 2003
Location: United Kingdom
Posted: 10th Feb 2003 16:17
yup static line of site function is probably easier to code although that snippet will work with multiple walls its a dang site harder to code, probably a hell of a lot quicker though.

freak
21
Years of Service
User Offline
Joined: 20th Jan 2003
Location:
Posted: 10th Feb 2003 18:47
if you give all your player objects for example object nrs between 100 and 199, then you have check collision with these, until there's collision with another object that's not in that range

Login to post a reply

Server time is: 2024-05-18 15:45:22
Your offset time is: 2024-05-18 15:45:22