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 / Bullethole theory

Author
Message
M00NSHiNE
21
Years of Service
User Offline
Joined: 4th Aug 2003
Location: England, UK
Posted: 7th Aug 2003 22:53
Is it possible that, like in the jetski and tank demos, you could get the points of two ends of a plain object (with a bullethole/blood splat texture) and rotate it so it lies at perfectly the same angle as the matrix tile? Would this work on static objects i.e. is there some way of doing it?

Also, should I use a matrix or static objects to make ceilings?

FPS game, all DBC v1.13
"It's amazin' what you can do with a computer and access to t'internet"
UnderLord
21
Years of Service
User Offline
Joined: 2nd Aug 2003
Location:
Posted: 7th Aug 2003 23:32
ou could use a textured object to make a ceiling but i don't think you'd want to use a matrix to make a ceiling

http://www.freewebs.com/independant
Hell IVIonkey
22
Years of Service
User Offline
Joined: 1st Apr 2003
Location: Outer Limits
Posted: 8th Aug 2003 01:15
The only way I can think of doing it is by getting dy/dx and dy/dz and thus finding the angles you need to rotate about the x and z coordinates. This could be done by GET GROUND HEIGHT an increment (perhaps .01 units) in the x and z directions, then finding the slopes between the bullet-impact coords and these new coords.

Hell IVIonkey
22
Years of Service
User Offline
Joined: 1st Apr 2003
Location: Outer Limits
Posted: 8th Aug 2003 02:42 Edited at: 8th Aug 2003 02:43
I discourage static object usage. On many video cards, they don't work correctly, create funny scanlines across the screen, and actually slow the game down.

M00NSHiNE
21
Years of Service
User Offline
Joined: 4th Aug 2003
Location: England, UK
Posted: 8th Aug 2003 12:12
What should be used as an alternative for scenery? Normal obects?

"It's amazin' what you can do with a computer and access to t'internet"
Hell IVIonkey
22
Years of Service
User Offline
Joined: 1st Apr 2003
Location: Outer Limits
Posted: 8th Aug 2003 12:15
Sure. Just don't use the DB collision commands (they're incredibly slow), but rather mathematical collision tests.

M00NSHiNE
21
Years of Service
User Offline
Joined: 4th Aug 2003
Location: England, UK
Posted: 8th Aug 2003 12:18
My next thing to find out is how to actually do maths collision - I need an example from somewhere to kick me off. I've just woke up and my eyes are hurting and I keep hitting the wrong keys.

"It's amazin' what you can do with a computer and access to t'internet"
Hell IVIonkey
22
Years of Service
User Offline
Joined: 1st Apr 2003
Location: Outer Limits
Posted: 8th Aug 2003 12:28
sounds good...

Here's for a simple cylinder test (3d distance formula).

dist_squared = (x1-x2)^2 + (y1-y2)^2 + (z1-z2)^2
IF dist_squared < (object_radius)^2 THEN do your collision repositioning.

The reason I don't take the squareroot is because it's slow when done every game cycle on several objects.

Post again if this isn't specific enough and you'd like to see real code, or if you need help graduating to cylinder, box/rectangle, and hollowed cylinder/box/sphere tests. If you're lucky, I can demonstrate ellipses and toruses, or just about anything considered primitive for that matter...

M00NSHiNE
21
Years of Service
User Offline
Joined: 4th Aug 2003
Location: England, UK
Posted: 8th Aug 2003 12:33
Thanks....kepp going if you can, the more I learn the better.

"It's amazin' what you can do with a computer and access to t'internet"
Hell IVIonkey
22
Years of Service
User Offline
Joined: 1st Apr 2003
Location: Outer Limits
Posted: 8th Aug 2003 12:35
First, were you able to implement the sphere test successfully? I don't wanna get to far ahead if it's not working. Also, ellipses and true toruses will take a lot of brainpower, so if you don't actually need them in your game...

M00NSHiNE
21
Years of Service
User Offline
Joined: 4th Aug 2003
Location: England, UK
Posted: 8th Aug 2003 12:37
I just need some basic box maths collision - ill figure out how to implement it later on

"It's amazin' what you can do with a computer and access to t'internet"
Hell IVIonkey
22
Years of Service
User Offline
Joined: 1st Apr 2003
Location: Outer Limits
Posted: 8th Aug 2003 12:46 Edited at: 8th Aug 2003 12:47
Disclaimer: I'm doing tests assuming that the player is an infinately small point yet the object has mass. This can be modified if you do several tests at different locations on the player (like at all vertices).

Box:
predefine the box depth#, width#, and height# values.
px#,py#,pz# - player x,y,z
ox#,oy#,oz# - object x,y,z

This can also be expanded to test each axis independently so that you can implement snap-to and/or sliding collision.

M00NSHiNE
21
Years of Service
User Offline
Joined: 4th Aug 2003
Location: England, UK
Posted: 8th Aug 2003 13:03
Thankyou very much Hell IVMonkey, youve been a big help.

BTW, that 'all vertices' test you mentioned sounds intriguing. Is that possible in DBC?

"It's amazin' what you can do with a computer and access to t'internet"
Hell IVIonkey
22
Years of Service
User Offline
Joined: 1st Apr 2003
Location: Outer Limits
Posted: 8th Aug 2003 13:09
Sure thing.

I don't see why not. After all, a vertex is just 3 coordinates. If you can test collision from the player's origin, you can surely test collision on offset locations from his origin (like a vertex).

Mentor
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 8th Aug 2003 13:33
if you have classic DB then the caverun example demonstrates how to use a matrix as a roof, the cave is made from 2 matrixes joined along the opposite edges and scrolled endlessly, bullet splash on a matrix is possible since you can get the heights of the corners of the tile and calculate the angle from that, you could also make up a level from plains joined together like tiles and store the angles of each and every plain in a matrix, that would also allow you to calculate slide collision quickly, your levels would be boxy but you could break up the monotony by placeing objects at differing angles, look at most of the original tombraider levels, they look ok and yet they are all boxes, good level design accounts for a lot when it comes to looks in a game.

Mentor.

Login to post a reply

Server time is: 2025-05-20 04:48:36
Your offset time is: 2025-05-20 04:48:36