Player-Tile collision in ES

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
User avatar
Bullet Pulse
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 89
Joined: Sun Feb 21, 2010 6:25 pm

Player-Tile collision in ES

Post 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-)
Image
User avatar
hurstshifter
ES Beta Backer
ES Beta Backer
Posts: 713
Joined: Mon Jun 08, 2009 8:33 pm
Favorite Gaming Platforms: SNES
Programming Language of Choice: C/++
Location: Boston, MA
Contact:

Re: Player-Tile collision in ES

Post by hurstshifter »

MAGIC
"Time is an illusion. Lunchtime, doubly so."
http://www.thenerdnight.com
User avatar
LeonBlade
Chaos Rift Demigod
Chaos Rift Demigod
Posts: 1314
Joined: Thu Jan 22, 2009 12:22 am
Current Project: Trying to make my first engine in C++ using OGL
Favorite Gaming Platforms: PS3
Programming Language of Choice: C++
Location: Blossvale, NY

Re: Player-Tile collision in ES

Post by LeonBlade »

Image
There's no place like ~/
User avatar
EccentricDuck
Chaos Rift Junior
Chaos Rift Junior
Posts: 305
Joined: Sun Feb 21, 2010 11:18 pm
Current Project: Isometric "2.5D" Airship Game
Favorite Gaming Platforms: PS2, SNES, GBA, PC
Programming Language of Choice: C#, Python, JScript
Location: Edmonton, Alberta

Re: Player-Tile collision in ES

Post 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).
User avatar
Ginto8
ES Beta Backer
ES Beta Backer
Posts: 1064
Joined: Tue Jan 06, 2009 4:12 pm
Programming Language of Choice: C/C++, Java

Re: Player-Tile collision in ES

Post by Ginto8 »

they probably calculate the vertices and determine which collision tiles the quad overlaps, then can determine if it's colliding.
Quit procrastinating and make something awesome.
Ducky wrote:Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.
User avatar
Arce
Jealous Self-Righteous Prick
Jealous Self-Righteous Prick
Posts: 2153
Joined: Mon Jul 10, 2006 9:29 pm

Re: Player-Tile collision in ES

Post 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:
<qpHalcy0n> decided to paint the office, now i'm high and my hands hurt
User avatar
Trask
ES Beta Backer
ES Beta Backer
Posts: 738
Joined: Wed Oct 29, 2008 8:17 pm
Current Project: Building a 2D Engine
Favorite Gaming Platforms: Sega Genesis and Xbox 360
Programming Language of Choice: C/C++
Location: Pittsburgh, PA
Contact:

Re: Player-Tile collision in ES

Post 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?
MarauderIIC wrote:You know those people that are like "CHECK IT OUT I just made Linux run on this piece of celery [or other random object]!!"? Yeah, that's Falco, but with ES.
Dear god, they actually ported ES to a piece of celery!
Martin Golding wrote: "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Re: Player-Tile collision in ES

Post 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.
User avatar
Arce
Jealous Self-Righteous Prick
Jealous Self-Righteous Prick
Posts: 2153
Joined: Mon Jul 10, 2006 9:29 pm

Re: Player-Tile collision in ES

Post 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.
<qpHalcy0n> decided to paint the office, now i'm high and my hands hurt
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Re: Player-Tile collision in ES

Post 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.
User avatar
Arce
Jealous Self-Righteous Prick
Jealous Self-Righteous Prick
Posts: 2153
Joined: Mon Jul 10, 2006 9:29 pm

Re: Player-Tile collision in ES

Post by Arce »

Gross. >.<
<qpHalcy0n> decided to paint the office, now i'm high and my hands hurt
User avatar
avansc
Respected Programmer
Respected Programmer
Posts: 1708
Joined: Sun Nov 02, 2008 6:29 pm

Re: Player-Tile collision in ES

Post by avansc »

falco, can more than one object occupy a tile at any given time?
Some person, "I have a black belt in karate"
Dad, "Yea well I have a fan belt in street fighting"
Post Reply