Platform Physics

Discussion and feedback on Construct 2

Post » Tue Sep 27, 2011 6:11 pm

Here's what seems to be the best way to do full physics platform movement :

http://amazingretardo.simiansoftwerks.com/2010/02/17/platformer-character-control-farseer-physics-engine/

I couldn't reproduce it in Construct though :(

From what it says it is able to reproduce a mario style movement at some extent. It also auto rotates the character on slopes. But it uses some features that i think C2 doesn't have yet.

Kiyoshi2011-09-27 18:14:57
B
58
S
13
G
10
Posts: 632
Reputation: 12,505

Post » Sun Oct 30, 2011 12:31 pm

Yeah... What the physics behavior is missing is the fixed angle and angle joints. A Revolute Joint keeps the two objects together and the circle spinning, but the rectangle keeps falling over.

Just add those two joints, and this would be a piece of cake to implement, I think.
B
94
S
37
G
11
Posts: 404
Reputation: 11,275

Post » Sun Oct 30, 2011 5:26 pm

You can make it in C2, just instead of using a fixed angle joint set the box property "prevent rotation" to yes.
You can then apply a torque to the wheel or a force to box, or even both.

example
Scirra Employee
B
129
S
45
G
15
Posts: 705
Reputation: 15,413

Post » Mon Oct 31, 2011 4:45 am

Ah, I can see how it works, and it works quite well, that is, if you don't plan on having the box rotate on slopes. Right now, it can't really do that, which prevents it from being able to do stuff like, say, Sonic-style loops.
B
94
S
37
G
11
Posts: 404
Reputation: 11,275

Post » Mon Oct 31, 2011 2:09 pm

My example doesn't do that, but it's possible to implement it.
You can change the box angle according to the angle of the ground and you will have it. The tricky part is detect the angle, but is totally doable.

Edit: I updated my example with a simple angle detection, but currently only works for ground.Animmaniac2011-10-31 14:19:16
Scirra Employee
B
129
S
45
G
15
Posts: 705
Reputation: 15,413

Post » Mon Oct 31, 2011 2:28 pm

Oh wow. /bookmarked
B
28
S
7
G
7
Posts: 102
Reputation: 6,483

Post » Mon Oct 31, 2011 2:40 pm

Here is a half sonic loop example:

Loop Example

The ideal would be to create an angle detection algorithm that doesn't depend on the angle of the objects but just it's collision polygon, so the player can interact with other physics objects too.
Scirra Employee
B
129
S
45
G
15
Posts: 705
Reputation: 15,413

Post » Mon Oct 31, 2011 3:41 pm

Nice example. But the idea is to make his movement as "Mario Style" as possible. So the movement "damping" must be high. I don't know what other paramaters to tweak though.
B
58
S
13
G
10
Posts: 632
Reputation: 12,505

Post » Mon Oct 31, 2011 4:26 pm

Well, the current angle detection system is fairly rudimentary, it doesn't work with certain tiles. I know a method, but I can't implement it right now.

Anyway. It seems clear to me that there are a couple of features missing to make a fully-featured Mario/Sonic style platformer:

- Families (duh!)
- Using events to selectively choose what a certain physics object can collide with or pass through, such as platforms, or how Sonic games use a 'gate' method for loops, with one half of the loop being completely solid to the player and the other half being non-solid, and they switch states as the player passes through.
B
94
S
37
G
11
Posts: 404
Reputation: 11,275

Post » Mon Oct 31, 2011 5:12 pm

[QUOTE=Kiyoshi] Nice example. But the idea is to make his movement as "Mario Style" as possible. So the movement "damping" must be high. I don't know what other paramaters to tweak though.[/QUOTE]
Just make an event to apply an opposite force whenever the move keys are not pressed. If you apply the whole opposite force it will stop instantly, if you want a smooth damping multiply it by a float between 0 and 1 before applying.

[QUOTE=Candescence]
Anyway. It seems clear to me that there are a couple of features missing to make a fully-featured Mario/Sonic style platformer:

- Families (duh!)
- Using events to selectively choose what a certain physics object can collide with or pass through...[/QUOTE]
You mean a (physics based) platformer, and that's not totally true.
Families is obviously an extremely useful feature for any game, but it's certainly possible to make things work without it, it's just more labor intensive.

In the same way it's possible to make a "loop gate". It would be really handy to have an action to activate and deactivate physics from an object through events, or even have selective collisions, but for now you can make an event to set the physics to "immovable" and move the "gate object" to another position. You can then place an identical object below the "gate" so nobody will perceive any visual difference.

Again, it's already doable, although it would be really nice to have some features to better support it.Animmaniac2011-10-31 17:14:35
Scirra Employee
B
129
S
45
G
15
Posts: 705
Reputation: 15,413

Next

Return to Construct 2 General

Who is online

Users browsing this forum: anty21ro, mystazsea, nimos100 and 10 guests