游戏邦在:
杂志专栏:
gamerboom.com订阅到鲜果订阅到抓虾google reader订阅到有道订阅到QQ邮箱订阅到帮看

分享设计2D平台游戏跳跃机制的经验

发布时间:2014-08-25 17:15:00 Tags:,,,,

作者:Mohan Rajagopalan

在任何一款2D平台游戏中,你如何设计跳跃机制将在极大程度上决定着游戏所呈现的感觉。因为《Wayward》将包含2D平台,跳跃自然就成了我们制作原型的第一要务。我们仍处于早期开发阶段,所有东西都在变化,但我想在此与各位分享我们的一点早期想法,基本设计,并讨论一些关于设计跳跃机制的有趣窍门。

自由度

最简单的跳跃版本要求开发者了解初始垂直速度和加速,因为重力会像跳跃过程中的时间函数一样决定角色的高度:

jump_equation_black(from gamasutra)

jump_equation_black(from gamasutra)

这是牛顿力学的标准抛物运动方程式,从中可得一个类似于物体在现实世界跳跃的抛物轨迹。你可以使用一个不同的模型(例如比抛物线更为方形的曲线),但人类就是习惯于抛物运动。玩家如果没有看到抛物轨迹就会觉得有什么不对劲。

所以,假设是通常模式,设计跳跃的一个方法就是捣鼓初始速度和重力的不同值,直到你发现能够让跳跃呈现合理感觉的数值为止。(注:使用真正的地球重力常力也许并不可行)这可能是一个有效的方法,但从设计角度来看,你可能会对除了初始速度和重力之外的数字更感兴趣。你可能会比较关心跳跃持续时长,最大跳跃高度,水平跳跃距离(在全速度奔跑的情况下),达到最大高度的时间,或者其他相关的东西。这些东西都来自速度和重力的选择,但如果你想将重力和速度视为源自你所关心之事的东西,而非相反的情况呢?你该如何从设计角度做出选择,让这些选择产生重力等属性呢?你该从何入手?你该做出哪个选择,该做多少选择?

我们可以运用一个我所谓的“自由度”设计方法。其理念就是任何游戏机制(或者一般的系统),你可以做出有限数量的选择(之事才能得到由这些选择决定的事情)。这迫使你选择少量你最关心的事情,将其列出来,再让其他事情顺其自然。

在我们的跳跃方程式中,我们知道跳跃在机制上是由重力和初始速度这两个因素决定的。因此,我们有两个自由度。这意味着,作为设计师,我将可做出两个选择,其他一切都已经确定。对我来说,跳跃高度和跳跃持续时间通常就是我对跳跃设计最在乎的两件事,所以我选择了这两者,并且知道我无法再做更多选择了。我将这两者视为最重要的事件,并让其他一切由此决定。

当你确定了自己关心的事情后,如果你可以做一些计算,那就编写你所调整的参数机制,而不是那些可以直接编码的事物(游戏邦注:在此指的是重力和初始速度)。但我们通常并不需要这个步骤——最有用的东西就是你能控制多少东西的这种设计知识。在这个例子中,我可能之后会通过尝试不同的速度和重力值而继续推进,但目标则是达到特定的高度和持续时长,我可以用自己喜欢的任意值进行尝试。

多变的跳跃高度

当然,这个跳跃模式太简单了。游戏素来就是允许玩家通过持续或长或短地摁住跳跃键来改变跳跃高度的传统。这并没有什么物理学上的意义,并且每款游戏都有这种设置,但它却是相当普遍的设计。

实现这一目标的常用方法就是在摁下跳跃按钮时抑制重力,令其达到特定的最大持续时间。这会产生并不太类似弹射运动的跳跃运动——其高度会线性增长直到加入重力因素为止,之后再转变为通常的抛物线:

jump_graph(from gamasutra)

jump_graph(from gamasutra)

(这是高度vs时间对比图,红线是加入重力时的高度,代表蓝色或紫色抛物线相重叠的情况。)

你必须意识到用这种方法并不能获得合理的抛物运动感。初始线性部分总是有点漂浮、喷气式跳跃的感觉。

回到之前的自由度方法,我们可以将跳跃视为由初始速度,重力和跳跃抑制持续时长决定的东西。很显然我们现在有3个自由度,第三个来自重力抑制计时器。

我并不是很在乎计时器。注意计时器并不会回应跳跃的顶点——当加入重力时玩家会继续向上移动,直到重力“超过”初始速度。计时器更微妙,并非玩家(或设计师)能够特别感受到的东西。但我还有另一个自由度(我仍然在意最大高度的最大跳跃持续时长),所以我在这个新系统中还会关心的其他东西是什么呢?

答案可能与多种跳跃高度有关。想想玩家如何处理一个变化的跳跃,我相当确信他们实际上只考虑两种情况:最高跳跃(他们一直摁着按键,直到达到顶点为止),最低跳跃(他们尽量轻轻点触一下跳跃键)。所以也许我所关心的第三件事就是最低跳跃高度。我可能还会关心最低跳跃持续时长,但我已经没有自由度了——我只能选择其中之一,并且我认为跳跃高度更为重要。

空中控制

到目前为止,我们还只讨论了跳跃的高低部分,但跳跃在空中时还有许多我们尚未确定的东西。例如,我们该给予玩家多少水平运动控制权?这里有毫无空中控制的极端(Ghouls ‘n Ghosts游戏),完全空中控制(《洛克人》式的游戏),以及介于两者之间的游戏(如《马里奥》、《Metroid》等)。毫无空中控制当然是最为“现实主义”的机制,但通常只会产生令人无法忍受的玩法。给予完全的空中控制则是最为游戏化的机制,可兼容超级准确的移动和棘手的平台谜题。

采用介于两者间的方法,即你获得了空中冲力但可以在半空中对其施加一定影响,可以为跳跃添加一些重量感,但同时又给予玩家更正错误的空间,令其获得一些控制感。这正是我们制作原型的切入点,但随着时间发展,我们不断调整了更多关于完全的空中控制权。一开始这非常令人意外,因为我们并不打算制作一款以准确的平台跳跃和计时为核心元素的游戏。但深度反思后,我们就明白自己想要更多空中控制权,因为我们并不想过于关注平台谜题。我们尽量让游戏更易于玩家移动,以便他们关注游戏的其他层面。

重力,跳跃高度以及微缩世界

多数游戏会让角色拥有惊人的垂直跳跃高度,《Wayward》也不例外。在2D游戏中尤其如此,玩家通常可以跳到至少有角色那么高的地方,许多时候甚至是数倍于这种高度。这反映了角色极为强大和轻盈的特点,以及极弱的重力情况。

不过微弱的重要并非游戏故意而为之。事实上,许多《马里奥》游戏中的重力都超过了地球重力的8倍。因为质量并不会影响下降速度,所以我们很容易看出无论这些角色有多轻盈,重力都很高,假设角色是正常高度的话。

但正常的高度就是一个正确的假设了吗?如果我们将角色想象成数英寸而非数英尺的高度,那么重力就是正确的。由此可以推论,这样小的角色可以跳跃到是自己身高好几倍的高度。如果我们不将这些游戏想象成控制真人大小的角色,而是玩具般大小的角色,那么可能就会有一点物理上的合理性。我们对游戏的看法就是将其视为一个微缩版的世界。

mario2d3d(from gamasutra)

mario2d3d(from gamasutra)

与一个世界玩耍而非在一个世界中玩耍的感觉是第三人称游戏的特点,2D版第三人称游戏尤其如此。在2D横向视角的游戏中,玩家通常能看到围绕角色周围大部分的游戏世界,他们能看到的远多于角色自己所能看到的范围。唤醒玩家与角色(或世界)“玩耍”,和通常那种“像角色一样”玩耍这种感觉的确很神秘。这正是玩家和开发者对2D游戏都有怀旧感的原因,也是AtomJack决定让《Wayward》采用2D玩法的原因。探索微缩版的世界会比沉浸在3D世界中更有趣,也更不吓人,但仍可唤起一种强大的好奇和探索感。(本文为游戏邦/gamerboom.com编译,拒绝任何不保留版权的转载,如需转载请联系:游戏邦

Designing a 2D Jump

by Mohan Rajagopalan

In a 2D platforming game of any kind, how you design the jump defines a tremendous amount of how the game is going to feel. Since Wayward will indeed have 2D platforms, jumping is naturally the first thing we prototyped. We’re still quite early in development, and things are changing all the time, but I thought I’d take you through some of our early thinking, walk through a little basic design, and discuss a few interesting tidbits on jumping.

DEGREES OF FREEDOM

The simplest version of jumping requires knowing initial vertical velocity and acceleration due to gravity to determine character height as a function of time during the jump:

This is the standard projectile motion equation from Newtonian mechanics, and yields a familiar parabolic trajectory which is more or less how jumping works in the real world. You could use a different model (like going for a more square-ish curve than a parabola), but humans are surprisingly attuned to parabolic motion. Players tend to feel that something is off when they don’t get that parabolic arc.

So, assuming the usual model, one way of designing a jump is to mess around with various values for initial velocity and gravity until you find numbers that make the jump feel right. (Note: using Earth’s real gravity constant probably won’t work, but more on that later.) This can be a valid approach, but thinking from a design perspective, you’re probably more interested in numbers besides initial velocity and gravity. You might care instead about jump duration, max jump height, horizontal jump distance (when running at full speed), time to max height, or maybe something else. All of those things can be derived from a choice of velocity and gravity, but what if you want to think of gravity and velocity as being derived from things you care about, instead of the other way around? How can you make the choices that you care about from a design perspective and let properties like gravity fall out from those choices? And where do you start? Which choices do you make, and how many can you make?

We can apply an approach which I call Degrees of Freedom design. The idea is that for any game mechanic (or system in general), there are a finite number of choices you can make before everything else is determined by those choices. This forces you to pick the small number of things you care about most, figure those out, and let everything else be what it has to be.

In our jump equation, we know the jump is mechanically determined by two things: gravity and initial velocity. Therefore, we have two degrees of freedom. That means that as a designer, I will be able to make two choices, and everything else is determined. For me, jump height and jump duration are usually the two things I care about most for jump design, so I’ll pick those two and know that I don’t get to make any more choices. I’ve prioritized the two things I think are most important, and let everything else be determined.

Once you’ve decided what you care about, if you want you can do some math and then code the mechanic so that those things are the literal parameters you adjust, instead of the things that might be most straightforward to code (in this example, gravity and initial velocity). But often that step isn’t required – the more useful thing is the design knowledge of how many things you have control of. In this example, I might then proceed by trying various values for velocity and gravity, but armed with the goal of hitting particular heights and durations, and the knowledge that it’s possible to do so for any pair of values I like.

VARIABLE JUMP HEIGHTS

Of course, that model of jumping is too simple. Games have a long tradition of allowing players to vary the heights of their jumps by holding down the jump button for shorter or longer durations. This doesn’t make a whole lot of physical sense, and not every game does it, but it is fairly common.

The usual way of accomplishing this is to suppress gravity while the jump button is held down, up to some maximum duration. This results in a jump motion which isn’t quite projectile motion – height gain is linear until gravity kicks in, then transitions into the usual parabola:

If this is height vs time, the red line is height until gravity kicks in, at which point the blue or purple parabola takes over.

It’s important to realize that you can’t get a jump that feels quite like proper projectile motion using this scheme. That initial linear part is always going to give a bit of a float-y, jetpack-y feel to the jump.

Going back to the degrees of freedom approach, we can now think of the jump as being determined by initial velocity, gravity, and the duration of the jump suppression. It’s clear that we’ve got three degrees of freedom now, the third one coming from the gravity suppression timer.

I don’t care about that timer directly. Note that the timer doesn’t correspond to the apex of the jump – the player will continue moving upwards once gravity kicks in, until gravity “overtakes” that initial velocity. The timer is more subtle, and not something the player (or designer) will feel specifically. But I’ve got another degree of freedom (I still care about max height and max jump duration, as before, for my first two degrees), so what else do I care about in this new system?

The answer probably should be related to variable jump heights. Thinking about how players process a variable jump, I’m pretty confident that they really only consider two cases: the highest jump (where they hold the button down until they hit the apex (although they didn’t have to, to achieve that max jump)), and lowest jump (where they just tap on the jump button as lightly as possible). So maybe the third thing I care about is lowest jump height. I might also care about lowest jump duration, but I’m out of degrees – I have to pick one or the other, and I think jump height is more important.

AIR CONTROL

So far we’ve only really covered the up and down part of the jump, but there’s a lot more to decide about what happens in the air. Specifically, how much horizontal motion control should we give the player? There are the extremes of no air control (Ghouls ‘n Ghosts games), full air control (Mega Man games), and lots in between (Mario, Metroid). Having no air control is the most “realistic” scheme for sure, but generally makes for unforgiving gameplay. Granting full air control is the most game-y scheme, allowing for ultra-precise movement and tricky platform puzzles.

Going for something in between, where you’ve got aerial momentum but can affect it to some degree mid-air, can give a nice weightiness to the jump while still giving the player room to correct errors and feel in control. That’s where we started in prototyping, but over time we kept adjusting more and more towards full air control. This was surprising at first, because we aren’t aiming for a game where precise platforming and timing was a core component of the game. But on further reflection, it became clear that we wanted more air control because we wanted less focus on platforming puzzles. By making it as easy as possible for the player to move where they want to move, we free them to focus on other aspects of the game.

GRAVITY, JUMP HEIGHTS, AND A WORLD IN MINIATURE

Most games feature characters with amazingly high vertical leaps, and Wayward is no exception. Particularly in 2D games, the player can usually jump at least the character’s height, and often many times more than that. Intuitively, that translates to some combination of very strong and light characters, and very weak gravity.

Well, it turns out that weak gravity isn’t what games do at all. In fact, many Mario games have gravity in excess of 8 times Earth gravity (here’s a fun analysis). Since mass doesn’t affect falling speed, it’s pretty easy to see that no matter how light these characters might be, gravity is crazy high. Assuming characters of normal height, that is.

But is normal height the right assumption? If we imagine the characters as being a few inches tall instead of a few feet, then gravity works out to be about right. And, by extrapolating a little from the square-cube law, it makes sense that such small characters might be able to jump many times their own heights. If instead of thinking about these games as controlling life size characters, we think about them as playing with toys of those characters, then the physics start to make a little more sense. Our view into the game is like looking at model playset of the gameworld. It’s a world in miniature.

That feeling of playing with a world rather playing inside a world is a characteristic of 3rd-person games, and especially 2D 3rd-person games. In 2D side-view games, the player usually views a large slice of the game world around the character, much more than the character would see themselves. There’s magic in evoking that feeling of “playing with” the character (and world), in contrast (or addition) to the usual immersive ideal of “playing as” the character. It’s a part of why gamers and developers alike can be nostalgic for 2D games, and a reason AtomJack decided to focus on 2D gameplay for Wayward. Exploring and seeing a world in miniature can be more playful and less daunting than being immersed in a 3D world, while still evoking a powerful sense of wonder and discovery.(source:gamasutra


上一篇:

下一篇: