Page 1 of 1

Player-Tile collision in ES

Posted: Mon Apr 26, 2010 7:04 pm
by Bullet Pulse
How does the player and tile collision work in Elysian Shadows?

To be more specific:
Does the game check the next move in the current direction of the player to see if there is a solid tile there?
Or does it use bounding box collision to check if the player is touching a solid tile and then push the player off of the tile if it is?

Thanks 8-)

Re: Player-Tile collision in ES

Posted: Mon Apr 26, 2010 9:31 pm
by hurstshifter
MAGIC

Re: Player-Tile collision in ES

Posted: Tue Apr 27, 2010 1:44 am
by LeonBlade
Image

Re: Player-Tile collision in ES

Posted: Tue Apr 27, 2010 2:39 am
by EccentricDuck
I think that Kendal talked about this in the first Elysian Shadows Revolution series of videos. They use the separating axis theorem (which I couldn't do justice without going back and watching the video again).

Re: Player-Tile collision in ES

Posted: Tue Apr 27, 2010 5:47 am
by Ginto8
they probably calculate the vertices and determine which collision tiles the quad overlaps, then can determine if it's colliding.

Re: Player-Tile collision in ES

Posted: Tue Apr 27, 2010 11:25 am
by Arce
Huh? No, it's got nothing to do with the SAT. It's much simpler than that.

We simply use Bézier curves to approximate a velocity tangent, then, using an Euler's Method derivative, project a ray with a magnitude of the player's speed and a step-size less than our tile dimensions centered around the player's local x,y, and compare each point to our collision array, and do the same except with a ray perpendicular at every stepsize with a magnitude of the player's height. This effectively gives us a collision grid in front of the player with a fairly close approximation of the result of his velocity deltas, and from here we just plug and chug points into our collision array in O(1) time, to receive a list of collisions points in the form of array index x,y. We can feed this list back to the physics system and calculate a new curve based on the result of the collision.

:lol:

Re: Player-Tile collision in ES

Posted: Tue Apr 27, 2010 11:28 am
by Trask
Arce wrote:Huh? No, it's got nothing to do with the SAT. It's much simpler than that.

We simply use Bézier curves to approximate a velocity tangent, then, using an Euler's Method derivative, project a ray with a magnitude of the player's speed and a step-size less than our tile dimensions centered around the player's local x,y, and compare each point to our collision array, and do the same except with a ray perpendicular at every stepsize with a magnitude of the player's height. This effectively gives us a collision grid in front of the player with a fairly close approximation of the result of his velocity deltas, and from here we just plug and chug points into our collision array in O(1) time, to receive a list of collisions points in the form of array index x,y. We can feed this list back to the physics system and calculate a new curve based on the result of the collision.

:lol:

:shock:

Geez ES community, wasn't it obvious?

Re: Player-Tile collision in ES

Posted: Tue Apr 27, 2010 11:54 am
by Falco Girgis
Arce wrote:and from here we just plug and chug points into our collision array in O(1) time
I hope you realize how dumb that sounds. Yes, we are ACCESSING the array in O(1) time, but the fact that we're "iterating" through points in an array to plug into that implies O(N) time, scrub.

Actually, we haven't even quite implemented this. It is a pretty INCREDIBLY hard problem when you think about it. This isn't a simple axis-aligned bounding box that we can test points on to see if they are within a solid tile. We have oriented bounding boxes who potentially have an infinite number of points along their edges that must be tested to see if they are occupying a solid tile.
EccentricDuck wrote:I think that Kendal talked about this in the first Elysian Shadows Revolution series of videos. They use the separating axis theorem (which I couldn't do justice without going back and watching the video again).
That's for free entity vs entity collision. The problem of checking an oriented bounding body against its surrounding array of tiles is MUCH harder. Our current potential solution is basically dynamically turning the surrounding tiles into oriented bounding boxes, iterating through them, and determining collision via the SAT. Very, very expensive. I'm still working on a good solution.

Re: Player-Tile collision in ES

Posted: Tue Apr 27, 2010 12:04 pm
by Arce
Obviously somebody missed the sarcasm. :lol:

Re-read what i said--you'll find that I'm as full of shit as I am myself.

Anyway, as Gryo said. It's pretty damned complicated. I've got some theories as to how we may go about this, but not much more.

Re: Player-Tile collision in ES

Posted: Tue Apr 27, 2010 12:10 pm
by Falco Girgis
I've gone so far as to consider writing an assembly optimized bresenham line function to populate a list of points in world-space to generate a tile list from. Even then, those tiles have to become OBBs themselves for the collision check. Not cute.

Re: Player-Tile collision in ES

Posted: Tue Apr 27, 2010 12:17 pm
by Arce
Gross. >.<

Re: Player-Tile collision in ES

Posted: Tue Apr 27, 2010 12:20 pm
by avansc
falco, can more than one object occupy a tile at any given time?