Difficulties in using chipmunk physics for sidescroller shoo
Posted: Sun Oct 19, 2008 8:16 pm
Hi!
I've tried to use chipmunk as the physics engine for a new (and old) project which tries to emulate the gameplay of Super Metroid. ( http://en.wikipedia.org/wiki/Super_Metroid , also has 2 screenshots) I hope some of you know the game, as then you'll recognize how important and perfect its gameplay was.
Unfortunately, i've run into quite a number of problems during the first few day of experimenting which I'm not really able to solve by myself.
1. The original map is split into square tiles with simple geometry per tile which makes it easy to adopt by making a CPBody out of each. Walking over such an array of blocks though leads to the player getting stuck or - when using a circular player shape - makes the player "jump" up occasionally. The game requires the player to be able to walk at really fast speeds (in the original it's visualized by having the player glow and drawing several shadows of itself behind it) and the faster the player goes, the worse the "jumping" gets. The problem was mentioned in another thread before and was said to result from the engine chosing the wrong collision axis. The other solution given (the first one being the circular player shape) involved reducing some slop-value in the source (don't remember the exact name), but that didn't help much either.
2. Somewhere it was recommended to implement player movement by setting the surface velocity. This was far to sluggish for me, so I'm now using surface velocity + setting normal velocity. When the player stops, I set surface velocity to 0, but again, it's far to slow. May i increase friction >1.0 or will i have to change velocity "by hand" once again?
3. Is there a way to make single objects unaffected by gravity? I'd like to have the "shoots" (mostly some kind of laser/plasma weapons) in my game to NOT follow a ballistic trajectory. Easiest way would be to increase speed to insane amounts but obviously that's not really an option.
4. Walking up slopes slows the player down, which is physically correct, of course. In the original game, though, the player was able to walk up 45° slopes with no speed loss at all. With chipmunk, the player "climbs" 1 or 2 tiles and slides back down then. Any idea how to fix this?
5. Walking down slopes (45°, again), makes the player run/jump forward, similar to walking over a cliff. This is physically nice, but i need it to player to stay on the ground and just walk further. (Changing impulse direction by 45° in an instant isn't exactly realistic for an object with mass, but there's no changing it)
I fear that keeping the player physics out of the physics engine and making it calculate just the environment and collisions may be the better choice over doing it in chipmunk as well. Is Chipmunk able to give predictions for collisons and minimum distances to objects in a given direction or does it only detect them when they've already happened?
Chipmunk, as the physics engine it is, is doing a great job nonetheless. It's super-fast and much fun to toy with. So many thanks for your work, slembcke!
Greetings, tuchs
I've tried to use chipmunk as the physics engine for a new (and old) project which tries to emulate the gameplay of Super Metroid. ( http://en.wikipedia.org/wiki/Super_Metroid , also has 2 screenshots) I hope some of you know the game, as then you'll recognize how important and perfect its gameplay was.
Unfortunately, i've run into quite a number of problems during the first few day of experimenting which I'm not really able to solve by myself.
1. The original map is split into square tiles with simple geometry per tile which makes it easy to adopt by making a CPBody out of each. Walking over such an array of blocks though leads to the player getting stuck or - when using a circular player shape - makes the player "jump" up occasionally. The game requires the player to be able to walk at really fast speeds (in the original it's visualized by having the player glow and drawing several shadows of itself behind it) and the faster the player goes, the worse the "jumping" gets. The problem was mentioned in another thread before and was said to result from the engine chosing the wrong collision axis. The other solution given (the first one being the circular player shape) involved reducing some slop-value in the source (don't remember the exact name), but that didn't help much either.
2. Somewhere it was recommended to implement player movement by setting the surface velocity. This was far to sluggish for me, so I'm now using surface velocity + setting normal velocity. When the player stops, I set surface velocity to 0, but again, it's far to slow. May i increase friction >1.0 or will i have to change velocity "by hand" once again?
3. Is there a way to make single objects unaffected by gravity? I'd like to have the "shoots" (mostly some kind of laser/plasma weapons) in my game to NOT follow a ballistic trajectory. Easiest way would be to increase speed to insane amounts but obviously that's not really an option.
4. Walking up slopes slows the player down, which is physically correct, of course. In the original game, though, the player was able to walk up 45° slopes with no speed loss at all. With chipmunk, the player "climbs" 1 or 2 tiles and slides back down then. Any idea how to fix this?
5. Walking down slopes (45°, again), makes the player run/jump forward, similar to walking over a cliff. This is physically nice, but i need it to player to stay on the ground and just walk further. (Changing impulse direction by 45° in an instant isn't exactly realistic for an object with mass, but there's no changing it)
I fear that keeping the player physics out of the physics engine and making it calculate just the environment and collisions may be the better choice over doing it in chipmunk as well. Is Chipmunk able to give predictions for collisons and minimum distances to objects in a given direction or does it only detect them when they've already happened?
Chipmunk, as the physics engine it is, is doing a great job nonetheless. It's super-fast and much fun to toy with. So many thanks for your work, slembcke!
Greetings, tuchs