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 / BSP and Object collision help needed

Author
Message
AndyUK
23
Years of Service
User Offline
Joined: 2nd Apr 2003
Location: United Kingdom
Posted: 8th Apr 2003 00:15
hi guys(and gals) i have a good control system for navigating bsp's but i want to go that one step further and be able to "walk" on the bsp. Is there a set way to this or can someone please give me some pointers, i have no idea and not enough info on the bsp commands to even attempt anything. Im not asking for code, just the commands i would need to use and the theory behind it. thanx guys. oh and by the way, without this forum i wouldnt have been able to do what i have so far...great help
| P4 2.4(533) | 512DDR(333) | GF4Ti4200 64MB | WinXP Home Sp1 | Cup of CoffeE |
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 8th Apr 2003 01:24
There are two ways I know of to do this:

1) Set camera collision on, and move the camera down a bit. With the collision on, the BSP will not allow the camera to move through the floor. This is the way most people do it, and it's easy to do.

2) Create a small plain object with collision set on, and move it down a large amount. Where it stops is the floor, and you just have to add your camera radius to its y value to position the camera.

The actual benefit of using 2) is that it's just the standard line-of-site function that you see posted everywhere! If the value is too different, you can use a falling routine to move you downwards until you hit the floor.
AndyUK
23
Years of Service
User Offline
Joined: 2nd Apr 2003
Location: United Kingdom
Posted: 8th Apr 2003 05:25
ok in my game i have created a box wich i control with mouse and keys.. and basically tell the camera to follow the box which works fine. How can i get the box to "walk" along the floor, basically detecting the floor and not fall through it. probably simple but i dont know the theory behind the collison detection commands or how to use them.

| P4 2.4(533) | 512DDR(333) | GF4Ti4200 64MB | WinXP Home Sp1 | Cup of CoffeE |
AndyUK
23
Years of Service
User Offline
Joined: 2nd Apr 2003
Location: United Kingdom
Posted: 8th Apr 2003 17:14
ok.. all done i figured it with 1 command and it works lovely.. i can now run around my bsp with sliding collision. time to start designing a game woohoo!!

| P4 2.4(533) | 512DDR(333) | GF4Ti4200 64MB | WinXP Home Sp1 | Cup of CoffeE |
Rob K
Retired Moderator
23
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 8th Apr 2003 20:04 Edited at: 8th Apr 2003 20:09
@ZooT

Beware of a few problems with the current collision system. With "Small Walls", eg steps on stairs and balconys or raised ledges, the collision doesn't work properly if you approach them at an angle of between about 30 to 60 degrees and you can walk through them, whatever the collision threshold is set to. Mike is working on this for P5 (I sent him a nice 5 page document detailing all the BSP faults I could find, so hopefully it will be fixed).

I guess you are making an FPS?

Just a few pointers on where to head next:

1) If you need bullet collision with people, make the bullet object, move it slowly in the direction it has been fired until it collides with bad guy or the BSP walls. Alternatively, use the INTERSECT OBJECT command, which can check if a line in 3D space goes through or touches a 3D object.

2) If you need AI, I suggest that you check the code archives on www.blitzbasic.com , as they have examples of various methods there [Blitz3D has been around longer so there are more user-written tutorials available]

3) There are a few animation bugs that you will have to be wary of in the demo if you plan to include bad-guys, but that is probably not too important in making a first game.

Hope this is useful info

Current Project: Retro Compo. Entry.
AndyUK
23
Years of Service
User Offline
Joined: 2nd Apr 2003
Location: United Kingdom
Posted: 8th Apr 2003 22:26 Edited at: 8th Apr 2003 22:27
cheers rob, just discovered the "small walls" problem and thought it was something to do with the creation of my particular bsp.. now that i have you here.. i have a small problem. How do i introduce gravity to hold the player on the ground and now that i think about it, how will a player automatically be able to walk up some steps? i know i might sound demanding at times and i do ask alot of questions but im really getting into this stuff.. by the way, i wont need and ai because im doing a multiplayer only game and yep your right its a fps. cheers m8

| P4 2.4(533) | 512DDR(333) | GF4Ti4200 64MB | WinXP Home Sp1 | Cup of CoffeE |
Rob K
Retired Moderator
23
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 8th Apr 2003 23:57
ZooT, to do gravity, you basically reduce the player's Y (vertical) position every frame UNLESS he is on the ground, this is a cheap hack but it works. When the player jumps, you disable the effect until he reaches the peak of his jump.

As for steps... as long as you set the collision threshold at the correct level (eg. 0.00001 should be OK), the player can automatically walk up steps. However when using SET BSP CAMERA COLLISION, the response flag must be set to 0.

ie:

"set bsp camera collision 1, 0, 1, 0
set bsp collision threshhold 1, 0.00001"

DBP automatically caters for stairs. However, be warned that there is a possibility using this that if you are not going forwards when you go up the stairs, the player will automatically walk backwards down the stairs, if you compare the collision for the last frame, with the collision for this frame then you can avoid this.

Current Project: Retro Compo. Entry.
AndyUK
23
Years of Service
User Offline
Joined: 2nd Apr 2003
Location: United Kingdom
Posted: 9th Apr 2003 03:46
i really need a proper description of these comands with examples... at the moment im doing all this blind.. very frustrating

| P4 2.4(533) | 512DDR(333) | GF4Ti4200 64MB | WinXP Home Sp1 | Cup of CoffeE |
Rob K
Retired Moderator
23
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 9th Apr 2003 19:23
Hmm, ZooT, get your email address to show up under your profile and I can email you an example program which should help.

BTW. Does the demo come with full help files or not?

Current Project: Retro Compo. Entry.
AndyUK
23
Years of Service
User Offline
Joined: 2nd Apr 2003
Location: United Kingdom
Posted: 9th Apr 2003 20:42
the demos help is VERY limited.. no examples and a brief explanation of the commands.. which i cannot make heads or tails of..

my email is [email protected]

thanx

| P4 2.4(533) | 512DDR(333) | GF4Ti4200 64MB | WinXP Home Sp1 | Cup of CoffeE |
Rob K
Retired Moderator
23
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 10th Apr 2003 23:42
The help in the real thing doesn't include any more in depth info for the commands but there is one example per command area (ie. CORE,DISPLAY,2D,SPRITES)

Current Project: Retro Compo. Entry.
Rob K
Retired Moderator
23
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 11th Apr 2003 00:02
@ZooT

Here is the source for it, but the code works fine and I am sure that you can adapt it.

Current Project: Retro Compo. Entry.
AndyUK
23
Years of Service
User Offline
Joined: 2nd Apr 2003
Location: United Kingdom
Posted: 12th Apr 2003 05:13
where?

| P4 2.4(533) | 512DDR(333) | GF4Ti4200 64MB | WinXP Home Sp1 | Cup of CoffeE |
Chenak
23
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United Kingdom
Posted: 12th Apr 2003 14:38
the source button next to the profile, www, email etc buttons lol

Once you start down the Dark Path, forever will it dominate your destiny...
AndyUK
23
Years of Service
User Offline
Joined: 2nd Apr 2003
Location: United Kingdom
Posted: 12th Apr 2003 16:25
lol cheers m8

| P4 2.4(533) | 512DDR(333) | GF4Ti4200 64MB | WinXP Home Sp1 | Cup of CoffeE |
Kangaroo2
23
Years of Service
User Offline
Joined: 26th Sep 2002
Location: United Kingdom
Posted: 14th Apr 2003 13:09
Rob K - Nice Complete Example, your code is set out well

Coming Soon! Kangaroo2 Studio... wait and quiver with anticipation! lol
[email protected] - http://www.kangaroo2.com - If the apocalypse comes, email me

Login to post a reply

Server time is: 2026-07-10 21:40:21
Your offset time is: 2026-07-10 21:40:21