游戲邦在:
雜志專欄:
www.577454.com訂閱到鮮果訂閱到抓蝦google reader訂閱到有道訂閱到QQ郵箱訂閱到幫看

長文開發者談互動角色行為設計的12條原則

發布時間:2021-10-20 14:44:07 Tags:,

開發者談互動角色行為設計的12條原則

原作者:Wendelin Reich & Werner Schirmer 譯者:Willow Wu

(本文的兩位作者以及Sophie Peseux共同創建了Virtual creatures,這是一家專注于行為設計的初創公司,致力于創造出具有深度互動性的NPC。)

簡介

在科幻電影《她》中有個十分有趣的片段:主人公Theodore在玩一個AR游戲,突然,一個NPC朝他辱罵了起來。原本平淡無奇的路人角色突然展現出了真實的個性,這種意外的展開促使Theodore笑了出來,也引發了他的思考。他意識到這種行為是個謎題。于是他也罵了回去,最終Theodore解決了謎題,游戲冒險繼續。

八年后,最先進的互動角色仍然無法提供類似于這樣的體驗。專業人士和玩家都一致認為,在2005年《極度恐慌》發行之后,角色AI一直沒有實現質的突破。更糟糕的是,最近出版的游戲AI教科書明確指出角色AI的創新基本上是停滯不前了。如今,人們更感興趣的領域是AI驅動的藝術創作、系統層面的AI應用等等。

現今大多數熱門游戲都有某種類型的NPC。因此我們認為,角色AI創新的匱乏會成為未來游戲的創意瓶頸,但對于那些愿意嘗試新方法的人來說,它或許會成為一個巨大的機會。因此,把這篇文章當作是互動角色探討系列的開端,我們認為是比較合理的。如果說人們創造NPC這樣的影響因素(agent)是為了讓他們以特定的方式行動從而讓玩家沉浸到游戲中,那么我們首先就要問自己影響因素的行為(agent behavior)具體是什么(這里的影響因素可以指動物也可以指人類)?

心理學和人工行為 (artificial behavior,AB)是我們學術研究的根基所在。在AB引擎上投入了這么多年的時間,我們總結出了行為的12種特性。我們可以把它們稱作是“原則”——算是對迪士尼著名的“動畫十二原則”的致敬吧。

有些是顯而易見的,有些不太容易能夠想到。重要的是,結合這12條原則,你能夠將那些似是而非的東西排除掉。更重要的是,如果你想要創建一個AB引擎,讓互動角色變得更“鮮活”一些,你就得確保引擎能夠支持這12條原則。

原則1:行為是可目擊的

首先,你可能會想到的是行為與用到的肌肉有關。就比如說你坐在一家高檔餐廳里,等待著你的約會對象。你的手指在不斷敲擊桌面,你的心臟(這也是肌肉)在狂跳。

這意味著你在同時做兩件事嗎?并不算是。人的身體里有很多復雜的東西在做復雜的事情,但大部分都是外界無法感知的。就我們的目的而言,行為僅包括無需特殊儀器(如核磁共振掃描儀)就能觀察到的事件。所以,如果你的心跳快到讓你神經緊繃,最后不慎打翻了一杯橙汁,把自己的衣服弄臟了,這就是可以觀察到的,也正是我們所說的行為。

Final Fantasy 12(from polygon.com)

Final Fantasy 12(from polygon.com)

對AB引擎來說, 這一原則帶來了一種非常樂見的簡化——我們不需要試圖再造生命體,只需要再現它的外觀。迪士尼稱之為“生命的幻象”,而我們更進一步地稱之為“互動生命的幻象”——在后續的系列文章中會詳細展開。

原則2:行為是連續的

生命體從出生一直到死亡都有行為。人類的語言為我們提供了大量的術語,可以用來形容沒有任何動作或發出任何可聽見的聲音的人。例如,我們可以說這個人在睡覺、坐著不動、屏住呼吸、裝死,等等。

但這難道不與原則1沖突嗎?并沒有。因為即使一個影響因素什么都不做,我們也能從中觀察到一些東西,比如Stephen Colbert坐在氣球雨中的畫面,你可以很容易地看出他保持坐定是一種熟練(而且可能是排練過)的行為表現。單純的坐直動作需要協調使用幾十塊肌肉。從更籠統的意義上來講,我們可以說影響因素產生了連續的行為流。因此,AB的問題在于如何在個體行為中生成這樣的流,而且它要能起到承上啟下的作用。

原則3:行為是交互式的

現實生活中并不存在沒有互動的行為。比如說,與朋友玩耍需要回應他們的行為,攀巖需要調整手勢。即使是最獨立的行為也會涉及到情景,需要跟它互動。以呼吸為例,呼吸速率取決于大氣中的氧氣密度。如果我們把情景(氧氣)剔除,行為(呼吸)就不再有意義了。

影響因素通過行為與世界建立聯系,這就是為什么所有的行為都要是可以交互的。這也意味著互動行為、適應性行為或響應性行為之間是沒有區別——這些詞本質上都是在說“行為必須是有情景的”。對于AB引擎來說,這意味著所有行為需要程序生成——不幸的是如今大多數游戲都在做完全相反的事,這些游戲開發者傾向于從預先配置的行為包中組裝行為流,如站立-循環、行走-循環、跳躍等等,它們之間的過渡很生硬。

原則4:行為是受到約束的

情景對行為施加了許多約束,以各種條件的形式塑造行為。目前來看,最重要的一種就是世界的物理構成——它給行動主體制造的阻力、它允許的聲音傳播的方式等等。

約束本身可以是主動的也可以是被動的,由此可以動態地引導影響因素的行為,往意想不到的方向發展。因此,AB必須超越單純的程序選擇行為,并為程序動畫提供全面的支持,允許行為流動態地適應約束。

原則5:行為是有序的

AI教科書經常會區分“腳本化”和“無腳本化”的行為,暗示后者更好、更自然。在我看來是有點沒道理的,因為實際中影響因素的行為多數是二者的結合。

人類大腦有專門的回路(游戲邦注:尤其是小腦)來存儲參數化運動序列的巨大數據庫。這些序列促使大腦更容易配置行為的標準形式。同時,這種序列對具體環境和動態情景的適應性很強。這就構成了一個強大的組合。它可以使用模板,在運行時只需要填入幾個參數,而不是每次都要重新決定要移動哪些肌肉,何時以及要移動多少,來制作……比如說一個探戈。除了降低復雜性外,這種方法還促進了個體之間的行為同步,這也能夠在一定程度上解釋為什么真實的行為有時感覺像是腳本化的。像Rascal這樣的AB引擎是從神經科學汲取了靈感,并將參數化、自適應的序列融入到架構中。

原則6:行為是可中斷的

即使是計劃最完善的行為,也不一定能在第一次與現實接觸時就順利執行。影響因素會一直改變他們的想法,他們的行為也得隨之改變。我們在現實世界中觀察到的這種細枝末節對AB來說卻是一個艱巨的挑戰,主要是因為原則2。中斷不能是直接打斷行為流,然后再開始一個全新的行為流。

對連續性和可瞬間打斷的兩種要求就像是拔河的雙方,會造成一種緊繃的局勢。此外,這種缺乏控制的感覺可能正是引擎使用者想要達到的效果(例如喜劇效果),這就是AB引擎還面臨的另一種挑戰。我們的引擎Rascal是通過一種層級控制結構來實現的——這個設計是從機器人領域獲得的啟發,我們或許會在之后的文章中詳細說說。

原則7:行為的變化是模式化的

你不能兩次踏入同一條河流,同樣的行為你也不能展現兩次。給一些變化——無論多小,但是總是會有,這就是讓行為變得更自然的有效方法之一。

重要的是,這些“相同”行為的不同表現方式往往是隨機、結構化的。就比如說,《哈利·波特》系列中韋斯萊家的雙胞胎在同步說“什么”的時候,他們抬頭、張嘴的方式可能會有點不同,但他們不會在……比如說在需要張開嘴的時候閉上嘴,反之亦然。演化生物學家稱這種現象為模式化變化(patterned variation)。無論是哪個場景,你都可以看出這些變化是基于已經設置好的生成原則或規則——例如,控制發聲器如何產生單詞“什么”的規則。這并不意味著(比如說)AB引擎需要模擬整個發聲裝置來產生更自然的變化。在實踐中,潛在變化的維數通常是有限的,可以用更淺顯的方法來實現近似。

原則8:行為是有層級的

當一個影響因素在展現行為時,如果你仔細觀察就會發現有很多事情通常是同時發生的。這個原則,還有后續的幾條能夠幫助你建立秩序。

行為幾乎都是有層級結構的,讓我們先從運動學角度入手。握手這個動作就很好地說明了這點。盡管它是“握手”,但這個小小的儀式涉及到許多身體部位的協調——它們都處于層級關系中,從屬部位會受到上級部位的影響。

所有的動作都是從軀干開始的,這使得手臂(從屬于軀干)在搖晃時向前傾。同時,頭部(也依附于軀干上)朝向對方,眼睛(依附于頭部)最初需要向下看從而調整最初的抓力。然后抬頭,跟對方做出回應。

當我們開始在行為中尋找層級關系時,我們就會發現它是無處不在的,更棘手的是,它們會隨著時間的推移而迅速變化(回想一下原則5)。

原則9:行為是平行的

你看到《廣告狂人》(Mad Men)里的Peggy Olson在一邊步行一邊吸煙,同時做幾件事是極為常見的。這些東西甚至不需要有等級關系(你可以不走路就抽煙,反之亦然)。盡管如此,原則8和原則9對AB的影響是相同的。它們要求行為流必須由多個具有層級關系的子行為組成。這些子行為可以控制身體不同或重疊的運動部位(眼睛、嘴巴、四肢……),讓AB的復雜性又提升了一個層次。舉個不同部位的例子:上面提到的Peggy Olson,她的吸煙行為完全不影響她走路。至于重疊,你可以想象一下Peggy一邊行走一邊因恐懼而顫抖——這兩種行為會對相同的身體部位產生影響,但方式不同且可能很復雜。

原則10~12:行為是由認知引起的、可被觀察的、可解讀的

最后三點我們可以放在一起討論,因為我們要講認知和行為之間的關系。

影響因素擁有控制其行為的中樞神經系統。他們看到其它影響因素的行為會自動解讀。在進化過程中,我們已經習慣于從可觀察的行為中硬解讀出某種(不可觀察的)認知原因,并賦予其目的性和意義。
因此,在上面的動圖中,你看到的不僅僅是一個女主持人舉起然后放下她的手臂——你看到的是她一開始試圖與同事擊掌,但沒有引起對方的注意,最終為自己的失敗感到丟臉。大量的心理學研究表明,這種歸因是自發的,是不可抑制的。對于AB來說,這意味著我們不可能將人工創造的行為與它所引發的意義剝離。行為總是在表達某種意思,不管你的本意是否如此。因此,AB引擎的開發不僅是一個工程上的挑戰,也是一個心理上的挑戰。這是關于如何說服玩家相信生成行為的(人造)意義,我們計劃在未來的幾篇文章中繼續討論這個話題。

本文由游戲邦編譯,轉載請注明來源,或咨詢微信zhengjintiao

This post was co-authored by Wendelin Reich and Werner Schirmer. Together with Sophie Peseux we’re founders of Virtual Beings, an artificial behavior-startup that develops mobile games with deeply interactive non-player characters (NPCs). See here for posts #2, #3 and #4

Introduction

Clip from ‘Her’ (2013)There’s a delightful little scene in the science-fiction movie Her (2013) where Theodore, the protagonist, plays a video game in augmented reality. At one point, an NPC turns towards him and starts insulting him. This sudden display of real personality from an otherwise bland character is so unexpected that it makes Theodore laugh as well as think. He realizes this behavior is a puzzle. By insulting the NPC back, he ends up solving it and the game continues.

Eight years later, the state of the art in interactive characters still doesn’t provide anything close to Theodore’s experience. Among professionals and players alike, there’s a strong consensus that character AI hasn’t seen qualitative breakthroughs since about 2005, the year F.E.A.R. was released. Even worse, recent textbooks on game AI state explicitly that innovation in character AI has essentially come to a halt, the field nowadays being more interested in AI-driven art production, system-level AI and so on.

A clear majority of popular games today features NPCs of some kind. We therefore believe that this dearth of innovation in character AI is both a creative bottleneck for future games and an immense opportunity for folks who are willing to approach the problem with a fresh look. This first article of our four-part series on the future of interactive characters therefore starts at what we see as the logical beginning. If the purpose of artificial agents such as NPCs is to behave in ways that engage players, we need to ask ourselves just what agent behavior is in the first place (where ‘agent’ refers to both animals and humans). Our academic roots are in both psychology and artificial behavior (AB). Over many years of development on Rascal, our AB-engine, we have found that behavior is characterized by twelve properties. We call them ‘principles’ as a small homage to Disney’s famous twelve basic principles of animation.

Some of them are obvious, others less so. What’s important is that these twelve principles, taken together, sharply delimitate behavior from anything that resembles it without matching it. And more importantly If you would like to create an AB-engine which allows interactive characters to feel ‘alive’, you’d want to make sure that it supports all twelve.

Principle 1 Behavior is observable

At first sight, behavior seems to be about muscles that move. Let’s say you’re sitting in a fancy restaurant, waiting for your date to show up. Your fingers are nervously tapping on the table and your heart (also a muscle) is racing.

Does that mean you’re doing two things at the same time here Not quite. Living bodies are full of complicated stuff doing complicated things, but most of this isn’t perceivable from the outside. For our purposes, behavior includes only events that are observable without special instruments (such as an MRI scanner). So if your racing heart contributes to your overall nervousness and you end up knocking over your glass of orange juice and ruining your shirt – that would be observable, hence behavior.

For AB, this first principle entails a welcome simplification We don’t have to try to recreate life itself, just its appearance. Disney called this ‘the illusion of life’. We’ll go one step further and call it the illusion of interactive life – something we’ll cover in a later blog post.

Principle 2 Behavior is continuous

Stephen ColbertLiving beings behave all the time, from birth all the way to their death. Our language recognizes this by providing us with an arsenal of terms we can apply to someone who isn’t showing any movement or making any audible sound. For example, we may say that this person is sleeping, sitting still, holding their breath, playing dead, and so on.

Doesn’t this conflict with principle 1 No, because even when an agent is seemingly doing nothing, we can observe something In the GIF on the left, you can tell effortlessly that sitting perfectly still under a shower of balloons is a skilled (and probably rehearsed) display of behavior. The mere act of sitting straight requires coordinated use of dozens of muscles. In a more general vein, we may say that agents emit continuous behavior streams. The problem of AB is thus to generate such streams from individual behaviors that are connected to preceding and subsequent behavior.

Principle 3 Behavior is interactive

Cat pokeThere is no real life behavior that is not interactive. For example, playing with a friend involves responding to their actions, and climbing a rock requires adapting one’s hands to its shape. Even the most self-involved behavior takes place in a context and needs to interact with it. Take breathing as an example, where the respiration rate depends (among other things) on the density of oxygen in the atmosphere. If we take away the context (oxygen), the behavior (breathing) ceases to make sense.

Behavior is how agents relate to the world, and that is why all behavior needs to be interactive. This also means that there is no difference between behavior that is interactive, adaptive or responsive – these words just add different flavors to the fact that behavior is necessarily contextual. For AB, this means that all behavior needs to be procedurally generated – which is unfortunately the exact opposite of what happens in most games today, which instead tend to assemble behavior streams from canned packages of pre-configured behavior stand-loop, walk-loop, jump and so on, with awkward transitions between them.

Principle 4 Behavior is constrained

Agility dogContext imposes lots of constraints on behavior, in the form of conditions that shape it in various ways. By the far the most important one is the physical makeup of the world – the resistance it offers to the agent’s body, the way it allows sound to propagate, and more.

Constraints can be passive or active themselves, thereby directing an agent’s behavior dynamically and somewhat unpredictably. AB must hence go beyond mere procedural selection of behavior and offer full-fledged support for procedural animation, allowing the behavior stream to adapt to constraints on the fly.

Principle 5 Behavior is sequenced

TangoAI textbooks often distinguish ‘scripted’ from ‘unscripted’ behavior, implying that the latter is somehow better and more organic. This seems a bit pointless to me, because real agent behavior is always a combination of both. In fact, our brains have dedicated circuitry (notably the cerebellum) to store gigantic databases of parametric motion sequences.

These sequences make it much easier for the brain to deploy standard forms of behavior. At the same time, such sequences are highly adaptable to concrete environments and dynamic context. This makes for a powerful combination. Instead of having to decide freshly each time exactly which muscles to move, when, and how much, to produce, say, a tango, it can use templates that leave only a few parameters to be filled in at ‘runtime’, so to speak. Apart from reducing complexity, this approach also facilitates synchronization of behavior between several individuals, and it explains in part why real behavior can sometimes feel scripted. Modern AB engines such as Rascal take their inspiration from neuroscience and incorporate parametric, adaptive sequencing into their architecture.

Principle 6 Behavior is interruptible

LeBron JamesEven the most perfectly planned behaviors won’t always survive first contact with reality. If they do, agents change their mind all the time and their behaviors will have to follow suit. This is an almost trivial observation about the real world but a hard challenge for AB, mostly because of principle 2. Interruptions can’t just break off the behavior stream and start a fresh one.

The requirements for continuity and for rapid interruptibility pull in opposite directions, creating a tension that even an athlete like LeBron James can’t always resolve gracefully. AB engines are faced with the added challenge that such a perceived lack of control may be precisely what the user of the engine wants to achieve (e.g., for comic effect). Rascal achieves this via a layered control architecture that’s inspired by robotics – something we might discuss in a future post.

Principle 7 Behavior shows patterned variation

Weasley TwinsYou cannot step twice into the same river, and you cannot display twice the same behavior. Some difference, however small, will always persist – and that’s part of what makes natural behavior, well, natural.

Importantly, these different expressions of one and the ‘same’ behavior tend to be both random and structured. The Weasley twins may hold their heads and open their lips in slightly different ways when they ask ‘What’, but they cannot go so far as to, say, close their mouth when it needs to be open, or vice versa. Evolutionary biologists call this phenomenon patterned variation. Whenever it’s found, it indicates that the variations are due to underlying generative principles or rules – for example, rules governing how the vocal apparatus can produce the word ‘what’. That doesn’t mean that AB engines need to simulate (say) an entire vocal apparatus to produce believable variations. In practice, the dimensionality of possible variations is often limited and can be approximated in more superficial ways.

Principle 8 Behavior is hierarchical

Handshake The closer we look at an agent’s body while it’s displaying behavior, the more we see that several things usually occur at once. This and the following principle help to establish some order here.

Let’s start with the observation that from a kinematic point of view, behavior is almost always hierarchically organized. A handshake illustrates this nicely. Despite its name, this little ritual involves coordination of many body parts that are in hierarchical relationships, where subordinate parts are affected by superior ones.

In the GIF on the left it all starts with the torso, which positions the arms (which are subordinate to the torso) and leans forward during the shake. Meanwhile, the head (which also depends on the torso) orients towards the other party and the eyes (which depend on the head) need to look downwards initially to coordinate the initial grip. They then look up and connect with those of the other.

Once we start looking for hierarchies in behavior, we find them everywhere, and to make things worse, they evolve rapidly over time (recall principle 5). The consequences for AB are significant, but (fortunately) identical to those of the next principle.

Principle 9 Behavior is parallel

Peggy from Mad MenWhat is Peggy Olson from ‘Mad Men’ doing She is walking. She is smoking. The fact that there are (at least) two perfectly good answers bothers no one because it’s normal to do several things in parallel.

These things don’t even have to be in a hierarchical relationship (litmus test you can smoke without walking, and vice versa). Still, the consequences of principles 8 and 9 for AB are identical. They entail that the behavior stream must be composed from multiple sub-behaviors that can be hierarchically organized. As an added complication, these sub-behaviors can control distinct or overlapping motor domains of the body (eyes, mouth, limbs, …). For an example of distinct domains, look no further than Peggy, who’s smoking behavior doesn’t interfere at all with her walk. For overlapping domains, imagine that Peggy were walking as well as shaking from fear – two behaviors that will effect the same body parts, but in distinctive and potentially complex ways.

Principles 10-12 Behavior is cognitively caused, monitored, and readable

High-fiveThe final three principles can be discussed together for the purposes of this overview, as they are about the relationship between behavior and cognition.

The things that emit behavior (i.e., agents) are also the things that have central nervous systems which control their behavior. And the things that see this behavior (i.e., other agents) also automatically interpret this behavior. We have been hardwired by evolution to ‘read’ (unobservable) cognitive causes into observable behavior and thereby give it intentionality and meaning.

Thus, in the GIF above, you don’t just see an anchorwoman who is lifting and then lowering her arm – you see a lady who is trying to high-five her colleague, failing to solicit her attention, and ultimately ashamed about her failure. Tons of psychological studies have shown that such attributions are automatic and irrepressible. For AB, this implies that it’s impossible to separate the behavior emitted by artificial agents from the meaning it elicits. Behaviors always express something, whether you want it to or not. AB engine development is therefore not just an engineering challenge, but also (and foremost) a psychological one. It’s about convincing the player of the (artificial) meaningfulness of generated behavior, which is a topic we plan to talk about in several future posts.

(source: game developer )


上一篇:

下一篇:

人妻夜夜添夜夜无码AV