Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411421 Posts in 69363 Topics- by 58416 Members - Latest Member: timothy feriandy

April 18, 2024, 01:35:15 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperDesignBalancing Controls / Feel (platformer)
Pages: [1] 2 3
Print
Author Topic: Balancing Controls / Feel (platformer)  (Read 17974 times)
Loren Schmidt
Level 10
*****



View Profile WWW
« on: November 23, 2008, 05:24:38 PM »

How do some of you folks approach your character movement?


I'm not a programmer, but recently I was faced with the task of cobbling together a movement system for a platformer I'm working on. It's a run and shoot affair, so the movement is more about dodging than acrobatics.

From left to right:
(1) When tapping the jump key, the player performs a small hop, suitable for jumping over mines or quickly dodging over a low projectile. When holding the jump key, the player performs a higher, though still fairly quick, long jump (~3/4 second).
(2) The player accelerates up to the maximum speed quickly, and friction with the ground is high. There is acceleration, but it's fairly toned down. (Max speed is 5 tiles / second.)
(3) Vertical jump distance is 2 tiles, horizontal is 3 tiles. It's possible to jump over pits 4 wide, but the game never requires it.

Air and ground speeds are the same (no bunny hopping).


So what sorts of movement have you used in your games? How did you decide on the final system? What are the technical details of your approach? One thing in particular that I struggled with was getting the variable jump height to work.

For clarity, I pre-emptively suggest that this thread not be about discussing the merits of accelerational versus non-accelerational character movement. This is all I have to say on that topic:
Logged
Laremere
Level 5
*****



View Profile
« Reply #1 on: November 23, 2008, 06:42:17 PM »

I just did acceleration on a small game I was working on, this is how I handled it:
(max_speed/current_speed)/acceleration_factor+current_speed=new_speed

What this does is that you quickly get close to your max speed, though the closer you get to the max speed, the slower you approach it.  There probably is a better way, but I don't know it, and this works fine for me.
Logged

If a tree falls in the forest and no one is around to hear it, is sound_tree_fall.play() called?

"Everything that is really great and inspiring is created by the individual who can labor in freedom."
-Albert Einstein
Loren Schmidt
Level 10
*****



View Profile WWW
« Reply #2 on: November 23, 2008, 07:44:34 PM »

Oh, that's neat. I was actually thinking about doing something similar. I thought it might work well during speed runs. How did that work out for you?

I ended up using a similar system for the jump in this game. The longer we hold the jump key, the higher we jump, but holding the jump key has less and less effect the higher we are. There are probably better ways of doing this, but here's what I did:


Gravity is constant. While moving upward, there is an upward boost that partly counters it. The higher we get, the lower the boost. While this makes the jump height very responsive, This has the odd side effect of making the fall faster than the ascent.

(for the technical minded, this is pretty steeply curved so the boost doesn't really peter out noticeably until the peak of the arc. In the code below, the power is 3, and jumpHeight is the distance from the ground.)
Code:
var attenuation = 1;
if (FADE_JUMP_ACCELERATION) {
attenuation = 1 - Math.pow((-jumpHeight
/ JUMP_ACCELERATION_HEIGHT), JUMP_ATTENUATION_POWER);
}
// trace("Jump acceleration Attenuation = " + attenuation);
speedY -= attenuation * JUMP_ACCELERATION / framerate;
Logged
jeb
Level 5
*****


Bling bling


View Profile WWW
« Reply #3 on: November 23, 2008, 11:59:45 PM »

A trick which thewreck taught me was that, if you need to use an impulse-based jump system, you can disable gravity to allow different jump heights.

In other words, when the jump key is pressed, you add/set a fixed amount of jump speed on the character. Then you disable gravity for the character as long as the player is keeping the jump key pressed (up to a certain amount of maximum time length).
Logged

JLJac
Level 10
*****



View Profile
« Reply #4 on: November 24, 2008, 01:00:15 AM »

I have never really liked those jump mechanics where you get higher the longer you hold down the button, because when you give the character a boost on the y-vector during the first phase of the jump you somewhat disturb the natural trajectory. I think the character should always move like this, no matter the height of the jump:


It's of course hard to follow that principle if you want to make the jump height variable. One possible way to do it is to make the character jump when you release the jump button, making the initial y-force depend on how long you have been holding it. Kind of making the player need to charge the jump before actually getting of the ground. This would also make an intresting feature when you leap over gaps, you would have to judge how long before the gap you need to start holding the button... Whoa, this really got me going *Making some sketches for a retro-style platformer*

Guess the good old upward-boosting system is a classic for a reason, you should stick with it if it feels good. But I don't think you should disable gravity, the player somehow feels that. It makes the world seem more solid if gravity is constantly working.

Ah, this might not be helpful at all, but since I've written it I might as well post it...
Good luck anyways
Logged
Loren Schmidt
Level 10
*****



View Profile WWW
« Reply #5 on: November 24, 2008, 02:19:57 AM »

That's a really good idea, Jeb, It sounds more flexible than the approach I used. I particularly like the idea of setting speed directly. If I do another pass on the movement I think I'll give that a shot. I think as long as gravity was only greatly reduced (instead of turned off altogether) it would still have a compelling heavy feel to it.

JLJac- that's a really intesting line of thought. You've got me thinking again about 'realistic' jump models- they're an interesting and underexplored alternative to the standard. I've never made anything with a that type of jumping in it, but it would be a fun project! (Actually I believe Cactus recently made something along these lines, but I haven't yet played it.) It occurs to me that you could achieve the same effect by having a longer than usual kick off animation, rather than a 'charge up' animation that preceds the jump. This animation could vary in length depending on how long the button was held down. This might work especially well if your character was some kind of rubbery spider thing.


Guess the good old upward-boosting system is a classic for a reason, you should stick with it if it feels good. But I don't think you should disable gravity, the player somehow feels that. It makes the world seem more solid if gravity is constantly working.
You're totally right about supernaturally detecting the lack of gravity. I actually ran into that only a few days ago. I was playing with the upward boost, and I realized that if it is too close to completely countering gravity it's very noticeable. It's as if the eye automatically reacts in some way to even the smallest amount of acceleration.

So in my current build, these are the constants:
horizontal speed limit (air and ground): 5
jump impulse: 6.5 tiles per second
jump boost strength: 40 tiles per second per second (decreases with height)
gravity: 43 tiles per second per second

So though this is by no means a natural parabola (+ air resistance), gravity is still perceptibly there throughout the jump.

Ah, this might not be helpful at all, but since I've written it I might as well post it...
Not at all! Thanks for your ideas, you gave me a lot to think about.

For the current project I'm working on, a more conventional jump is a good fit. So getting back to an arcade-style jump, here's another question:
Normally after jumping, the jump key is disabled to prevent pogo-sticking along the ground- but what if there was a slight grace period during the very end of a jump? What I'm imagining is we press the jump key slightly early, and instead of ignoring the keypress because we're in mid-air, it forgives us and triggers a jump as soon as we hit the ground.
Logged
Ishi
Pixelhead
Level 10
******


coffee&coding


View Profile WWW
« Reply #6 on: November 24, 2008, 04:13:10 AM »

I generally use a boost thingy for jumping also. There's an initial upwards velocity set when you first hit the jump key, then for a set period of time you get additional upwards acceleration. If you keep the boost period pretty small the trajectory will still be realistic for the most part, and usually the jump height can still be controlled pretty well by the player.

I personally wouldn't like jumping when the key is released, especially in an action game where it needs to be pretty much instinctive.
Logged

JLJac
Level 10
*****



View Profile
« Reply #7 on: November 24, 2008, 04:36:18 AM »

Yeah, that's a problem, there will be a little delay before the jump... But if you make it a part of the gameplay that you almost every time hold down the button for a little while it would propably feel more natural. It is also a bit more realistic, few creatures can jump in an instant, most have to spend some time lowering their body and bending their knees before they launch themselves into the air.

I like the thought of making the character bend his legs while "charging" a jump. Propably you could make him crouch lower and lower the more powered the jump is. Only problem is to make the walk cycle work at the same time Huh?

I also liked the rubbery spiderish kind of thing, liked in fact so much it inspired me to this concept art of Extraterrestial Neon Cave of Glowing Creatures, an upcoming project I will never even begin to work on :D



Have also thought about that early input idea. Maybe you could create a five frame countdown when you press the jump button in midair, and if the character hits the floor within this time he jumps instantly again? Would be great for a time-trial platformer Smiley The player would be able to just float around the levels, never standing on the obstacles but only touching them the slightest of time with his feet, crouching tiger hidden dragon-style Cool
Logged
Farbs
Man
Level 10
*


/Farbs


View Profile WWW
« Reply #8 on: November 24, 2008, 06:38:33 AM »

For Mario in ROM CHECK FAIL I did pretty much what jeb and Ishi are suggesting. I used a different gravity constant while moving upwards if the player was holding the jump button. It may not be the effect you're after, but it was as "Mario" feeling as I could get it.
Logged
Loren Schmidt
Level 10
*****



View Profile WWW
« Reply #9 on: November 24, 2008, 06:42:04 PM »

I feel like there are many different movement systems possible. It's not so much a question of which are better as what sort of game each would fit best. Some kinds of movement demand more concentration than others.

A good example of this is Lunar Lander. Lunar lander is a game about mastering the player movement, with no combat or extra goals at all. A more extreme case is the control scheme in QWOP. The QWOP controls are fun, but wouldn't really work in a game that wasn't about the control scheme.


JLJac-
In Freethinker (or in heavily physics-based games in general), are you finding that you tend to avoid hacks like the boost / gravity reduction idea? I could see it potentially working better if everything is more self-consistent. Bonus points for the random inspired concept art! I kind of have a thing for rubbery spider creatures.

Have also thought about that early input idea. Maybe you could create a five frame countdown when you press the jump button in midair, and if the character hits the floor within this time he jumps instantly again? Would be great for a time-trial platformer Smiley The player would be able to just float around the levels, never standing on the obstacles but only touching them the slightest of time with his feet, crouching tiger hidden dragon-style Cool
I'll give this a shot today, and post back here with results. I think it would work well for fast, unrealistic arcade style gameplay.

Farbs, Ishi- It seems like everyone is using the same system!

P.S.- Farbs, I tried to play Polychromatic Funk monkey, and I ran into an error. I PM'ed you about it.
Logged
Loren Schmidt
Level 10
*****



View Profile WWW
« Reply #10 on: November 25, 2008, 12:54:30 AM »

Update:
I added a bit of forgiveness to the jump key timing in my current project (1/10 of a second), and it seems to be working. It makes a big difference when doing a series of precise jumps. In these situations it makes the controls feel much more responsive.


One thing that's always interested me is the way movement + jump physics vary from game to game. For instance (units are in tiles)-

Mario (Super Mario World)*
character height: 1 (small), 2 (big)
hold button to jump higher
jump height: ~3 - 4
running jump height: 5
jump length (running): ~15
run speed: ~17 / second?
air time: ~.8 seconds
movement accelerational, turnaround time fairly high, long skids possible.
acceleration: unknown

Cave Story
character height: 1
hold button to jump higher
jump height: 1.5 - 3
jump length (running): 6
run speed: ~7 / second
air time: ~1.3 seconds
movement accelerational, turnaround time extremely low, no skidding to speak of
acceleration: unknown

If anyone would like to post stats for a game they made, I'm sure it would be interesting to compare. I'll start:

Untitled Project:
character height: .5
hold button to jump higher
jump height: 0.75 - 2.1
jump length (running): 4
run speed: 5
air time: .76 seconds
movement accelerational, though speed caps out very quickly
acceleration: 32


* Mario also seems to have some extremely weird special jump physics that only kick in when falling quickly, but I'm leaving that out.
Logged
JLJac
Level 10
*****



View Profile
« Reply #11 on: November 25, 2008, 12:58:28 AM »

Haha, I don't think the people who made spore knew they where working on a CA-tool rather than a game  :D

Maybe you have a good point there, Ishi. If the boost phase is only 5-7 frames after the takeoff you would get a mostly realistic path of trajectory, but still the player would be able to choose from 5 different jump heights, depending on in wich of those frames he releases the button. Might be interersting Huh?

Sparky, I like this idea more and more. I saw that you somewhere posted some suggestions for exploding platforms, and if you implement the "early input jump" in your game you could maybe make other platforms that explode instantly if you stand on them, but don't explode at all if you only touch them one frame when jumping with an early input.

Or even better, make the character able to run/jump on water or lava surfaces he would otherwise sink through, because he never actually collides with the surface, since he already have jumped off of it when he hits it... You get what I mean?

You could make whole levels without any real platforms, where you have to run and jump like crazy without rest for 40 seconds in a row Evil
Logged
Loren Schmidt
Level 10
*****



View Profile WWW
« Reply #12 on: November 25, 2008, 04:34:47 PM »

Maybe you have a good point there, Ishi. If the boost phase is only 5-7 frames after the takeoff you would get a mostly realistic path of trajectory, but still the player would be able to choose from 5 different jump heights, depending on in wich of those frames he releases the button. Might be interersting Huh?
I really like the idea of keeping variable jump height without distorting the shape of the jump too much. My current game could stand to benefit by doing something like this.
Sparky, I like this idea more and more. I saw that you somewhere posted some suggestions for exploding platforms, and if you implement the "early input jump" in your game you could maybe make other platforms that explode instantly if you stand on them, but don't explode at all if you only touch them one frame when jumping with an early input.

Or even better, make the character able to run/jump on water or lava surfaces he would otherwise sink through, because he never actually collides with the surface, since he already have jumped off of it when he hits it... You get what I mean?

You could make whole levels without any real platforms, where you have to run and jump like crazy without rest for 40 seconds in a row Evil
If you set the forgiveness higher, say 1/8 of a second, you could definitely do all this. It's funny, I was only thinking about it as limited pogo-sticking, and I was only attempting to improve the responsiveness. It's neat to see you take the idea new directions.


We were talking about an 'early input' jump. It's interesting... there's an old thread on this forum that brings up a similar idea- a 'late input' jump when running off a ledge:
As for the more classic style of platformers, the article I linked to suggests that the coder allow jumping for a split-second after leaving a ledge to compensate for ambiguity, which is a good method.  As long as the window of opportunity to jump is short enough, it will still look natural.  It gives you a grace of one or two pixels to circumvent the "But I pressed jump!" response. 

This is brilliant! I'm definitely implementing this.
Edit: Oops, I made it possible to jump indefinitely in mid-air. Let's try this again...
« Last Edit: November 25, 2008, 04:57:37 PM by Sparky » Logged
Chris Whitman
Sepia Toned
Level 10
*****


A master of karate and friendship for everyone.


View Profile
« Reply #13 on: November 25, 2008, 05:15:21 PM »

That's just a space jump. It's a 'feature.'

But yeah, I feel a platformer jump should be as close as you can get to triangular without looking too weird. The solution that I've always found the most natural is a very low terminal velocity coupled with, as Jeb mentioned, switching off gravity while the jump button has been pressed until the top of the jump. Otherwise you risk getting the Castlevania jump, which is incredibly annoying.

My problem with the boost phase is that I think it would be annoying if the boost phase were too long, but would feel twitchy and unpredictable otherwise. Try giving it a prototype, but I'm guessing you're going to end up with either player annoyance (because it takes so long to jump) or a crazy learning curve for just jumping between platforms with accuracy.
Logged

Formerly "I Like Cake."
Loren Schmidt
Level 10
*****



View Profile WWW
« Reply #14 on: November 25, 2008, 10:37:38 PM »

I like your 'triangular jump' idea. It seems like a good way to make the player feel very in control of the jump height. I tried setting the vertical speed cap lower in the game I'm working on (8, as opposed to 16) and it definitely made the jump feel easier to handle.

Actually in practice the 'boost' idea is very similar to just switching gravity off. In the game I'm working on, gravity is very nearly cancelled during the ascent. It isn't until near the top of the jump that the boost fades and gravity takes over.
Logged
JLJac
Level 10
*****



View Profile
« Reply #15 on: November 27, 2008, 09:58:37 AM »

Hey sparky, how's it going with your game? When will I be able to play it? Would really like to see the "early input" in action Smiley
Logged
Loren Schmidt
Level 10
*****



View Profile WWW
« Reply #16 on: November 28, 2008, 12:42:54 AM »


Here's another OCD movement rule some of you might like (or have fun disparaging, whatever floats your boat  Smiley): When we run off a ledge, there's a special case downward kick of 10 tiles per second.  This makes ledge drops feel less floaty than they normally do. This sounds useless and weird, but in a game that's about combat over acrobatics it makes the action feel snappier. It's nice for dropping down and ambushing enemies from above.

Hey sparky, how's it going with your game? When will I be able to play it? Would really like to see the "early input" in action Smiley
Things are going really well! I'm on track for a demo in less than two weeks. I'll start a thread for it a few days before that. The 'early input' is actually pretty subtle- I have it set to 1/12 of a second (5 frames). It's really only noticeable when you play without it, then switch it back on. But it's invaluable for repeated small hops. The 'late ledge jump' is also working well.
Logged
salade
Level 4
****



View Profile
« Reply #17 on: November 30, 2008, 01:01:35 PM »

Well thats interesting. I always took the quickfall thing for granted...
It seems like this effect is always punctated by some some sort of special animation for your character, one that differs from their falling animation after a jump.
Logged
JLJac
Level 10
*****



View Profile
« Reply #18 on: November 30, 2008, 01:13:49 PM »

Hm... Maybe you could connect this to an input, preferably the down arrow, allowing the player to get down quickly even when jumping Huh? Sometimes it's really annoying to not be able to get down, for example when a projectile is heading your way at the top of a jump.
Logged
Loren Schmidt
Level 10
*****



View Profile WWW
« Reply #19 on: November 30, 2008, 11:20:39 PM »

Salade- Wow, I had no idea. Honestly my platformer experience fairly limited. Could you point me to a game that uses the mechanic? I'd love to see that in action.

JLJac- That might be neat. The closest thing I've seen to that is in Cave Story- the Booster v. 2.0 lets you jet downward if you want. Another game that comes to mind is Street Fighter. With some characters (such as Dhalsim) it's often useful to use down-travelling attacks in order to cut a jump short.

Logged
Pages: [1] 2 3
Print
Jump to:  

Theme orange-lt created by panic