Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(3 edits) (+1)

I think I wanted to write about it just forgot 

anyway from what I know Quake is using the BSP for all world collisions
and their trick is to extrude the walls and floors inwards
the advantage is this makes collision very elegant (simple and fast): point to plane collisions for all world collision (no worry about triangles)

and the disadvantage is they need to store multiple copy of the level (e.g. one for bullets-unextruded, one for humans, one for big stuff like shamblers )

and I think this what they mean by the Minkowski geo thing  (I'm not sure about this but I think it refers to adding the volume of one object to another and changing it to a point to object test - something like that)


I'm afraid Zortch is not this sophisticated or elegant: there is a large triangle soup and it's sorted onto a 2D grid  and it's mostly sphere to triangle and line to triangle test
(and characters do a cylinder to cylinder test against each other)
it's quite a complicated mess, I prepared some slides that might explain it better:

there are also many edge cases: a character might stand on another, a character might stand on another
that is travelling on a conveyor belt or mover ..  and so you can only stack crates the moving creatures
will drop you off


it's a complicated thing - there are seperate item classes for items affected by gravity,
ones that stay put and ones floating in air etc.


this made thin enemies very hard to hit - the female guards use slightly bigger OBB than needed
(also all heads use a bigger radius - where there is a head that is)
and of course some bones are marked to not to be hit at all
and I forgot to mention on the slide: the AABB of the character is fixed and not affected by the 3D models box
(usually smaller than the character)


another trick is that the sphere to triangle test needs to be done multiple times
because the new velocity might push the object into another triangle
(not to mention moving geometry also needs to be tested every time)

of course all this trouble is to climb stairs and small heights effortlessly
which sometimes works too well - you auto jump over any railing
there was also a problem with slopes - with sphere collison you get 'free' sliding
but here it had to be hacked in based on the triangle normal

gibs and grenades use a simplified  method where it's only sphere against triangle


(there were problems with this of course: walls would often push out grenades before it could collide with them
so there are extra checks to see if the mover actually changed place etc)

in summary the collision system is a collection of hacks held together with prayer and glue

(+2)

I'm sorry it took me so long to respond but I really am thankful that you've written such a detailed reply!! It's interesting to see how youve approached it

no worries, I'm happy to answer all questions 👍

(+1)

Hi, mutantleg! Can you please tell in more detail what "linetest with radius" is? I tried to implement a linetest with floor-related triangles, like in Super Mario 64, but my character keeps failing in the "gaps" between the triangles... (perhaps this is a problem with the precision of floating-point numbers) How do you add radius accounting?

(1 edit) (+1)

sure, it's rather simple (in concept 😉):
- first you linetest against the plane the triangle is on (any point on the triangle and the triangles normal)
- then you have the point where you hit the plane
- and you need to find  the closest point on the triangle   to this point
- and then you measure the distance between these two points and if it's below the radius it's a hit

of course it can be done in a more sophisticated way by also doing a linetest for each vertex as if they were spheres etc.
and less sophisticated: just using more than one raycast to check for the floor

what tools are you using btw? would you like example code? 🤔

(+1)

Thank you very much!

would you like example code?

No, thanks, I understand the algorithm. It's very similar to the "sphere vs. triangle" test (which I've already implemented).

what tools are you using btw?

I'm currently doing some prototyping using Python/PyGame/PyOpenGL (but I'm newbie...).

Btw, why don't you use capsules? They're really popular for collision detection in games now.... 🤔

(+1)

I just find spheres easier to use for slopes and stairs (and the math is simpler)
for player movement they are perfect
I only got problems with the enemy code because they insist getting inside little holes 
- so for first person I found sphere to be better but  for third person capsule would be probably better 🤔