Player-Tile collision in ES
Moderator: Coders of Rage
- Bullet Pulse
- Chaos Rift Cool Newbie
- Posts: 89
- Joined: Sun Feb 21, 2010 6:25 pm
Player-Tile collision in ES
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
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
- hurstshifter
- 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
MAGIC
"Time is an illusion. Lunchtime, doubly so."
http://www.thenerdnight.com
http://www.thenerdnight.com
- LeonBlade
- 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
There's no place like ~/
- EccentricDuck
- 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
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).
- Ginto8
- 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
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.
Re: Player-Tile collision in ES
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.
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.
<qpHalcy0n> decided to paint the office, now i'm high and my hands hurt
- Trask
- 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
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.
Geez ES community, wasn't it obvious?
Dear god, they actually ported ES to a piece of celery!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.
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."
- Falco Girgis
- 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
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.Arce wrote:and from here we just plug and chug points into our collision array in O(1) time
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.
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.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).
Re: Player-Tile collision in ES
Obviously somebody missed the sarcasm.
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-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
- Falco Girgis
- 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
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
Gross. >.<
<qpHalcy0n> decided to paint the office, now i'm high and my hands hurt
Re: Player-Tile collision in ES
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"
Dad, "Yea well I have a fan belt in street fighting"