<?xml version="1.0" encoding="utf-8" ?>
<!-- generator="FEEDCREATOR_VERSION" -->
<rss version="2.0" xmlns:sns="http://blog.sina.com.cn/sns">
    <channel>
        <title>Flash AS 基理殿堂</title>
        <description></description>
        <link>http://blog.sina.com.cn/yyy98</link>
        <lastBuildDate>Fri, 05 Aug 2011 19:58:53 +0800</lastBuildDate>
        <generator>FEEDCREATOR_VERSION</generator>
        <language>zh-cn</language>
        <copyright>Copyright 1996 - 2009 SINA Inc. All Rights Reserved.</copyright>
        <pubDate>Thu, 16 Feb 2012 14:31:20 +0800</pubDate>
        <item>
            <title>[转载]五步让你完全沉迷游戏</title>
            <link>http://blog.sina.com.cn/s/blog_3ecb9b110100tgx4.html</link>
            <description><![CDATA[<div class="blogzz_abstract borderc" style="padding-top:15px;margin:20px 0; border:none; border-top:1px dotted #ccc;"><div class="blogzz_ainfo" style="margin-bottom:12px;"><span style="margin-right:25px;"><strong>原文地址：</strong><a target="_blank" href="http://blog.sina.com.cn/s/blog_4686489c0100w0l1.html" title="五步让你完全沉迷游戏">五步让你完全沉迷游戏</a></span><span><strong>作者：</strong><a href="http://blog.sina.com.cn/u/1183205532"  title="helldd" target="_blank" >helldd</a></span></div><div class="blogzz_acon"><p><span STYLE="font-family: simsun; line-height: 18px; font-size: 12px;"><img HEIGHT="300" BORDER="0" WIDTH="400" ALT="" SRC="http://i.crackedcdn.com/phpimages/article/8/2/9/19829.jpg?v=1" STYLE="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; width: 555px; height: 114px;" /></SPAN></P>
<p>So, the headlines say somebody else has died due to video game
addiction. Yes, it's Korea again.</P>
<p>What the hell? Look, I'm not saying video games are heroin. I
totally get that the victims had other shit going on in their
lives. But, half of you reading this know a World of Warcraft
addict and experts say video game addiction is a thing.</P>
<p>&nbsp;</P>
<p><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<font COLOR="#0000FF" SIZE="2">嗯 最近呢
报纸的头条说又有人因为沉迷游戏而死了</FONT></SPAN></P>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<font COLOR="#0000FF" SIZE="2">这是怎么了？我不是说电脑游戏是海洛因。我当然知道这些沉迷在游戏里的人在现实中可能很受伤或很孤独，但是沉迷魔兽世界这个现象或者专家叫兽说的沉迷网络游戏还是比较严重的。所以我就想问问</FONT></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<br /></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<font SIZE="2">So here's the big question: Are some games
intentionally designed to keep you compulsively playing, even when
you're not enjoying it?</FONT></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<font COLOR="#0000FF" SIZE="4">是不是有些游戏故意设计成让你不断的去玩，即使你一点也没享受？</FONT></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<br /></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<font SIZE="4">Oh, hell yes. And their methods are downright
creepy.</FONT></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<font COLOR="#0000FF" SIZE="4">当然有，而且他们的那些招数有时候真的挺令人毛骨悚然的</FONT></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<br /></SPAN></DIV>
<div STYLE="font-size: 23px; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<strong><font SIZE="4">#5. Putting You in a Skinner
Box</FONT></STRONG></SPAN></DIV>
<div STYLE="font-size: 23px; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<strong><font COLOR="#FF0000" SIZE="4">把你当小白鼠</FONT></STRONG></SPAN></DIV>
<p><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<strong><img HEIGHT="300" BORDER="0" WIDTH="400" ALT="" SRC="http://i.crackedcdn.com/phpimages/article/8/3/6/19836.jpg?v=1" STYLE="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; width: 594px; height: 294px;" /></STRONG></SPAN></P>
<p>&nbsp;</P>
<p><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<strong>&nbsp;</STRONG></SPAN></P>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<font SIZE="2">If you've ever been addicted to a game or known
someone who was, this article is really freaking
disturbing.</FONT></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<font SIZE="2"><font COLOR="#0000FF">如果你曾沉迷于某个游戏或者知道那么个人沉迷，那么你肯定觉的下面这篇文章很恶心。</FONT></FONT></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">
&nbsp;</DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<font SIZE="2">http://www.world-science.net/exclusives/081111_gaming.htm</FONT></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<br /></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">
&nbsp;</DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<font SIZE="2">It's written by a games researcher at Microsoft on
how to make video games that hook players, whether they like it or
not. He has a doctorate in behavioral and brain
sciences.&nbsp;</FONT></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<font COLOR="#0000FF" SIZE="2">这篇文章是一个在微软的游戏研究员写的，内容是说怎么让游戏钓住人，能不能让玩家喜欢。这个人比较厉害，有行为学和脑科学的博士学位。</FONT></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<br /></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">
&nbsp;</DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<em><font SIZE="2">quote</FONT></EM></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<em><font SIZE="2">"Each contingency is an arrangement of time,
activity, and reward, and there are an infinite number of ways
these elements can be combined to produce the pattern of activity
you want from your players."</FONT></EM></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<em><font COLOR="#0000FF" SIZE="2">书中说：游戏中每一个事件都是一个一个设计好的时间段，活动，奖励的集合。这有无数的方法让这些元素可以结合在一起构成各种各样的游戏事件的探索</FONT></EM></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<br /></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<font SIZE="2">Notice his article does not contain the words "fun"
or "enjoyment." That's not his field. Instead it's "the pattern of
activity you want."</FONT></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<font COLOR="#0000FF" SIZE="2">注意到这个写的文章中没有任何一个“好玩","有意思"的字眼。因为那玩意跟他没有关系。反而写的是游戏事件的探索。</FONT></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<br /></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<br /></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<font SIZE="2">"...at this point, younger gamers will raise their
arms above their head, leaving them
vulnerable."</FONT></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<font COLOR="#0000FF" SIZE="2">在某种意义上讲，年轻的玩家会举手庆祝胜利，贬低输者。</FONT></SPAN></DIV>
<p>&nbsp;</P>
<p><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<img HEIGHT="300" BORDER="0" WIDTH="400" ALT="" SRC="http://i.crackedcdn.com/phpimages/article/8/3/7/19837.jpg?v=1" STYLE="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; width: 276px; height: 186px;" /></SPAN></P>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<font SIZE="2">His theories are based around the work of BF
Skinner, who discovered you could control behavior by training
subjects with simple stimulus and reward.</FONT></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<br /></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<font COLOR="#0000FF" SIZE="2">他的理论基于B. F.
Skinner。这个人发现，控制生物的行为只需要用简单的赏罚措施来训练目标。</FONT></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<br /></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<font SIZE="2">He invented the "Skinner Box," a cage containing a
small animal that, for instance, presses a lever to get food
pellets.</FONT></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<br /></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<font COLOR="#0000FF" SIZE="2">他发明的Skinner box斯金纳箱
，用来控制小动物，比如拉一个杆或者按按钮就可以得到食物</FONT></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<img HEIGHT="300" BORDER="0" WIDTH="400" ALT="" SRC="http://i.crackedcdn.com/phpimages/article/8/3/8/19838.jpg?v=1" STYLE="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; width: 226px; height: 291px;" /><br />
</SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<font SIZE="2">This sort of thing caused games researcher Nick Yee
to once call Everquest a "Virtual Skinner Box."</FONT></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<font COLOR="#0000FF" SIZE="2">这玩意的发明导致了游戏研究者&nbsp;Nick
Yee 把《无尽的任务》称为Skinner虚拟实验室。</FONT></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<br /></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<font SIZE="2">So What's The Problem?</FONT></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<font COLOR="#0000FF" SIZE="2">问题在哪？</FONT></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<br /></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<font SIZE="2"><font COLOR="#000000">Gaming has changed. It used to
be that once they sold us a $50 game, they didn't particularly care
how long we played.The big thing was making sure we liked it enough
to buy the next
one.<span>&nbsp;</SPAN></FONT></FONT></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF">现在游戏的本质已经变了。曾经一个游戏要50块钱，厂商也不会特别关心我们究竟玩多久。游戏只要做的好玩以此来确保我们还买下一作。</FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">
&nbsp;But the industry is moving toward
subscription-based games like MMO's that need the subject to keep
playing--and paying--until the sun goes supernova.</DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF">但游戏的商业化逐步向前使基于用户群的游戏比如MMO大型多人在线，需要用户一直玩下去并且一直付钱直到地球爆炸，太阳毁灭，春哥去世。</FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">Now, there's no way
they can create enough exploration or story to keep you playing for
thousands of hours, so they had to change the mechanics of the
game, so players would instead keep doing the same actions over and
over and over, whether they liked it or not. So game developers
turned to Skinner's techniques.</DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF">不过他们没有办法创造一个足够大的探索的空间或者故事背景让你玩个好几百年，所以他们必须得改变游戏的机理，让这些玩家不管喜欢还是不喜欢，能坚持一直做重复无聊的事情。所以这些游戏设计师就用了Skinner方法</FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">This is a big source
of controversy in the world of game design right now. Braid creator
Jonathan Blow said Skinnerian game mechanics are a form of
"exploitation." It's not that these games can't be fun. But they're
designed to keep gamers subscribing during the periods when it's
not fun, locking them into a repetitive slog using Skinner's
manipulative system of carefully scheduled rewards.</DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF">这个目前在游戏设计方面是一个很大的争论。《时空环境》的设计者<span>&nbsp;</SPAN>Jonathan
Blow认为Skinner这种模式的游戏机理是一种剥削形式。它不是那种“好玩的游戏”，而是设计出来让玩家定期辛勤地劳作，通过Skinner用来控制生物的奖赏惩罚制度把他们牢牢的栓在电脑前不断的猛击鼠标键盘。</FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">Why would this work,
when the "rewards" are just digital objects that don't actually
exist? Well...</DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#3366FF">你想问为什么这种方法会奏效，那些奖励都只是一些电子代码啊?
那么请看下面</FONT>&nbsp;&nbsp;
&nbsp;</DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 23px; line-height: 1.5;"><strong>#4.
Creating Virtual Food Pellets For You To Eat</STRONG></DIV>
<div STYLE="font-size: 23px; line-height: 1.5;">
<strong><br /></STRONG></DIV>
<div STYLE="font-size: 23px; line-height: 1.5;">
<strong><font COLOR="#FF0000">设计一些虚拟精神食粮供你吃</FONT></STRONG></DIV>
<div STYLE="font-size: 23px; line-height: 1.5;">
<strong><br /></STRONG></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">Most addiction-based
game elements are based on this fact:<br />
<br />
Your brain treats items and goods in the video game world as if
they are real. Because they are.</DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF">大多数游戏成瘾都基于以下这个事实：</FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF"><br /></FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF">你的大脑把游戏物品当成真实存在的东西。事实上，游戏物品确实有价值。</FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 23px; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">People scoff at this
idea all the time ("You spent all that time working for a sword
that doesn't even exist?") and those people are stupid. If it takes
time, effort and skill to obtain an item, that item has value,
whether it's made of diamonds, binary code or beef jerky.</DIV>
<div STYLE="font-size: 23px; line-height: 1.5;">
<strong><br /></STRONG></DIV>
<div STYLE="font-size: 23px; line-height: 1.5;"><font COLOR="#0000FF"><font SIZE="2"><font SIZE="2"><span STYLE="font-size: 17px;"><font SIZE="2">有人冷嘲热讽玩游戏的人：就为了一件虚拟的武器你能浪费你所有的人参？其实这些人想错了。如果某件东西</FONT>需要花费很多时间精力和技术，<font SIZE="2">那么</FONT></SPAN></FONT><font SIZE="2"><span STYLE="font-size: 17px;">不论</SPAN><span STYLE="font-size: 17px;">这件物品</SPAN></FONT><span STYLE="font-size: 17px;"><font SIZE="2">是用钻石做的，还是二进制码构成的，还是牛肉做的，他都是有价值的</FONT>。</SPAN></FONT></FONT></DIV>
<div STYLE="font-size: 23px; line-height: 1.5;">
&nbsp;</DIV>
<div STYLE="font-size: 23px; line-height: 1.5;"><span STYLE="font-size: 17px;"><img HEIGHT="300" BORDER="0" WIDTH="400" ALT="" SRC="http://i.crackedcdn.com/phpimages/article/8/4/1/19841.jpg?v=1" STYLE="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; width: 328px; height: 196px;" /><br />
</SPAN></DIV>
<div STYLE="font-size: 23px; line-height: 1.5;"></DIV>
<div STYLE="font-size: 23px; line-height: 1.5;"><span STYLE="font-size: 17px;">I have easily 500 hours in Zelda
bottles.</SPAN></DIV>
<div STYLE="font-size: 23px; line-height: 1.5;"><span STYLE="font-size: medium;"><font COLOR="#0000FF" SIZE="2">我不经意的就耗费500小时在《塞尔达》的瓶子上。</FONT></SPAN></DIV>
<div STYLE="font-size: 23px; line-height: 1.5;"><span STYLE="font-size: medium;"><br /></SPAN></DIV>
<div STYLE="font-size: 23px; line-height: 1.5;"><span STYLE="font-size: medium;"><br /></SPAN></DIV>
<div STYLE="font-size: 23px; line-height: 1.5;"><span STYLE="font-size: medium;"><font SIZE="2">That's why the highest court in
South Korea ruled that virtual goods are to be legally treated the
same as real goods. And virtual goods are now a $5 billion industry
worldwide.</FONT></SPAN></DIV>
<div STYLE="font-size: 23px; line-height: 1.5;"><span STYLE="font-size: medium;"><br /></SPAN></DIV>
<div STYLE="font-size: 23px; line-height: 1.5;"><span STYLE="font-size: medium;"><br /></SPAN></DIV>
<div STYLE="font-size: 23px; line-height: 1.5;"><span STYLE="font-size: medium;"><font SIZE="4"><font COLOR="#0000FF" SIZE="2">这就是为什么韩国最高法院规定虚拟货币是可以合法跟金钱兑换的。现在全世界虚拟货币总额高达50亿美元</FONT>。</FONT></SPAN></DIV>
<div STYLE="font-size: 23px; line-height: 1.5;"><span STYLE="font-size: medium;"><br /></SPAN></DIV>
<div STYLE="font-size: 23px; line-height: 1.5;"><span STYLE="font-size: medium;"><font SIZE="2">There's nothing crazy about it.
After all, people pay thousands of dollars for diamonds, even
though diamonds do nothing but look pretty. A video game suit of
armor looks pretty and protects you from video game orcs. In both
cases you're paying for an idea.</FONT></SPAN></DIV>
<div STYLE="font-size: 23px; line-height: 1.5;"><span STYLE="font-size: medium;"><br /></SPAN></DIV>
<div STYLE="font-size: 23px; line-height: 1.5;"><span STYLE="font-size: medium;"><br /></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font SIZE="4"><br /></FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF">这没有什么好值得争议的。毕竟人们还花很多钱去买钻石，尽管我们都知道钻石只是好看点而已。一套装备也很好看而且能保护你不受那些兽人的伤害。这样说来这两样东西都是一样的，你只是花钱买一个概念（idea)而已。</FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><img HEIGHT="300" BORDER="0" WIDTH="400" ALT="" SRC="http://i.crackedcdn.com/phpimages/article/9/8/7/19987.jpg?v=1" STYLE="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial;" /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">&nbsp;
&nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp;
&nbsp;</DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
生日快乐！这是送你的。</FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">So What's The
Problem?<br />
<br /></DIV>
<blockquote STYLE="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 40px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px;">
<div STYLE="font-size: 9pt; line-height: 1.5;">Of course, virtually
every game of the last 25 years has included items you can collect
in the course of defeating the game--there's nothing new or evil
about that. But because gamers regard in-game items as real and
valuable on their own, addiction-based games send you running
around endlessly collecting them even if they have nothing to do
with the game's objective.</DIV>
</BLOCKQUOTE>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF">问题在哪？</FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF">当然了，事实上过去25年里在基本每个游戏都要你收集物品，以便通关。这也没什么特别的。不过由于玩家把游戏里的东西当成自己的财宝一样，所以那些故意让人上瘾的游戏让你无穷无尽的去收集东西，尤其某些东西甚至在游戏里没什么用。</FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">It is very much
intentional on the developers' part, an appeal to our natural
hoarding and gathering instincts, collecting for the sake of
collecting. It works, too, just ask the guy who kept collecting
items even while naked boobies sat just feet away. Boobies.</DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF">游戏开发者明显故意利用我们贮藏和收集物品的动物本性，让我们永远刷怪刷怪刷怪。
这种方法很见效的，不信你看这儿就有一人，尽管边儿上坐着一个性感尤物却执着刷怪做任务。。</FONT>&nbsp;http://kotaku.com/5384643/i-kept-playing--the-costs-of-my-gaming-addiction</DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">As the article from
the Microsoft guy proves, developers know they're using these
objects as pellets in a Skinner box. At that point it's all
about...</DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#008080">从那篇微软员工写的文章上来看，游戏开发者知道他们设计物品来对待玩家就好比在skinner实验箱给小白鼠奖励一样。这是为了。。。</FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 23px; line-height: 1.5;"><strong>#3. Making
You Press the Lever</STRONG></DIV>
<div STYLE="font-size: 23px; line-height: 1.5;">
<strong><br /></STRONG></DIV>
<div STYLE="font-size: 23px; line-height: 1.5;">
<strong>让你主动按按钮</STRONG></DIV>
<div STYLE="font-size: 23px; line-height: 1.5;">
<strong><br /></STRONG></DIV>
<div STYLE="font-size: 23px; line-height: 1.5;">
<strong><br /></STRONG></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">So picture the rat
in his box. Or, since I'm one of these gamers and don't like to
think of myself as a rat, picture an adorable hamster. Maybe he can
talk, and is voiced by Chris Rock.</DIV>
<div STYLE="font-size: 23px; line-height: 1.5;"><span STYLE="font-size: medium;"><font COLOR="#0000FF" SIZE="2">想象一个关在笼子里的一个小白鼠，噢，既然我自己也老玩游戏，当然不愿意承认自己是小白鼠。那就想象是精灵鼠小弟行了吧。</FONT></SPAN></DIV>
<div STYLE="font-size: 23px; line-height: 1.5;"><span STYLE="font-size: medium;"><br /></SPAN></DIV>
<div STYLE="font-size: 23px; line-height: 1.5;"><span STYLE="font-size: medium;"><font COLOR="#000000" SIZE="2">If you want to
make him press the lever as fast as possible, how would you do it?
Not by giving him a pellet with every press--he'll soon relax,
knowing the pellets are there when he needs them. No, the best way
is to set up the machine so that it drops the pellets at random
intervals of lever pressing. He'll soon start pumping that thing as
fast as he can. Experiments prove it.</FONT></SPAN></DIV>
<div STYLE="font-size: 23px; line-height: 1.5;"><span STYLE="font-size: medium;"><br /></SPAN></DIV>
<div STYLE="font-size: 23px; line-height: 1.5;"><span STYLE="font-size: medium;"><font COLOR="#0000FF" SIZE="2">如果你想让它不停的按按钮，你会怎么做呢？如果你不在它按按钮的时候奖励它食物，它显然就不会再去按了。最牛逼的办法就是设定个程序根据按按钮的次数按照不定的几率的掉落食物，那么它马上就会不停的按按钮。实验证明了这点。</FONT></SPAN></DIV>
<div STYLE="font-size: 23px; line-height: 1.5;"></DIV>
<div STYLE="font-size: 23px; line-height: 1.5;"><span STYLE="font-size: medium;"><font SIZE="4"><img HEIGHT="300" BORDER="0" WIDTH="400" ALT="" SRC="http://i.crackedcdn.com/phpimages/article/8/4/6/19846.jpg" STYLE="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial;" /></FONT></SPAN></DIV>
<div STYLE="font-size: 23px; line-height: 1.5;"><span STYLE="font-size: medium;"><font SIZE="4">See? Proof.</FONT></SPAN></DIV>
<div STYLE="font-size: 23px; line-height: 1.5;"><span STYLE="font-size: medium;"><br /></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">They call these
"Variable Ratio Rewards" in Skinner land and this is the reason
many enemies "drop" valuable items totally at random in WoW. This
is addictive in exactly the same way a slot machine is addictive.
You can't quit now because the very next one could be a winner. Or
the next. Or the next.</DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF">这叫“变动的暴率”，这就是为什么在魔兽世界里，怪物掉的东西都是随机的。。这就跟老虎机勾住人是一个意思。"也许再玩一次就大奖呢？=
&nbsp;也许下一个怪就掉我的装备了呢？"</FONT></DIV>
<div STYLE="font-size: 23px; line-height: 1.5;"><span STYLE="font-size: medium;"><br /></SPAN></DIV>
<div STYLE="font-size: 23px; line-height: 1.5;"><span STYLE="font-size: medium;"><br /></SPAN></DIV>
<div STYLE="font-size: 23px; line-height: 1.5;"><span STYLE="font-size: medium;"><br /></SPAN></DIV>
<div STYLE="font-size: 23px; line-height: 1.5;"><span STYLE="font-size: medium;"><br /></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">The Chinese MMO ZT
Online has the most devious implementation of this I've ever seen.
The game is full of these treasure chests that may or may not
contain a random item and to open them, you need a key. How do you
get the keys? Why, you buy them with real-world money, of course.
Like coins in a slot machine.</DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF">在中国，网络游戏《征途》用的方法可谓是世界上最狡猾的。这个游戏满世界都是各种各样随机开出宝物的箱子。你想打开这些箱子，你就得用KEY。怎么获得这些KEY呢？当然花RMB买了，跟老虎机的游戏币一个意思。</FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">
&nbsp;</DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><img HEIGHT="300" BORDER="0" WIDTH="400" ALT="" SRC="http://i.crackedcdn.com/phpimages/article/8/4/8/19848.jpg?v=1" STYLE="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; width: 372px; height: 227px;" /><br />
</DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<font SIZE="4">And that's hardly the most ridiculous aspect of the
game.</FONT></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<font COLOR="#0000FF" SIZE="4">当然那显然不是这样游戏最离谱的地方。</FONT></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">
&nbsp;</DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">Now, in addition to
the gambling element, you have thousands of players in competition
with each other, to see who can be the most obsessive about opening
the chests. One woman tells of how she spent her entire evening
opening chests--over a thousand--to try to win the daily
prize.</DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br />
She didn't. There was always someone else more obsessed.</DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF">除了赌博元素外，你跟其他成千上万的玩家还有个排名，互相攀比看看谁开的箱子最多。有个妹子就说她曾经花整个晚上在开箱子--开了1000多个箱子就为了得当日日常奖励。她最后也没有得到,因为总有人比她开的多.</FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">So What's The
Problem?</DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">Are you picturing
her sitting there, watching her little character in front of the
chest, clicking dialogue boxes over and over, watching the same
animation over and over, for hour after hour?</DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF">问题在哪？</FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF">你是不是能到想象那个妹子坐在电脑前，看着她的人物在箱子前，不断开箱子，点对话，看同一个动画效果无数次？</FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><img HEIGHT="300" BORDER="0" WIDTH="400" ALT="" SRC="http://i.crackedcdn.com/phpimages/article/8/4/9/19849.gif?v=1" STYLE="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; width: 348px; height: 257px;" /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">If you didn't know
any better, you'd think she had a crippling mental illness. How
could she possibly get from her rational self to that Rain
Man-esque compulsion?</DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF">如果不懂她在做什么的话，你会以为她有严重的心理疾病
：“她怎么可能从一个好妹子变成了一个窝在家里的宅？”</FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">BF Skinner knew. He
called that training process "shaping." Little rewards, step by
step, like links in a chain. In WoW you decide you want the super
cool Tier 10 armor. You need five separate pieces. To get the full
set, you need more than 400 Frost Emblems, which are earned a
couple at a time, from certain enemies. Then you need to upgrade
each piece of armor with Marks of Sanctification. Then again with
Heroic Marks of Sanctification. To get all that you must re-run
repetitive missions and sit, clicking your mouse, for days and days
and days. Boobies be damned.</DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<font COLOR="#0000FF" SIZE="2">BF
Skinner管这种过程叫塑形.用小奖励,一步一步,一环扣一环地把你控制住.</FONT></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<font COLOR="#0000FF" SIZE="2">在魔兽世界里,你想要来套T10,首先它有五件,然后你还要至少400个冰霜徽章.</FONT></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<font SIZE="2">这些</FONT></SPAN>冰霜徽章也要花时间在特定的怪物上得到.然后你还需要用"印记"换更好的T10.</FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF">所以你又得回去原来的地方继续刷怪,日日夜夜,不停的点着鼠标.</FONT>&nbsp;Boobies
be damned.</DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">Once it gets to that
point, can you even call that activity a "game" anymore? It's more
like scratching a rash. And it gets worse...</DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF">一旦你明白了,你还管这些叫"游戏"吗?
这更像是挠蚊子包,越挠越痒.并且还变的更恶劣了....</FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><strong><font SIZE="5">#2. Keeping You Pressing It... Forever</FONT></STRONG></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">
<div STYLE="font-size: 9pt; line-height: 1.5;"><strong><font COLOR="#FF0000" SIZE="5">让你一直点击鼠标,直到永远.</FONT></STRONG></DIV>
<br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">Now, the big
difference between our Skinner box hamster and a real human is that
we humans can get our pellets elsewhere. If a game really was just
nothing but clicking a box for random rewards, we'd eventually drop
it to play some other game. Humans need a long-term goal to keep us
going, and the world of addictive gaming has got this down to a
science. Techniques include...</DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF">小白鼠和人的最大区别在于我们人可以选择别的游戏.如果一个游戏真的只是开箱子随机得物品的话,我们最终就会玩别的去了.人类需要一个长远的目标来坚持继续向前.</FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF">让人沉迷的游戏用以下科学方法拴住玩家.</FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">Easing Them In</DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">First, set up the
"pellets" so that they come fast at first, and then slower and
slower as time goes on. This is why they make it very easy to earn
rewards (or level up) in the beginning of an MMO, but then the time
and effort between levels increases exponentially. Once the gamer
has experienced the rush of leveling up early, the delayed
gratification actually increases the pleasure of the later levels.
That video game behavior expert at Microsoft found that gamers play
more and more frantically as they approach a new level.</DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF">由浅入深的吸引玩家.</FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF"><br /></FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF">首先,设计好"食物"让玩家很快聚集过来,然后随时间减慢"食物"的供应速度.这就是为什么MMO一开始都是升级容易,然后需要的付出和时间与等级就按比例的增加了.一旦玩家感觉到升级迅速的快感后,之后减缓的升级速度实际上增加了升级的快感.微软的游戏行为学研究人员发现玩家升的级越高,他们玩的就越狂热.</FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">Eliminating Stopping
Points:</DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br />
<br />
The easiest way is to just put save points far apart, or engage the
player in long missions (like WoW raids) that, once started, are
difficult to get out of without losing progress.<br />
<br />
But that can be frustrating for gamers, so you can take the
opposite approach of a game like New Super Mario Bros. Wii, where
you make the levels really short so it's like eating potato chips.
They're so small on their own that it doesn't take much convincing
to get the player to grab another one, and soon they've eaten the
whole bag.</DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF">减少玩家的休息</FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF"><br /></FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF">最简单的方法就是把存档点设置的特别特比远,或者鼓励玩家做一个长线任务(比如WOW的25人本)一旦开始了,就很难主动停止,否则就前功尽弃.</FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF"><br /></FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF">不过肯定有玩家不吃这一套.所以这里有个从另外一个角度做的游戏:WII上的超级马里奥兄弟,游戏中关卡比较的短,给人的感觉就像吃一包薯片一样.吃了一片儿,意犹未尽,又吃一片儿,直到整袋吃完.</FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><img HEIGHT="300" BORDER="0" WIDTH="400" ALT="" SRC="http://i.crackedcdn.com/phpimages/article/8/5/1/19851.jpg?v=1" STYLE="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; width: 239px; height: 168px;" /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">Somewhere in that
bag is an angry dinosaur and a kidnapped princess.</DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">这<font COLOR="#0000FF">包薯片中藏着库巴和被绑的公主</FONT>.</DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">By the way, this is
the same reason a person who wouldn't normally read a 3,000-word
article on the Internet will happily read it if it's split up into
list form. Are you ignoring boobies to read this? I've done my
job!</DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF">顺便说一下这也是为什么一个人不会看一篇一整段3000字的文章,却会读那些分成细小段落的文章的原因.</FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<br /></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<font COLOR="#FFFFFF"><font COLOR="#FFFFFF">kaworu</FONT>翻译
QQ&nbsp; 149644687<br /></FONT></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<br /></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<font SIZE="2">Play It Or Lose It:<br />
<br />
This is the real dick move. Why reward the hamster for pressing the
lever? Why not simply set it up so that when he fails to press it,
we punish him?<br />
<br />
Behaviorists call this "avoidance." They set the cage up so that it
gives the animal an electric shock every 30 seconds unless it hits
the lever. It learns very very fast to stay on the lever, all the
time, hitting it over and over. Forever.</FONT></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<br /></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF">不玩你就输了</FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF"><br /></FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF">这是一个比较操蛋的阴招.为什么因为小白鼠按键就奖励它?为什么不是设计成如果他不按,就惩罚他?</FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF"><br /></FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF">行为学家叫这个"avoidance避免".他们设计这样的笼子让每隔30秒就给动物一个电击，</FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF">除非它按那个按钮。动物也学的非常非常快，永远在按钮旁边，不停的按着按钮，一次又一次。</FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">
&nbsp;</DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><img HEIGHT="300" BORDER="0" WIDTH="400" ALT="" SRC="http://i.crackedcdn.com/phpimages/article/8/5/3/19853.jpg?v=1" STYLE="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; width: 272px; height: 186px;" /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">"Get back to
Excitebike!"</DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">Why is your mom
obsessively harvesting her crops in Farmville? Because they wither
and rot if she doesn't. In Ultima Online, your house or castle
would start to decay if you didn't return to it regularly. In
Animal Crossing, the town grows over with weeds and your virtual
house becomes infested with cockroaches if you don't log in often
enough. It's the crown jewel of game programming
douchebaggery--keep the player clicking and clicking and clicking
just to avoid losing the stuff they worked so hard to get.</DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF">为什么到时间了就要疯了似的收割农作物，因为它会枯萎会腐烂。在《UO》你的房子或者城堡会变旧。在《动物之森》中，在镇子会长满野草，假如不经常登陆的话你的房子会爬进蟑螂。这是操蛋游戏设计史的里程牌设计让玩家不停的玩玩玩而只为了避免失去他们曾非常努力得到的东西</FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">All Of the
Above:<br />
<br />
Each of those techniques has a downside and to get the ultimate
addictive game, you combine as many as possible, along with the
"random drop" gambling element mentioned before (count how many of
these techniques are in WoW). They get the hamster running back and
forth from one lever to another to another.</DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF">上述每一个方法都有不足。为了让人沉迷于这个游戏。他们就把这些方法全部结合起来，加上“固定暴率，随机掉落”（算算有多少在魔兽世界里）做成一个游戏。让小白鼠们，一会跑去按这个按钮，一会跑去按那个按钮。</FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">So What's The
Problem?<br />
<br />
We asked earlier if the item collection via obsessive clicking
could be called a "game." So that raises the question: What is a
game?<br />
<br />
Well, we humans play games because there is a basic satisfaction in
mastering a skill, even if it's a pointless one in terms of our
overall life goals. It helps us develop our brains (especially as
children) and to test ourselves without serious consequences if we
fail. This is why our brains reward us with the sensation we call
"fun" when we do it. Hell, even dolphins do it:</DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF">问题在哪？</FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF"><br /></FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF">之前我们提出这个问题：强迫性的点击&gt;&gt;&gt;&gt;收集物品
能不能称为一个游戏 那么这引出一个大问题 什么是游戏？</FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF"><br /></FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF">嗯，我们玩游戏是因为我们满足于掌控游戏世界，尽管对我们现实世界没有任何意义。它也能帮助开发我们的大脑（尤其是孩子们），还可以看看自己的能力而且即使失败了也没什么后果。这就是为什么我们的大脑在我们玩游戏时奖励我们一种我们称做“快乐”的感觉。其实海豚也是这样的</FONT>（http://www.youtube.com/watch?v=TMCf7SNUb-Q&amp;feature=player_embedded）</DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">This is why I
haven't included games
like<span>&nbsp;</SPAN><em>Guitar
Hero</EM><span>&nbsp;</SPAN>in this article. They're
addictive, sure, but in a way everybody understands. It's perfectly
natural to enjoy getting good at something. Likewise, competitive
games like<span>&nbsp;</SPAN><em>Modern Warfare
2</EM><span>&nbsp;</SPAN>are just sports for people who
lack athleticism. There's no mystery there; everybody likes to win.
<div STYLE="font-size: 9pt; line-height: 1.5; border-top-width: medium; border-right-width: medium; border-bottom-width: medium; border-left-width: medium; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-color: initial; overflow-x: hidden; overflow-y: hidden; text-align: left; background-color: transparent; color: rgb(0, 0, 0); text-decoration: none;">
<br /></DIV>
</DIV>
<div STYLE="font-size: 9pt; line-height: 1.5; border-top-width: medium; border-right-width: medium; border-bottom-width: medium; border-left-width: medium; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-color: initial; overflow-x: hidden; overflow-y: hidden; text-align: left; background-color: transparent; color: rgb(0, 0, 0); text-decoration: none;">
<br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5; border-top-width: medium; border-right-width: medium; border-bottom-width: medium; border-left-width: medium; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-color: initial; overflow-x: hidden; overflow-y: hidden; text-align: left; background-color: transparent; color: rgb(0, 0, 0); text-decoration: none;">
<font COLOR="#0000FF">所以我没有谈及像吉他英雄这样的游戏。它们也故意让人上瘾，不过用的路子是大家都明白知道的。我们很自然会想要玩的越来越好。同样地，像使命召唤6这样的游戏只是</FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF">面向那些缺乏运动细胞的人的一种体育运动，它遵循一个最简单的规则，人人都想赢。（译者注：使命召唤网战里的升级解锁系统？？？死后回放？？？？这显然也不是什么好东西。）</FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">But these "hit the
lever until you pass out from starvation" gaming elements stray
into a different area completely. As others have pointed out, the
point is to keep you playing long after you've mastered the skills,
long after you've wrung the last real novel experience from it. You
can't come up with a definition of "fun" that encompasses the
activity of clicking a picture of a treasure chest with your mouse
a thousand times.</DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF">但那些让你一直”按按钮，直到饿死“的游戏迷失偏离到了另外一种境界。就像其他人指出来的一样，这种游戏的意思就是在你操作NB,完全掌控这个游戏后，还得玩下去。即使体验最后一丁点新鲜事物后还要玩下去。显然点击鼠标获得一张宝物的图片不能用”好玩“来定义把？</FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">This is why some
writers blasted Blizzard when WoW introduced a new "achievement"
system a couple of years ago. These are rewards tied to performing
random pointless tasks, over and over again (such as, fishing until
you catch a thousand fish). No new content, no element of practice,
or discovery, or mastery was included. Just a virtual
treadmill.</DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF">这就是为什么一些作家炮轰几年前暴雪”发明“的成就系统。那些成就捆绑着一些毫无意义的任务（比如钓上1000条鱼）。这不是新剧情，不是新游戏元素的实践，或者新的游戏手法。只是一个网络上的脚踏车。（译者注：成就团？成就龙？）</FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><img HEIGHT="300" BORDER="0" WIDTH="400" ALT="" SRC="http://i.crackedcdn.com/phpimages/article/8/5/6/19856.jpg?v=1" STYLE="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; width: 193px; height: 222px;" /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font COLOR="#0000FF">&nbsp;
如同小白鼠的。。。</FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">Of course, game
developers (and various commenters, I'm sure) would correctly point
out that nobody is making the players do it. Why would humans
voluntarily put themselves in laboratory hamster mode? Well, it's
all about...</DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF">当然游戏设计师和各种下面回帖的一定准确的指出：没人逼你这么做。为什么人类会自愿的把自己当成小白鼠呢？这是因为。。。</FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font SIZE="5">#1.
Getting You To Call the Skinner Box Home</FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font SIZE="5"><br /></FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#FF0000" SIZE="5"><strong>让你把Skinner箱当作自己的家</STRONG></FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><img HEIGHT="300" BORDER="0" WIDTH="400" ALT="" SRC="http://i.crackedcdn.com/phpimages/article/8/3/2/19832.jpg?v=1" STYLE="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; width: 542px; height: 298px;" /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">Do you like your
job?<br />
<br />
Considering half of you are reading this at work, I'm going to
guess no. And that brings us to the one thing that makes gaming
addiction--and addiction in general--so incredibly hard to
beat.</DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF">你喜欢自己的工作么。</FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF">考虑到有那么一部分人读这篇文章的时候是在上班的时候，那我猜答案是否定的。</FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">As shocking as this
sounds, a whole lot of the "guy who failed all of his classes
because he was playing WoW all the time" horror stories are really
just about a dude who simply didn't like his classes very much.
This was never some dystopian mind control scheme by Blizzard. The
games just filled a void.</DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF">尽管听起来还是比较震惊的，什么“某人所有课都挂了，就因为一直玩魔兽世界”，其实只是因为这位爷，不喜欢上那些课而已。这跟什么暴雪是黑社会控制着玩家没什么关系，游戏只是填补了他们的空缺而已。。。</FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">Why do so many of us
have that void? Because according to everything expert Malcolm
Gladwell, to be satisfied with your job you need three things, and
I bet most of you don't even have two of them:<br />
<br />
Autonomy (that is, you have some say in what you do day to
day);<br />
<br />
Complexity (so it's not mind-numbing repetition);<br />
<br />
Connection Between Effort and Reward (i.e. you actually see the
awesome results of your hard work).</DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF">为什么我们中有太多人有这个空缺呢？通过Malcolm
Gladwell，我们知道任何人满意他的工作需要三件东西，我打赌你们中的大部分人连两件都没有</FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF"><br /></FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF">自主权&nbsp;</FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF">复杂性</FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF">努力后的回报</FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><img HEIGHT="300" BORDER="0" WIDTH="400" ALT="" SRC="http://i.crackedcdn.com/phpimages/article/8/5/7/19857.jpg?v=1" STYLE="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial;" /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">Notice that pants
are not necessary for job satisfaction.</DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<blockquote STYLE="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 40px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px;">
<div STYLE="font-size: 9pt; line-height: 1.5;">Most people,
particularly in the young gamer demographics, don't have this in
their jobs or in any aspect of their everyday lives. But the most
addictive video games are specifically geared to give us all
three... or at least the illusion of all three.</DIV>
</BLOCKQUOTE>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF">多数人，特别是年轻的玩家，在工作中得不到这些甚至是在任何事情中都没有。不过那些最让人上瘾的游戏可是特别地把这三个东西给我们了，或者至少，三个美好的幻象。</FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">Autonomy:<br />
<br />
You pick your quests, or which Farmville crops to plant. Hell, you
even pick your own body, species and talents.</DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<font COLOR="#0000FF" SIZE="4">自主权</FONT></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<br /></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF">游戏里你可以选择哪些任务做哪些不做，或者开心农场里种自己想种的物种。甚至你可以选择自己的身材，种族，天赋。</FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">Complexity:<br />
<br />
Players will do monotonous grinding specifically because it doesn't
feel like grinding. Remember the complicated Tier Armor/Frost
Emblem dance that kept our gamer clicking earlier.</DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<font COLOR="#0000FF" SIZE="4">复杂性</FONT></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font SIZE="4"><br /></FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF">奇怪的是玩家会去做一些单调的打装备的工作。为什么？因为他们没感觉这是在打装备。比如搞T10的时候要做的那系列复杂的工作，这让玩家心甘情愿去刷。</FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">Connection Between
Effort and Reward:<br />
<br />
This is the big one. When you level up in WoW a goddamned plume of
golden light shoots out of your body.</DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><br /></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<font COLOR="#FF0000" SIZE="4">努力后的回报</FONT></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<br /></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<font SIZE="4"><font COLOR="#FF0000">这是最重要的，一旦你在魔兽世界升了一级，这时候我操屏幕上就出现一巨大耀眼闪亮光的金光闪瞎你的狗眼</FONT>。</FONT></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<img HEIGHT="300" BORDER="0" WIDTH="400" ALT="" SRC="http://i.crackedcdn.com/phpimages/article/8/5/9/19859.jpg?v=1" STYLE="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; width: 470px; height: 299px;" /><br />
</SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<br /></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<font COLOR="#000000" SIZE="4">This is what most of us don't get in
everyday life--quick, tangible rewards. It's less about instant
gratification and more about a freaking sense of accomplishment.
How much harder would we work at the office if we got this, and
could measure our progress toward it? And if the light shot from
our crotch?</FONT></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<br /></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<br /></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<font COLOR="#0000FF" SIZE="4">这些是我们在现实生活中不能直接切实的看到生活给我们的回报。生活给予我们的不是那种即刻的满足，更像是一种长久的成就感。我们要怎样玩命努力工作才能得到这些东西，或者在过程中有东西能衡量我们跟未来的距离吗？我们是要生活给予我们的呢，还是要屏幕上显示出来升级的光芒呢。</FONT></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<br /></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<br /></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<font SIZE="4">The beauty of it is it lets games use the tedium to
their advantage. As we discussed elsewhere, there's a "work to earn
the right to play" aspect of World of Warcraft, where you grind or
"farm" for gold for the right to do the cool stuff later. The
tedious nature of the farming actually adds to the sense of
accomplishment later. And it also helps squash any sense of guilt
you might have had about neglecting school, work or household
chores to play the game. After all, you did your chores--the 12
hours you spent farming for gold last Tuesday was less fun than
mowing the fucking lawn. Now it's time for fun.</FONT></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<br /></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<br /></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF">最绝的就是他们让玩家用游戏单调的地方换取游戏有意思的地方。比如那种先得做一系列任务，才能进团队副本的，或者“我就打个点卡钱”。实际上这种无聊的刷怪行为，确实可以增加之后的成就感，并且也帮你把对不学习或不工作的罪恶感挤走。毕竟你花费时间做了点什么。“昨天我花一天的时间打钱，真无聊，还不如归置归置屋子呢。今天我总可以参加G团了吧”</FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font-family: Tahoma; font-style: normal; font-variant: normal; font-weight: normal; font-size: medium; line-height: normal; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px;">
<br /></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-indent: 0px; orphans: 2;">So What's The
Problem?</SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-indent: 0px; orphans: 2;"><br /></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-indent: 0px; orphans: 2;">Video game designer Erin
Hoffman said it perfectly: "Addiction is not about what you DO, but
what you DON'T DO because of the replacement of the addictive
behavior." She was talking about how the attraction of a simple
flash game like Bejeweled depends entirely on how badly you want to
avoid doing the work you have open in the other
window.</SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-indent: 0px; orphans: 2;"><br /></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-indent: 0px; orphans: 2;"><font COLOR="#0000FF">问题在哪？</FONT></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-indent: 0px; orphans: 2;"><br /></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span STYLE="widows: 2; text-indent: 0px; orphans: 2;"><font COLOR="#0000FF">游戏设计师<span>&nbsp;</SPAN>Erin
Hoffman说的很好：“沉迷游戏不是说你愿意做啥，而是你不愿意做什么，你用玩游戏逃避了你不愿意做的事。”
她说一个简单的FLASH游戏<span>&nbsp;</SPAN>Bejeweled<span>&nbsp;都可以让人沉迷进去，这是因为你不想工作，你想干别的。</SPAN></FONT></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">
<span><br /></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span><img HEIGHT="300" BORDER="0" WIDTH="400" ALT="" SRC="http://i.crackedcdn.com/phpimages/article/8/6/1/19861.jpg?v=1" STYLE="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial;" /><br />
</SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">
<span><br /></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span>The terrible
truth is that a whole lot of us begged for a Skinner Box we could
crawl into, because the real world's system of rewards is so much
more slow and cruel than we expected it to be. In that, gaming is
no different from other forms of mental
escape,&nbsp;from sports fandom to
moonshine</SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">
<span><br /></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span><font COLOR="#0000FF">事实就是我们很多人都乞求钻进Skinner箱,&nbsp;
乞求成为小白鼠，&nbsp;
乞求别人的奖励。因为现实生活给我们的回报真的是太长久了，又太幸苦了。所以，游戏跟看体育，看电影，或者看星星一样就是逃避生活的工具而已。</FONT></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">
<span><br /></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">
<span><br /></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span><img HEIGHT="300" BORDER="0" WIDTH="400" ALT="" SRC="http://i.crackedcdn.com/phpimages/article/8/6/2/19862.jpg?v=1" STYLE="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; width: 365px; height: 260px;" /><br />
</SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF">海洛因说：我估计注射器里放的是1毫升魔兽世界</FONT></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">
<span><br /></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">
<span><br /></SPAN></DIV>
<blockquote STYLE="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 40px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px;">
<div STYLE="font-size: 9pt; line-height: 1.5;"><span>The danger
lies in the fact that these games have become so incredibly
efficient at delivering the sense of accomplishment that people
used to get from their education or career. We're not saying gaming
will ruin the world, or that gaming addiction will be a scourge on
youth the way crack ruined the inner cities in the 90s. But we may
wind up with a generation of dudes working at Starbucks when they
had the brains and talent for so much more. They're dissatisfied
with their lives because they wasted their 20s playing video games,
and will escape their dissatisfaction by playing more video games.
Rinse, repeat.</SPAN></DIV>
</BLOCKQUOTE>
<div STYLE="font-size: 9pt; line-height: 1.5;">
<span><br /></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span><font COLOR="#0000FF">危险在于现在游戏设计特别高效向你灌输成就感，比学业或者事业中要大的太多了。我们不是说游戏会毁了这个世界，或者沉迷游戏在年轻人中是一种瘟疫。不过我们以后可能会有一整代的人，在麦当劳在肯德基工作，即便他们有很好的天赋。他们不满意自己的生活因为他们浪费20年的光阴在玩游戏上，然后又逃避现实，逃避自己的“不满意”，去花更多的时间玩游戏。如此往复。</FONT></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">
<span><br /></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">
<span><br /></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><span>And let's face
it; if you think WoW is addictive, wait until you see the games
they're making 10 years from now. They're only getting better at
what they do.</SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">
<span><br /></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;">
<span><br /></SPAN></DIV>
<div STYLE="font-size: 9pt; line-height: 1.5;"><font COLOR="#0000FF">不过有个事实就是，如果你认为魔兽世界是毒品的话，等十年后你再看，魔兽世界一定会变的不一样。（译者注：最后这段不知如何翻译）</FONT></DIV></div></div>]]></description>
            <author>FL车在臣</author>
            <category>杂谈系列</category>
            <comments>http://blog.sina.com.cn/s/blog_3ecb9b110100tgx4.html#comment</comments>
            <pubDate>Fri, 05 Aug 2011 19:58:53 +0800</pubDate>
            <guid>http://blog.sina.com.cn/s/blog_3ecb9b110100tgx4.html</guid>
        </item>
        <item>
            <title>[Zynga] 全球第一社交游戏公司 Zynga 北京招聘 Hot Jobs</title>
            <link>http://blog.sina.com.cn/s/blog_3ecb9b110100sgak.html</link>
            <description><![CDATA[<div STYLE=""><b><span STYLE="font-weight: normal;"><b><font COLOR="#FF0000">Zynga 北京</FONT></B></SPAN>招聘<br /></B></DIV>
<span STYLE="font-weight: bold;">有意者请与我联系 Email：</SPAN><span STYLE="text-decoration: underline; font-weight: bold;">wyang@zynga.com</SPAN><br STYLE="font-weight: bold;" />

<span STYLE="font-weight: bold;">PS：在 Zynga 的感觉非常好，轻松 +
融洽，在这里你会找到适合自己的位置，充分发挥你的才能。</SPAN><br STYLE="font-weight: bold;" />
<div STYLE=""><span STYLE="font-weight: bold;">以下是职位介绍</SPAN><b><br />
<br STYLE="font-weight: bold; color: rgb(111, 49, 152);" />
</B><span STYLE="font-weight: bold; color: rgb(111, 49, 152);">Engineering</SPAN><br STYLE="font-weight: bold;" />

<span STYLE="font-weight: bold; color: rgb(255, 0, 0);">Software
Engineer &ndash; PHP</SPAN><br />
<span STYLE="font-weight: bold;">Responsibilities</SPAN><br />
We are looking for best-of-the-class PHP developers to deliver new
titles and new features on multiple social networks, and enhance
our backend platform.&nbsp; The candidate is expected
to have strong expertise in developing high-volume,
high-availability, and large-scale data-driven web
applications.&nbsp; The ability to transform creativity
design into well-organized and highly-efficient OO code on a
complex code-base is the key to success.<br />
<br />
<span STYLE="font-weight: bold;">Minimum Requirements</SPAN><br />
&bull;&nbsp;&nbsp;&nbsp; Bachelor's
Degree in Computer Science or equivalent<br />
&bull;&nbsp;&nbsp;&nbsp; 2+ years of
software development experience<br />
&bull;&nbsp;&nbsp;&nbsp; Minimum 1
year of PHP development experience<br />
&bull;&nbsp;&nbsp;&nbsp; Solid
understanding of OO design principles and practices<br />
&bull;&nbsp;&nbsp;&nbsp; Strong
analytical and problem solving skills<br />
&bull;&nbsp;&nbsp;&nbsp; Excellent
teamwork skills, flexibility and ability to multi-task
effectively<br />
<br />
<span STYLE="font-weight: bold;">Preferred
Qualifications</SPAN><br />
&bull;&nbsp;&nbsp;&nbsp; Familiarity
with Linux, Apache, and MySQL<br />
&bull;&nbsp;&nbsp;&nbsp; Social
network platform experience<br />
&bull;&nbsp;&nbsp;&nbsp; Experience
with caching and sharding<br />
&bull;&nbsp;&nbsp;&nbsp; Fluent in
written and spoken English<br />
<br />
<span STYLE="font-weight: bold; color: rgb(255, 0, 0);">Software
Engineer &ndash; Flash</SPAN><br />
<span STYLE="font-weight: bold;">Responsibilities</SPAN><br />
We are looking for best-of-the-class Flash developers to deliver
new titles and features with sophisticated game play and stringent
performance requirements.&nbsp; The candidate is
expected to have deep understanding of Flash and Flash based
applications.&nbsp; The ability to transform creativity
design into well-organized and highly-efficient OO code on a
complex code-base is the key to success.<br />
<br />
<span STYLE="font-weight: bold;">Minimum Requirements</SPAN><br />
&bull;&nbsp;&nbsp;&nbsp; Bachelor's
Degree in Computer Science or equivalent<br />
&bull;&nbsp;&nbsp;&nbsp; 2+ years of
software development experience<br />
&bull;&nbsp;&nbsp;&nbsp; Deep
experience in Flash development and Actionscript<br />
&bull;&nbsp;&nbsp;&nbsp; Solid
understanding of OO design principles and practices<br />
&bull;&nbsp;&nbsp;&nbsp; Strong
analytical and problem solving skills<br />
&bull;&nbsp;&nbsp;&nbsp; Excellent
teamwork skills, flexibility and ability to multi-task
effectively<br />
<br />
<span STYLE="font-weight: bold;">Preferred
Qualifications</SPAN><br />
&bull;&nbsp;&nbsp;&nbsp; Hands-on
experience with CPU/memory optimization, JavaScript/Flash bridging,
cross-browser compatibility<br />
&bull;&nbsp;&nbsp;&nbsp; Extensive
design and game development experience<br />
&bull;&nbsp;&nbsp;&nbsp; Fluent in
written and spoken English<br />
<br />
<span STYLE="font-weight: bold; color: rgb(255, 0, 0);">Software
Engineer &ndash; Backend Systems</SPAN><br />
<span STYLE="font-weight: bold;">Responsibilities</SPAN><br />
We are looking for best-of-the-class system engineers to deliver
new titles and new features on multiple social networks, and
enhance our backend platform.&nbsp; The candidate is
expected to have strong expertise in developing high-volume,
high-availability, and large-scale data-driven web
applications.&nbsp; The ability to transform creativity
design into well-organized and highly-efficient OO code on a
complex code-base is the key to success.<br />
<br />
<span STYLE="font-weight: bold;">Minimum Requirements</SPAN><br />
&bull;&nbsp;&nbsp;&nbsp; Bachelor's
Degree in Computer Science or equivalent<br />
&bull;&nbsp;&nbsp;&nbsp; 2+ years of
software development experience<br />
&bull;&nbsp;&nbsp;&nbsp; Strong
expertise in large scale system architecture, LAMP stack, and
TCP/IP networking<br />
&bull;&nbsp;&nbsp;&nbsp; Solid
understanding of OO design principles and practices<br />
&bull;&nbsp;&nbsp;&nbsp; Strong
analytical and problem solving skills<br />
&bull;&nbsp;&nbsp;&nbsp; Excellent
teamwork skills, flexibility and ability to multi-task
effectively<br />
<br />
<span STYLE="font-weight: bold;">Preferred
Qualifications</SPAN><br />
&bull;&nbsp;&nbsp;&nbsp; Social
network platform experience<br />
&bull;&nbsp;&nbsp;&nbsp; Experience
with caching and sharding<br />
&bull;&nbsp;&nbsp;&nbsp; Fluent in
written and spoken English<br />
<br />
<span STYLE="font-weight: bold; color: rgb(255, 0, 0);">Data
Analyst</SPAN><br />
Zynga seeks a skilled, positive, and energetic Data Analyst to join
the team!&nbsp; The successful candidate will have
excellent SQL-writing ability, and enjoy combining analytic skills
with business acumen to provide our game studios with the data and
insights that will drive our continued success.&nbsp;
The Data Analyst works with key decision-makers on a daily basis as
a data-driven advisor and partner on strategic
issues.&nbsp; The candidate should enjoy both working
with people and performing technical analyses.<br />
<br />
We are committed to developing high quality casual and multi player
games!&nbsp;&nbsp;<br />
<br />
<span STYLE="font-weight: bold;">Responsibilities:</SPAN><br />
&bull;&nbsp;&nbsp;&nbsp; Provide
reporting and performance monitoring to game studios using data
drawn from diverse sources<br />
&bull;&nbsp;&nbsp;&nbsp; Perform
detailed data exploration and validation to separate genuine
phenomena from spurious anomalies<br />
&bull;&nbsp;&nbsp;&nbsp; Develop new
insights and analyses that inform decisions and help us continue to
delight the people playing our games<br />
<span STYLE="font-weight: bold;"><br />
Required Skills:</SPAN><br />
&bull;&nbsp;&nbsp;&nbsp; Several
years experience performing quantitative analysis, preferably for
an internet or technology company<br />
&bull;&nbsp;&nbsp;&nbsp; Excellent
SQL skills: extensive experience querying large, complex data
sets<br />
&bull;&nbsp;&nbsp;&nbsp; High
proficiency with Excel including pivoting capabilities and analysis
modules &ndash; VBA macros and ODBC sourcing a plus<br />
&bull;&nbsp;&nbsp;&nbsp; Working
knowledge of basic statistics; experience with R, SAS or similar a
plus<br />
&bull;&nbsp;&nbsp;&nbsp; Ability to
execute research projects, and generate practical results and
recommendations<br />
&bull;&nbsp;&nbsp;&nbsp; Good client
management skills with a strong grasp of both technical and
business perspectives<br />
&bull;&nbsp;&nbsp;&nbsp; Proven
ability to work in a fast-paced environment, and to meet changing
deadlines and priorities on multiple simultaneous projects<br />
&bull;&nbsp;&nbsp;&nbsp; Excellent
organizational, communication and interpersonal skills<br />
&bull;&nbsp;&nbsp;&nbsp; Enjoy
working in both individual and team settings<br />
&bull;&nbsp;&nbsp;&nbsp; B.S. or
B.A. in math, economics, engineering or other technical field
required; advanced degrees a plus<br />
&bull;&nbsp;&nbsp;&nbsp; Fluent in
spoken and written English<br />
<br />
<br STYLE="font-weight: bold;" />
<span STYLE="font-weight: bold; color: rgb(111, 49, 152);">Network
Ops / IT</SPAN><br STYLE="font-weight: bold;" />
<span STYLE="font-weight: bold; color: rgb(255, 0, 0);">Operations
Engineer</SPAN><br />
<span STYLE="font-weight: bold;">Responsibilities</SPAN><br />
We are looking for best-of-the-class engineer to operate Zynga's
large scale gaming system. The candidate will build and maintain a
strong relationship with the game studios to deploy and support the
most sophisticated social games on Zynga's cloud
infrastructure.&nbsp; Main responsibilities include
game trouble shooting, performance optimization, system monitoring,
and operations tool development. You should be comfortable with
working in a very fast paced environment where agility,
flexibility, and technical excellence are highly valued.<br />
&nbsp;<br />
<span STYLE="font-weight: bold;">Minimum Requirements</SPAN><br />
&bull;&nbsp;&nbsp;&nbsp; Bachelor's
Degree in Computer Science or equivalent<br />
&bull;&nbsp;&nbsp;&nbsp; 2+ years of
experience of supporting large mission-critical, highly scalable
distributed systems Infrastructure, large network operations
experience such as found in Internet and telecom industries<br />
&bull;&nbsp;&nbsp;&nbsp; Extensive
network, storage, and system management experience<br />
&bull;&nbsp;&nbsp;&nbsp; Extensive
UNIX/Linux system administration experience, solid understanding of
TCP/IP networking<br />
&bull;&nbsp;&nbsp;&nbsp; Experience
with LAMP stack, database (MySQL) administration and scaling<br />
&bull;&nbsp;&nbsp;&nbsp; Strong
scripting skills in Shell, Perl, Python, or PHP<br />
&bull;&nbsp;&nbsp;&nbsp; Excellent
English written and verbal communication skills<br />
&bull;&nbsp;&nbsp;&nbsp; Must be
enthusiastic, action oriented, capable of independently solving
complex technical problems<br />
&nbsp;<br />
<span STYLE="font-weight: bold;">Preferred
Qualifications</SPAN><br />
&bull;&nbsp;&nbsp;&nbsp; Hands-on
datacenter experience<br />
&bull;&nbsp;&nbsp;&nbsp; Experience
with elastic cloud infrastructure<br />
&bull;&nbsp;&nbsp;&nbsp; Familiarity
with social gaming and social networks<br />
<br />
<span STYLE="font-weight: bold; color: rgb(255, 0, 0);">IT Engineer
&ndash; Windows</SPAN><br />
Zynga is looking for an IT Engineer &ndash; Windows&nbsp; to
support our growing user base. The IT Engineer reports to IT
Manager, and must be technically excellent and willing to provide
fantastic customer service in both creative and corporate
environments.<br />
<br />
<span STYLE="font-weight: bold;">Requirements:</SPAN><br />
&bull;&nbsp;&nbsp;&nbsp; BA in
Computer Science, Management Information Systems or related field
(or equivalent experience) required<br />
&bull;&nbsp;&nbsp;&nbsp; 5-7 years
of Windows systems administration experience with in depth
knowledge of Windows Server, AD, Exchange and Sharepoint<br />
&bull;&nbsp;&nbsp;&nbsp; Knowledge
of networking, including WAN/LAN, wireless enterprise solution and
mobile management systems<br />
&bull;&nbsp;&nbsp;&nbsp; Systems
administration-level knowledge of DNS, DHCP, RADIUS, NFS. Expert
knowledge of scripting.<br />
&bull;&nbsp;&nbsp;&nbsp; Experience
supporting complex systems in a 24x7 environment.<br />
&bull;&nbsp;&nbsp;&nbsp;
Demonstrated ability to work independently and be an effective
contributor in a diversified and geographically distributed
team<br />
&bull;&nbsp;&nbsp;&nbsp; Excellent
multi-tasking and communication skill<br />
&bull;&nbsp;&nbsp;&nbsp; Fluent in
oral and written English are required<br />
<br />
<span STYLE="font-weight: bold; color: rgb(111, 49, 152);">QA</SPAN><br STYLE="font-weight: bold;" />
<span STYLE="font-weight: bold; color: rgb(255, 0, 0);">Sr. Quality
Assurance Manager</SPAN><br />
Zynga is looking for an experienced Quality Assurance Manager with
strong leadership abilities and excellent organizational
skills.&nbsp; The candidate must have experience in
resource allocation and estimates, change management, risk analysis
and have an extensive background in consumer, gaming and Internet
based software technologies.&nbsp; This person must be
able to work in a fast paced environment and have previous
experience managing medium to large teams of Quality Assurance
testers.<br />
&nbsp;<br />
<span STYLE="font-weight: bold;">Responsibilities:</SPAN><br />
&bull;&nbsp;&nbsp;&nbsp; Define
quality procedures in conjunction with operating staff;<br />
&bull;&nbsp;&nbsp;&nbsp; Identify
relevant quality-related training needs and delivering
training;<br />
&bull;&nbsp;&nbsp;&nbsp; Ensure
tests and procedures are properly understood, carried out and
evaluated<br />
&bull;&nbsp;&nbsp;&nbsp; Supervise
staff in carrying out tests and checks;<br />
&bull;&nbsp;&nbsp;&nbsp; Bring
together staff of different disciplines and driving the group to
plan, formulate and agree upon comprehensive quality
procedures;&nbsp;<br />
<br />
<span STYLE="font-weight: bold;">Required Skills:</SPAN><br />
&bull;&nbsp;&nbsp;&nbsp; 5-8 years
QA Management experience, preferably in gaming or internet
technologies<br />
&bull;&nbsp;&nbsp;&nbsp; 2-3 Years
experience working with outsource partners, managing and
maintaining the quality and budgetary requirements<br />
&bull;&nbsp;&nbsp;&nbsp; 3- 5 Years
experience promoting quality achievement and performance
improvement throughout the organization;<br />
&bull;&nbsp;&nbsp;&nbsp; Maintaining
awareness of the business context and company profitability,
including budgetary control issues<br />
&bull;&nbsp;&nbsp;&nbsp; Experience
working closely with Customer Service groups<br />
&bull;&nbsp;&nbsp;&nbsp; Excellent
spoken and written English<br />
<br />
<span STYLE="font-weight: bold; color: rgb(255, 0, 0);">QA
Tester</SPAN><br />
Responsibilities:<br />
&bull;&nbsp;&nbsp;&nbsp; Working
with development department to carry out the test and complete the
tests in time with good quality.<br />
&bull;&nbsp;&nbsp;&nbsp; Formulating
the good project test sample which shall be implemented and
improved strictly so as to ensure the qualified efficiency and
status of products development<br />
&bull;&nbsp;&nbsp;&nbsp; Writing and
communicating game testing report according to relevant regulations
and requirement<br />
<br />
<span STYLE="font-weight: bold;">Required Skills:</SPAN><br />
&bull;&nbsp;&nbsp;&nbsp; More than 6
years’ experience in game and more than 1 year’ experience in Web
Game<br />
&bull;&nbsp;&nbsp;&nbsp; Great
interests in creation and web game, and strong passion for game
industry<br />
&bull;&nbsp;&nbsp;&nbsp; Familiar
with design of test sample and having some knowledge of test
process<br />
&bull;&nbsp;&nbsp;&nbsp; Good at
analysis and organization, and being a good communicator<br />
&bull;&nbsp;&nbsp;&nbsp; Good team
spirit and good pressure handler<br />
&bull;&nbsp;&nbsp;&nbsp; Diploma or
advance degree in computer or relevant major<br />
&bull;&nbsp;&nbsp;&nbsp; More than 1
year experience in game testing<br />
&bull;&nbsp;&nbsp;&nbsp; Excellent
program basis (Flash as3 or php)<br />
&bull;&nbsp;&nbsp;&nbsp; Excellent
English reading and writing skill<br />
&bull;&nbsp;&nbsp;&nbsp;
Participated into the game development<br />
&bull;&nbsp;&nbsp;&nbsp;
Professional web game player<br />
<br />
<span STYLE="font-weight: bold; color: rgb(111, 49, 152);">Community Management
/ Customer Support</SPAN><br STYLE="font-weight: bold;" />
<span STYLE="font-weight: bold; color: rgb(255, 0, 0);">Community
Manager</SPAN><br />
Zynga’s Community Manager is the voice of the company or product
externally and the voice of the customers internally. The value
lies in the community manager serving as a hub, and his/her ability
to personally connect with the customers to humanize the company,
increase user retention, build product loyalty, and provide
feedback to many internal departments (development, PR, marketing,
customer service, tech support, etc.)<br />
We are committed to developing high quality casual and multi player
games!<br />
<br />
<span STYLE="font-weight: bold;">Responsibilities:</SPAN><br />
&bull;&nbsp;&nbsp;&nbsp; Creatively
and proactively assist customers through multiple contact
methods<br />
&bull;&nbsp;&nbsp;&nbsp; Serve as a
point of contact for inbound requests<br />
&bull;&nbsp;&nbsp;&nbsp; Identify
and analyze issues, patterns and trends in customer requests
&amp; product performance<br />
&bull;&nbsp;&nbsp;&nbsp; Transfer
the information to the appropriate departments so that they can
respond accordingly bugs to quality assurance<br />
&bull;&nbsp;&nbsp;&nbsp; New ideas
to product development<br />
&bull;&nbsp;&nbsp;&nbsp; Messaging
effectiveness to marketing<br />
&bull;&nbsp;&nbsp;&nbsp; Frequently
asked questions noted<br />
&bull;&nbsp;&nbsp;&nbsp; Identifying
user generated content<br />
&bull;&nbsp;&nbsp;&nbsp; Author blog
posts, articles, podcasts, videos and other community content<br />
&bull;&nbsp;&nbsp;&nbsp; Establish
and report metrics on a monthly basis, including
recommendations<br />
&bull;&nbsp;&nbsp;&nbsp; Identify
and engage advocates<br />
&bull;&nbsp;&nbsp;&nbsp; Proactively
escalate issues, observations, opportunities, and insights to the
executive team<br />
&bull;&nbsp;&nbsp;&nbsp; Communicate
issues, opportunities, and insights to the company at large.<br />
&bull;&nbsp;&nbsp;&nbsp; Provide
creative insight to ensure games are appropriate for the
market<br />
&bull;&nbsp;&nbsp;&nbsp; Stay up to
date on new social media tools, best practices and how other
organizations and companies are using them, so that the company can
continue to be an early adopter of these technologies<br />
&bull;&nbsp;&nbsp;&nbsp; Participate
in professional networking by following the prominent bloggers and
online writers &amp; attending events<br />
<br />
<span STYLE="font-weight: bold;">Required Skills:</SPAN><br />
&bull;&nbsp;&nbsp;&nbsp; 2+ years of
experience in online community development<br />
&bull;&nbsp;&nbsp;&nbsp; BA
preferred<br />
&bull;&nbsp;&nbsp;&nbsp; Experience
moderating forum discussions<br />
&bull;&nbsp;&nbsp;&nbsp; Experience
managing community leaders<br />
&bull;&nbsp;&nbsp;&nbsp; Excellent
written and verbal communication skills<br />
&bull;&nbsp;&nbsp;&nbsp; Ability to
work in a team environment with maturity and leadership<br />
<br STYLE="font-weight: bold;" />
<span STYLE="font-weight: bold; color: rgb(255, 0, 0);">Customer
Support</SPAN><br />
Zynga is looking for a Customer Service Representative to join our
growing team!&nbsp; As a Customer Service
Representative, you will help to resolve escalated email requests
from our customers.&nbsp; This is a contract position.
We are committed to developing high quality casual and multi player
games!&nbsp;<br />
<br />
<span STYLE="font-weight: bold;">Responsibilities:</SPAN><br />
&bull;&nbsp;&nbsp;&nbsp; Respond to
inbound email requests from customers<br />
&bull;&nbsp;&nbsp;&nbsp; Research
customer issues using in-house tools<br />
&bull;&nbsp;&nbsp;&nbsp; Create
reports in Excel<br />
&bull;&nbsp;&nbsp;&nbsp; Play our
games<br />
<span STYLE="font-weight: bold;">Required Skills:</SPAN><br />
&bull;&nbsp;&nbsp;&nbsp; 1 year
Customer Service experience<br />
&bull;&nbsp;&nbsp;&nbsp; 2 year
College degree or equivalent course work<br />
&bull;&nbsp;&nbsp;&nbsp;
Intermediate MS Office skills including Word, Excel and
PowerPoint<br />
&bull;&nbsp;&nbsp;&nbsp; Familiarity
with social networks<br />
&bull;&nbsp;&nbsp;&nbsp; Familiarity
with social network games or online games<br />
&bull;&nbsp;&nbsp;&nbsp; Familiarity
with online game communities desired<br />
&bull;&nbsp;&nbsp;&nbsp; Online
customer service experience preferred<br />
&bull;&nbsp;&nbsp;&nbsp; Ability to
communicate instructions to others clearly in written and oral
form<br />
&bull;&nbsp;&nbsp;&nbsp; Ability to
learn and perform tasks quickly<br />
&bull;&nbsp;&nbsp;&nbsp; Ability to
diagnose and analyze issues for resolution&nbsp;<br />
<br />
<span STYLE="font-weight: bold; color: rgb(255, 0, 0);">Community
Specialist</SPAN><br />
Zynga is looking for an experienced moderator to help manage our
web forums. We are committed to developing high quality casual and
multi player games!<br />
<span STYLE="font-weight: bold;">Responsibilities:</SPAN><br />
&bull;&nbsp;&nbsp;&nbsp; Work with
the Engineer to fix the bugs/weaknesses in the forum<br />
&bull;&nbsp;&nbsp;&nbsp; Responsible
for every detail of fan events based on forums (post, collect
qualifiers, etc.)<br />
&bull;&nbsp;&nbsp;&nbsp; Keep users
posting in guidelines<br />
&bull;&nbsp;&nbsp;&nbsp; Help
users/players with answers<br />
&bull;&nbsp;&nbsp;&nbsp; Collect
voices of forum users and escalate them to CM<br />
<span STYLE="font-weight: bold;">Required skills:</SPAN><br />
&bull;&nbsp;&nbsp;&nbsp; Must be a
FB/social network user and a veteran player of social game/Zynga
game<br />
&bull;&nbsp;&nbsp;&nbsp; Work
experience with forum management/CS<br />
&bull;&nbsp;&nbsp;&nbsp; Passion for
communicating with users/players<br />
<br STYLE="font-weight: bold;" />
<span STYLE="font-weight: bold; color: rgb(111, 49, 152);">User
Insights</SPAN><br STYLE="font-weight: bold;" />
<span STYLE="font-weight: bold; color: rgb(255, 0, 0);">User
Researcher</SPAN><br />
We’re passionate about learning our users’ behaviors, attitudes,
emotions and goals to help define the games experiences we create.
The UX/UI/UR group is a critical driving force behind gathering
these insights and using them to inform design. The UX/UI/UR group
is a multi-disciplinary team of interaction designers, user
interface designers, and user researchers who collaborate closely
with each other as well as with producers, product managers and
engineers to create intuitive, usable, good-looking and immersive
games.<br />
Responsibility<br />
&bull;&nbsp;&nbsp;&nbsp; Work
closely with product managers and designers, to identify project
goals, research opportunities, prioritize research questions, and
make plans.<br />
&bull;&nbsp;&nbsp;&nbsp; Identify
the most appropriate methods for certain user research
tasks&nbsp; based on research goals, context, time and
resources.<br />
&bull;&nbsp;&nbsp;&nbsp; Recruit
testing participants and organize in-lab, on-site, or remote
playtests and usability tests regularly, and establish a database
of and keep good connection with the testing participants. Manage
all related logistics to successfully execute research and
testing.<br />
&bull;&nbsp;&nbsp;&nbsp; Translate
user research findings into design recommendations and actions
plans, and evangelize to diverse audiences (UX Designers, UI
Designers, Product Managers, etc.) through written reports and oral
presentations.<br />
&bull;&nbsp;&nbsp;&nbsp; Work with
designers to conduct usability testing of wireframes, mockups,
prototypes and products.<br />
<br />
<span STYLE="font-weight: bold;">Requirement</SPAN><br />
&bull;&nbsp;&nbsp;&nbsp; At least 3
(6 FOR SENIOR) years of relevant work experience. Demonstrated
fluency in best practices for both qualitative and quantitative
user research.<br />
&bull;&nbsp;&nbsp;&nbsp; Good
knowledge of a wide range of user research methods and techniques.
Strong understanding of strengths and shortcomings of different
research methods, including when and how to apply them during each
product phase.<br />
&bull;&nbsp;&nbsp;&nbsp;
Demonstrated good understanding of design processes and
methodology, and experience in integrating user research findings
into the design process.<br />
&bull;&nbsp;&nbsp;&nbsp; Excellent
analytical ability, especially with regard to observation of user
behavior.<br />
&bull;&nbsp;&nbsp;&nbsp; Outstanding
interpersonal, communication and presentation skills and effective
cross-function collaboration skills.<br />
&bull;&nbsp;&nbsp;&nbsp; Experience
with data mining and remote usability testing tools is a
plus.<br />
&bull;&nbsp;&nbsp;&nbsp; Minimum
bachelor’s degree in related area such as psychology, human factors
or HCI.<br />
<br />
<span STYLE="font-weight: bold; color: rgb(255, 0, 0);">UI
Designer</SPAN><br />
We're passionate about learning our users’ behaviors, attitudes,
emotions and goals to help define the games experiences we create.
The UX/UI/UR group is a critical driving force behind gathering
these insights and using them to inform design. The UX/UI/UR group
is a multi-disciplinary team of interaction designers, user
interface designers, and user researchers who collaborate closely
with each other as well as with producers, product managers and
engineers to create intuitive, usable, good-looking and immersive
games.<br />
<br />
<span STYLE="font-weight: bold;">Responsibility</SPAN><br />
&bull;&nbsp;&nbsp;&nbsp; Work
closely with interaction designers and user researchers to
implement the design decisions. Responsible for execution of strong
interaction design and visual design principles.<br />
&bull;&nbsp;&nbsp;&nbsp; Work
closely with artists to design user interface elements and visual
style that corresponds to the artistic style specification.<br />
&bull;&nbsp;&nbsp;&nbsp; Define
visuals and enhance interaction models for products and features
with height quality UI elements.<br />
&bull;&nbsp;&nbsp;&nbsp; Rapid
prototyping with or without computer.<br />
&bull;&nbsp;&nbsp;&nbsp; Partner
with engineers to collaborate and iterate in fast-paced
design-build cycles.<br />
<br />
<span STYLE="font-weight: bold;">Requirement</SPAN><br />
&bull;&nbsp;&nbsp;&nbsp; 5+ years of
professional user interface design experience for software, web
applications, games, mobile devices.<br />
&bull;&nbsp;&nbsp;&nbsp; Thorough
understanding of user experience design for social applications or
rich Internet experiences.<br />
&bull;&nbsp;&nbsp;&nbsp; Strong
rapid prototyping skills, with tools like Flash, and web standard
technologies. (Expertise in making interactive prototypes with
Flash and ActionScript is a plus.)<br />
&bull;&nbsp;&nbsp;&nbsp; Expertise
in using&nbsp; Adobe CS(Photoshop, Flash, Illustrator)
and associated design tools.<br />
&bull;&nbsp;&nbsp;&nbsp; Extensive
experience with user interface design patters and popular UCD
methodologies across multiple platforms.<br />
&bull;&nbsp;&nbsp;&nbsp;
Demonstrated strong understanding of interaction design processes
and methodology and a willingness to help establish these
processes.<br />
&bull;&nbsp;&nbsp;&nbsp; Outstanding
interpersonal, communication and presentation skills, and effective
cross-function collaboration skills.<br />
&bull;&nbsp;&nbsp;&nbsp; Good
understanding of the preferences and habits of Chinese Internet
users and game players.<br />
&bull;&nbsp;&nbsp;&nbsp; Minimal
bachelor’s degree in Interaction Design, Graphical Design, New
Media Design, Industrial Design, HCI, Human Factors/Ergonomics or
related field.<br />
<br />
<span STYLE="font-weight: bold;">Portfolio</SPAN><br />
The portfolio of an UI Designer can include but not limit to:<br />
&bull; TODO<br />
Candidates will be invited to talk about the works related to
his/her portfolio.<br />
<br />
<span STYLE="font-weight: bold; color: rgb(255, 0, 0);">UX
Designer</SPAN><br />
We're passionate about learning our users’ behaviors, attitudes,
emotions and goals to help define the games experiences we create.
The UX/UI/UR group is a critical driving force behind gathering
these insights and using them to inform design. The UX/UI/UR group
is a multi-disciplinary team of interaction designers, user
interface designers, and user researchers who collaborate closely
with each other as well as with producers, product managers and
engineers to create intuitive, usable, good-looking and immersive
games.<br />
<span STYLE="font-weight: bold;"><br />
Responsibility</SPAN><br />
&bull;&nbsp;&nbsp;&nbsp; Working
closely with Producers and Product Managers to define user
interaction models, produce both high-level flows and detailed UI
layouts, and streamline UI experiences.<br />
&bull;&nbsp;&nbsp;&nbsp;
Enthusiastically partner with User Researchers to understand the
people, goals, context, constrains, and reasons of a problem, to
initialize and drive the whole design process.<br />
&bull;&nbsp;&nbsp;&nbsp; Design the
Information Architecture and generate the corresponding visual
hierarchy of the information through UI design.<br />
&bull;&nbsp;&nbsp;&nbsp; Mockup
interactive prototypes for what you design (with Flash,
ActionScript, HTML/CSS/JavaScript, or other tools) for
communicating, evaluating, or setting up a framework for UI
Designers to work on.<br />
<br />
<span STYLE="font-weight: bold;">Requirement</SPAN><br />
&bull;&nbsp;&nbsp;&nbsp; At least 3
(6 FOR SENIOR) years experience in user interface design,
information architecture, usability evaluation, user research, and
other related disciplines within a consulting or corporate
environment.<br />
&bull;&nbsp;&nbsp;&nbsp; Good
knowledge and experience of implementing processes and methodology
of user- centered design. Ability to employ pragmatic and effective
approaches to user experience design.<br />
&bull;&nbsp;&nbsp;&nbsp; Strong
rapid prototyping skills, with tools like Flash, and web standard
technologies. (Expertise in making interactive prototypes with
Flash and ActionScript is a plus.)<br />
&bull;&nbsp;&nbsp;&nbsp; Outstanding
communication and collaborative and interpersonal skills,
open-minded and enjoy building based on the others’ ideas. Skills
to brainstorm well with team give and take constructive
feedback.<br />
&bull;&nbsp;&nbsp;&nbsp; Excellent
organization, time management, iterative process management skills
for support multiple projects simultaneously in a fast-paced and
rapidly growing environment. (FOR SENIOR)<br />
&bull;&nbsp;&nbsp;&nbsp; Good
understanding of the preferences and habits of Chinese Internet
users and game players.<br />
&bull;&nbsp;&nbsp;&nbsp; Proficient
in Adobe Photoshop, Flash and/or Illustrator, and good at web
standard technologies.<br />
&bull;&nbsp;&nbsp;&nbsp; Proficient
in (spoken and FOR SENIOR) written English and mandarin.<br />
&bull;&nbsp;&nbsp;&nbsp; Academic
background in related fields (interaction design, HCI, psychology,
human factors) is a big plus.<br />
<br />
<span STYLE="font-weight: bold;">Portfolio</SPAN><br />
&bull;&nbsp;&nbsp;&nbsp; The
portfolio of an Interaction Designer can include but not limit
to:<br />
&bull;&nbsp;&nbsp;&nbsp; Entities or
photos of sketches, diagrams, paper prototypes, etc.<br />
&bull;&nbsp;&nbsp;&nbsp; The
runnable or screenshots of the rapid prototypes made with web
standard technologies (HTML, CSS, JavaScript), Flash with/without
ActionScript, or other prototyping tools.<br />
&bull;&nbsp;&nbsp;&nbsp; UI design
works of games, web applications, websites, software or digital
devices.<br />
&bull;&nbsp;&nbsp;&nbsp; Legitimate
copies or digest of the documents of information architecture,
personas, use cases, etc.<br />
Candidates will be invited to talk about the works related to
his/her portfolio.<br />
<br />
<span STYLE="font-weight: bold; color: rgb(111, 49, 152);">Art /
Design</SPAN><br STYLE="font-weight: bold;" />
<span STYLE="font-weight: bold; color: rgb(255, 0, 0);">Character
Concept Artist</SPAN><br />
<span STYLE="font-weight: bold;">Responsibilities:</SPAN><br />
The Concept Artist will be working with the Art Director and
Producer, designing overall look and feel of characters in the
game. This Artist will also create final in-game artwork and
placeholder artwork as needed by engineering.&nbsp;
This position will also work with web and marketing teams to create
game-related artwork. The Concept Artist will spend most of their
time designing 2d character related asset, icons, advertising, web
ready art, et cetera.<br />
&nbsp;<br />
<span STYLE="font-weight: bold;">Required Skills:</SPAN><br />
&bull;&nbsp;&nbsp;&nbsp; Quick
sketching and storyboarding experience<br />
&bull;&nbsp;&nbsp;&nbsp; Good
knowledge of human/animal anatomy, proportions and posing.<br />
&bull;&nbsp;&nbsp;&nbsp; Excellent
basic design skills, including the effective use of color theory,
form, lighting , composition and use of detail.<br />
&bull;&nbsp;&nbsp;&nbsp; Good
understanding of designing cartoon style character.<br />
&bull;&nbsp;&nbsp;&nbsp; Solid 2D
painting/illustration skills with digital painting
program(Photoshop, illustrator, flash etc) and Strong fundamental
art skills<br />
&bull;&nbsp;&nbsp;&nbsp; Maintain
consistent style under the direction of the Art Director<br />
&bull;&nbsp;&nbsp;&nbsp; Ability to
communicate visually, and to identify and define visual design
issues and solutions<br />
&bull;&nbsp;&nbsp;&nbsp; Experience
in games development (shipped titles a plus!)<br />
&bull;&nbsp;&nbsp;&nbsp; A passion
for games, virtual worlds, and social networking<br />
&bull;&nbsp;&nbsp;&nbsp; Experience
in Flash including creating optimized movies, buttons, and
animation<br />
&nbsp;<br />
<span STYLE="font-weight: bold;">Extra Credit</SPAN><br />
&bull;&nbsp;&nbsp;&nbsp; Fine art
background<br />
&bull;&nbsp;&nbsp;&nbsp;
Environment, building props concepting<br />
&bull;&nbsp;&nbsp;&nbsp; Some 3D
modeling skill<br />
<br />
<span STYLE="font-weight: bold; color: rgb(255, 0, 0);">2D
Artist</SPAN><br />
<span STYLE="font-weight: bold;">Responsibilities:</SPAN><br />
We are looking for a 2Dartist who will be mainly working with our
art team, creating user centered and interaction design solutions.
Collaborate with artists, engineers, designer and product
management to create user interface and game art assets with a
consistent art style throughout the entire project.<br />
<br />
<span STYLE="font-weight: bold;">Required Skills:</SPAN><br />
&bull;&nbsp;&nbsp;&nbsp; Good
knowledge of user interface design best practice, and interactive
design Fundamentals.<br />
&bull;&nbsp;&nbsp;&nbsp; Good
ability and high efficiency to design and create UI components,
in-game HUD elements, menus, icons, and other 2d game assets
etc<br />
&bull;&nbsp;&nbsp;&nbsp; Have
ability to communicate ideas through mock-ups, wireframes flow
diagrams and prototypes.<br />
&bull;&nbsp;&nbsp;&nbsp; Good
understanding of layout, typography and color theory<br />
&bull;&nbsp;&nbsp;&nbsp; Expert
knowledge of Photoshop, Flash, strong skills in Illustrator,<br />
&bull;&nbsp;&nbsp;&nbsp; Good
understanding of the limits of web technologies and game
development process<br />
&bull;&nbsp;&nbsp;&nbsp; Maintain
consistent style under the direction of the Art Director<br />
&bull;&nbsp;&nbsp;&nbsp; Ability to
communicate visually, and to identify and define visual design
issues and solutions<br />
&bull;&nbsp;&nbsp;&nbsp; Experience
in social or casual games development (shipped titles a
plus!)<br />
&bull;&nbsp;&nbsp;&nbsp; A passion
for casual cartoon style games, virtual worlds, and social
networking<br />
<span STYLE="font-weight: bold;"><br />
Extra Credit</SPAN><br />
&bull;&nbsp;&nbsp;&nbsp; Knowledge
of 3D skill<br />
&bull;&nbsp;&nbsp;&nbsp; Graphic
Design or Web Design background<br />
&bull;&nbsp;&nbsp;&nbsp; Working
knowledge of HTML, CSS, JavaScript,<br />
&bull;&nbsp;&nbsp;&nbsp; Good at
Flash animation<br />
<br />
<span STYLE="font-weight: bold; color: rgb(255, 0, 0);">3D
Artist</SPAN><br />
<span STYLE="font-weight: bold;">Responsibilities:</SPAN><br />
The 3D Artist will be working with the Art Director, Art lead and
Producer, creating 3d art assets that drive the visual identity and
user interface of the game. This 3D Artist will also create final
in-game artwork and placeholder artwork as needed by
engineering.&nbsp; This position will also work with
web and marketing teams to create game-related artwork. The 3D
Artist will spend most of their time designing and modeling 3D
objects but is flexible enough to handle 2D art, flash animation,
icons, advertising, web ready art, et cetera.<br />
<br />
<span STYLE="font-weight: bold;">Required Skills:</SPAN><br />
&bull;&nbsp;&nbsp;&nbsp; 2+ years
experience in games development (shipped titles a plus!)<br />
&bull;&nbsp;&nbsp;&nbsp; Excellent
design skills, including the effective use of color, form, lighting
and composition<br />
&bull;&nbsp;&nbsp;&nbsp; Solid
modeling skills with Maya or 3D max on including vehicle, building,
environment props, characters within the given art direction.<br />
&bull;&nbsp;&nbsp;&nbsp; Solid
texturing creation skills with photoshop(CS3-4), expert on using
color, specular, bump, AO displacement etc.<br />
&bull;&nbsp;&nbsp;&nbsp; Good
knowledge of UV-mapping techniques<br />
&bull;&nbsp;&nbsp;&nbsp; Good
knowledge of 3D lighting and rendering in Maya or Max<br />
&bull;&nbsp;&nbsp;&nbsp;
&nbsp;Good ability to communicate creative ideas
through sketch, mock-ups, and any other visually tools.<br />
&bull;&nbsp;&nbsp;&nbsp;
&nbsp;Can work independently to meet the requirement
under the instruction.<br />
&bull;&nbsp;&nbsp;&nbsp; Familiar
with cartoon style and can maintain consistent style under the
direction of the Art Director<br />
&bull;&nbsp;&nbsp;&nbsp; A passion
for casual cartoon style games, virtual worlds, and social
networking<br />
Plus<br />
&bull;&nbsp;&nbsp;&nbsp; 3D
animation<br />
&bull;&nbsp;&nbsp;&nbsp; Experience
in Flash including creating optimized movies, buttons, and
animation<br />
<br />
<span STYLE="color: rgb(111, 49, 152); font-weight: bold;">Product
Management / Game Production</SPAN><br />
<span STYLE="font-weight: bold; color: rgb(255, 0, 0);">Producer</SPAN><br />
Zynga is looking for an all-star producer to join their growing
team in Beijing!&nbsp; The Producer will work with a
specific studio to help build one of our games.<br />
&nbsp;<br />
<span STYLE="font-weight: bold;">Responsibilities:</SPAN><br />
&bull;&nbsp;&nbsp;&nbsp; Act as the
creative visionary for the product<br />
&bull;&nbsp;&nbsp;&nbsp; Effectively
communicate the core experience of your game to other parts of the
Zynga organization, and help ensure that your product leverages the
ideas and resources of the larger organization<br />
&bull;&nbsp;&nbsp;&nbsp; Work with
your Product Manager and project CTO to create an organizational
structure, processes and project plan that allow the team to
efficiently produce high quality work on time<br />
&bull;&nbsp;&nbsp;&nbsp; Initiate,
foster, maintain and manage others toward positive working
relationships with internal and external organizations critical to
both current and future development process<br />
&bull;&nbsp;&nbsp;&nbsp; Research
and communicate game market trends, patterns, and customer
requirements<br />
&bull;&nbsp;&nbsp;&nbsp;
Passionately articulate goals and team principles to help form a
stimulating and fun work environment and culture<br />
<br />
<span STYLE="font-weight: bold;">Required Skills:</SPAN><br />
&bull;&nbsp;&nbsp;&nbsp; 5 years
experience managing internal development teams within the video
game industry (Software Engineers, Artists, Designers, Producers
etc.)<br />
&bull;&nbsp;&nbsp;&nbsp; 3 years
experience as a Producer within the games industry, creating top
quality games<br />
&bull;&nbsp;&nbsp;&nbsp; Excellent
written and verbal communication skills<br />
&bull;&nbsp;&nbsp;&nbsp; Ability to
work in a team environment with maturity and leadership<br />
&bull;&nbsp;&nbsp;&nbsp; Fluent in
spoken and written English and Chinese<br />
<br />
<span STYLE="color: rgb(255, 0, 0); font-weight: bold;">Product
Manager</SPAN><br />
Zynga is looking for a Product Manager who can help drive the
creation of new features on some of Zynga’s top games! The Product
Manager will add experience, direction, and measurable performance
to the game design process.<br />
&nbsp;<br />
<span STYLE="font-weight: bold;">Responsibilities:</SPAN><br />
Zynga’s Product Manager will be responsible for creating a list of
features to one of our hit games! This person will have to work
independently to provide a detailed roadmap on the implementation
process. The implementation process should include designing,
executing, and optimizing the feature(s).&nbsp; They’ll
own the outcome of these new features by working with our talented
team of engineers to get the features implemented.<br />
&nbsp;<br />
Required Skills:<br />
&bull;&nbsp;&nbsp;&nbsp; 2-5 years
of experience&nbsp; in product management in consumer
web or game development<br />
&bull;&nbsp;&nbsp;&nbsp; Must be
able to graphically create wire-frames and give interface direction
to UI team<br />
&bull;&nbsp;&nbsp;&nbsp; Must have
proven experience in contributing to a successful project or
product in the past<br />
&bull;&nbsp;&nbsp;&nbsp; Experience
with multivariate testing<br />
&bull;&nbsp;&nbsp;&nbsp; Experience
with a web based company managing web based applications<br />
&bull;&nbsp;&nbsp;&nbsp; Passion for
creating fun, compelling and addictive user experiences<br />
&bull;&nbsp;&nbsp;&nbsp; Passion for
writing product specifications, white papers<br />
&bull;&nbsp;&nbsp;&nbsp; Outstanding
written and oral communication skills<br />
&bull;&nbsp;&nbsp;&nbsp; Strong
organizational and analytical skills &amp; attention to
detail<br />
&bull;&nbsp;&nbsp;&nbsp; We are
looking for an enthusiastic, performance-driven self-starter and
team player<br />
&bull;&nbsp;&nbsp;&nbsp;
Demonstrated capacity for developing and understanding
strategy<br />
&bull;&nbsp;&nbsp;&nbsp; Strong
aptitude for determining the optimal way to position products in
the market<br />
&bull;&nbsp;&nbsp;&nbsp; Strong
passion for games<br />
&bull;&nbsp;&nbsp;&nbsp; Previous
start-up experience is a strong plus<br />
&bull;&nbsp;&nbsp;&nbsp; Social
networking experience is a strong plus<br />
&bull;&nbsp;&nbsp;&nbsp; BA/BS
degree &ndash; CS/EE/Engineering degree preferred&nbsp;<br />
&bull;&nbsp;&nbsp;&nbsp; Fluent in
spoken and written English and Chinese<br />
<br />
<span STYLE="color: rgb(255, 0, 0); font-weight: bold;">Game
Designer</SPAN><br />
Zynga is looking for an experienced Game Designer to work with
large scale social games that runs on social networks. Qualified
candidates will have experience on console and/or PC games and are
fluent in game design practices and overall game development.<br />
<br />
<span STYLE="font-weight: bold;">Responsibilities:</SPAN><br />
&bull;&nbsp;&nbsp;&nbsp; Create or
adapt leading game features to work with an existing game<br />
&bull;&nbsp;&nbsp;&nbsp; Pitch new
ideas to the team/ hold brainstorming sessions<br />
&bull;&nbsp;&nbsp;&nbsp; Tune and
model complex systems using Excel<br />
&bull;&nbsp;&nbsp;&nbsp; Write copy,
names, and narrative elements of game<br />
&bull;&nbsp;&nbsp;&nbsp; Analyze
real-time feedback and metrics, and adjust game designs
accordingly<br />
&bull;&nbsp;&nbsp;&nbsp; Work with
product managers, developers and artists to oversee the
implementation of new features and systems<br />
&bull;&nbsp;&nbsp;&nbsp; Ability to
describe user experience stories and create wireframe screens and
flows<br />
&bull;&nbsp;&nbsp;&nbsp; Remain
up-to-date with Game Design literature and best practices to be an
evangelist for the craft of Game Design<br />
&nbsp;Required Skills:<br />
&bull;&nbsp;&nbsp;&nbsp; Experience
or knowledge of traditional board game, card game, or dice game
design<br />
&bull;&nbsp;&nbsp;&nbsp; Expert with
math and formulas in game environment<br />
&bull;&nbsp;&nbsp;&nbsp; Experience
designing combat and/or system mechanics including player control,
moves, and NPC/AI types and behaviors<br />
&bull;&nbsp;&nbsp;&nbsp; Strong
knowledge of game balancing and pacing<br />
&bull;&nbsp;&nbsp;&nbsp; Management
experience, preferably with an experienced design team<br />
&bull;&nbsp;&nbsp;&nbsp; Adept with
Excel/spreadsheets<br />
&bull;&nbsp;&nbsp;&nbsp; Passionate
gamer<br />
&bull;&nbsp;&nbsp;&nbsp; 2 shipped
games<br />
&bull;&nbsp;&nbsp;&nbsp; Game
programming background required<br />
&bull;&nbsp;&nbsp;&nbsp; Fluent in
spoken and written English a plus<br />
<br />
<span STYLE="font-weight: bold; color: rgb(255, 0, 0);">Content
Writer</SPAN><br />
At Zynga, we connect the world with games that motivate our players
through world class game design, social design, and content. As a
game writer, you are responsible for bringing our virtual worlds to
life through mystery, aspiration, and emotion in the most fast
paced company in the industry. You will be responsible for creating
brand new ways to deliver stories to our tens of millions of
players around the world.<br />
<br />
<span STYLE="font-weight: bold;">Responsibilities:</SPAN><br />
&bull;&nbsp;&nbsp;&nbsp; Be the
creative leader for all game content, including quests, art,
characters, and story.<br />
&bull;&nbsp;&nbsp;&nbsp; Create
content ideas and high level concepts, writing documents clearly
communicating your vision.<br />
&bull;&nbsp;&nbsp;&nbsp; Oversee all
writing duties, incorporating feedback from the team as well as the
constraints of IP.<br />
&bull;&nbsp;&nbsp;&nbsp; Telling the
story, developing themes, storylines and making plots and
characters, gripping and believable.<br />
&bull;&nbsp;&nbsp;&nbsp; Writing
compelling character interactions, paying special attention to
character development.<br />
&bull;&nbsp;&nbsp;&nbsp; Creatively
leverage the constraints imposed on story telling by the medium of
social games.<br />
&bull;&nbsp;&nbsp;&nbsp; Be a strong
contributor to products and brainstorms.<br />
&bull;&nbsp;&nbsp;&nbsp; Be an
advocate for the end users<br />
Required Skills:<br />
&bull;&nbsp;&nbsp;&nbsp; Avid social
gamer with a solid understanding of game development and game
genres<br />
&bull;&nbsp;&nbsp;&nbsp; Has
previous game writing experience<br />
&bull;&nbsp;&nbsp;&nbsp; Several
years of creative writing experience, diversely spread across
writing dialogue, screenplays, and prose<br />
&bull;&nbsp;&nbsp;&nbsp; Owner/CEO
mindset: ability to take ownership of an issue and see it through
to business outcomes<br />
&bull;&nbsp;&nbsp;&nbsp; Strong
communication skills to relay ideas and strategies to the
team<br />
&bull;&nbsp;&nbsp;&nbsp; Ability to
build and maintain relationships with multiple partner groups by
collecting and synthesizing<br />
&bull;&nbsp;&nbsp;&nbsp; Ability to
be flexible on a day to day basis with task priority<br />
&bull;&nbsp;&nbsp;&nbsp; Ability to
operate at Zynga speed, work under tight deadlines<br />
<br />
<span STYLE="color: rgb(111, 49, 152); font-weight: bold;">BIZ</SPAN><br />
<span STYLE="font-weight: bold; color: rgb(255, 0, 0);">BD
Director</SPAN><br />
Zynga is looking for a Director of Business Development and
Distribution to join their growing team! This position is not
purely focused on revenue or sales responsibilities. The critical
success factor is to create a large base of alliances and
partnerships with content owners, media giants and brand owners to
increase the visibility and usage of Zynga’s games portfolio.<br />
&nbsp;<br />
We are committed to developing high quality casual and multi player
games!&nbsp; Come join us ... we're having a
ball!<br />
&nbsp;<br />
Responsibilities:<br />
&bull;&nbsp;&nbsp;&nbsp; Develop
strategy to extend Zynga properties across social networks and
other customer acquisition channels<br />
&bull;&nbsp;&nbsp;&nbsp; Develop and
present specific business strategy based on performance,
competitive pressures, etc.<br />
&bull;&nbsp;&nbsp;&nbsp; Identify
new partnership opportunities and assist in prioritizing,
structuring, negotiating and closing distribution deals<br />
&bull;&nbsp;&nbsp;&nbsp; Work with
all relevant divisions of Zynga (including&nbsp;
Finance, Engineering, Production, Marketing, Ad Sales, Tech-Ops,
and Programming) to generate consensus and execute key
initiatives<br />
&bull;&nbsp;&nbsp;&nbsp; Maintain
relationships and optimize existing partnerships<br />
&bull;&nbsp;&nbsp;&nbsp; Work
closely with our game studio to ensure the success of products in
the local marketplace<br />
&bull;&nbsp;&nbsp;&nbsp; Achieve or
exceed mutually agreed upon revenue targets for the region<br />
&bull;&nbsp;&nbsp;&nbsp; Develop
intelligence on the social gaming industry by playing current
games, gathering and analyzing relevant industry news and reports,
and building and maintaining a network of industry insiders<br />
&bull;&nbsp;&nbsp;&nbsp; Review laws
and regulations that might affect the business and stay on top of
evolving trends and regulations that may affect the business in the
future&nbsp;&nbsp;<br />
Required Skills:<br />
&bull;&nbsp;&nbsp;&nbsp; Strong
background in business development and strategy, with at least 5
years of experience<br />
&bull;&nbsp;&nbsp;&nbsp; At least 3
years direct experience working in the computer game, media or
internet services industry<br />
&bull;&nbsp;&nbsp;&nbsp; Proven
track record of sourcing, structuring, negotiating and closing
deals<br />
&bull;&nbsp;&nbsp;&nbsp;
Relationships with major portals (extensive Rolodex of industry
contacts)<br />
&bull;&nbsp;&nbsp;&nbsp;
Understanding of social networking<br />
&bull;&nbsp;&nbsp;&nbsp;
Understanding of how to create promotional and revenue
opportunities through web distribution<br />
&bull;&nbsp;&nbsp;&nbsp; MBA and/or
JD preferred.<br />
&bull;&nbsp;&nbsp;&nbsp; Previous
start-up experience a plus<br />
<br />
<span STYLE="font-weight: bold; color: rgb(255, 0, 0);">Senior
Marketing Manager</SPAN><br />
Zynga is looking for a Senior Marketing Manager to join our growing
Beijing office!&nbsp; This position is the senior most
marketing role responsible for all of Zynga’s Chinese language
games.&nbsp; Primary responsibilities include user
acquisition, retention marketing, brand development, marketing
messaging, key promotions, and overall program
management.&nbsp; This position is located in Zynga’s
Beijing office and reports to the Director of Marketing in Zynga’s
San Francisco headquarters.<br />
<br />
We are committed to developing high quality casual and multi player
games!&nbsp; Come join us ... we're having a
ball!<br />
<br />
<span STYLE="font-weight: bold;">Responsibilities:</SPAN><br />
&bull;&nbsp;&nbsp;&nbsp; Oversee all
aspects of channel marketing for Zynga’s growing portfolio of
Chinese language social games, including online media buying and
business development, email and retention marketing, cross
promotion, integrated offline and online promotions<br />
&bull;&nbsp;&nbsp;&nbsp; Lead brand
development for Zynga’s Chinese language games and guide corporate
brand initiatives in the Chinese language market<br />
&bull;&nbsp;&nbsp;&nbsp; Manage and
grow team of online marketing professionals<br />
&bull;&nbsp;&nbsp;&nbsp; Develop
strategy, plan, and execute on game related marketing across all
marketing areas<br />
&bull;&nbsp;&nbsp;&nbsp; Guide the
game product management team to integrate strong messaging into all
touchpoints.<br />
&bull;&nbsp;&nbsp;&nbsp; Manage
marketing creative pipeline, budget and invoicing<br />
Required Skills:<br />
&bull;&nbsp;&nbsp;&nbsp; Candidate
must be bilingual in English and Mandarin with experience marketing
to the Chinese language audience<br />
&bull;&nbsp;&nbsp;&nbsp; Owner/CEO
mindset: ability to take ownership of an issue and see it through
to business outcomes<br />
&bull;&nbsp;&nbsp;&nbsp; At least 10
years of outstanding background in general, cross-functional
marketing<br />
&bull;&nbsp;&nbsp;&nbsp; Additional
outstanding experience in product management / development or
analytical marketing is a big plus<br />
&bull;&nbsp;&nbsp;&nbsp; Proven
track record of problem solving, quick to execution, and driving
results<br />
&bull;&nbsp;&nbsp;&nbsp; Previous
start-up experience a strong plus<br />
&bull;&nbsp;&nbsp;&nbsp; Experienced
&amp; mature people and team manager<br />
&bull;&nbsp;&nbsp;&nbsp; Strong
influencing and leadership skills; effective cross-functional
driver<br />
&bull;&nbsp;&nbsp;&nbsp; Passion for
social games<br />
&bull;&nbsp;&nbsp;&nbsp; Deep
understanding of social networking engagement models<br />
&bull;&nbsp;&nbsp;&nbsp;
Understanding of web-wide distribution, partnership, and
competitive strategy<br />
&bull;&nbsp;&nbsp;&nbsp; Ability to
be flexible on a day to day basis with task priority<br />
&bull;&nbsp;&nbsp;&nbsp; Ability to
operate at Zynga speed, work under tight deadlines<br />
&bull;&nbsp;&nbsp;&nbsp; MBA or
advanced degree recommended, with outstanding academic record<br />
<br />
<br />
<span STYLE="font-weight: bold; color: rgb(255, 0, 0);">GR
Manager</SPAN><br />
<span STYLE="font-weight: bold;">Responsibilities:</SPAN><br />
&bull;&nbsp;&nbsp;&nbsp; Maintain a
proactive relationship approach with key contacts<br />
&bull;&nbsp;&nbsp;&nbsp; Arrange and
supervise programs as required for
meetings/events/communications<br />
&bull;&nbsp;&nbsp;&nbsp;
Coordinate/communicate internally as required for the facilitation
of GR program<br />
&bull;&nbsp;&nbsp;&nbsp; Help to
prepare and execute on proactive GR strategy for China<br />
&nbsp;<br />
<span STYLE="font-weight: bold;">Requirements:</SPAN><br />
&bull;&nbsp;&nbsp;&nbsp; University
graduate or with Master degree<br />
&bull;&nbsp;&nbsp;&nbsp; With ten
years of working experience in relevant experience in
organization<br />
&bull;&nbsp;&nbsp;&nbsp; Sound
knowledge in Chinese Government Structure and culture, with
government relationship a plus<br />
&bull;&nbsp;&nbsp;&nbsp; Good
understanding on essential elements of&nbsp; government
system<br />
&bull;&nbsp;&nbsp;&nbsp; Excellent
inter-personal relationships<br />
&bull;&nbsp;&nbsp;&nbsp; Expert
communication and relationship building skills<br />
&bull;&nbsp;&nbsp;&nbsp; High
proficiency in written and verbal English and Chinese<br />
<br />
<span STYLE="font-weight: bold; color: rgb(111, 49, 152);">Finance</SPAN><br />
<span STYLE="font-weight: bold; color: rgb(255, 0, 0);">Accounting
Manager</SPAN><br />
<span STYLE="font-weight: bold;">RESPONSIBILITIES &amp;
DUTIES</SPAN><br />
&bull;&nbsp;&nbsp;&nbsp; Obtain and
maintain a thorough understanding of the financial reporting and
general ledger structure.<br />
&bull;&nbsp;&nbsp;&nbsp; Ensure an
accurate and timely monthly, quarterly and year end close.<br />
&bull;&nbsp;&nbsp;&nbsp; Ensure the
timely reporting of all monthly financial information.<br />
&bull;&nbsp;&nbsp;&nbsp; Assist the
Controller in the daily banking requirements.<br />
&bull;&nbsp;&nbsp;&nbsp; Ensure the
accurate and timely processing of positive pay transactions.<br />
&bull;&nbsp;&nbsp;&nbsp; Ensure the
monthly and quarterly Bank Compliance activities are performed in a
timely and accurate manner.<br />
&bull;&nbsp;&nbsp;&nbsp; Supports
budget and forecasting activities.<br />
&bull;&nbsp;&nbsp;&nbsp;
Collaborates with the other finance department managers to support
overall department goals and objectives.<br />
&bull;&nbsp;&nbsp;&nbsp; Monitors
and analyzes department work to develop more efficient procedures
and use of resources while maintaining a high level of
accuracy.<br />
&bull;&nbsp;&nbsp;&nbsp; Advises
staff regarding the handling of non-routine reporting
transactions.<br />
&bull;&nbsp;&nbsp;&nbsp; Responds to
inquiries from the Director of Finance, Controller, and other
finance and firm wide managers regarding financial results, special
reporting requests and the like.<br />
&bull;&nbsp;&nbsp;&nbsp; Work with
the Controller to ensure a clean and timely year end audit.<br />
&bull;&nbsp;&nbsp;&nbsp; Supervise
the general ledger group to ensure all financial reporting
deadlines are met.<br />
&bull;&nbsp;&nbsp;&nbsp; Assist in
development and implementation of new procedures and features to
enhance the workflow of the department.<br />
&bull;&nbsp;&nbsp;&nbsp; Provide
training to new and existing staff as needed.<br />
&bull;&nbsp;&nbsp;&nbsp; Handle
personnel issues relating to staff conflicts, absenteeism,
performance issues, etc.<br />
&bull;&nbsp;&nbsp;&nbsp; Work with
each direct report to establish goals and objectives for each year
and monitor and advise on the progress to enhance the professional
development of staff.<br />
&bull;&nbsp;&nbsp;&nbsp; Support
Controller with special projects and workflow process
improvements.<br />
<br />
<span STYLE="font-weight: bold;">MINIMUM REQUIREMENTS</SPAN><br />
&bull;&nbsp;&nbsp;&nbsp; BA/BS in
Business with an emphasis in Accounting, CPA preferred<br />
&bull;&nbsp;&nbsp;&nbsp; a minimum
of 5 years working experience in MNCs, taking the responsibilities
for the management of financial systems and budgets, financial
reporting, financial data analysis, auditing, taxation and
providing financial advice;<br />
&bull;&nbsp;&nbsp;&nbsp; Have strong
experience with Microsoft office and oracle.<br />
&bull;&nbsp;&nbsp;&nbsp; Strong
verbal and written communication skills.<br />
&bull;&nbsp;&nbsp;&nbsp; Strong
interpersonal, supervisory and customer service skills
required.<br />
&bull;&nbsp;&nbsp;&nbsp; Ability to
multi-task, work under pressure and meet deadlines required.<br />
<b><br /></B></DIV>]]></description>
            <author>FL车在臣</author>
            <category>杂谈系列</category>
            <comments>http://blog.sina.com.cn/s/blog_3ecb9b110100sgak.html#comment</comments>
            <pubDate>Thu, 23 Jun 2011 01:25:16 +0800</pubDate>
            <guid>http://blog.sina.com.cn/s/blog_3ecb9b110100sgak.html</guid>
        </item>
        <item>
            <title>[杂谈] Flash 平台应用性能优化官方文档</title>
            <link>http://blog.sina.com.cn/s/blog_3ecb9b110100popm.html</link>
            <description><![CDATA[<p><font STYLE="FonT-siZe: 20px"><strong>1.
关于存储</STRONG></FONT></P>
<ul>
<li>&nbsp;使用适当的 Display Object<br />
* Shape &ndash; 没有交互（占内存少）<br />
* Sprite &ndash; 有交互（占内存多）<br />
* MovieClip &ndash; 有时间线（占内存更多）</LI>
<li>尽可能重用对象，而不要重新创建</LI>
<li>强制类型转换 int(exp) 要比 Math.floor() 和 Math.ceil() 快很多</LI>
<li>使用对象池技术重用对象</LI>
<li>释放内存 &ndash; 将所有对象的引用设置为 null</LI>
<li>尽可能重用 BitmapData</LI>
<li>Callback 要比 event 快而且消耗更少的内存</LI>
</UL>
<p><font STYLE="FonT-siZe: 20px"><strong>2. 减少 CPU
使用率</STRONG></FONT></P>
<ul>
<li>即便将一个 Display Object 从 stage 上移除了( removeChild ) 甚至是已经将它的引用设置为
null，它依然有可能在消耗 CPU。所以要在其移出 display list 时将其完全停下来（比如 mc.stop()
）。</LI>
<li>卸载从外部装载的内容时，使用loader.unloadAndStop()，而不要使用
loader.unload()。</LI>
<li>尽可能禁用鼠标交互。obj.mouseEnabled = false; obj.mouseChildren =
false;</LI>
<li>Timer 在某些情况下比 ENTER_FRAME 要好。</LI>
<li>减少 tweening 的使用。</LI>
</UL>
<p><font STYLE="FonT-siZe: 20px"><strong>3. ActionScript
性能<br /></STRONG></FONT></P>
<ul>
<li>尽可能使用 Vector 替代 Array。固定长度的 Vector 更快。( Vector 可以这样初始化：var
coords:Vector.&lt;Number&gt; =
Vector.&lt;Number&gt;([132, 20, 46, 254,
244, 100, 20, 98, 218, 254]);)</LI>
<li>新的 drawing API 更快，它们是：drawPath, drawGraphicsData,
drawTriangles。</LI>
<li>使用 setVector() 方法来处理像素。</LI>
<li>使用 setPixel() 和 setPixel32 方法时，要配合使用 lock() 和 unlock() 方法。</LI>
<li>使用 TextField 时，appendText() 方法比 += 操作符要快。</LI>
<li>尽可能在避免在循环内更新 TextField。</LI>
<li>尽可能少使用方括号操作符访问 Vector 或 Array 元素，可以利用一个临时变量来操作。</LI>
<li>尽量将代码内嵌，避免过多的函数调用。（比如用 value &gt; 0 ? value :
-value; 来代替 Math.abs()）</LI>
<li>代码量过大也会造成性能的降低。尽量少使用大型第三方库(Flex, TLF)。</LI>
<li>避免在循环内使用取值表达式（myArray.length）。用临时局部变量来操作。</LI>
<li>更多优化技巧参考：<a HREF="http://www.rozengain.com/blog/2007/05/01/some-actionscript-30-optimizations/" TARGET="_blank"></A><a HREF="http://www.rozengain.com/blog/2007/05/01/some-actionscript-30-optimizations/">http://www.rozengain.com/blog/2007/05/01/some-actionscript-30-optimizations/</A></LI>
</UL>
<p><font STYLE="FonT-siZe: 20px"><strong>4.
渲染性能</STRONG></FONT></P>
<ul>
<li>尽可能避免使用 alpha 参数。</LI>
<li>适当的使用 cacheAsBitmap 可以大幅提高性能。（对于变化少的矢量元件）</LI>
<li>针对每个子元件使用 cacheAsBitmap 而不是针对父元件使用。</LI>
<li>使用 TextLine 处理静态文本比 TextField 快而且使用更少的内存。</LI>
<li>使用 cacheAsBitmap 和 opaqueBackground 参数可以改进渲染性能（包含 TextField
）。</LI>
</UL>]]></description>
            <author>FL车在臣</author>
            <category>杂谈系列</category>
            <comments>http://blog.sina.com.cn/s/blog_3ecb9b110100popm.html#comment</comments>
            <pubDate>Fri, 25 Feb 2011 19:13:41 +0800</pubDate>
            <guid>http://blog.sina.com.cn/s/blog_3ecb9b110100popm.html</guid>
        </item>
        <item>
            <title>第二章 转向行为&amp;#8546;[FL车在臣]</title>
            <link>http://blog.sina.com.cn/s/blog_3ecb9b110100l5q3.html</link>
            <description><![CDATA[<p><font STYLE="FonT-siZe: 24px"><strong>追赶（Pursue）行为</STRONG></FONT><br />
我要再一次说“这个行为与寻找行为非常相似”。并且是真的。实事上，追赶行为会调用寻找（seek）作为它的最后一个动作。追赶的关键就预测目标将来的位置。这就意味着目标是运动的，所以它会有位置和速度。我们可以假设这个目标是一辆机车。事实上，可以是另一个
SteeredVehicle 对象继承自机车类。<br />
&nbsp;&nbsp;&nbsp;
如何预测目标将要去哪呢？我们拿到它的当前速度向量，延续到它的将来，然后使用这个预测作为寻找的目标。但是要计算多远的将来呢？非常好的问题！我们称做<strong>预测时间（look
ahead
time）</STRONG>。如果你计算太远（高预测时间）你将超过目标。要是不够远（低预测时间）你会远远落后于目标。事实上，寻找行为可以被定义为预测时间为零的追赶行为（在零秒钟的将来目标在哪？就是它现在的位置）。<br />

&nbsp;&nbsp;&nbsp;
一种策略是将两个机车的距离作为预测时间的依据。如果你离目标很远，那么就要花上一段时间才能追上，所以要预测远些。如果非常近，那么你会很快到达那里，所以预测时间应该少些。这就是
SteeredVehicle 类使用的方法，让我们看一下：<br />
public function pursue(target:Vehicle):void<br />
{<br />
&nbsp;var lookAheadTime:Number =
position.dist(target.position) / _maxSpeed;<br />
&nbsp;var predictedTarget:Vector2D =
target.position.add(target.velocity.multiply(lookAheadTime));<br />
&nbsp;seek(predictedTarget);<br />
}<br />
第一件事就是计算预测时间，用它们的距离除以最快速度。计算的结果就是在目标不移动的情况下，运动多少帧或多少定时间隔后就会到达目标。然后我们就可以用目标当前的位置加上其速度与预测时间的积算出目标在未来几帧时的位置。最后，我们只要寻找（seek）到新的预测目标就好了。如图
2-7 所示。</P>
<p><a HREF="http://blog.photo.sina.com.cn/showpic.html#url=http://s3.sinaimg.cn/orignal/3ecb9b11t8fa41c867702" TARGET="_blank"><img SRC="http://s3.sinaimg.cn/middle/3ecb9b11t8fa41c867702&amp;690" /></A><br />

<strong>图 2-7</STRONG> 追赶行为先计算车子将要到哪儿再寻找过去</P>
<p><br />
同样，这种方法只一粗略的计算，因为一切都在运动中。但是它比寻找更加精确就已经不错了。它也是相当简单和快速的。如果你愿意，这个方法还有更精确（更复杂）的算法可以去研究和实现。但是这里至少是我们的起点。<br />

&nbsp;&nbsp;&nbsp;
现在开始行动吧。这次我们将创建三辆机车。一个是简单的运动机车（Vehicle）作为目标对象。其它两个都是转向机车（SteeredVehicle），一个寻找目标而另一个追赶目标。如果一切正常，追赶者应该胜出，这要归功于其算法优势。大家可以在本书站点下载
PursueTest.as 文件：<br />
package<br />
{<br />
&nbsp;import com.foed.SteeredVehicle;<br />
&nbsp;import com.foed.Vector2D;<br />
&nbsp;import com.foed.Vehicle;<br />
&nbsp;<br />
&nbsp;import flash.display.Sprite;<br />
&nbsp;import flash.display.StageAlign;<br />
&nbsp;import flash.display.StageScaleMode;<br />
&nbsp;import flash.events.Event;</P>
<p>&nbsp;public class PursueTest extends Sprite<br />
&nbsp;{<br />
&nbsp;&nbsp;private var
_seeker:SteeredVehicle;<br />
&nbsp;&nbsp;private var
_pursuer:SteeredVehicle;<br />
&nbsp;&nbsp;private var
_target:Vehicle;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function
PursueTest()<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;stage.align =
StageAlign.TOP_LEFT;<br />
&nbsp;&nbsp;&nbsp;stage.scaleMode
= StageScaleMode.NO_SCALE;<br />
&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;_seeker = new
SteeredVehicle();<br />
&nbsp;&nbsp;&nbsp;_seeker.x =
400;<br />
&nbsp;&nbsp;&nbsp;addChild(_seeker);<br />

&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;_pursuer =
new SteeredVehicle();<br />
&nbsp;&nbsp;&nbsp;_pursuer.x =
400;<br />
&nbsp;&nbsp;&nbsp;addChild(_pursuer);<br />

&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;_target = new
Vehicle();<br />
&nbsp;&nbsp;&nbsp;_target.position
= new Vector2D(200, 300);<br />
&nbsp;&nbsp;&nbsp;_target.velocity.length
= 15;<br />
&nbsp;&nbsp;&nbsp;addChild(_target);<br />

&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;addEventListener(Event.ENTER_FRAME,
onEnterFrame);<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;private function
onEnterFrame(event:Event):void<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;_seeker.seek(_target.position);<br />

&nbsp;&nbsp;&nbsp;_seeker.update();<br />

&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;_pursuer.pursue(_target);<br />

&nbsp;&nbsp;&nbsp;_pursuer.update();<br />

&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;_target.update();<br />

&nbsp;&nbsp;}<br />
&nbsp;}<br />
}<br />
注意两个转向机车在同一个位置起跑，寻找者很快就移动到目标点，而追赶者是迎头赶上并拦截目标。<br />
&nbsp;&nbsp;&nbsp;
关于这个实验要明确一点——有很多参数和数值会影响效果。接下来是逃离行为。</P>
<p>&nbsp;</P>
<p><font STYLE="FonT-siZe: 24px"><strong>逃离（Evade）行为</STRONG></FONT><br />
你可能已经猜到了，逃离和追赶是截然相反的。就向追赶与寻找非常相似一样，躲避和逃离也非常相似并且会用到前者。<br />
&nbsp;&nbsp;&nbsp;
实际上，逃离会预测车子将会去哪以便将来更好地回避并直接远离这一点。至此所有原则都在追赶行为中讨论过了。实际上，除了最后一行调用的是
flee 而非 seek，其它地方和追赶行为完全相同：<br />
public function evade(target:Vehicle):void<br />
{<br />
&nbsp;var lookAheadTime:Number =
position.dist(target.position) / _maxSpeed;<br />
&nbsp;var predictedTarget:Vector2D =<br />
&nbsp;target.position.subtract(target.velocity.multiply(lookAheadTime));<br />

&nbsp;flee(predictedTarget);<br />
}<br />
无需更多的解释。下面是一个快捷的 pursue 和 evade 方法的测试，见 PursueEvadeTest.as
文件：<br />
package<br />
{<br />
&nbsp;import com.foed.SteeredVehicle;<br />
&nbsp;import com.foed.Vector2D;<br />
&nbsp;import com.foed.Vehicle;<br />
&nbsp;<br />
&nbsp;import flash.display.Sprite;<br />
&nbsp;import flash.display.StageAlign;<br />
&nbsp;import flash.display.StageScaleMode;<br />
&nbsp;import flash.events.Event;</P>
<p>&nbsp;public class PursueEvadeTest extends
Sprite<br />
&nbsp;{<br />
&nbsp;&nbsp;private var
_pursuer:SteeredVehicle;<br />
&nbsp;&nbsp;private var
_evader:SteeredVehicle;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function
PursueEvadeTest()<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;stage.align =
StageAlign.TOP_LEFT;<br />
&nbsp;&nbsp;&nbsp;stage.scaleMode
= StageScaleMode.NO_SCALE;<br />
&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;_pursuer =
new SteeredVehicle();<br />
&nbsp;&nbsp;&nbsp;_pursuer.position
= new Vector2D(200, 200);<br />
&nbsp;&nbsp;&nbsp;_pursuer.edgeBehavior
= Vehicle.BOUNCE;<br />
&nbsp;&nbsp;&nbsp;addChild(_pursuer);<br />

&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;_evader = new
SteeredVehicle();<br />
&nbsp;&nbsp;&nbsp;_evader.position
= new Vector2D(400, 300);<br />
&nbsp;&nbsp;&nbsp;_evader.edgeBehavior
= Vehicle.BOUNCE;<br />
&nbsp;&nbsp;&nbsp;addChild(_evader);<br />

&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;addEventListener(Event.ENTER_FRAME,
onEnterFrame);<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;private function
onEnterFrame(event:Event):void<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;_pursuer.pursue(_evader);<br />

&nbsp;&nbsp;&nbsp;_evader.evade(_pursuer);<br />

&nbsp;&nbsp;&nbsp;_pursuer.update();<br />

&nbsp;&nbsp;&nbsp;_evader.update();<br />

&nbsp;&nbsp;}<br />
&nbsp;}<br />
}<br />
我们看到，这个例子和 SeekFleeTest1
效果基本相同，现在用的是追赶和逃离行为。因为两个车子都用了更高级的方法，两者都没有高低之分，所以很难看出它们和 seek/flee
的测试有什么不同。然而，玩过一会儿，替换一些方法，看看你会发现什么。下面，我们从 seek/flee
这类的行为中走出，进入到更加随机的漫游行为。</P>
<p>&nbsp;</P>
<p><font STYLE="FonT-siZe: 24px"><strong>漫游（Wander）行为</STRONG></FONT><br />
漫游行为就像它的名字一样。角色在屏幕上漫无目的的游荡。在游戏或模拟运动中通常用作搜寻或觅食——或者只是漫游。<br />
&nbsp;&nbsp;&nbsp;
漫游行为不像听起来那么简单，实现起来可能会有点儿复杂。你可以简单地使用一些随机行为，如布朗运动，但是那会让角色看起来有些神经质或者不平稳。我们期望的是更加平滑和自然的效果。通常的做法是在角色的周围想象有一个圆，选择圆上的任意一点作为目标点。在每一帧或每次更新时，角色向这个点移动。由于目标点总是在假想的圆上，因此计算出的转向力永远不会有太大的变化。这个行为如图
2-8 所示。</P>
<p><a HREF="http://blog.photo.sina.com.cn/showpic.html#url=http://s3.sinaimg.cn/orignal/3ecb9b11t8fa420eb1072" TARGET="_blank"><img SRC="http://s3.sinaimg.cn/middle/3ecb9b11t8fa420eb1072&amp;690" /></A><br />

<strong>图 2-8</STRONG>
漫游者用距离（distance）、半径（radius）和偏移量（offset）计算转向力</P>
<p><br />
我们可以改变某些参数得到不同漫游范围：如圆的大小，圆和角色的距离以及每帧可以移动多少个随机点。<br />
下面是 wander 方法：<br />
public function wander():void<br />
{<br />
&nbsp;var center:Vector2D =
velocity.clone().normalize().multiply(_wanderDistance);<br />
&nbsp;var offset:Vector2D = new Vector2D(0);<br />
&nbsp;offset.length = _wanderRadius;<br />
&nbsp;offset.angle = _wanderAngle;<br />
&nbsp;_wanderAngle += Math.random() * _wanderRange -
_wanderRange * .5;<br />
&nbsp;var force:Vector2D = center.add(offset);<br />
&nbsp;_steeringForce = _steeringForce.add(force);<br />
}<br />
首先我们找到了圆心。速度向量位于机车的正前方。通过标准化该向量并乘以 _wanderDistance
得到圆的位置。从那里，添加另一个叫 offset 的向量，随机指向圆上的某一点。因此 offset 的长度就是
_wanderRadius，角度则是 _wanderAngle。然后，我们将在 _wanderRange 中随机变化
_wanderAngle 的值。圆心加上偏移（偏移）得到的向量就是这个行为的转向力。再将它加入到转向力中就完成了。</P>
<p>&nbsp;</P>
<p>请注意以下是新加入到 SteeredVehicle 类中的变量。将它们定义在类的开始并初始化：<br />
private var _wanderAngle:Number = 0;<br />
private var _wanderDistance:Number = 10;<br />
private var _wanderRadius:Number = 5;<br />
private var _wanderRange:Number = 1;<br />
然后我们提供一些访问方法，以便让可以在单独的机车上改变它们（_wanderAngle 是完全随机的无需具体指定）：<br />
public function set wanderDistance(value:Number):void<br />
{<br />
&nbsp;_wanderDistance = value;<br />
}<br />
public function get wanderDistance():Number<br />
{<br />
&nbsp;return _wanderDistance;<br />
}</P>
<p>public function set wanderRadius(value:Number):void<br />
{<br />
&nbsp;_wanderRadius = value;<br />
}<br />
public function get wanderRadius():Number<br />
{<br />
&nbsp;return _wanderRadius;<br />
}</P>
<p>public function set wanderRange(value:Number):void<br />
{<br />
&nbsp;_wanderRange = value;<br />
}<br />
public function get wanderRange():Number<br />
{<br />
&nbsp;return _wanderRange;<br />
}<br />
最后，看看它运行起来怎么样，见 WanderTest.as 文件：<br />
package<br />
{<br />
&nbsp;import com.foed.SteeredVehicle;<br />
&nbsp;import com.foed.Vector2D;<br />
&nbsp;<br />
&nbsp;import flash.display.Sprite;<br />
&nbsp;import flash.display.StageAlign;<br />
&nbsp;import flash.display.StageScaleMode;<br />
&nbsp;import flash.events.Event;</P>
<p>&nbsp;public class WanderTest extends Sprite<br />
&nbsp;{<br />
&nbsp;&nbsp;private var
_vehicle:SteeredVehicle;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function
WanderTest()<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;stage.align =
StageAlign.TOP_LEFT;<br />
&nbsp;&nbsp;&nbsp;stage.scaleMode
= StageScaleMode.NO_SCALE;<br />
&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;_vehicle =
new SteeredVehicle();<br />
&nbsp;&nbsp;&nbsp;_vehicle.position
= new Vector2D(200, 200);<br />
&nbsp;&nbsp;&nbsp;addChild(_vehicle);<br />

&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;addEventListener(Event.ENTER_FRAME,
onEnterFrame);<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;private function
onEnterFrame(event:Event):void<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;_vehicle.wander();<br />

&nbsp;&nbsp;&nbsp;_vehicle.update();<br />

&nbsp;&nbsp;}<br />
&nbsp;}<br />
}<br />
你可以变换不同的 wander 变量看看它们的不同。还有别忘了试试其它属性（如
mass、maxSpeed、maxForce）对漫游有什么影响。你还可以重新试一下早前的 seek 和 pursue
测试让寻找者／追赶者去跟随一辆漫游的机车。<br />
&nbsp;&nbsp;&nbsp;
东西越来越有趣了并且接下来会更棒。简单的行为我们已经都看过了。剩下的会更为复杂，先从对象回避开始。</P>
<p>&nbsp;</P>
<p><font STYLE="FonT-siZe: 24px"><strong>对象回避（Object
avoidance）</STRONG></FONT><br />
这个行为与前面看到的都不一样，因为对象回避更为复杂而且似乎每个人都会给它一些不同的诠释——从简单到极度难懂的解决方法。因为这个行为没有一个完全统一的标准，我要带大家以非常基本的实现作为起点，同时鼓励大家不断进步。<br />

&nbsp;&nbsp;&nbsp;
<strong>对象回避（object
avoidance）</STRONG>指有些东西挡在机车的轨道上，而车子必需转向另一条路以免碰撞。所以它和碰撞检测似乎有些关系，只不过现在把检测放在了预测阶段：“以我当前的速度前进，我将会撞到那个物体”。<br />

&nbsp;&nbsp;&nbsp;
一旦预测到会发生碰撞，那么就需要做一些智能的动作确保不会发生碰撞。简单的做法你可以只是停下来或转个身，但是别忘了多种行为可能会交织在一起。如果你正在试图躲避或逃离追击者，那么当你在路径上看到一棵树的时候停下或向后转好像不是非常聪明的选择。理想的是你应该做一些必要的动作来躲避障碍同时继续躲避或逃离。而追击者本身也需要躲避障碍同时继续追击。<br />

&nbsp;&nbsp;&nbsp;
近一步讲，你可以想象离你要躲避的目标越近，你越要更多地改变路径。假如你穿过沙漠看到几英里处有一座金字塔，你可以转一两度弯，然后径直向前。但是如果你到了金字塔跟前，那么你就需要转
90 度的弯才能躲过去。<br />
&nbsp;&nbsp;&nbsp;
现在看到它是多么复杂了吧，知道为什么有很多不同的实现方法了吧。第一种简单做法也是有最多人实现过的，就是将障碍物看作圆（或在3D世界中看作球体）。障碍物实际上可能不是一个圆，但是如果你把它想成一个拥有半径的中心点，那么计算就会非常简单并且基本可以工作。请记住我们通常不寻求像素级的碰撞检测；只要知道障碍物的位置以及大小，就可以避开它了。下面就是这个用来表示障碍物的Circle（圆）类：<br />

package com.foed<br />
{<br />
&nbsp;import flash.display.Sprite;</P>
<p>&nbsp;public class Circle extends Sprite<br />
&nbsp;{<br />
&nbsp;&nbsp;private var
_radius:Number;<br />
&nbsp;&nbsp;private var _color:uint;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function
Circle(radius:Number, color:uint = 0x000000)<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;_radius =
radius;<br />
&nbsp;&nbsp;&nbsp;_color =
color;<br />
&nbsp;&nbsp;&nbsp;graphics.lineStyle(0,
_color);<br />
&nbsp;&nbsp;&nbsp;graphics.drawCircle(0,
0, _radius);<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function get
radius():Number<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;return
_radius;<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function get
position():Vector2D<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;return new
Vector2D(x, y);<br />
&nbsp;&nbsp;}<br />
&nbsp;}<br />
}<br />
这个类仅持有半径（radius）和颜色（color）属性，然后根据半径画圆。radius 和 position 都有各自的
getter 方法，分别获取半径和一个 Vector2D 对象。下面就来实现对象回避行为。<br />
&nbsp;&nbsp;&nbsp;
由于通常要回避的对象会多于一个，因此
avoid（回避）方法持有一个圆的数组，循环它们，看看它们是否需要回避。如果是，则计算一个转向力完成这件事。代码变得相当复杂，因为有很多不同版本的对象回避行为，因此我仅给大家展示一个没有过多解释的例子。<br />

&nbsp;&nbsp;&nbsp; 预测碰撞的代码基本是参照
<em>AI for Game Developers</EM> 一书中例子，由 O'Reilly 公司的 David M. Bourg
和 Glenn Seemann
编写，不过相当简单。转向力是根据多种资源和思想以及一点我自己的想象混合计算出来的。我将让代码注释来解释这段代码（运行效果如图 2-9
所示）：<br />
public function avoid(circles:Array):void<br />
{<br />
&nbsp;for(var i:int = 0; i &lt;
circles.length; i++)<br />
&nbsp;{<br />
&nbsp;&nbsp;var circle:Circle = circles[i]
as Circle;<br />
&nbsp;&nbsp;var heading:Vector2D =
_velocity.clone().normalize();<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;// 圆和机车间的向量<br />
&nbsp;&nbsp;var difference:Vector2D =
circle.position.subtract(_position);<br />
&nbsp;&nbsp;var dotProd:Number =
difference.dotProd(heading);<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;// 如果圆在机车前面……<br />
&nbsp;&nbsp;if(dotProd &gt;
0)<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;//
代表机车“触角”feeler 的向量<br />
&nbsp;&nbsp;&nbsp;var
feeler:Vector2D = heading.multiply(_avoidDistance);<br />
&nbsp;&nbsp;&nbsp;// difference
向量在 feeler 上的映射<br />
&nbsp;&nbsp;&nbsp;var
projection:Vector2D = heading.multiply(dotProd);<br />
&nbsp;&nbsp;&nbsp;//
圆和触角间的距离<br />
&nbsp;&nbsp;&nbsp;var
dist:Number = projection.subtract(difference).length;<br />
&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;//
如果触角和圆相交（算上缓冲），并且映射小于触角长度，<br />
&nbsp;&nbsp;&nbsp;//
则会发生碰撞，因此需要转向<br />
&nbsp;&nbsp;&nbsp;if(dist
&lt; circle.radius + _avoidBuffer
&amp;&amp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
projection.length &lt; feeler.length)<br />
&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;//
计算一个正负 90 度的力<br />
&nbsp;&nbsp;&nbsp;&nbsp;var
force:Vector2D = heading.multiply(_maxSpeed);<br />
&nbsp;&nbsp;&nbsp;&nbsp;force.angle
+= difference.sign(_velocity) * Math.PI / 2;<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />

&nbsp;&nbsp;&nbsp;&nbsp;//
根据到达圆的距离，增加或减少这个力<br />
&nbsp;&nbsp;&nbsp;&nbsp;force
= force.multiply(1.0 - projection.length /<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
feeler.length);<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />

&nbsp;&nbsp;&nbsp;&nbsp;//
加入到转向力<br />
&nbsp;&nbsp;&nbsp;&nbsp;_steeringForce
= _steeringForce.add(force);<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />

&nbsp;&nbsp;&nbsp;&nbsp;//
刹车力<br />
&nbsp;&nbsp;&nbsp;&nbsp;_velocity
= _velocity.multiply(projection.length / feeler.length);<br />
&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;}<br />
&nbsp;}<br />
}</P>
<p><a HREF="http://blog.photo.sina.com.cn/showpic.html#url=http://s2.sinaimg.cn/orignal/3ecb9b11t8fa4277c0351" TARGET="_blank"><img SRC="http://s2.sinaimg.cn/middle/3ecb9b11t8fa4277c0351&amp;690" NAME="image_operate_89341318852602890" /></A><br />
<strong>图 2-9</STRONG> 当碰撞发生的时候，就会应用转向力</P>
<p>&nbsp;</P>
<p>注意这里有两个属性必需加到类中：<br />
&nbsp;&nbsp;&nbsp; private var
_avoidDistance:Number = 300;<br />
&nbsp;&nbsp;&nbsp; private var
_avoidBuffer:Number = 20;<br />
回避距离（avoidDistance）是机车在多远的距离能看障碍物。回避缓冲（avoidBuffer）是机车经过障碍物并要躲避时自身与物体的距离。<br />

&nbsp;&nbsp;&nbsp;
这段代码并不完美，但是还算不错没有让 CPU 负荷太高。大家可以直接用它也可以改进它或只是寥寥看一下。下面是一个实例，见
AvoidTest.as 文件：<br />
package<br />
{<br />
&nbsp;import com.foed.Circle;<br />
&nbsp;import com.foed.SteeredVehicle;<br />
&nbsp;import com.foed.Vector2D;<br />
&nbsp;import com.foed.Vehicle;<br />
&nbsp;<br />
&nbsp;import flash.display.Sprite;<br />
&nbsp;import flash.display.StageAlign;<br />
&nbsp;import flash.display.StageScaleMode;<br />
&nbsp;import flash.events.Event;</P>
<p>&nbsp;public class AvoidTest extends Sprite<br />
&nbsp;{<br />
&nbsp;&nbsp;private var
_vehicle:SteeredVehicle;<br />
&nbsp;&nbsp;private var
_circles:Array;<br />
&nbsp;&nbsp;private var _numCircles:int =
10;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function
AvoidTest()<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;stage.align =
StageAlign.TOP_LEFT;<br />
&nbsp;&nbsp;&nbsp;stage.scaleMode
= StageScaleMode.NO_SCALE;<br />
&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;_vehicle =
new SteeredVehicle();<br />
&nbsp;&nbsp;&nbsp;_vehicle.edgeBehavior
= Vehicle.BOUNCE;<br />
&nbsp;&nbsp;&nbsp;addChild(_vehicle);<br />

&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;_circles =
new Array();<br />
&nbsp;&nbsp;&nbsp;for(var i:int
= 0; i &lt; _numCircles; i++)<br />
&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;var
circle:Circle = new Circle(Math.random() * 50 + 50);<br />
&nbsp;&nbsp;&nbsp;&nbsp;circle.x
= Math.random() * stage.stageWidth;<br />
&nbsp;&nbsp;&nbsp;&nbsp;circle.y
= Math.random() * stage.stageHeight;<br />
&nbsp;&nbsp;&nbsp;&nbsp;addChild(circle);<br />

&nbsp;&nbsp;&nbsp;&nbsp;_circles.push(circle);<br />

&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;addEventListener(Event.ENTER_FRAME,
onEnterFrame);<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;private function
onEnterFrame(event:Event):void<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;_vehicle.wander();<br />

&nbsp;&nbsp;&nbsp;_vehicle.avoid(_circles);<br />

&nbsp;&nbsp;&nbsp;_vehicle.update();<br />

&nbsp;&nbsp;}<br />
&nbsp;}<br />
}<br />
这里创建一个圆的数组，当车子试图躲避圆的时候它会漫游开。这个实现相当简单，但是运行得不错。它可以处理漫游或直线运动，当寻找物体的同时又要躲避时，这种方法就有些粗糙了。不过这类行为会在第四章寻路中得到更好的解决。接下来，我们进入另一种行为：路径跟随。</P>
<p>&nbsp;</P>
<p><font STYLE="FonT-siZe: 24px"><strong>路径跟随（Path
following）</STRONG></FONT><br />
<strong>路径跟随</STRONG>和它的名字很像：车子沿预定路径行进。路径可以在地图或游戏世界中被图像化，而对转向行为而言，可以用一组航点（waypoint）来表示。在
ActionScript 3.0 的实现中，只需要一个 Vector2D 对象数组。<br />
&nbsp;&nbsp;&nbsp;
实现策略惊人的简单。拿到第一个航点作为寻找目标。当机车在该点的一定范围内时，我们就认为它到达了该航点，然后向下一个移动。直至到达最后一个航点为止。你可以用一个循环路径，这样车子就会在到达最后一点时再从第一点重新开始。如图
2-10 所示。</P>
<p><a HREF="http://blog.photo.sina.com.cn/showpic.html#url=http://s12.sinaimg.cn/orignal/3ecb9b11t8fa42e76034b" TARGET="_blank"><img SRC="http://s12.sinaimg.cn/middle/3ecb9b11t8fa42e76034b&amp;690" /></A><br />

<strong>图 2-10</STRONG> 寻找第一个航点。当距离足够近时寻找下一个……</P>
<p>&nbsp;</P>
<p>类中需要新加两个属性：<br />
&nbsp;&nbsp;&nbsp; private var
_pathIndex:int = 0;<br />
&nbsp;&nbsp;&nbsp; private var
_pathThreshold:Number = 20;<br />
然后让我们给这些属性提供访问器：<br />
public function set pathIndex(value:int):void<br />
{<br />
&nbsp;_pathIndex = value;<br />
}<br />
public function get pathIndex():int<br />
{<br />
&nbsp;return _pathIndex;<br />
}</P>
<p>public function set pathThreshold(value:Number):void<br />
{<br />
&nbsp;_pathThreshold = value;<br />
}<br />
public function get pathThreshold():Number<br />
{<br />
&nbsp;return _pathThreshold;<br />
}<br />
第一个访问器给 _pathIndex，它持有航点数组的索引。_pathThreshold
访问器定义距离航点多远时就认为该点“走完”了。</P>
<p>以下是具体的实现：<br />
public function followPath(path:Array, loop:Boolean =
false):void<br />
{<br />
&nbsp;var wayPoint:Vector2D = path[_pathIndex];<br />
&nbsp;if(wayPoint == null) return;<br />
&nbsp;if(_position.dist(wayPoint) &lt;
_pathThreshold)<br />
&nbsp;{<br />
&nbsp;&nbsp;if(_pathIndex &gt;=
path.length - 1)<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;if(loop)<br />

&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;_pathIndex
= 0;<br />
&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;else<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;_pathIndex++;<br />

&nbsp;&nbsp;}<br />
&nbsp;}<br />
&nbsp;if(_pathIndex &gt;= path.length - 1
&amp;&amp; !loop)<br />
&nbsp;{<br />
&nbsp;&nbsp;arrive(wayPoint);<br />
&nbsp;}<br />
&nbsp;else<br />
&nbsp;{<br />
&nbsp;&nbsp;seek(wayPoint);<br />
&nbsp;}<br />
}<br />
这些判断语句有些混乱。首先，拿到航点数组中的第一个元素。如果它不是一个有效的 Vector2D 对象则直接
return。允许传入空数组。<br />
&nbsp;&nbsp;&nbsp; 如果 Vector2D
对象有效，就判断它是否在
threshold（阈值）距离内。如果是，则判断它是不是最后一个航点。如果是，则循环到第一点。如果不是最后一个航点，移到下一个。写起来有点儿复杂，但如果你将航点一个个画在纸上然后顺着它们连成线，你会发现这真的很简单。<br />

&nbsp;&nbsp;&nbsp;
现在，我们有了引导的航点。只需要运行 — seek( wayPoint) —
就能运行得很好了。不过我们还可以通过允许一种特殊情况让它变得更优雅一些：移动到路径的最后一个点时<em>不</EM>
做循环，而是用到达行为替代寻找。这样就让机车缓动到最后一个航点而非前后乱跳。<br />
&nbsp;&nbsp;&nbsp;
好了，介绍完了。我们需要一个可以运行的例子（PathTest.as 文件）：<br />
package<br />
{<br />
&nbsp;import com.foed.SteeredVehicle;<br />
&nbsp;import com.foed.Vector2D;<br />
&nbsp;<br />
&nbsp;import flash.display.Sprite;<br />
&nbsp;import flash.display.StageAlign;<br />
&nbsp;import flash.display.StageScaleMode;<br />
&nbsp;import flash.events.Event;<br />
&nbsp;import flash.events.MouseEvent;</P>
<p>&nbsp;public class PathTest extends Sprite<br />
&nbsp;{<br />
&nbsp;&nbsp;private var
_vehicle:SteeredVehicle;<br />
&nbsp;&nbsp;private var _path:Array;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function
PathTest()<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;stage.align =
StageAlign.TOP_LEFT;<br />
&nbsp;&nbsp;&nbsp;stage.scaleMode
= StageScaleMode.NO_SCALE;<br />
&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;_vehicle =
new SteeredVehicle();<br />
&nbsp;&nbsp;&nbsp;addChild(_vehicle);<br />

&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;_path = new
Array();<br />
&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;stage.addEventListener(MouseEvent.CLICK,
onClick);<br />
&nbsp;&nbsp;&nbsp;addEventListener(Event.ENTER_FRAME,
onEnterFrame);<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;private function
onEnterFrame(event:Event):void<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;_vehicle.followPath(_path,
true);<br />
&nbsp;&nbsp;&nbsp;_vehicle.update();<br />

&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;private function
onClick(event:MouseEvent):void<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;graphics.lineStyle(0,
0, .25);<br />
&nbsp;&nbsp;&nbsp;if(_path.length
== 0)<br />
&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;graphics.moveTo(mouseX,
mouseY);<br />
&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;graphics.lineTo(mouseX,
mouseY);<br />
&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;graphics.drawCircle(mouseX,
mouseY, 10);<br />
&nbsp;&nbsp;&nbsp;graphics.moveTo(mouseX,
mouseY);<br />
&nbsp;&nbsp;&nbsp;_path.push(new
Vector2D(mouseX, mouseY));<br />
&nbsp;&nbsp;}<br />
&nbsp;}<br />
}<br />
相当简单对吧。大部分代码是关于绘制路径的。这里有一个 _path 数组并且车子在 onEnterFrame
方法中设置为跟随路径。起初，它是一个没有航点的空数组，所以车子不会动。<br />
&nbsp;&nbsp;&nbsp;
我们每次点击鼠标就会在路径上创建一个新的航点。同时 onClick 方法只是让路径可以显示出来。<br />
&nbsp;&nbsp;&nbsp;
一旦你开始点击，车子就会开始沿你创建的路径前进。因为 loop 参数指定为
true，所以它会沿着路径绕圈。注意车子不是机械化的紧贴着路径走；它是自然的运动——温和地过度转弯和死角。通过改变 threshold
的值会影响转弯的效果。其它 SteeredVehicle 的属性，如 mass、maxSpeed、maxForce
也会影响转向行为。所以有很多数值可以调整以达到你想要的效果。<br />
&nbsp;&nbsp;&nbsp;
路径跟随通常与寻路（第四章）结合使用。寻路关注的是两个点间的最佳路线。它要考虑到角色不能到达的区域以及地形的潜在因素如石子地面与平缓地面。寻路通常是基于网格的，结果通常是一个可以让角色移动到目标的网格数组。这个数组可以当作路径跟随转向行为的路径，这样可以让运动显得更自然。<br />

&nbsp;&nbsp;&nbsp;
接下来，我们讨论最后一种行为，集群，它是三类子行为真正复杂的组合。</P>
<p>&nbsp;</P>
<p><font STYLE="FonT-siZe: 24px"><strong>集群（Flocking）行为</STRONG></FONT><br />
说到集群行为就不得不提到 Craig Reynolds 和它的“boids”模拟系统。Reynolds
做了一项惊人工作将看似极为复杂过程转换成几种简单的行为。</P>
<p>&nbsp;</P>
<p>说到鸟群，它有三个主要特性：<br />
&#9632;
首先，这些鸟基本都在一个区域内。如果其中一只移动过快远离了它的群落，它会很快回归群体。这就是<strong>凝聚（cohesion）</STRONG>，如图
2-11 所示。</P>
<p><a HREF="http://blog.photo.sina.com.cn/showpic.html#url=http://s14.sinaimg.cn/orignal/3ecb9b11t8fa439da1e9d" TARGET="_blank"><img NAME="image_operate_88681283835461596" SRC="http://s14.sinaimg.cn/middle/3ecb9b11t8fa439da1e9d&amp;690" /></A><br />
<strong>图 2-11</STRONG> 凝聚：寻找邻居位置的平均值</P>
<p>&nbsp;</P>
<p>&#9632;
然后，它又不喜欢离彼此太近，因此试图躲避相互碰撞。它们有私人空间的独立意识并开始防止跟别的鸟离得太近或者允许和另一只鸟离自己很近。这就是<strong>分离（separation）</STRONG>，如图
2-12 所示。</P>
<p><a HREF="http://blog.photo.sina.com.cn/showpic.html#url=http://s14.sinaimg.cn/orignal/3ecb9b11t8fa439e9697d" TARGET="_blank"><img NAME="image_operate_32311283835451189" SRC="http://s14.sinaimg.cn/middle/3ecb9b11t8fa439e9697d&amp;690" /></A></P>
<p><strong>图 2-12</STRONG> 分离：如果跟邻居太近，则离开</P>
<p>&nbsp;</P>
<p>&#9632;
最后，鸟群向大概一致的方向移动。是的，这里会有一点个别的变化，但是总体一致，这些鸟以它们的方向移动，最终鸟群汇成一条线。这就是<strong>队列（alignment）</STRONG>，如图
2-13 所示。</P>
<p><a HREF="http://blog.photo.sina.com.cn/showpic.html#url=http://s1.sinaimg.cn/orignal/3ecb9b11t8fa439f8ab10" TARGET="_blank"><img NAME="image_operate_31671283835456396" SRC="http://s1.sinaimg.cn/middle/3ecb9b11t8fa439f8ab10&amp;690" /></A></P>
<p><strong>图 2-13</STRONG> 队列：调整到邻居向量的平均值</P>
<p>&nbsp;</P>
<p>&nbsp;&nbsp;&nbsp;
凝聚、分离、队列这三个行为构成了一个复杂的集群行为。<br />
&nbsp;&nbsp;&nbsp;
当想到鸟群的复杂行为时，有的人势必会猜想需要对鸟群整体进行智能控制，或者假设每只鸟都有完全独立的意识。这些想法我都不反对，但是我要说当你开始理解这三种行为组成群落时，你会发现每只鸟不必都让大家知道，也不需要一个总体的“蜂巢”控制器。事实上，每只鸟只需要能看到当前临近的鸟。如果它开始接近它们，但又不是太近，则将自身的方向调整为临近鸟的方向，接下来这个神秘的集群行为就浮现在我们眼前了。<br />

&nbsp;&nbsp;&nbsp;
虽然，技术上讲集群行为是由三个子行为组成的，但是这三个行为通常是一起使用的。我们一般不需要角色只展现一种或两种行为，所以这三个行为的代码将会写在一个方法里。这样实现起来也会更加高效，因为需要很多循环，如果将三件事都放在一个循环里完成就会更好。OK，下面就是这个方法：<br />

public function flock(vehicles:Array):void<br />
{<br />
&nbsp;var averageVelocity:Vector2D =
_velocity.clone();<br />
&nbsp;var averagePosition:Vector2D = new
Vector2D();<br />
&nbsp;var inSightCount:int = 0;<br />
&nbsp;for(var i:int = 0; i &lt;
vehicles.length; i++)<br />
&nbsp;{<br />
&nbsp;&nbsp;var vehicle:Vehicle =
vehicles[i] as Vehicle;<br />
&nbsp;&nbsp;if(vehicle != this
&amp;&amp; inSight(vehicle))<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;averageVelocity
= averageVelocity.add(vehicle.velocity);<br />
&nbsp;&nbsp;&nbsp;averagePosition
= averagePosition.add(vehicle.position);<br />
&nbsp;&nbsp;&nbsp;if(tooClose(vehicle))
flee(vehicle.position);<br />
&nbsp;&nbsp;&nbsp;inSightCount++;<br />

&nbsp;&nbsp;}<br />
&nbsp;}<br />
&nbsp;if(inSightCount &gt; 0)<br />
&nbsp;{<br />
&nbsp;&nbsp;averageVelocity =
averageVelocity.divide(inSightCount);<br />
&nbsp;&nbsp;averagePosition =
averagePosition.divide(inSightCount);<br />
&nbsp;&nbsp;seek(averagePosition);<br />
&nbsp;&nbsp;_steeringForce.add(averageVelocity.subtract(_velocity));<br />

&nbsp;}<br />
}<br />
首先，传入机车数组。策略是循环整个数组看哪一辆车子在当前车子的视野范围内，如果车子在视野内，则将它们的速度和位置加到一起。我们也记录有多少车子在视野内用以计算平均值。还要注意如果当前处理的车子就是自身，则略过。<br />

&nbsp;&nbsp;&nbsp;
如果有车子靠得太近，就执行躲避（flee）行为远离它，即允许与它分道扬镳。<br />
&nbsp;&nbsp;&nbsp;
当遍历过整个数组后，如果在视野范围内发现了机车，则计算位置和速度的平均值。我们寻找（seek）到平均位置并让转向力朝向平均速度。<br />

&nbsp;&nbsp;&nbsp;
不是很困难，但是要注意有两个用到的方法目前还没有展示：inSight 和 tooClose：<br />
public function inSight(vehicle:Vehicle):Boolean<br />
{<br />
&nbsp;if(_position.dist(vehicle.position)
&gt; _inSightDist) return false;<br />
&nbsp;var heading:Vector2D =
_velocity.clone().normalize();<br />
&nbsp;var difference:Vector2D =
vehicle.position.subtract(_position);<br />
&nbsp;var dotProd:Number =
difference.dotProd(heading);<br />
&nbsp;<br />
&nbsp;if(dotProd &lt; 0) return
false;<br />
&nbsp;return true;<br />
}</P>
<p>public function tooClose(vehicle:Vehicle):Boolean<br />
{<br />
&nbsp;return _position.dist(vehicle.position)
&lt; _tooCloseDist;<br />
}<br />
inSight 方法决定一辆机车是否可以看到另一辆。要做到这一点，首先判断那辆机车是否在某个范围内。如果不是则返回
false。然后做一些新奇的向量数学运算来判断机车是否在其前面或后面。如果另一辆机车在前面，则可以看到它；如果在后面则看不到它。这其实是一个相当硬性的实现，因为它只允许
180
度的视野。这个实例能够很好表达我们的意图，但是如果想要改良这个行为可以从改变不同的视野方面入手。一个较窄的视野意味着角色只能看到正前方而很少看到两旁的物体。一个较宽的视野意味着角色可能看到身后的东西。这些视野的变化会导致不同形态的集群。<br />

&nbsp;&nbsp;&nbsp; 下面是 tooClose
方法，如果机车在某个特定范围内则返回 true；否则返回 false。</P>
<p>我们看到这两个方法需要依赖两个类变量。并且还要加为它们加两个访问器：<br />
private var _inSightDist:Number = 200;<br />
private var _tooCloseDist:Number = 60;</P>
<p>public function set inSightDist(value:Number):void<br />
{<br />
&nbsp;_inSightDist = value;<br />
}<br />
public function get inSightDist():Number<br />
{<br />
&nbsp;return _inSightDist;<br />
}</P>
<p>public function set tooCloseDist(value:Number):void<br />
{<br />
&nbsp;_tooCloseDist = value;<br />
}<br />
public function get tooCloseDist():Number<br />
{<br />
&nbsp;return _tooCloseDist;<br />
}<br />
最终，我们需要一个测试类（见 FlockTest.as 文件）：<br />
package<br />
{<br />
&nbsp;import com.foed.SteeredVehicle;<br />
&nbsp;import com.foed.Vector2D;<br />
&nbsp;import com.foed.Vehicle;<br />
&nbsp;<br />
&nbsp;import flash.display.Sprite;<br />
&nbsp;import flash.display.StageAlign;<br />
&nbsp;import flash.display.StageScaleMode;<br />
&nbsp;import flash.events.Event;</P>
<p>&nbsp;public class FlockTest extends Sprite<br />
&nbsp;{<br />
&nbsp;&nbsp;private var
_vehicles:Array;<br />
&nbsp;&nbsp;private var _numVehicles:int =
30;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function
FlockTest()<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;stage.align =
StageAlign.TOP_LEFT;<br />
&nbsp;&nbsp;&nbsp;stage.scaleMode
= StageScaleMode.NO_SCALE;<br />
&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;_vehicles =
new Array();<br />
&nbsp;&nbsp;&nbsp;for(var i:int
= 0; i &lt; _numVehicles; i++)<br />
&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;var
vehicle:SteeredVehicle = new SteeredVehicle();<br />
&nbsp;&nbsp;&nbsp;&nbsp;vehicle.position
= new Vector2D(Math.random() * stage.stageWidth, Math.random() *
stage.stageHeight);<br />
&nbsp;&nbsp;&nbsp;&nbsp;vehicle.velocity
= new Vector2D(Math.random() * 20 - 10, Math.random() * 20 -
10);<br />
&nbsp;&nbsp;&nbsp;&nbsp;vehicle.edgeBehavior
= Vehicle.BOUNCE;<br />
&nbsp;&nbsp;&nbsp;&nbsp;_vehicles.push(vehicle);<br />

&nbsp;&nbsp;&nbsp;&nbsp;addChild(vehicle);<br />

&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;addEventListener(Event.ENTER_FRAME,
onEnterFrame);<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;private function
onEnterFrame(event:Event):void<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;for(var i:int
= 0; i &lt; _numVehicles; i++)<br />
&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;_vehicles[i].flock(_vehicles);<br />

&nbsp;&nbsp;&nbsp;&nbsp;_vehicles[i].update();<br />

&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;}<br />
&nbsp;}<br />
}<br />
我们简单地创建了一群转向机车，将它们分散到舞台上，并加入数组中。每一帧，循环整个数组，让每一辆车执行集群（flock）行为，然后执行更新（update）。你会看到虽然每辆车子都是独立运动的，但是它们对周围是有意识的，并且是动态成组的。改变一下变量，车子数量，了解一下它是如何工作的。<br />

&nbsp;&nbsp;&nbsp;
另一个可以改良的地方是数组的优化。目前每辆机车会判断整个数组，这样做效率会很差。你可以用双重循环或类似第一章介绍的基于网格的实现对其进行重构。然而，这可能需要将一些代码从
flock 方法中移出到主文档类或其它集群控制器类。我就把这个任务留给大家了。</P>
<p>&nbsp;</P>
<p><font STYLE="FonT-siZe: 24px"><strong>总结</STRONG></FONT><br />
本章介绍了基本的转向行为，从简单的寻找和躲避到复杂的对象回避和集群行为。乐趣在于将这些行为结合起来创建出复杂的动力系统。同时，这一章只对这个主题做一个浅显的介绍。在网上和其它相关书籍中会有大量的关于转向行为的资料，通常隶属于人工智能。我希望本章至少能给大家一些启发并可以运用到你的
ActionScript 3.0 应用和游戏中。<br />
&nbsp;&nbsp;&nbsp;
下一章讨论等角世界以及寻路，结合本章的转向行为（或许还有高级碰撞检测），我们就可以创建出自己大型的游戏。</P>]]></description>
            <author>FL车在臣</author>
            <category>AdvancED_AS3_Animation!</category>
            <comments>http://blog.sina.com.cn/s/blog_3ecb9b110100l5q3.html#comment</comments>
            <pubDate>Tue, 07 Sep 2010 12:42:04 +0800</pubDate>
            <guid>http://blog.sina.com.cn/s/blog_3ecb9b110100l5q3.html</guid>
        </item>
        <item>
            <title>第二章 转向行为&amp;#8545;[FL车在臣]</title>
            <link>http://blog.sina.com.cn/s/blog_3ecb9b110100l5cb.html</link>
            <description><![CDATA[<p><font STYLE="FonT-siZe: 24px"><strong>Vehicle
类</STRONG></FONT><br />
&nbsp;&nbsp;&nbsp; Vehicle
类是基础的转向角色类，但是没有任何转向行为。它仅仅处理简单的运动：位置、速度、质量以及角色碰撞到屏幕边缘会发生什么（既可以反弹回来，也可以重置在舞台的相对面）。SteeredVehicle
类是 Vehicle 的子类，其自身添加了转向行为。这种设计让 Vehicle 类作为不需要转向行为就能运动的对象。还让
SteeredVehicle 类只关注转向功能的实现而不用担心基本运动的细节。<br />
&nbsp;&nbsp;&nbsp;
现在我们已经把<strong>角色</STRONG>当作一个能够运动并且拥有行为的东西。这现在开始，<strong>我们将使用角色（character）</STRONG>和<strong>机车（vehicle）</STRONG>这两个词进行相互替换。可以认为角色是驾驶机车的人，甚至“机车”就是角色的身体。如果还不能帮助你的话，请阅读在本章开始提到的“Steering
Behaviors for Autonomous Characters”论文的“Locomotion”部分。<br />
&nbsp;&nbsp;&nbsp;
简单起见，下面是这个类，大家可以从本书的下载网站找到 Vehicle.as 文件：<br />
package com.foed<br />
{<br />
&nbsp;import flash.display.Sprite;<br />
&nbsp;<br />
&nbsp;<br />
&nbsp;public class Vehicle extends Sprite<br />
&nbsp;{<br />
&nbsp;&nbsp;protected var
_edgeBehavior:String = WRAP;<br />
&nbsp;&nbsp;protected var _mass:Number =
1.0;<br />
&nbsp;&nbsp;protected var _maxSpeed:Number
= 10;<br />
&nbsp;&nbsp;protected var
_position:Vector2D;<br />
&nbsp;&nbsp;protected var
_velocity:Vector2D;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;// potential edge
behaviors<br />
&nbsp;&nbsp;public static const WRAP:String
= "wrap";<br />
&nbsp;&nbsp;public static const
BOUNCE:String = "bounce";<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function Vehicle()<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;_position =
new Vector2D();<br />
&nbsp;&nbsp;&nbsp;_velocity =
new Vector2D();<br />
&nbsp;&nbsp;&nbsp;draw();<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;protected function
draw():void<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;graphics.clear();<br />

&nbsp;&nbsp;&nbsp;graphics.lineStyle(0);<br />

&nbsp;&nbsp;&nbsp;graphics.moveTo(10,
0);<br />
&nbsp;&nbsp;&nbsp;graphics.lineTo(-10,
5);<br />
&nbsp;&nbsp;&nbsp;graphics.lineTo(-10,
-5);<br />
&nbsp;&nbsp;&nbsp;graphics.lineTo(10,
0);<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function
update():void<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;// make sure
velocity stays within max speed.<br />
&nbsp;&nbsp;&nbsp;_velocity.truncate(_maxSpeed);<br />

&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;// add
velocity to position<br />
&nbsp;&nbsp;&nbsp;_position =
_position.add(_velocity);<br />
&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;// handle any
edge behavior<br />
&nbsp;&nbsp;&nbsp;if(_edgeBehavior
== WRAP)<br />
&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;wrap();<br />

&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;else
if(_edgeBehavior == BOUNCE)<br />
&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;bounce();<br />

&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;// update
position of sprite<br />
&nbsp;&nbsp;&nbsp;x =
position.x;<br />
&nbsp;&nbsp;&nbsp;y =
position.y;<br />
&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;// rotate
heading to match velocity<br />
&nbsp;&nbsp;&nbsp;rotation =
_velocity.angle * 180 / Math.PI;<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;private function
bounce():void<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;if(stage !=
null)<br />
&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;if(position.x
&gt; stage.stageWidth)<br />
&nbsp;&nbsp;&nbsp;&nbsp;{<br />

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;position.x
= stage.stageWidth;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;velocity.x
*= -1;<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />

&nbsp;&nbsp;&nbsp;&nbsp;else
if(position.x &lt; 0)<br />
&nbsp;&nbsp;&nbsp;&nbsp;{<br />

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;position.x
= 0;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;velocity.x
*= -1;<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />

&nbsp;&nbsp;&nbsp;&nbsp;<br />

&nbsp;&nbsp;&nbsp;&nbsp;if(position.y
&gt; stage.stageHeight)<br />
&nbsp;&nbsp;&nbsp;&nbsp;{<br />

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;position.y
= stage.stageHeight;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;velocity.y
*= -1;<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />

&nbsp;&nbsp;&nbsp;&nbsp;else
if(position.y &lt; 0)<br />
&nbsp;&nbsp;&nbsp;&nbsp;{<br />

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;position.y
= 0;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;velocity.y
*= -1;<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />

&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;private function
wrap():void<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;if(stage !=
null)<br />
&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;if(position.x
&gt; stage.stageWidth) position.x = 0;<br />
&nbsp;&nbsp;&nbsp;&nbsp;if(position.x
&lt; 0) position.x = stage.stageWidth;<br />
&nbsp;&nbsp;&nbsp;&nbsp;if(position.y
&gt; stage.stageHeight) position.y = 0;<br />
&nbsp;&nbsp;&nbsp;&nbsp;if(position.y
&lt; 0) position.y = stage.stageHeight;<br />
&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function set
edgeBehavior(value:String):void<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;_edgeBehavior
= value;<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;public function get
edgeBehavior():String<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;return
_edgeBehavior;<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function set
mass(value:Number):void<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;_mass =
value;<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;public function get
mass():Number<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;return
_mass;<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function set
maxSpeed(value:Number):void<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;_maxSpeed =
value;<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;public function get
maxSpeed():Number<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;return
_maxSpeed;<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function set
position(value:Vector2D):void<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;_position =
value;<br />
&nbsp;&nbsp;&nbsp;x =
_position.x;<br />
&nbsp;&nbsp;&nbsp;y =
_position.y;<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;public function get
position():Vector2D<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;return
_position;<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function set
velocity(value:Vector2D):void<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;_velocity =
value;<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;public function get
velocity():Vector2D<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;return
_velocity;<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;override public function set
x(value:Number):void<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;super.x =
value;<br />
&nbsp;&nbsp;&nbsp;_position.x =
x;<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;override public function set
y(value:Number):void<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;super.y =
value;<br />
&nbsp;&nbsp;&nbsp;_position.y =
y;<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;}<br />
}<br />
如果你对 <em>Making Things Move</EM>
的一些基本概念比较熟悉，那么这里就没什么新的概念，只是处理方式不太相同。首先，我们没有使用 x 和 y 变量保存位置和速度（如
x，y，vx，vy）而是用两个 Vector2D 对象: _position 和 _velocity 与之对应。<br />
&nbsp;&nbsp;&nbsp; 大多数工作在
update 方法中进行。首先截断速度向量保证它不会大于 _maxSpeed；然后将速度加到当前位置。在 <em>Making
Things Move</EM> 中，我们用过如下方法：<br />
&nbsp;&nbsp;&nbsp; x +=
_vx;<br />
&nbsp;&nbsp;&nbsp; y +=
_vy;<br />
我们现在通过向量可以只用一行代码：<br />
&nbsp;&nbsp;&nbsp; _position =
_position.add(_velocity);<br />
然后在方法中判断边境并调用 wrap 或 bounce 方法。最后，更新 Sprite 在屏幕的位置对应 _position 的 x
和 y 值，再调整角色的 rotation 属性使其朝向移动的方向：<br />
&nbsp;&nbsp;&nbsp; x =
position.x;<br />
&nbsp;&nbsp;&nbsp; y =
position.y;<br />
&nbsp;&nbsp;&nbsp; rotation =
_velocity.angle * 180 / Math.PI;<br />
其余的基本都是各个 protected 属性的 getter/setter 方法。当这个类被实例化的时候，我将默认调用 draw
方法。该方法可以被子类重写创建特定图形的角色，也许绘制图形之前该对象在屏幕上是可见的。<br />
&nbsp;&nbsp;&nbsp; 我创建了一个名为
VehicleTest 的文档类用于快速测试 Vehicle 类，见本书的下载文件 VehicleTest.as：<br />
package<br />
{<br />
&nbsp;import com.foed.Vector2D;<br />
&nbsp;import com.foed.Vehicle;<br />
&nbsp;<br />
&nbsp;import flash.display.Sprite;<br />
&nbsp;import flash.display.StageAlign;<br />
&nbsp;import flash.display.StageScaleMode;<br />
&nbsp;import flash.events.Event;<br />
&nbsp;<br />
&nbsp;public class VehicleTest extends Sprite<br />
&nbsp;{<br />
&nbsp;&nbsp;private var
_vehicle:Vehicle;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function
VehicleTest()<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;stage.align =
StageAlign.TOP_LEFT;<br />
&nbsp;&nbsp;&nbsp;stage.scaleMode
= StageScaleMode.NO_SCALE;<br />
&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;_vehicle =
new Vehicle();<br />
&nbsp;&nbsp;&nbsp;addChild(_vehicle);<br />

&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;_vehicle.position
= new Vector2D(100, 100);<br />
&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;_vehicle.velocity.length
= 5;<br />
&nbsp;&nbsp;&nbsp;_vehicle.velocity.angle
= Math.PI / 4;<br />
&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;addEventListener(Event.ENTER_FRAME,
onEnterFrame);<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;private function
onEnterFrame(event:Event):void<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;_vehicle.update();<br />

&nbsp;&nbsp;}<br />
&nbsp;}<br />
}<br />
首先创建一个新的 Vehicle 然后加入显示列表。设置其位置为 new Vector2D 实例：<br />
&nbsp;&nbsp;&nbsp;
_vehicle.position = new Vector2D(100, 100);<br />
另一种相同的做法是直接设置 x 和 y 的坐标值：<br />
&nbsp;&nbsp;&nbsp;
_vehicle.position.x = 100;<br />
&nbsp;&nbsp;&nbsp;
_vehicle.position.y = 100;<br />
或者在重写的 x 和 y 方法中，直接设置 vehicle 本身的 x 和 y 让 position 向量直接获得值：<br />
&nbsp;&nbsp;&nbsp; _vehicle.x =
100;<br />
&nbsp;&nbsp;&nbsp; _vehicle.y =
100;<br />
该类在设置向量时使用了另一种策略：设置长度和角度向量证明了使用向量带来的灵活性：<br />
&nbsp;&nbsp;&nbsp;
_vehicle.velocity.length = 5;<br />
&nbsp;&nbsp;&nbsp;
_vehicle.velocity.angle = Math.PI / 4;<br />
这里 length 就是速度，而 angle 就是方向。不要忘了角度应该是弧度制的，所以 Math.PI / 4 就等于 45
度。但是，如果你知道对象运动的 x 和 y 速度，你可以直接将 x, y 赋值给一个新的 Vector2D。<br />
&nbsp;&nbsp;&nbsp; 最后，设置一个
ENTER_FRAME 事件的侦听器，每帧去调用 vehicle 的 update
方法。这样就能让机车按照被赋值的方向运动。当它碰到屏幕边缘的时候，将会环绕到屏幕的另一侧。如图 2-2 所示。</P>
<p><a href="http://blog.photo.sina.com.cn/showpic.html#url=http://static8.photo.sina.com.cn/orignal/3ecb9b11t8f942f643737" TARGET="_blank"><img SRC="http://static8.photo.sina.com.cn/middle/3ecb9b11t8f942f643737&amp;690" WIDTH="601" HEIGHT="479" /></A><br />
<strong>图 2-2</STRONG> 运动中的机车</P>
<p>&nbsp;&nbsp;&nbsp; 对于
Vehicle 类的测试已经完成了。让我们进入更有趣的部分——转向行为，也就是本章的重点。</P>
<p>&nbsp;</P>
<p><font STYLE="FonT-siZe: 24px"><strong>SteeredVehicle
类</STRONG></FONT><br />
&nbsp;&nbsp;&nbsp;
SteeredVehicle 类继承自 Vehicle 并增加了转向行为。每个行为都是 public
方法以便在每侦或每个定时间隔被访问用于施加某种转向力。通常在所有的转向力增加后再调用 update 方法。<br />
&nbsp;&nbsp;&nbsp;
例如，如果我们想要创建一个简单的漫游机车，可以在 update 之前调用其 wander 方法：<br />
private function onEnterFrame(event:Event):void<br />
{<br />
&nbsp;_vehicle.wander();<br />
&nbsp;_vehicle.update();<br />
}<br />
这里是转向行为的工作方式：调用转向方法，计算转向力，是一种让机车顺时针或逆时针转向的力。如 seek
方法会计算足够让机车转到目标点的力。机车可能会受到多种转向行为的影响——可能在寻找目标的时候同时需要逃避或躲闪另一辆机车。这些力加杂一起。当最后调用
update 方法时，vehicle 计算出所有的转向力而后改变其自身速度（方向与速度）。<br />
&nbsp;&nbsp;&nbsp; 这里是
SteeredVehicle 类的核心，除去了机车类已经有的行为代码（SteeredVehicle.as
可以从本书的网站下载）：<br />
package com.foed<br />
{<br />
&nbsp;import flash.display.Sprite;</P>
<p>&nbsp;public class SteeredVehicle extends
Vehicle<br />
&nbsp;{<br />
&nbsp;&nbsp;private var _maxForce:Number =
1;<br />
&nbsp;&nbsp;private var
_steeringForce:Vector2D;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function
SteeredVehicle()<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;_steeringForce
= new Vector2D();<br />
&nbsp;&nbsp;&nbsp;super();<br />

&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function set
maxForce(value:Number):void<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;_maxForce =
value;<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;public function get
maxForce():Number<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;return
_maxForce;<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;override public function
update():void<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;_steeringForce.truncate(_maxForce);<br />

&nbsp;&nbsp;&nbsp;_steeringForce
= _steeringForce.divide(_mass);<br />
&nbsp;&nbsp;&nbsp;_velocity =
_velocity.add(_steeringForce);<br />
&nbsp;&nbsp;&nbsp;_steeringForce
= new Vector2D();<br />
&nbsp;&nbsp;&nbsp;super.update();<br />

&nbsp;&nbsp;}<br />
&nbsp;}<br />
}<br />
我们看到 _steeringForce 属性，一个 Vector2D 类型。这个属性记录所有行为的转向力（注意还有一个
_maxForce 属性）。在现实中我们不会看到机车或角色有“急转弯”现象，所以要限制每一个帧实际可能的转向力。通过 maxForce
的 getter/setter 方法对其进行访问。通过调整 maxForce
属性可以让机车急速转弯、快速移动、更加准确到达目标或者拐一个大弯。<br />
&nbsp;&nbsp;&nbsp; 现在让我们跳到
update 方法。假设一个或多个转向行为被调用，_steeringForce 属性包含一个超级向量。update 方法首先截断
_steeringForce 使其不会大于最大的转向力。然后用 _steeringForce
除以机车的质量（mass）。在真实世界中，大车拥有较大的动量需要拐大弯，而小车转弯更快。转向力被加到当前机车的速度上，_steeringForce
变量重置为下一轮累加做准备。最后调用基类的 update 方法，完成所有的基本移动工作，该工作已经在 Vehicle
类中实现了。<br />
&nbsp;&nbsp;&nbsp;
现在让我们看看行为的实现，从寻找（seek）开始。每一个行为都是 SteeredVehicle
类中的一个公共方法。某些行为则需要新的类变量或额外的方法来支持，并且必要的时候它们还要暴露出来。</P>
<p>&nbsp;</P>
<p><font STYLE="FonT-siZe: 24px"><strong>Seek（寻找）行为</STRONG></FONT><br />
如前面描述的，寻找只是让机车移运动到指定点。方法如下：<br />
public function seek(target:Vector2D):void<br />
{<br />
&nbsp;var desiredVelocity:Vector2D =
target.subtract(_position);<br />
&nbsp;desiredVelocity.normalize();<br />
&nbsp;desiredVelocity =
desiredVelocity.multiply(_maxSpeed);<br />
&nbsp;var force:Vector2D =
desiredVelocity.subtract(_velocity);<br />
&nbsp;_steeringForce = _steeringForce.add(force);<br />
}<br />
首先，计算出期望速度（desired
velocity），即能让车子运动到目标点的确切速度。用机车的位置减去目标位置。意思就是“如果以这个方向，走这段距离，你就会到达想去的地方”。如图
2-3 所示。</P>
<p><a href="http://blog.photo.sina.com.cn/showpic.html#url=http://static7.photo.sina.com.cn/orignal/3ecb9b11t8f9433c8cdb6" TARGET="_blank"><img SRC="http://static7.photo.sina.com.cn/middle/3ecb9b11t8f9433c8cdb6&amp;690" WIDTH="187" HEIGHT="298" /></A><br />
<strong>图 2-3</STRONG> 以期望速度运动会立即到达目标点</P>
<p>&nbsp;</P>
<p>
当然，事情不总是如人所愿。有的时候可能你会发现更好的算法。这里我们将标准化（normalize）期望速度并乘以最大速度（maxSpeed）。这样仍会得出一个指向目标点的向量，而它的量与车子运动的最快速度相同，其含意是“你不能即刻到达那里，但要朝这个方向以最快速度运动，你就会很快到达”。<br />

&nbsp;&nbsp;&nbsp;
期望速度有了；还要考虑车子自身已有的速度。用期望速度减去车子速度得到一个向量，意义是“将这个向量加入到当前速度，朝向正确的方向以最快速度前进”。<br />

&nbsp;&nbsp;&nbsp;
这个向量就是转向力。别忘了在 update 方法中，让 _steeringForce 和 maxForce
做截断操作。所以我们不是全速前进到目的地，而是要在 _maxForce 和 _maxSpeed 的限制中找到最佳点。如图 2-4
所示。</P>
<p><a href="http://blog.photo.sina.com.cn/showpic.html#url=http://static13.photo.sina.com.cn/orignal/3ecb9b11t8f9436a94bbc" TARGET="_blank"><img SRC="http://static13.photo.sina.com.cn/middle/3ecb9b11t8f9436a94bbc&amp;690" WIDTH="195" HEIGHT="302" NAME="image_operate_47961283766655509" /></A><br />
<strong>图 2-4</STRONG> 最佳期望速度，以及改变当前速度所需的力</P>
<p><br />
现在我们看一个寻找行为的示例：<br />
package<br />
{<br />
&nbsp;import com.foed.SteeredVehicle;<br />
&nbsp;import com.foed.Vector2D;<br />
&nbsp;<br />
&nbsp;import flash.display.Sprite;<br />
&nbsp;import flash.display.StageAlign;<br />
&nbsp;import flash.display.StageScaleMode;<br />
&nbsp;import flash.events.Event;</P>
<p>&nbsp;public class SeekTest extends Sprite<br />
&nbsp;{<br />
&nbsp;&nbsp;private var
_vehicle:SteeredVehicle;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function
SeekTest()<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;stage.align =
StageAlign.TOP_LEFT;<br />
&nbsp;&nbsp;&nbsp;stage.scaleMode
= StageScaleMode.NO_SCALE;<br />
&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;_vehicle =
new SteeredVehicle();<br />
&nbsp;&nbsp;&nbsp;addChild(_vehicle);<br />

&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;addEventListener(Event.ENTER_FRAME,
onEnterFrame);<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;private function
onEnterFrame(event:Event):void<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;_vehicle.seek(new
Vector2D(mouseX, mouseY));<br />
&nbsp;&nbsp;&nbsp;_vehicle.update();<br />

&nbsp;&nbsp;}<br />
&nbsp;}<br />
}<br />
这是个相当简单的例子。只是创建一个车子，放置在舞台，并且在每一帧让车子寻找鼠标并调用 update 方法。试者改变一下
maxSpeed 和 maxForce
的值，甚至可以改变其质量（mass）感受一下转向行为的变化。你也可以让它去寻找一个固定点，而非鼠标。或者玩点儿刺激的，创建另一个
Vehicle 让车子去寻找它。那么 onEnterFrame 方法可能会是这样：<br />
&nbsp;&nbsp;&nbsp;
_vehicle.seek(_targetVehicle.position);<br />
你甚至可以让一个转向机车去寻找鼠标，再让另一个转向机车去寻找第一辆。当你感觉它们都运行得不错时，我们就进入下一个行为：躲避（flee）。</P>
<p>&nbsp;</P>
<p><font STYLE="FonT-siZe: 24px"><strong>Flee（躲避）行为</STRONG></FONT><br />
躲避行为与寻找行为彻底、完全、绝对的相反。事实上，它们的实现方法除了最后一行代码外全部相同，就是从 _steeringForce
中减去转向力而不是加：<br />
public function flee(target:Vector2D):void<br />
{<br />
&nbsp;var desiredVelocity:Vector2D =
target.subtract(_position);<br />
&nbsp;desiredVelocity.normalize();<br />
&nbsp;desiredVelocity =
desiredVelocity.multiply(_maxSpeed);<br />
&nbsp;var force:Vector2D =
desiredVelocity.subtract(_velocity);<br />
<strong>&nbsp;_steeringForce =
_steeringForce.subtract(force);</STRONG><br />
}<br />
不需要再做任何细节的解释了，因为它和寻找行为基本相同。最后一句的意思是“Ok，我已经知道你要到达的位置了。现在掉个头往相反的方向走”。下面是一个躲避行为的简单测试（可从本书网站下载
FleeText.as）：<br />
package<br />
{<br />
&nbsp;import com.foed.SteeredVehicle;<br />
&nbsp;import com.foed.Vector2D;<br />
&nbsp;import com.foed.Vehicle;<br />
&nbsp;<br />
&nbsp;import flash.display.Sprite;<br />
&nbsp;import flash.display.StageAlign;<br />
&nbsp;import flash.display.StageScaleMode;<br />
&nbsp;import flash.events.Event;</P>
<p>&nbsp;public class FleeTest extends Sprite<br />
&nbsp;{<br />
&nbsp;&nbsp;private var
_vehicle:SteeredVehicle;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function
FleeTest()<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;stage.align =
StageAlign.TOP_LEFT;<br />
&nbsp;&nbsp;&nbsp;stage.scaleMode
= StageScaleMode.NO_SCALE;<br />
&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;_vehicle =
new SteeredVehicle();<br />
<strong>&nbsp;&nbsp;&nbsp;_vehicle.position
= new Vector2D(200, 200);<br />
&nbsp;&nbsp;&nbsp;_vehicle.edgeBehavior
= Vehicle.BOUNCE;</STRONG><br />
&nbsp;&nbsp;&nbsp;addChild(_vehicle);<br />

&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;addEventListener(Event.ENTER_FRAME,
onEnterFrame);<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;private function
onEnterFrame(event:Event):void<br />
&nbsp;&nbsp;{<br />
<strong>&nbsp;&nbsp;&nbsp;_vehicle.flee(new
Vector2D(mouseX, mouseY));</STRONG><br />
&nbsp;&nbsp;&nbsp;_vehicle.update();<br />

&nbsp;&nbsp;}<br />
&nbsp;}<br />
}<br />
除了明显的调用 flee 和 seek
方法的不同之外，主要的不同是先让车子的位置略微接近舞台一点并让它在与舞台碰撞时反弹。如果你删除了那两行代码，你就知道我为什么要加了。车子把自己藏在角落以躲避鼠标，然后你可能就看不到它了。<br />

&nbsp;&nbsp;&nbsp;
现在我们已经有了一对完全相反的行为了，显然下一步就要创建两个机车让它们各自拥有一种行为，然后看看它们有什么表现。下面这个例子就是要做这件事，在下载网站上的
SeekFleeTest1.as 文件：<br />
package<br />
{<br />
&nbsp;import com.foed.SteeredVehicle;<br />
&nbsp;import com.foed.Vector2D;<br />
&nbsp;import com.foed.Vehicle;<br />
&nbsp;<br />
&nbsp;import flash.display.Sprite;<br />
&nbsp;import flash.display.StageAlign;<br />
&nbsp;import flash.display.StageScaleMode;<br />
&nbsp;import flash.events.Event;</P>
<p>&nbsp;public class SeekFleeTest1 extends
Sprite<br />
&nbsp;{<br />
&nbsp;&nbsp;private var
_seeker:SteeredVehicle;<br />
&nbsp;&nbsp;private var
_fleer:SteeredVehicle;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function
SeekFleeTest1()<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;stage.align =
StageAlign.TOP_LEFT;<br />
&nbsp;&nbsp;&nbsp;stage.scaleMode
= StageScaleMode.NO_SCALE;<br />
&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;_seeker = new
SteeredVehicle();<br />
&nbsp;&nbsp;&nbsp;_seeker.position
= new Vector2D(200, 200);<br />
&nbsp;&nbsp;&nbsp;_seeker.edgeBehavior
= Vehicle.BOUNCE;<br />
&nbsp;&nbsp;&nbsp;addChild(_seeker);<br />

&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;_fleer = new
SteeredVehicle();<br />
&nbsp;&nbsp;&nbsp;_fleer.position
= new Vector2D(400, 300);<br />
&nbsp;&nbsp;&nbsp;_fleer.edgeBehavior
= Vehicle.BOUNCE;<br />
&nbsp;&nbsp;&nbsp;addChild(_fleer);<br />

&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;addEventListener(Event.ENTER_FRAME,
onEnterFrame);<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;private function
onEnterFrame(event:Event):void<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;_seeker.seek(_fleer.position);<br />

&nbsp;&nbsp;&nbsp;_fleer.flee(_seeker.position);<br />

&nbsp;&nbsp;&nbsp;_seeker.update();<br />

&nbsp;&nbsp;&nbsp;_fleer.update();<br />

&nbsp;&nbsp;}<br />
&nbsp;}<br />
}<br />
这时我们有了两辆车子：_seeker 和 _fleer。我想不必去解释 seeker 寻找 fleer，以及 fleer 躲避
seeker 了吧（试着读这句英文十遍 "The seeker seeks the fleer, and the fleer
flees the seeker"！）。让它运行一会儿看看它们是怎么相互作用的。然后试着改变一些参数看看会发生什么。<br />
&nbsp;&nbsp;&nbsp;
现在我们已经有不只一种行为，可以在一辆机车上应用多个行为了。接下的例子，机车 A 将寻找 B，B 要去寻找 C，而 C 再寻找
A。同时每辆机车还要躲避寻找它的机车，它们三个会彼此追逐形成一个圈。这个例子可以在 SeekFleeTest2.as 中找到，如图
2-5 所示：<br />
package<br />
{<br />
&nbsp;import com.foed.SteeredVehicle;<br />
&nbsp;import com.foed.Vector2D;<br />
&nbsp;import com.foed.Vehicle;<br />
&nbsp;<br />
&nbsp;import flash.display.Sprite;<br />
&nbsp;import flash.display.StageAlign;<br />
&nbsp;import flash.display.StageScaleMode;<br />
&nbsp;import flash.events.Event;</P>
<p>&nbsp;public class SeekFleeTest2 extends
Sprite<br />
&nbsp;{<br />
&nbsp;&nbsp;private var
_vehicleA:SteeredVehicle;<br />
&nbsp;&nbsp;private var
_vehicleB:SteeredVehicle;<br />
&nbsp;&nbsp;private var
_vehicleC:SteeredVehicle;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function
SeekFleeTest2()<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;stage.align =
StageAlign.TOP_LEFT;<br />
&nbsp;&nbsp;&nbsp;stage.scaleMode
= StageScaleMode.NO_SCALE;<br />
&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;_vehicleA =
new SteeredVehicle();<br />
&nbsp;&nbsp;&nbsp;_vehicleA.position
= new Vector2D(200, 200);<br />
&nbsp;&nbsp;&nbsp;_vehicleA.edgeBehavior
= Vehicle.BOUNCE;<br />
&nbsp;&nbsp;&nbsp;addChild(_vehicleA);<br />

&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;_vehicleB =
new SteeredVehicle();<br />
&nbsp;&nbsp;&nbsp;_vehicleB.position
= new Vector2D(400, 200);<br />
&nbsp;&nbsp;&nbsp;_vehicleB.edgeBehavior
= Vehicle.BOUNCE;<br />
&nbsp;&nbsp;&nbsp;addChild(_vehicleB);<br />

&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;_vehicleC =
new SteeredVehicle();<br />
&nbsp;&nbsp;&nbsp;_vehicleC.position
= new Vector2D(300, 260);<br />
&nbsp;&nbsp;&nbsp;_vehicleC.edgeBehavior
= Vehicle.BOUNCE;<br />
&nbsp;&nbsp;&nbsp;addChild(_vehicleC);<br />

&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;addEventListener(Event.ENTER_FRAME,
onEnterFrame);<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;private function
onEnterFrame(event:Event):void<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;_vehicleA.seek(_vehicleB.position);<br />

&nbsp;&nbsp;&nbsp;_vehicleA.flee(_vehicleC.position);<br />

&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;_vehicleB.seek(_vehicleC.position);<br />

&nbsp;&nbsp;&nbsp;_vehicleB.flee(_vehicleA.position);<br />

&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;_vehicleC.seek(_vehicleA.position);<br />

&nbsp;&nbsp;&nbsp;_vehicleC.flee(_vehicleB.position);<br />

&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;_vehicleA.update();<br />

&nbsp;&nbsp;&nbsp;_vehicleB.update();<br />

&nbsp;&nbsp;&nbsp;_vehicleC.update();<br />

&nbsp;&nbsp;}<br />
&nbsp;}<br />
}</P>
<p><a href="http://blog.photo.sina.com.cn/showpic.html#url=http://static14.photo.sina.com.cn/orignal/3ecb9b11t8f944168210d" TARGET="_blank"><img SRC="http://static14.photo.sina.com.cn/middle/3ecb9b11t8f944168210d&amp;690" WIDTH="495" HEIGHT="358" /></A><br />
<strong>图 2-5</STRONG>&nbsp; A 追逐 B，B追逐 C，C追逐 A</P>
<p>&nbsp;&nbsp;&nbsp;
同样，试着改变参数，搅乱他们，看看能创造出什么样的情形。当你准备好了，我们就进入到达行为。</P>
<p>&nbsp;</P>
<p><font STYLE="FonT-siZe: 24px"><strong>Arrive（到达）行为</STRONG></FONT><br />
&nbsp;&nbsp;&nbsp;
达到行为在很多方面与寻找行为基本相似。实际上，它们的算法和运作方法通常是相同的。差别就是当车子到达离目标一定距离的时候就进入到达模式，此时转为一种精确模式缓动到目标点，越接近目标速度越慢。<br />

&nbsp;&nbsp;&nbsp;
要看看为什么到达行为有时候非常重要，请运行一下前面的 SeekTest
类。将鼠标移动到远离车子的位置，然后让车子去“扑捉”鼠标。你将看到车子急速地经过目标；然后它好像意识到错了，调个头，又回来。这是个不确定的持续过程，因为车子总是以最快的速度向目标运动，即使只有几个像素它也会这样。</P>
<p><br />
到达行为通过让车子接近目标后减速解决了这个问题：<br />
public function arrive(target:Vector2D):void<br />
{<br />
&nbsp;var desiredVelocity:Vector2D =
target.subtract(_position);<br />
&nbsp;desiredVelocity.normalize();<br />
&nbsp;<br />
&nbsp;var dist:Number = _position.dist(target);<br />
&nbsp;if(dist &gt; _arrivalThreshold)<br />
&nbsp;{<br />
&nbsp;&nbsp;desiredVelocity =
desiredVelocity.multiply(_maxSpeed);<br />
&nbsp;}<br />
&nbsp;else<br />
&nbsp;{<br />
&nbsp;&nbsp;desiredVelocity =
desiredVelocity.multiply(_maxSpeed * dist /
_arrivalThreshold);<br />
&nbsp;}<br />
&nbsp;<br />
&nbsp;var force:Vector2D =
desiredVelocity.subtract(_velocity);<br />
&nbsp;_steeringForce = _steeringForce.add(force);<br />
}<br />
前两行代码和 seek
方法一样。而期望速度和最大速度相乘之前要判断到达目标的距离。如果距离大于threshold（阈值），就还像原来那么做。在退出 if
语句后，继续执行与 seek 方法相同的程序。<br />
&nbsp;&nbsp;&nbsp;
然而，如果距离小于阈值，就得做些别的事儿。我们用 _maxSpeed * dist / _arriveThreshold 代替乘
_maxSpeed。如果距离只比阈值小一点，则 dist / _arriveThreshold 会非常接近 1.0，比如
0.99。因此 desiredVelocity 会非常接近 _maxSpeed。当距离接近零时，比值会变得越来越小，从而影响期望速度
desiredVelocity 的量。因此计算出的向量也会趋近于零（假定机车只有一个行为或外力的情况下）。如图 2-6 所示。</P>
<p><a href="http://blog.photo.sina.com.cn/showpic.html#url=http://static5.photo.sina.com.cn/orignal/3ecb9b11t8f9446d89cd4" TARGET="_blank"><img SRC="http://static5.photo.sina.com.cn/middle/3ecb9b11t8f9446d89cd4&amp;690" WIDTH="349" HEIGHT="338" /></A><br />
<strong>图 2-6</STRONG> 如果距离在到达阈值（arrival
threshold）内，则缓动到目标。否则，仅用寻找</P>
<p>&nbsp;</P>
<p>当然，现在 SteeredVehicle 类需要新的阈值属性，所以把它加到类的顶部：<br />
package com.foed<br />
{<br />
&nbsp;import flash.display.Sprite;</P>
<p>&nbsp;public class SteeredVehicle extends
Vehicle<br />
&nbsp;{<br />
&nbsp;&nbsp;private var _maxForce:Number =
1;<br />
&nbsp;&nbsp;private var
_steeringForce:Vector2D;<br />
<strong>&nbsp;&nbsp;private var
_arrivalThreshold:Number = 100;</STRONG><br />
&nbsp;&nbsp;...<br />
&nbsp;}<br />
}<br />
然后我们为 arriveThreshold 添加 setter 和 getter 方法，以便能获取其值：<br />
public function set arriveThreshold(value:Number):void<br />
{<br />
&nbsp;_arrivalThreshold = value;<br />
}<br />
public function get arriveThreshold():Number<br />
{<br />
&nbsp;return _arrivalThreshold;<br />
}<br />
下面的测试类中你会看到它是怎么工作的：<br />
package<br />
{<br />
&nbsp;import com.foed.SteeredVehicle;<br />
&nbsp;import com.foed.Vector2D;<br />
&nbsp;<br />
&nbsp;import flash.display.Sprite;<br />
&nbsp;import flash.display.StageAlign;<br />
&nbsp;import flash.display.StageScaleMode;<br />
&nbsp;import flash.events.Event;</P>
<p>&nbsp;public class ArriveTest extends Sprite<br />
&nbsp;{<br />
&nbsp;&nbsp;private var
_vehicle:SteeredVehicle;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function
ArriveTest()<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;stage.align =
StageAlign.TOP_LEFT;<br />
&nbsp;&nbsp;&nbsp;stage.scaleMode
= StageScaleMode.NO_SCALE;<br />
&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;_vehicle =
new SteeredVehicle();<br />
&nbsp;&nbsp;&nbsp;addChild(_vehicle);<br />

&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;addEventListener(Event.ENTER_FRAME,
onEnterFrame);<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;private function
onEnterFrame(event:Event):void<br />
&nbsp;&nbsp;{<br />
<strong>&nbsp;&nbsp;&nbsp;_vehicle.arrive(new
Vector2D(mouseX, mouseY));</STRONG><br />
&nbsp;&nbsp;&nbsp;_vehicle.update();<br />

&nbsp;&nbsp;}<br />
&nbsp;}<br />
}<br />
这个类与 SeekTest 的唯一不同就在 onEnterFrame 中的那一行，调用 arrive 而非
seek。移动鼠标时车子开始寻找行为，一旦鼠标不动让车子接近它，它将缓动到鼠标指针刚好的位置。再移动鼠标，车子又回到寻找模式。通过修改
arriveThreshold 的值，你能看到在多么接近目标时状态会变化。<br />
&nbsp;&nbsp;&nbsp;
如果你愿意的话，可以任意加一些新车子来玩。不愿意的话呢，咱们就进入追赶行为。</P>]]></description>
            <author>FL车在臣</author>
            <category>AdvancED_AS3_Animation!</category>
            <comments>http://blog.sina.com.cn/s/blog_3ecb9b110100l5cb.html#comment</comments>
            <pubDate>Mon, 06 Sep 2010 17:43:18 +0800</pubDate>
            <guid>http://blog.sina.com.cn/s/blog_3ecb9b110100l5cb.html</guid>
        </item>
        <item>
            <title>第二章 转向行为&amp;#8544;[FL车在臣]</title>
            <link>http://blog.sina.com.cn/s/blog_3ecb9b110100kdvd.html</link>
            <description><![CDATA[<p><font STYLE="FonT-siZe: 24px"><strong>第二章&nbsp;
转向行为</STRONG></FONT></P>
<p><strong>&nbsp;&nbsp;&nbsp;
转向行为（steering
behaviors）</STRONG>这个名词是指一系列让物体运动看似智能的算法。这些行为隶属于<strong>人工智能（artificial
intelligence）</STRONG>和<strong>人工生命（artificial
life）</STRONG>，它们能让角色像是有自己的生命一样——可以决定自己何时、何地以及如何运动，以便可以到达目标、追逐敌人、逃离追击、躲避障碍物，以及寻路等等。</P>
<p>&nbsp;&nbsp;&nbsp; 这个名词是
Craig Reynolds 在 1999 年的游戏开发者大会上在名为“Steering Behaviors for
Autonomous
Characters”的论文中提出的。它描述了一系列算法用于创建一个军队系统，应用在角色游戏和模拟领域。军队通常会影响角色的运动带来角色需要和想要的东西。这其中也囊括了不同的动力的分类，如集群（flocking）行为。事实上，Reynolds
的模拟鸟群聚集的程序“boids”，已经让他广为人知了（见图 2-1）。<br />
<a HREF="http://blog.photo.sina.com.cn/showpic.html#url=http://static12.photo.sina.com.cn/orignal/3ecb9b11t8c46bc4bb01b" TARGET="_blank"><img SRC="http://static12.photo.sina.com.cn/middle/3ecb9b11t8c46bc4bb01b&amp;690" />
</A><br />
<strong>图 2-1</STRONG>&nbsp; Craig Reynolds 的
“boids”</P>
<p><br />
&nbsp;&nbsp;&nbsp;
现在，你可以在<a HREF="http://www.red3d.com/cwr/steer/">http://www.red3d.com/cwr/steer/</A>
中找到 Reynolds 的网站，快速的搜索一下这个标题，你会找到很多下载地址。这个网站虽然提到了一个开源的 C++
版本的行为控制框架：OpenSteer (<a HREF="http://opensteer.sourceforge.net/">http://opensteer.sourceforge.net/</A>)
但是 Reynolds
并没有非常深入地实现这套算法。不过，他在网页中描述的这个系统已经做了很多的基础工作，这也是人工智能运动引擎建立的基石。本章将跟随这些脚步，创建一个基于
ActionScript 3.0 版本的引擎包括网站中描述最多的行为。<br />
&nbsp;&nbsp;&nbsp;
在本章开始之前，要了解本章的目标是介绍行为，了解行为，并展示一个实现每种行为的框架。一些更为复杂的行为可以有许多不同的解决方法，伴随大量不同级别的复杂度。这里并不需要一个“标准”或“正确”
方法处理所有这些行为，并且我给的实现方法都是尽量简单的。换句话讲，考虑到这是一个引导和起点。对于产品级的应用来说，目前这些代码还需要大量改进，就像为你的应用量身定做。</P>
<p><br />
<font STYLE="FonT-siZe: 22px"><strong>行为</STRONG></FONT><br />
&nbsp;&nbsp;&nbsp;
首先，让我们看看基本的行为有哪些——每一个是做什么的以及用于什么地方：<br />
&#9632; <em>寻找（seek)</EM>：角色试图移动到某个指定点。该点可以是一个固定点或是移动目标，例如另一个角色。<br />
&#9632;
<em>躲避（flee）</EM>：和寻找行为完全相反。角色尽可能向避开指定点的方向移动。同样，这个点即可是固定的也可是运动的。<br />

&#9632; <em>到达（arrive）</EM>:
和寻找行为相同，只是角色足够接近目标点时速度会降下来，就像缓动运动最终停在目标点一样。<br />
&#9632;
<em>追赶（pursue）</EM>：寻找行为的改进版，加入了对目标的速度的计算。不只寻找目标当前所在的点，而要预先判断目标要去哪里并向此点移动。显然，这个行为只应用在移动目标，因为固定点是没有速度的。<br />

&#9632; <em>逃离（evade）</EM>：与追赶完全相反。角色预先根据对方的速度判断到达的点，然后尽可能地远离该点。<br />
&#9632; <em>漫游（wander）</EM>：随机但又平滑真实的移动。<br />
&#9632; <em>物体躲避（object avoidance）</EM>：角色可以察觉在其运动路径上的物体并转向躲避它们。<br />
&#9632; <em>路径跟随（path
following）</EM>：角色尽量保持在指定路径上，但这是在持续的物理和其它行为干扰下实现的。<br />
除了这些行为以外，还有复杂的复合行为，如我们熟知的<strong>集群（flocking）</STRONG>模拟相似角色的群组行为，基本上是应用其它三种简单行为创造出来的：<br />

&#9632; <span STYLE="FonT-sTYLe: italic">分离（separation）</SPAN>：集群中的每个角色试图与他的邻居保持一定距离。<br />

&#9632; <span STYLE="FonT-sTYLe: italic">凝聚（cohesion）</SPAN>：每个角色试图不要离他的邻居太远。<br />
&#9632; <span STYLE="FonT-sTYLe: italic">队列（alignment）</SPAN>：每个角色试图与他的邻居保持相同的转向。<br />
&nbsp;&nbsp;&nbsp;
虽然这三个行为都相当简单，但是当把它们加以组合，则会产生一些惊人的动态效果，真正让你感觉看到的是一群鸟或者其它一群生物。调整三个子行为参数可以改变群组的性质，导致某些群落经常脱离队伍，或是紧密交织的一个群落，或是一列群体追随一个头领，或是其他的变化。<br />

&nbsp;&nbsp;&nbsp;
在让物体以行为方式运动之前，我们先要找出一个让它们运动的方法。</P>
<p>&nbsp;</P>
<p><font STYLE="FonT-siZe: 22px"><strong>Vector2D
类<br /></STRONG></FONT>&nbsp;&nbsp;&nbsp;
转向行为被多种不同的编程语言实现过（ActionScript
大概也有一两次）。最初是用向量（在绝大多数实现中你将发现）进行描述的。（如果你想学习更多有关向量的知识，可以参考 Foundation
ActionScript 3.0 Animation: <em>Making Things
Move!</EM>，在这里有更多细节。）<br />
&nbsp;&nbsp;&nbsp;
简而言之，<strong>向量（vector）</STRONG>描述了一个有方向和量的东西。例如，一个运动物体的向量包括运动的路径（方向）以及它的速度（量）。因此速度向量（velocity）是最适合表示这种向量的了。加速度（Acceleration）——如何改变物体速度向量的力——也包括外力的量和方向（另一种向量）。向量也能很好表达两个物体的相对位置，量就是它们间的距离而方向则是它们间的角度。<br />

&nbsp;&nbsp;&nbsp;
此外，你可以使用向量来描述角色的朝向。这个例子，没有任何量，只有方向，所以你可以设置量为
1.0。这种向量称作<strong>单位向量（unit
vector）</STRONG>，实际上它只有一个单位长度，这样让它的数学运算表现更好。<br />
&nbsp;&nbsp;&nbsp;
向量的所有这些特性都对转向行为非常有用，因为会被大量用于速度向量，军团方向，物体间距离以及物体朝向中。所以创建一个
ActionScript 3.0 的向量类对转向行为系统将是非常有用。我作为一个好人，我要为你们创建它。当然，我后来发现 Flash
CS4 自身已经有了 Vector3D
类，因此你最终可能要超越它。但是我发现额外的这个维度让计算变得有些复杂，所以我决定在本章还是用我自己轻量级的 Vector2D
类。我不会太过深入地解释它，它包含了最为有用的方法，你可以在其它语言相似的类中找到这些方法，尤其是那些用于转向行为的方法。我将在这里把它全部呈现出来，让大家更好参考。当我们使用这个类中的方法时，我会解释一些细节。大家可以在本书的下载页面
<a HREF="http://www.friendsofed.com/">www.friendsofed.com</A> 中找到
Vector2D.as 文件。<br />
package com.foed<br />
{<br />
&nbsp;import flash.display.Graphics;<br />
&nbsp;<br />
&nbsp;<br />
&nbsp;public class Vector2D<br />
&nbsp;{<br />
&nbsp;&nbsp;private var _x:Number;<br />
&nbsp;&nbsp;private var _y:Number;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function
Vector2D(x:Number = 0, y:Number = 0)<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;_x = x;<br />
&nbsp;&nbsp;&nbsp;_y = y;<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function
draw(graphics:Graphics, color:uint = 0):void<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;graphics.lineStyle(0,
color);<br />
&nbsp;&nbsp;&nbsp;graphics.moveTo(0,
0);<br />
&nbsp;&nbsp;&nbsp;graphics.lineTo(_x,
_y);<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function
clone():Vector2D<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;return new
Vector2D(x, y);<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function
zero():Vector2D<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;_x = 0;<br />
&nbsp;&nbsp;&nbsp;_y = 0;<br />
&nbsp;&nbsp;&nbsp;return
this;<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function
isZero():Boolean<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;return _x ==
0 &amp;&amp; _y == 0;<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function set
length(value:Number):void<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;var a:Number
= angle;<br />
&nbsp;&nbsp;&nbsp;_x =
Math.cos(a) * value;<br />
&nbsp;&nbsp;&nbsp;_y =
Math.sin(a) * value;<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;public function get
length():Number<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;return
Math.sqrt(lengthSQ);<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function get
lengthSQ():Number<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;return _x *
_x + _y * _y;<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function set
angle(value:Number):void<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;var
len:Number = length;<br />
&nbsp;&nbsp;&nbsp;_x =
Math.cos(value) * len;<br />
&nbsp;&nbsp;&nbsp;_y =
Math.sin(value) * len;<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;public function get
angle():Number<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;return
Math.atan2(_y, _x);<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function
normalize():Vector2D<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;if(length ==
0)<br />
&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;_x
= 1;<br />
&nbsp;&nbsp;&nbsp;&nbsp;return
this;<br />
&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;var
len:Number = length;<br />
&nbsp;&nbsp;&nbsp;_x /=
len;<br />
&nbsp;&nbsp;&nbsp;_y /=
len;<br />
&nbsp;&nbsp;&nbsp;return
this;<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function
truncate(max:Number):Vector2D<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;length =
Math.min(max, length);<br />
&nbsp;&nbsp;&nbsp;return
this;<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function
reverse():Vector2D<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;_x =
-_x;<br />
&nbsp;&nbsp;&nbsp;_y =
-_y;<br />
&nbsp;&nbsp;&nbsp;return
this;<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function
isNormalized():Boolean<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;return length
== 1.0;<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function
dotProd(v2:Vector2D):Number<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;return _x *
v2.x + _y * v2.y;<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function
crossProd(v2:Vector2D):Number<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;return _x *
v2.y - _y * v2.x;<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public static function
angleBetween(v1:Vector2D, v2:Vector2D):Number<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;if(!v1.isNormalized())
v1 = v1.clone().normalize();<br />
&nbsp;&nbsp;&nbsp;if(!v2.isNormalized())
v2 = v2.clone().normalize();<br />
&nbsp;&nbsp;&nbsp;return
Math.acos(v1.dotProd(v2));<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function
sign(v2:Vector2D):int<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;return
perp.dotProd(v2) &lt; 0 ? -1 : 1;<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function get
perp():Vector2D<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;return new
Vector2D(-y, x);<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function
dist(v2:Vector2D):Number<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;return
Math.sqrt(distSQ(v2));<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function
distSQ(v2:Vector2D):Number<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;var dx:Number
= v2.x - x;<br />
&nbsp;&nbsp;&nbsp;var dy:Number
= v2.y - y;<br />
&nbsp;&nbsp;&nbsp;return dx *
dx + dy * dy;<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function
add(v2:Vector2D):Vector2D<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;return new
Vector2D(_x + v2.x, _y + v2.y);<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function
subtract(v2:Vector2D):Vector2D<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;return new
Vector2D(_x - v2.x, _y - v2.y);<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function
multiply(value:Number):Vector2D<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;return new
Vector2D(_x * value, _y * value);<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function
divide(value:Number):Vector2D<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;return new
Vector2D(_x / value, _y / value);<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function
equals(v2:Vector2D):Boolean<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;return _x ==
v2.x &amp;&amp; _y == v2.y;<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function set
x(value:Number):void<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;_x =
value;<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;public function get
x():Number<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;return
_x;<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function set
y(value:Number):void<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;_y =
value;<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;public function get
y():Number<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;return
_y;<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function
toString():String<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;return
"[Vector2D (x:" + _x + ", y:" + _y + ")]";<br />
&nbsp;&nbsp;}<br />
&nbsp;}<br />
}<br />
C 和 C++ 语言都有非常优雅的特性叫做<strong>操作符重载（operator
overloading）</STRONG>允许你映射一个系统内置的操作符，如 + 或 -，做为类的方法。这样的话，我们可以用
vectorC = vectorA + vectorB，代替 vectorC =
vectorA.add(vectorB)。<br />
&nbsp;&nbsp;&nbsp;
虽然操作符重载让类更接近本地语言并且变得更容易理解，但是 ActionScript
目前还不支持这样做，所以我们只能用单词方法来实现。<br />
&nbsp;&nbsp;&nbsp;
设计这样一个类的最大挑战是决定某些方法应该如何工作——在本例中，比如
truncate（截断）、normalize（规范化）、reverse（倒置）、add（加法）、subtract（减法）、multiply（乘法）以及
divide（除法）方法。我们有两种可能的实现方式：一种方式如相加（add）可以直接改变被调对象本身的状态，也可以返回一个相加（add）结果的新对象。<br />

&nbsp;&nbsp;&nbsp; 例如，我们有一个
vectorA 等于 (3, 2) 表示它 x 值为 3，y 为 2，以及一个 vectorB 等于 (4,
5)。然后运行如下代码：<br />
&nbsp;&nbsp;&nbsp;
vectorA.add(vectorB);<br />
根据上学时的思维，vectorB 不会发生变化，但是 vectorA 应该变为 (7, 7)。<br />
另一种可能是这样的：<br />
&nbsp;&nbsp;&nbsp; vectorC =
vectorA.add(vectorB);<br />
这里 vectorA 和 vectorB 的值都保持不变 (3, 2) 和 (4, 5)，而新创建的 vectorC 应该等于 (7,
7)。<br />
那么这两种加法哪个是正确的呢？在创建这个类的时候我犹豫许久，最终我意识到很多情况下比如用对象自身位置或速度做数学运算时不需要改变对象自身的值。因此在做
add、subtract 和 divide 操作时保持对象自身属性不变。<br />
&nbsp;&nbsp;&nbsp; 然而，做
truncate、reverse 和 normalize
运算时通常意味着直接对对象做操作。所以直接改变对象的属性值比返回一个新的实例更为有用。<br />
&nbsp;&nbsp;&nbsp;
互换实现方法并不难。例如，让 vectorB 和vectorA 相加，再让 vectorA 获得相加结果，可以这样做：<br />
&nbsp;&nbsp;&nbsp; vectorA =
vectorA.add(vectorB);<br />
如果你想要做 truncate、reverse 和 normalize 运算而不改变原有的值，可以使用 clone
方法如：<br />
&nbsp;&nbsp;&nbsp; normalizedA
= vectorA.clone().normalize();<br />
这个方法创建一个 vectorA 的拷贝并对其做规范化，保持原始的 vectorA 不变。<br />
&nbsp;&nbsp;&nbsp; 在 Seb
Lee-Delisle 做本书的技术评审时指出像这样创建对象的拷贝会导致大量临时对象被创建，然后销毁。这就需要 Flash
Player
的垃圾回收机跟踪所有这些无效对象并移除它们，会引起效率问题。我之所以选择这样是为了代码清晰，但我也知道这是个可以优化的地方。<br />

&nbsp;&nbsp;&nbsp;
现在我们已经有了表示角色位置、速度以及外力的向量类，接下来需要一个简单的类表示角色。</P>]]></description>
            <author>FL车在臣</author>
            <category>AdvancED_AS3_Animation!</category>
            <comments>http://blog.sina.com.cn/s/blog_3ecb9b110100kdvd.html#comment</comments>
            <pubDate>Mon, 26 Jul 2010 17:03:33 +0800</pubDate>
            <guid>http://blog.sina.com.cn/s/blog_3ecb9b110100kdvd.html</guid>
        </item>
        <item>
            <title>[杂谈] 十条不错的编程观点</title>
            <link>http://blog.sina.com.cn/s/blog_3ecb9b110100j5eb.html</link>
            <description><![CDATA[<span STYLE="font-weight: bold;">1） The only "best practice" you
should be using all the time is "Use Your Brain".</SPAN><br />
唯一的“Best
Practice”并不是使用各种各样被前人总结过的各种设计方法、模式，框架，那些著名的方法、模式、框架只代码赞同他们的人多，并不代表他们适合你，你应该更多的去使用你的大脑，独立地思考那些方法、模式、框架出现的原因和其背后的想法和思想，那才是“best
practice”。事实上来说，那些所谓的“Best Practice”只不过是限制那些糟糕的程序员们的破坏力。<br />
<br />
<span STYLE="font-weight: bold;">2）Programmers who don't code in
their spare time for fun will never become as good as those that
do.</SPAN><br />
如果你对编程没有感到一种快乐，没有在你空闲的时候去以一种的娱乐方式去生活，无论是编程，还是运动，还是去旅游，那么你只不过是在应付你的工作，无时无刻不扎在程序堆中，这样下来，就算是你是一个非常聪明，非常有才华的人，你也不会成为一个优秀的编程员，要么只会平平凡凡，要么只会整天扎在技术中成为书呆子。当然，这个观点是有争议，热情和能力的差距也是很大的。不过我们可以从中汲取其正面的观点。<br />

<br />
<span STYLE="font-weight: bold;">3）Most comments in code are in
fact a pernicious form of code duplication.</SPAN><br />
注释应该是注释Why，而不是How和What，参看《惹恼程序员的十件事》，代码告诉你How，而注释应该告诉你Why。但大多数的程序并不知道什么是好的注释，那些注释其实和code是重复的，毫无意义。<br />

<br />
<span STYLE="font-weight: bold;">4）XML is highly
overrated.</SPAN><br />
XML 可能被高估了。XML对于Web上的应用是不错的，但是我们把其用到了各种地方，好像没有XML，我们都不会编程了。<br />
<br />
<span STYLE="font-weight: bold;">5）Not all programmers are created
equal.</SPAN><br />
这是那些junior经理或是流程爱犯的错，他们总是认为，DeveloperA ==
DeveloperB，只要他们的title一样，他们以为他们的能力、工作速度、解决问题的方法，掌握的技能等等都是一样的。呵呵。更扯的是，在某些时候，就算是最差的程序员，他们也会认为其比别人强十倍，这就是现代的SB管理。<br />

<br />
<span STYLE="font-weight: bold;">6）"Googling it" is
okay!</SPAN><br />
Google
只会给你知识，并不会教给你技能。那里只有“鱼”，没有“渔”，过度的使用Google，只会让你越来越离不开他，你越来越去要去立马告诉你答案，而你越来越不会自己去思考，自己去探索，去专研。如果KFC快餐是垃圾食品对我们的身体没有好处，那么使用Google也一种快餐文化对我们的智力发展大大的没有好处。<br />

<br />
<span STYLE="font-weight: bold;">7）If you only know one language,
no matter how well you know it, you're not a great
programmer.</SPAN><br />
如果你只懂一种语言，准确的说，如果你只懂一类语类，如：Java和C#，PHP和Perl，那么，你将会被局限起来，只有了解了各种各样的语言，了解了不同语言的不同方法
，你才会有比较，只有了比较，你才会明白各种语言的长处和短处，才会让你有更为成熟的观点，而且不整天和别的程序在网上斗嘴争论是Windows好还是
Unix好，是C好还是C++好，有这点工夫能干好多事了。世界因为不同而精彩，只知道事物的一面是有害的。<br />
<br />
<span STYLE="font-weight: bold;">8）Your job is to put yourself out
of work.</SPAN><br />
你的工作不是保守，那种教会徒弟，饿死师父的想法，不但是相当短浅的，而且还是相当脑残的。因为，在计算机世界里，你掌握的老技术越多，你就越没用，因为技术更新的太快。你对工作越保守，这个工作就越来越离不开你，你就越不越不能抽身去学新的东西，你也就越来越OUT了。记住：If
you can't be replaced then you can't be promoted!<br />
<br />
<span STYLE="font-weight: bold;">9）Design patterns are hurting good
design more than they're helping it.</SPAN><br />
很多程序员把设计模式奉为天神，他们过度的追求设计模式以至都都忘了需求是什么，结果整个系统设计被设计模式搞得乱七八糟，我们叫这种编程为“设计模式驱动编程”，正如第一点所说，如果你不懂得用自己的大脑思考的话，知其然，不知所以然的话，那么你不但得不到其好处，反而受其所累。<br />

<br STYLE="font-weight: bold;" />
<span STYLE="font-weight: bold;">10）Unit Testing won't help you
write good code.</SPAN><br />
准确地说，我们可以认为这是Test-Driven开发，其实，这种开发就是先写unit test
case，这样的开发方式的主要目的是，为了防止你不会因为一个改动而引入Bug，但这并不会让你能写出更好的代码。这只会让你写出不会出错的代码。同第一点，这样的方法，只不过是防止糟糕的程序员，而并不是让程序员或代码质量更有长进。反而，通过Unit
Test会为程序员的为自己代码做辩解的一种托辞。<br />]]></description>
            <author>FL车在臣</author>
            <category>杂谈系列</category>
            <comments>http://blog.sina.com.cn/s/blog_3ecb9b110100j5eb.html#comment</comments>
            <pubDate>Wed, 09 Jun 2010 17:31:57 +0800</pubDate>
            <guid>http://blog.sina.com.cn/s/blog_3ecb9b110100j5eb.html</guid>
        </item>
        <item>
            <title>[AS3 狂想曲] Flash 动态加载字体 [FL车在臣]</title>
            <link>http://blog.sina.com.cn/s/blog_3ecb9b110100izch.html</link>
            <description><![CDATA[<div><font COLOR="#2F3699"><b>演示文件源码下载：</B></FONT><a HREF="http://kerryas.googlecode.com/files/demo_EmbedFont.rar" TARGET="_blank">http://kerryas.googlecode.com/files/demo_EmbedFont.rar</A></DIV>
<div><br /></DIV>
<div>1、在上面这个 demo 压缩包中的 font 目录下，大家可以找到 AlphaFitness.ttf
字体文件，首先安装该字体。</DIV>
<div><br /></DIV>
<div>2、重新启动 Flash，新建一个 Flash 文件（在 demo 中位于
assets/game_font.fla），右键单击库面板，选择新建字体（New Font）。<br />
-- 如果使用 Flash CS4 IDE，我们还可以使用元数据标签（MetaData）嵌入字体，如在第一帧写入代码：<br />
[Embed(source="AlphaFitness.ttf", fontName="AlphaFitnessFont",
mimeType="application/x-font")]<br />
var font:Class;<br /></DIV>
<div><a HREF="http://blog.photo.sina.com.cn/showpic.html#url=http://static8.photo.sina.com.cn/orignal/3ecb9b11t8819ec247237" TARGET="_blank"><img SRC="http://static8.photo.sina.com.cn/middle/3ecb9b11t8819ec247237&amp;690" HEIGHT="690" WIDTH="410" /></A><br />
<div><br /></DIV>
<div>3、选择要使用的字体，这里我们用 AlphaFitness 字体，导出类名为 AlphaFitnessFont。</DIV>
<a HREF="http://blog.photo.sina.com.cn/showpic.html#url=http://static16.photo.sina.com.cn/orignal/3ecb9b11t8819ec7ffd0f" TARGET="_blank"><img SRC="http://static16.photo.sina.com.cn/middle/3ecb9b11t8819ec7ffd0f&amp;690" HEIGHT="451" WIDTH="424" /></A><br />
<div><br /></DIV>
<div>4. 设置好后确认，导出 SWF 文件（本 demo 中为 assets/game_font.swf）。</DIV>
<div><br /></DIV>
<div>5. 主程序，首先使用 Loader 加载该嵌入字体的 SWF 文件，通过 getDefinitionByName
获得导出类 "AlphaFitnessFont"，使用 Font.registerFont 注册该字体，再用 new
将这个类实例化成一个 Font 类对象并在 TextFormat 中使用这个字体，示例如下：</DIV>
</DIV>
<div>package&nbsp; {<br />
&nbsp;&nbsp;&nbsp; import
flash.display.Loader;<br />
&nbsp;&nbsp;&nbsp; import
flash.display.Sprite;<br />
&nbsp;&nbsp;&nbsp; import
flash.events.Event;<br />
&nbsp;&nbsp;&nbsp; import
flash.net.URLRequest;<br />
&nbsp;&nbsp;&nbsp; import
flash.system.LoaderContext;<br />
&nbsp;&nbsp;&nbsp; import
flash.text.Font;<br />
&nbsp;&nbsp;&nbsp; import
flash.text.TextField;<br />
&nbsp;&nbsp;&nbsp; import
flash.text.TextFieldAutoSize;<br />
&nbsp;&nbsp;&nbsp; import
flash.text.TextFormat;<br />
&nbsp;&nbsp;&nbsp; import
flash.utils.getDefinitionByName;<br />
&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp; public class
Main extends Sprite {<br />
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; private var
textField:TextField;<br />
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; private var
fontLoader:Loader;<br />
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; public
function Main() {<br />
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; textField =
new TextField();<br />
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;
textField.selectable = false;<br />
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;
textField.textColor = 0xFF0000;<br />
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;
textField.autoSize = TextFieldAutoSize.LEFT;<br />
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;
addChild(textField);<br />
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; fontLoader =
new Loader();<br />
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;
fontLoader.load(new URLRequest("./assets/game_font.swf"), new
LoaderContext(false, loaderInfo.applicationDomain));<br />
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;
fontLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,
loadFontCompleteHandler);<br />
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; // 读取字体完成，通过
TextFormat 应用到 TextField 中的文字<br />
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; private
function loadFontCompleteHandler(e:Event):void {<br />
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;
fontLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE,
loadFontCompleteHandler);<br />
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; var
alphaFitnessFontClazz:Class =
getDefinitionByName("AlphaFitnessFont") as Class;<br />
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;
Font.registerFont(alphaFitnessFontClazz);<br />
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; var
alphaFitnessFont:Font = new alphaFitnessFontClazz() as Font;<br />
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; var
textFormat:TextFormat = new TextFormat(alphaFitnessFont.fontName,
60, null, true);<br />
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;
textField.defaultTextFormat = textFormat;<br />
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;
textField.embedFonts = true;<br />
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;
textField.text = "Hello, Zynga!!!";<br />
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp; }<br />
}<br /></DIV>]]></description>
            <author>FL车在臣</author>
            <category>AS3 狂想曲</category>
            <comments>http://blog.sina.com.cn/s/blog_3ecb9b110100izch.html#comment</comments>
            <pubDate>Thu, 03 Jun 2010 13:58:56 +0800</pubDate>
            <guid>http://blog.sina.com.cn/s/blog_3ecb9b110100izch.html</guid>
        </item>
        <item>
            <title>[杂谈] Zynga 中国招聘职位及要求 [FL车在臣]</title>
            <link>http://blog.sina.com.cn/s/blog_3ecb9b110100ixp2.html</link>
            <description><![CDATA[<a HREF="http://blog.photo.sina.com.cn/showpic.html#url=http://s16.sinaimg.cn/orignal/3ecb9b11t87ef035f1f9f" TARGET="_blank"><img SRC="http://s16.sinaimg.cn/bmiddle/3ecb9b11t87ef035f1f9f&amp;690" STYLE="margin: 0pt auto; display: block;" HEIGHT="63" WIDTH="195" /></A>我们是Zynga中国的创始成员，我们周围有很多很好的朋友们可以帮助我们快速地成长。已经熟悉的朋友可以更快地融入到我们的文化里，同时，加入Zynga
中国对我们的朋友们也是一个非常好的机会。<br />
<br />
* 要求最好会英文，哪怕只是基础；<br />
* 简历要用英文。<br />
<div STYLE="margin: 1ex;">
<div>
<p ALIGN="center"><font FACE="Times New Roman" SIZE="5"><b>Zynga
China- Open Positions - Technical</B></FONT></P>
<p><font FACE="Times New Roman" SIZE="3">Zynga is the #1 social
gaming company in the world, and one of the fastest growing
Internet companies in history.&nbsp; At Zynga, our
mission is to connect people through our games.&nbsp;
<a NAME="0.1__Toc261894845"></A>At Zynga, you will find smart,
creative people who are passionate about taking on new challenges.
Whether you are a developer, designer, or a customer service
manager, there’s an opportunity here for you to level up and be
your own CEO.</FONT></P>
<p><font FACE="Times New Roman" SIZE="3">These positions are for
our office in Beijing, we are looking for the best and brightest
candidates to help up build a stellar team!</FONT></P>
<p><font FACE="Times New Roman" SIZE="3">For more information,
please visit our website:</FONT> <a HREF="http://www.zynga.com/" TARGET="_blank"><font COLOR="#0000FF" FACE="Times New Roman" SIZE="3"><u>http://www.zynga.com</U></FONT></A><font FACE="Times New Roman" SIZE="3">.</FONT></P>
<p><font FACE="Times New Roman" SIZE="3">We have the following
technical positions open</FONT></P>
<ul TYPE="disc">
<li><font FACE="Times New Roman" SIZE="3">Chief Technology
Officer</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Software
Engineer</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Software Engineer &ndash;
Flash</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Software Engineer &ndash;
PHP</FONT></LI>
</UL>
<p>&nbsp;<br /></P>
<p><a NAME="0.1__Toc261894846"></A><font COLOR="#4F81BD" FACE="Cambria" SIZE="4"><b>Chief Technology
Officer</B></FONT><font FACE="Times New Roman" SIZE="3">&nbsp;<br />
&nbsp;&nbsp;<br />
The Chief Technology Officer’s role is to assure the successful
execution of the company’s business mission through development and
deployment of Zynga’s products in Asia and
globally.&nbsp;<br />
&nbsp;&nbsp;<br />
We are committed to&nbsp;developing high quality casual
and multi player games!&nbsp; Come join us...we're
having a ball!&nbsp;<br />
&nbsp;&nbsp;<br />
<b>Responsibilities:</B>&nbsp;<br />
The CTO will be instrumental in helping to scale a very dynamic and
growing organization in China.&nbsp; This person should
have deep technology knowledge and be able to evaluate and identify
appropriate technology platforms for the delivery of Zynga’s
products.&nbsp;&nbsp;&nbsp;<br />

&nbsp;&nbsp;<br />
The CTO should be able to make technological assessments and
evaluations on key points of redundancy across systems and human
capital planning.&nbsp;<br />
&nbsp;&nbsp;<br />
<b>Required Skills:</B></FONT></P>
<ul TYPE="disc">
<li><font FACE="Times New Roman" SIZE="3">7 years experience
building massively scalable applications</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Substantial experience in
the consumer web or games space</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Strong aptitude for
determining the optimal way to use cutting edge technology in our
market place</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Supervise recruitment,
training, retention, and organization of all engineering staff in
accordance with the company hiring process, personnel policies, and
budget requirements</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Build and manage a top
caliber development team and oversee the development
&amp; project management with some of our top game
titles in the studio</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Collaborate with the
executive team to assess and recommend technologies and support
company organizational needs.</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Deep technology
understanding of LAMP, Flash, Unix, MySQL, Java &amp;
Smartfox</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">We are looking for an
enthusiastic, performance-driven self-starter and team
player</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Previous start-up
experience is a strong plus</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">BA/BS degree &ndash;
CS/EE/Engineering degree preferred</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Fluent in spoken and
written English</FONT></LI>
</UL>
&nbsp;<br />
<p><font COLOR="#4F81BD" FACE="Cambria" SIZE="4"><b>Software
Engineer</B></FONT></P>
<p><font FACE="Times New Roman" SIZE="3">Responsibilities:</FONT></P>
<p><font FACE="Times New Roman" SIZE="3">The best candidates will
have solid experience developing web applications utilizing Web 2.0
technologies. Social platforms and scaling experience is a huge
plus. You will be joining a team that is committed to working on
high quality code in a C/C++/Flash environment.</FONT></P>
<p><font FACE="Times New Roman" SIZE="3">This candidate will be
addressing critical issues on some of our biggest game titles,
which have several million users across multiple social networks.
You must be able to write coherent, organized code and be
comfortable working on a complicated code-base with high levels of
abstraction.</FONT></P>
<p><font FACE="Times New Roman" SIZE="3">Required
Skills:</FONT></P>
<ul TYPE="disc">
<li><font FACE="Times New Roman" SIZE="3">Minimum: Bachelors Degree
in Computer Science or equivalent</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">4+ years software
development experience</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Multiple and current
C/C++/Flash projects</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Passion for software
development and OO Design</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Familiarity with all of
the following: Linux, Apache, MySQL</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Excellent teamwork
skills, flexibility, and ability to handle multiple
tasks</FONT></LI>
</UL>
<p><font FACE="Times New Roman" SIZE="3">Nice to Have:</FONT></P>
<ul TYPE="disc">
<li><font FACE="Times New Roman" SIZE="3">Experience with Mixi
PC</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Mobile development
experience</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Strong social platforms
experience</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Comfortable working with
huge data sets and massively high concurrent-user load</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Experience with memchache
a plus</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Experience with sharding
and/or sharded databases a plus</FONT></LI>
</UL>
&nbsp;<br />
<p><a NAME="0.1__Toc261894848"></A><font COLOR="#4F81BD" FACE="Cambria" SIZE="4"><b>Software Engineer - PHP</B></FONT><font FACE="Times New Roman" SIZE="3">&nbsp;<br />
&nbsp;&nbsp;<br />
Zynga is looking for a commando team of strong&nbsp;Web
Developers to join their growing team! You'll be responsible for
owning the development and architecture of our up-and-coming games.
Are you ready to put your ideas into our games that will be viewed
instantly by millions?&nbsp;<br />
&nbsp;&nbsp;<br />
We are committed to developing high quality casual and multi player
games!&nbsp; Come join us ... we're having a
ball!&nbsp;&nbsp;<br />
&nbsp;&nbsp;<br />
<b>Responsibilities</B>&nbsp;<br />
The best candidates will have solid experience developing web
applications utilizing Web 2.0 technologies. You will be joining a
team who's committed to working on high quality code in a LAMP
(PHP) environment.&nbsp;<br />
&nbsp;<br />
You must have experience with database-driven web technologies to
work on high-volume, high-availability, large-scale lamp
system.&nbsp;<br />
&nbsp;&nbsp;<br />
This candidate will be instrumental for designing features and
addressing critical issues on some of our biggest game titles,
which have several million users across multiple social networks.
You must be able to write coherent, organized code and be
comfortable working on a complicated code-base with high levels of
abstraction.&nbsp;<br />
&nbsp;&nbsp;<br />
<b>Required Skills</B></FONT></P>
<ul TYPE="disc">
<li><font FACE="Times New Roman" SIZE="3">BA&nbsp;in
Computer Science or equivalent</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">2-6 years software
development experience</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">1 year with
PHP</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Passion for software
development and OO Design</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Familiarity a plus in one
or more of the following: Linux, Apache, MySQL</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Excellent teamwork
skills, flexibility, and ability to handle multiple
tasks</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Experience with version
control systems such as Subversion or CVS</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Social network platform
experience</FONT></LI>
</UL>
<p><font FACE="Times New Roman" SIZE="3"><b>Nice to
Have:</B></FONT></P>
<ul TYPE="disc">
<li><font FACE="Times New Roman" SIZE="3">Strong social network
platform experience</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Comfortable working with
huge data sets and massively high concurrent-user load</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Experience with memchache
a plus</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Experience with sharding
and/or sharded databases a plus</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Fluent in spoken and
written English</FONT></LI>
</UL>
&nbsp;<br />
<p><a NAME="0.1__Toc261894850"></A><font COLOR="#4F81BD" FACE="Cambria" SIZE="4"><b>Software Engineer -
Flash</B></FONT><font FACE="Times New Roman" SIZE="3"><b>&nbsp;<br />
&nbsp;</B>&nbsp;<br />
Zynga is looking for all-star Flash Developers to become part of
their talented team of engineers! Our Flash Developers get to build
viral, fun social games that are viewed by
millions!&nbsp;<br />
&nbsp;&nbsp;<br />
We are committed to developing high quality casual and multi player
games, come join us ... we're having a
ball!&nbsp;&nbsp;<br />
&nbsp;<b>&nbsp;<br />
Responsibilities:</B></FONT></P>
<ul TYPE="disc">
<li><font FACE="Times New Roman" SIZE="3">Build great, flash-based
multi-player games</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Passion
for&nbsp;building viral consumer products</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Work in a dynamic,
fast-paced environment&nbsp;</FONT></LI>
</UL>
<p><font FACE="Times New Roman" SIZE="3"><b>Required
Skills:</B></FONT></P>
<ul TYPE="disc">
<li><font FACE="Times New Roman" SIZE="3">B.S. in Computer Science,
or equivalent experience.</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">3 years of solid software
development experience.</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Expertise in Flash
Development: Actionscript, CPU/Memory optimization,
JavaScript/Flash bridging, Cross-browser compatibility.</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Extensive design and game
development experience.</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Strong knowledge of
software development lifecycle.</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Strong analytical skills
and ability to assist other team members in problem
solving.</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Please include examples
of your work when applying!&nbsp;</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Fluent in spoken and
written English</FONT></LI>
</UL>
</DIV>
</DIV>
<div STYLE="text-align: center;" ALIGN="center">
<hr ALIGN="center" SIZE="2" WIDTH="100%" /></DIV>
<div STYLE="text-align: center;"><font FACE="Times New Roman" SIZE="5"><b>Zynga China- Open Positions - HR</B></FONT></DIV>
<p><font FACE="Times New Roman" SIZE="3">Zynga is the #1 social
gaming company in the world, and one of the fastest growing
Internet companies in history.&nbsp; At Zynga, our
mission is to connect people through our games.&nbsp;
<a NAME="0.2__Toc261894845"></A>At Zynga, you will find smart,
creative people who are passionate about taking on new challenges.
Whether you are a developer, designer, or a customer service
manager, there’s an opportunity here for you to level up and be
your own CEO.</FONT></P>
<p><font FACE="Times New Roman" SIZE="3">These positions are for
our office in Beijing, we are looking for the best and brightest
candidates to help up build a stellar team!</FONT></P>
<p><font FACE="Times New Roman" SIZE="3">For more information,
please visit our website:</FONT> <a HREF="http://www.zynga.com/" TARGET="_blank"><font COLOR="#0000FF" FACE="Times New Roman" SIZE="3"><u>http://www.zynga.com</U></FONT></A><font FACE="Times New Roman" SIZE="3">.</FONT></P>
<p><font FACE="Times New Roman" SIZE="3">We have the following HR
positions open</FONT></P>
<ul TYPE="disc">
<li><font FACE="Times New Roman" SIZE="3">Technical
Recruiter</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">HR Manager</FONT></LI>
</UL>
<p>&nbsp;<br /></P>
<p><font COLOR="#4F81BD" FACE="Cambria" SIZE="4"><b>Technical
Recruiter</B></FONT><font FACE="Times New Roman" SIZE="3">&nbsp;<br />
&nbsp;<br />
Zynga is looking for a Technical Recruiter to help us grow our
China office! &nbsp;&nbsp;The ideal
candidate has strong research skills and ability to attract passive
talent.&nbsp;&nbsp;</FONT> <font COLOR="#333333" FACE="Times New Roman" SIZE="3">Dealing with some of the
largest applications in the world, we both demand and are
privileged to hold a high technical bar.&nbsp; We are
growing quickly, and require demonstrated experience working on a
fast paced technical recruiting team.</FONT><font COLOR="#333333" FACE="Arial" SIZE="1">&nbsp;<br />
&nbsp;</FONT><font FACE="Times New Roman" SIZE="3">&nbsp;<br />
We are committed to developing high quality casual and multi player
games!&nbsp; Come join us ... we're having a
ball!&nbsp;&nbsp;<br />
&nbsp;&nbsp;<br />
<b>Responsibilities:</B></FONT></P>
<ul TYPE="disc">
<li><font FACE="Times New Roman" SIZE="3">Identify, attract, and
screen candidates for engineering and product teams</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Finding creative and
effective resources to source viable candidates (blogs, user-groups
and beyond)</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Schedule&nbsp; phone screens and on site interviews
with the leadership team</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Negotiate salaries and
create offer proposals</FONT></LI>
</UL>
<div STYLE="margin-left: 2em">
<p><font FACE="Times New Roman" SIZE="3"><b>Required
Skills:</B></FONT></P>
</DIV>
<ul TYPE="disc">
<li><font FACE="Times New Roman" SIZE="3">4 years of technical
sourcing and candidate development</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Strong research
skills</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Solid understanding of
consumer web and gaming industry</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Proven track-record of
attracting top engineering talent</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Fluent in Boolean logic
search techniques and other passive candidate
techniques</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Self directed</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Ability to
prioritize</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Broad knowledge of
programming languages, web technologies, software development
process and emerging technologies</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Ability to maintain
strong relationships with recruiters and candidates</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Fluent in spoken and
written English</FONT></LI>
</UL>
&nbsp;<br />
<h2><font COLOR="#4F81BD" FACE="Cambria" SIZE="4"><b>Human Resource
Manager</B></FONT></H2>
<p><font FACE="Times New Roman" SIZE="3">Do you have a passion for
building great Human Resources programs in an organization? If you
have had a strong record of success in Human Resources we would
love to talk to you! We are looking for a seasoned Human Resources
Manager to join our international team. This individual will report
to our Chief People Officer, and work out of our Beijing
office.&nbsp;<br />
&nbsp;&nbsp;<br />
<b>Responsibilities:</B></FONT></P>
<ul TYPE="disc">
<li><font FACE="Times New Roman" SIZE="3">Actively provide human
resources expertise in employee relations, coaching/development,
compensation, conflict management, organizational development and
training throughout Europe</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Manage Zynga’s
performance review program</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Engage and influence
senior management to support and implement HR initiatives across
the organization</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Research and assist
on&nbsp;learning&nbsp;&amp;
development and training opportunities for Zynga</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Lead the development and
implementation of systems and processes to drive continuous
learning and knowledge sharing across the organization in support
of the business strategies</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Work with customer groups
to update and apply policies and procedures consistently across the
business</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Actively participate in
the administration of benefits and compensation programs
&nbsp;</FONT></LI>
</UL>
<p><font FACE="Times New Roman" SIZE="3"><b>Required
Skills:</B></FONT></P>
<ul TYPE="disc">
<li><font FACE="Times New Roman" SIZE="3">BA/BS Minimum (Business
or HR degree preferred)</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">3-5 years or more of
applicable experience</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Strong communication
skills</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Experience in the
administration of benefits and compensation programs and other
Human Resources programs within an international
setting</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Ability to work with
minimal supervision</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Excellent problem solving
skills</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Experience with
exceptionally fast paced environments</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Ability to handle a large
amount of ambiguity</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Demonstrated ability to
manage projects from end to end</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Fluent in spoken and
written English</FONT></LI>
</UL>
<p><font FACE="Times New Roman" SIZE="3"><b>Nice To
Have:</B></FONT></P>
<ul TYPE="disc">
<li><font FACE="Times New Roman" SIZE="3">8 - 10 years progressive
experience</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Masters
degree</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Strong partnership and
generalist experience</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Software company
experience as a HR business partner</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Organizational
development and management coaching experience</FONT></LI>
</UL>
<div STYLE="text-align: center;" ALIGN="center">
<hr ALIGN="center" SIZE="2" WIDTH="100%" /></DIV>
<div STYLE="text-align: center;"><font FACE="Times New Roman" SIZE="5"><b>Zynga China- Open Positions &ndash; Product</B></FONT></DIV>
<div STYLE="margin: 1ex;">
<div>
<p><font FACE="Times New Roman" SIZE="3">Zynga is the #1 social
gaming company in the world, and one of the fastest growing
Internet companies in history.&nbsp; At Zynga, our
mission is to connect people through our games.&nbsp;
<a NAME="0.3__Toc261894845"></A>At Zynga, you will find smart,
creative people who are passionate about taking on new challenges.
Whether you are a developer, designer, or a customer service
manager, there’s an opportunity here for you to level up and be
your own CEO.</FONT></P>
<p><font FACE="Times New Roman" SIZE="3">These positions are for
our office in Beijing, we are looking for the best and brightest
candidates to help up build a stellar team!</FONT></P>
<p><font FACE="Times New Roman" SIZE="3">For more information,
please visit our website:</FONT> <a HREF="http://www.zynga.com/" TARGET="_blank"><font COLOR="#0000FF" FACE="Times New Roman" SIZE="3"><u>http://www.zynga.com</U></FONT></A><font FACE="Times New Roman" SIZE="3">.</FONT></P>
<p><font FACE="Times New Roman" SIZE="3">We have the following
Product positions open</FONT></P>
<ul TYPE="disc">
<li><font FACE="Times New Roman" SIZE="3">Dir. Of Product
Management</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Product
Manager</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Executive
Producer</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Producer</FONT></LI>
</UL>
<p>&nbsp;<br /></P>
<p><a NAME="0.3__Toc261894856"></A><font COLOR="#4F81BD" FACE="Cambria" SIZE="4"><b>Director of Product</B></FONT><font FACE="Times New Roman" SIZE="3">&nbsp;<br />
&nbsp;&nbsp;<br />
Zynga is looking for a Director of Product to join their growing
team in Beijing!&nbsp; The Director of Product provides
experience, direction, and measurable performance to the game
design process. This position will be responsible for mapping the
product roadmap, spec’ing games, and improving viral performance of
the games.&nbsp;<br />
&nbsp;<br />
<b>Responsibilities:</B>&nbsp;<br />
This position will be responsible for mapping the product roadmap,
building specs on our games, and improving viral performance of the
games.&nbsp;<br />
&nbsp;&nbsp;<br />
<b>Required Skills:</B></FONT></P>
<ul TYPE="disc">
<li><font FACE="Times New Roman" SIZE="3">5-8 years of experience
in leading product management in consumer web or game
development</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Must be able to
graphically create wire-frames and give interface direction to UI
team</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Experience with A/B
testing</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Passion for creating fun,
compelling and addictive user experiences</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Passion for writing
product specifications, White papers</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Outstanding written and
oral communication skills</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Strong organizational and
analytical skills &amp; attention to detail</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Demonstrated capacity for
developing and understanding strategy</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Strong aptitude for
determining the optimal way to position products in the
market</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">We are looking for an
enthusiastic, performance-driven self-starter and team
player</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Previous start-up
experience is a strong plus</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">BA/BS degree &ndash;
CS/EE/Engineering degree preferred &nbsp;</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Fluent in spoken and
written English</FONT><br /></LI>
</UL>
<br />
<p><a NAME="0.3__Toc261894857"></A><font COLOR="#4F81BD" FACE="Cambria" SIZE="4"><b>Product Manager</B></FONT><font FACE="Times New Roman" SIZE="3">&nbsp;<br />
&nbsp;&nbsp;<br />
Zynga is&nbsp;looking for a Product Manager who can
help drive the creation of new features on some of Zynga’s top
games! The Product Manager will add experience, direction, and
measurable performance to the game design
process.&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;<br />
<b>Responsibilities:</B>&nbsp;<br />
Zynga’s Product Manager will be responsible for creating a list of
features to one of our hit games! This person will have to work
independently to provide a detailed roadmap on the implementation
process. The implementation process should include designing,
executing, and optimizing the feature(s).&nbsp; They’ll
own the outcome of these new features by working with our talented
team of engineers to get the features
implemented.&nbsp;<br />
&nbsp;&nbsp;<br />
<b>Required Skills:</B></FONT></P>
<ul TYPE="disc">
<li><font FACE="Times New Roman" SIZE="3">2-5 years of experience
&nbsp;in product management in consumer web or game
development</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Must be able to
graphically create wire-frames and give interface direction to UI
team</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Must have proven
experience in contributing to a successful project or product in
the past</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Experience with
multivariate testing</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Experience with a web
based company managing web based applications</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Passion for creating fun,
compelling and addictive user experiences</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Passion for writing
product specifications, white papers</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Outstanding written and
oral communication skills</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Strong organizational and
analytical skills &amp; attention to detail</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">We are looking for an
enthusiastic, performance-driven self-starter and team
player</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Demonstrated capacity for
developing and understanding strategy</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Strong aptitude for
determining the optimal way to position products in the
market</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Strong passion for
games</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Previous start-up
experience is a strong plus</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Social networking
experience is a strong plus</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">BA/BS degree &ndash;
CS/EE/Engineering degree preferred&nbsp;</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Fluent in spoken and
written English</FONT><br /></LI>
</UL>
<p><a NAME="0.3__Toc261894858"></A><font COLOR="#4F81BD" FACE="Cambria" SIZE="4"><b>Executive Producer</B></FONT><font FACE="Times New Roman" SIZE="3">&nbsp;<br />
&nbsp;&nbsp;<br />
Zynga is looking for an Executive Producer for our hit
games!&nbsp; The Executive Producer will lead
production and serve as a key member of the executive team for one
of the largest social games in the world.&nbsp;<br />
&nbsp;&nbsp;<br />
&nbsp;<br />
<b>Responsibilities:</B><br /></FONT></P>
<ul TYPE="disc">
<li><font FACE="Times New Roman" SIZE="3">Manage and motivate a
team of producers, artists, and designers to accomplish their goals
of producing mass market social games</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Work with your key
reports (Art Director, Creative Director and Producers) to create
an organizational structure, processes, and project plan that allow
the team to produce high quality work efficiently on time and on
budget</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Drive creative vision for
the product</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Own quality of the
product and overall user experience</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Work collaboratively with
product managers and engineers to drive results and
outcomes</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Effectively communicate
the core experience of your game to other parts of the Zynga
organization, and help ensure that your product leverages the ideas
and resources of the larger organization</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Research and communicate
game market trends, patterns, and customer requirements</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Passionately articulate
goals and team principles to help form a stimulating and fun work
environment and culture</FONT></LI>
</UL>
<p><font FACE="Times New Roman" SIZE="3"><b>Required
Skills:</B><br /></FONT></P>
<ul TYPE="disc">
<li><font FACE="Times New Roman" SIZE="3">7 years experience
managing internal development teams within the internet or video
game industry (Software Engineers, Artists, Designers, Producers
etc.)</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">5 years experience as a
Sr. Producer (creative visionary) within the internet or games
industry, creating top quality web services or games</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Excellent written and
verbal communication skills</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Ability to work in a team
environment with maturity and leadership</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Fluent in spoken and
written English</FONT></LI>
</UL>
&nbsp;<br />
<p><a NAME="0.3__Toc261894859"></A><font COLOR="#4F81BD" FACE="Cambria" SIZE="4"><b>Game Designer - Systems</B></FONT><font FACE="Times New Roman" SIZE="3">&nbsp;<br />
&nbsp;<br />
Zynga is looking for an experienced Game Designer to work with
large scale social games that runs on social networks. Qualified
candidates will have experience on console and/or PC games and are
fluent in game design practices and overall game
development.&nbsp;<br />
&nbsp;&nbsp;&nbsp;<br />
<b>Responsibilities:</B></FONT></P>
<ul TYPE="disc">
<li><font FACE="Times New Roman" SIZE="3">Create or adapt leading
game features to work with an existing game</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Pitch new ideas to the
team/ hold brainstorming sessions</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Tune and model complex
systems using Excel</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Write copy, names, and
narrative elements of game</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Analyze real-time
feedback and metrics, and adjust game designs
accordingly</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Work with product
managers, developers and artists to oversee the implementation of
new features and systems</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Ability to describe user
experience stories and create wireframe screens and
flows</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Remain up-to-date with
Game Design literature and best practices to be an evangelist for
the craft of Game Design</FONT></LI>
</UL>
&nbsp;
<p>&nbsp;<font FACE="Times New Roman" SIZE="3"><b>Required Skills:</B></FONT></P>
<ul TYPE="disc">
<li><font FACE="Times New Roman" SIZE="3">Experience or knowledge
of traditional board game, card game, or dice game
design</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Expert with math and
formulas in game environment</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Experience designing
combat and/or system mechanics including player control, moves, and
NPC/AI types and behaviors</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Strong knowledge of game
balancing and pacing</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Management experience,
preferably with an experienced design team</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Adept with
Excel/spreadsheets</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Passionate
gamer</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">2 shipped
games</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Game programming
background required</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Fluent in spoken and
written English a plus</FONT></LI>
</UL>
&nbsp;<br />
<p><a NAME="0.3__Toc261894860"></A><font COLOR="#4F81BD" FACE="Cambria" SIZE="4"><b>Producer</B></FONT><font FACE="Times New Roman" SIZE="3">&nbsp;<br />
&nbsp;&nbsp;<br />
Zynga is looking for an all-star producer to join their growing
team in Beijing!&nbsp; The Producer will work with a
specific studio to help build one of our
games.&nbsp;<br />
&nbsp;&nbsp;<br />
&nbsp;<br />
&nbsp;<b>Responsibilities:</B></FONT></P>
<ul TYPE="disc">
<li><font FACE="Times New Roman" SIZE="3">Act as the creative
visionary for the product</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Effectively communicate
the core experience of your game to other parts of the Zynga
organization, and help ensure that your product leverages the ideas
and resources of the larger organization</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Work with your key
reports (Art Director, Creative Director and Producers) to create
an organizational structure, processes and project plan that allow
the team to efficiently produce high quality work on time and on
budget</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Initiate, foster,
maintain and manage others toward positive working relationships
with internal and external organizations critical to both current
and future development process</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Research and communicate
game market trends, patterns, and customer requirements</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Passionately articulate
goals and team principles to help form a stimulating and fun work
environment and culture</FONT></LI>
</UL>
<p><font FACE="Times New Roman" SIZE="3"><b>Required
Skills:</B></FONT></P>
<ul TYPE="disc">
<li><font FACE="Times New Roman" SIZE="3">5 years experience
managing internal development teams within the video game industry
(Software Engineers, Artists, Designers, Producers
etc.)</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">3 years experience as a
Producer within the games industry, creating top quality
games</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Excellent written and
verbal communication skills</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Ability to work in a team
environment with maturity and leadership</FONT></LI>
<li><font FACE="Times New Roman" SIZE="3">Fluent in spoken and
written English</FONT></LI>
</UL>
</DIV>
</DIV>
<br />
<div STYLE=""><b><span STYLE="font-weight: normal;"><b><font COLOR="#FF0000">Zynga
中国&nbsp;<wbr /></FONT></B></SPAN>招聘</B></DIV>
<div STYLE="">
<b>有意者请与我联系，</B><b>Email</B><b>：wyang@zynga.com</B></DIV>
<div STYLE="text-align: left;"><b>-- <font COLOR="#FF0000">FL</FONT> 车在臣</B></DIV>
<br />]]></description>
            <author>FL车在臣</author>
            <category>杂谈系列</category>
            <comments>http://blog.sina.com.cn/s/blog_3ecb9b110100ixp2.html#comment</comments>
            <pubDate>Tue, 01 Jun 2010 10:16:50 +0800</pubDate>
            <guid>http://blog.sina.com.cn/s/blog_3ecb9b110100ixp2.html</guid>
        </item>
        <item>
            <title>第一章 高级碰撞检测&amp;#8546;[FL车在臣]</title>
            <link>http://blog.sina.com.cn/s/blog_3ecb9b110100iss3.html</link>
            <description><![CDATA[<p><font STYLE="FonT-siZe: 24px"><strong>测试并调整网格</STRONG></FONT><br />
&nbsp;&nbsp;&nbsp;
每次运行这个应用，你可以看到打印出的碰撞检测次数。在我 1440 &times; 900 分辩率的电脑上，在最大化的浏览器中运行
SWF，测试的碰撞检测次数从 80 到 130 次，因为前面的代码是：100 个半径为 25 的小球，网格大小为
50。舞台越小碰撞次数越多。运行几次后可以得出一些数值范围。因为唯一不断变化的是小球的随机分配，你会从执行结果中得到平均值。</P>
<p>&nbsp;&nbsp;&nbsp;
现在试着增加格子的大小，比如
100。你会注意到碰撞检测的次数明显变多，因为每个方格中的小球更多了。听起来不好，但却会减少方格和数组循环的次数，一会儿我们会看到它的好处。</P>
<p>&nbsp;&nbsp;&nbsp; 现在减少网格数量到
40 或 30。碰撞检测的次数减少了，看起来更符合要求。大家可能会偶尔看到丢失碰撞的情况 ——
两个物体在碰撞后没有变化（仍是白色）。这可不好，但它却提醒我们网格大小要能容纳最大的物体。由此进一步，根据最大的物体动态设置网格大小。</P>
<p>&nbsp;</P>
<p>将网格大小设为 50 并修改 makeBalls 创建小球的一句：<br />
&nbsp;&nbsp;&nbsp; var
ball:Ball = new Ball(Math.random() * RADIUS);<br />
这个改变不会影响判断次数；执行效果很好。它只是告诉我们即使物体大小不同，程序仍可正确运行——当然要切记网格大小的规则。</P>
<p>&nbsp;&nbsp;&nbsp;
现在做一些小小的调整，看看会有什么不同，尤其是“当前格子中物体间的比较”方法。</P>
<p>&nbsp;&nbsp;&nbsp;
我们需要创建一个新的方法来完成此任务，叫它 basicCheck() 方法，内容如下：<br />
private function basicCheck():void {<br />
&nbsp;for(var i:int = 0; i &lt;
_balls.length - 1; i++) {<br />
&nbsp;&nbsp;var ballA:Ball = _balls[i] as
Ball;<br />
&nbsp;&nbsp;for(var j:int = i + 1; j
&lt; _balls.length; j++) {<br />
&nbsp;&nbsp;&nbsp;var
ballB:Ball = _balls[j] as Ball;<br />
&nbsp;&nbsp;&nbsp;checkCollision(ballA,
ballB);<br />
&nbsp;&nbsp;}<br />
&nbsp;}<br />
}<br />
这是 100 个物体产生 4950
次碰撞检测的代码。我们已经用更少的判断次数战胜了这种方法，但是它没有大量网格计算的开销。那么这两种方式如何比较呢？我们真能从中受益吗？</P>
<p>&nbsp;&nbsp;&nbsp;
显然必须看到一些优点，否则这一章也就不存在了，要让大家耳闻不如一见。我们要做的是让基于网格判断的代码执行十次，同时执行这个方法十次，看看哪种用时最少。我会将代码写在构造函数中，变化如下：<br />

public function GridCollision() {<br />
&nbsp;stage.align = StageAlign.TOP_LEFT;<br />
&nbsp;stage.scaleMode = StageScaleMode.NO_SCALE;<br />
&nbsp;<br />
&nbsp;makeBalls();<br />
&nbsp;drawGrid();<br />
&nbsp;<br />
&nbsp;var startTime:int;<br />
&nbsp;var elapsed:int;<br />
&nbsp;var i:int;<br />
&nbsp;<br />
&nbsp;// 获得初始化时间<br />
&nbsp;startTime = getTimer();<br />
&nbsp;// 做 10 次循环<br />
&nbsp;for(i = 0; i &lt; 10; i++) {<br />
&nbsp;&nbsp;makeGrid();<br />
&nbsp;&nbsp;assignBallsToGrid();<br />
&nbsp;&nbsp;checkGrid();<br />
&nbsp;}<br />
&nbsp;// 用当前时间减去开始时间<br />
&nbsp;elapsed = getTimer() - startTime;<br />
&nbsp;trace("Grid-based:", elapsed);<br />
&nbsp;// 再做十次基本判断<br />
&nbsp;startTime = getTimer();<br />
&nbsp;for(i = 0; i &lt; 10; i++) {<br />
&nbsp;&nbsp;basicCheck();<br />
&nbsp;}<br />
&nbsp;elapsed = getTimer() - startTime;<br />
&nbsp;trace("Basic check", elapsed);<br />
}<br />
创建开始时间的变量，然后计算消耗的时间。将开始时间设置为 getTimer() 并执行十次下面这三行代码：<br />
&nbsp;makeGrid();<br />
&nbsp;assignBallsToGrid();<br />
&nbsp;checkGrid();<br />
用当前时间减去开始时间，看看用时多久。再把 basicCheck() 执行十次。</P>
<p>&nbsp;&nbsp;&nbsp;
结果如何呢？在我这儿，基于网格的方法执行速度比基本的方法快了 2.5 倍。没有我之前期望得那么厉害，可是我们明明已经节省了 4800
次碰撞检测啊。这说明网格方法还有很大的系统开销。但是，2.5 倍的速度提升也不赖啊，不是么？</P>
<p>&nbsp;&nbsp;&nbsp;
此外，物体越多节省的开销也就也多。如果我增加 _numBalls 到 1000，那么基于网格的方法处理速度不到 1
秒，反之基本判断方法需要多达 13 秒。（当然，一秒钟一帧是不可接受的帧率，但是也比每帧 13
秒强得多吧！）另外，如果将小球的数量减少到 50
个，基本的判断确实很快。因此在系统开销超过碰撞检测节省部分的分水岭时，最好改用简单的方法。这个分水岭到底在哪，那要按你的应用中需要检测的物体而定。</P>
<p>&nbsp;&nbsp;&nbsp; 将
_numBalls 设置回 100 再运行几次，你就会知道网格方法需要多长时间。在我的机器上，10 次的平均值为 55
毫秒。现在将网格大小从 50 改为 75。我们平均值从降到了 37 毫秒。我发现网格大小在 85 到 100 之间平均用时为 32
毫秒，是基本检测方法的四倍！注意，所有这些数字都只是作为指导性的例子。你可能会得到非常不同的结果。节省开销的重要方法是调整网格大小，要找到适合你应用程序的最佳值。这里有很多变量：舞台大小，物体数量，物体大小，网格大小以及碰撞检测的算法（不以某台电脑的表现为标准）。我还没有想出一个能够得到最佳参数的神奇公式。</P>
<p>&nbsp;</P>
<p><font STYLE="FonT-siZe: 24px"><strong>将它改为可重用的类</STRONG></FONT><br />
通过 GridCollision
类希望大家能从网格级碰撞检测中领悟到其背后的思想，证明它存在的价值。但它确实还有不少问题。首先，它在主文档类中，因此需要拷贝粘贴到另一个应用中。因此它与
Ball 类耦合度很高。如果想在其它类中作为对象使用它，你就要改变这个类的所有引用。而且，碰撞检测的算法是基于距离的。你可能要用简单的
hitTestObject 或是位图级的碰撞检测。所以我们要创建一个新的类来应对这些问题，我会尽可能地做到最优化。这个类就叫它
CollisionGrid，可从 <a HREF="http://www.friendsofed.com/">www.friendsofed.com</A> 下载：<br />
package {<br />
&nbsp;import flash.display.DisplayObject;<br />
&nbsp;import flash.display.Graphics;<br />
&nbsp;import flash.events.EventDispatcher;<br />
&nbsp;<br />
&nbsp;public class CollisionGrid extends
EventDispatcher {<br />
&nbsp;&nbsp;private var
_checks:Vector.&lt;DisplayObject&gt;;<br />
&nbsp;&nbsp;private var
_grid:Vector.&lt;Vector.&lt;DisplayObject&gt;&gt;;<br />

&nbsp;&nbsp;private var
_gridSize:Number;<br />
&nbsp;&nbsp;private var
_height:Number;<br />
&nbsp;&nbsp;private var
_numCells:int;<br />
&nbsp;&nbsp;private var _numCols:int;<br />
&nbsp;&nbsp;private var _numRows:int;<br />
&nbsp;&nbsp;private var
_width:Number;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function
CollisionGrid(width:Number, height:Number, gridSize:Number) {<br />
&nbsp;&nbsp;&nbsp;_width =
width;<br />
&nbsp;&nbsp;&nbsp;_height =
height;<br />
&nbsp;&nbsp;&nbsp;_gridSize =
gridSize;<br />
&nbsp;&nbsp;&nbsp;_numCols =
Math.ceil(_width / _gridSize);<br />
&nbsp;&nbsp;&nbsp;_numRows =
Math.ceil(_height / _gridSize);<br />
&nbsp;&nbsp;&nbsp;_numCells =
_numCols * _numRows;<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function
drawGrid(graphics:Graphics):void {<br />
&nbsp;&nbsp;&nbsp;//
绘制线条表示网格<br />
&nbsp;&nbsp;&nbsp;graphics.lineStyle(0,
.5);<br />
&nbsp;&nbsp;&nbsp;for(var i:int
= 0; i &lt;= _width; i += _gridSize) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;graphics.moveTo(i,
0);<br />
&nbsp;&nbsp;&nbsp;&nbsp;graphics.lineTo(i,
_height);<br />
&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;for(i = 0; i
&lt;= _height; i += _gridSize) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;graphics.moveTo(0,
i);<br />
&nbsp;&nbsp;&nbsp;&nbsp;graphics.lineTo(_width,
i);<br />
&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;<br />

&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function
check(objects:Vector.&lt;DisplayObject&gt;):void
{<br />
&nbsp;&nbsp;&nbsp;var
numObjects:int = objects.length;<br />
&nbsp;&nbsp;&nbsp;_grid = new
Vector.&lt;Vector.&lt;DisplayObject&gt;&gt;(_numCells);<br />

&nbsp;&nbsp;&nbsp;_checks = new
Vector.&lt;DisplayObject&gt;();<br />
&nbsp;&nbsp;&nbsp;//
遍历所有对象<br />
&nbsp;&nbsp;&nbsp;for(var i:int
= 0; i &lt; numObjects; i++) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;var
obj:DisplayObject = objects[i];<br />
&nbsp;&nbsp;&nbsp;&nbsp;//
用一个小标表示在一维网格中的位置<br />
&nbsp;&nbsp;&nbsp;&nbsp;var
index:int = Math.floor(obj.y / _gridSize) * _numCols +
Math.floor(obj.x / _gridSize);<br />
&nbsp;&nbsp;&nbsp;&nbsp;if(_grid[index]
== null) _grid[index] = new
Vector.&lt;DisplayObject&gt;;<br />
&nbsp;&nbsp;&nbsp;&nbsp;//
将对象放入格子中<br />
&nbsp;&nbsp;&nbsp;&nbsp;_grid[index].push(obj);<br />

&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;checkGrid();<br />

&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;private function
checkGrid():void {<br />
&nbsp;&nbsp;&nbsp;//
循环遍历每个格子<br />
&nbsp;&nbsp;&nbsp;for(var i:int
= 0; i &lt; _numCols; i++) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;for(var
j:int = 0; j &lt; _numRows; j++) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//
第一个格子中所有的对象间的碰撞检测<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;checkOneCell(i,
j);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;checkTwoCells(i,
j, i + 1, j);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;checkTwoCells(i,
j, i - 1, j + 1);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;checkTwoCells(i,
j,
i,&nbsp;&nbsp;&nbsp;&nbsp;
j + 1);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;checkTwoCells(i,
j, i + 1, j + 1);<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />

&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;private function
checkOneCell(x:int, y:int):void {<br />
&nbsp;&nbsp;&nbsp;// 根据 x, y
获得格子<br />
&nbsp;&nbsp;&nbsp;var
cell:Vector.&lt;DisplayObject&gt; = _grid[y
* _numCols + x];<br />
&nbsp;&nbsp;&nbsp;if(cell ==
null) return;<br />
&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;//
格子中对象的数量<br />
&nbsp;&nbsp;&nbsp;var
cellLength:int = cell.length;<br />
&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;//
所有对象间相互比较<br />
&nbsp;&nbsp;&nbsp;for(var i:int
= 0; i &lt; cellLength - 1; i++) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;var
objA:DisplayObject = cell[i];<br />
&nbsp;&nbsp;&nbsp;&nbsp;for(var
j:int = i + 1; j &lt; cellLength; j++) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var
objB:DisplayObject = cell[j];<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_checks.push(objA,
objB);<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />

&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;private function
checkTwoCells(x1:int, y1:int, x2:int, y2:int):void {<br />
&nbsp;&nbsp;&nbsp;//
确保格子的存在<br />
&nbsp;&nbsp;&nbsp;if(x2
&gt;= _numCols || x2 &lt; 0 || y2
&gt;= _numRows) return;<br />
&nbsp;&nbsp;&nbsp;var
cellA:Vector.&lt;DisplayObject&gt; =
_grid[y1 * _numCols + x1];<br />
&nbsp;&nbsp;&nbsp;var
cellB:Vector.&lt;DisplayObject&gt; =
_grid[y2 * _numCols + x2];<br />
&nbsp;&nbsp;&nbsp;if(cellA ==
null || cellB == null) return;<br />
&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;var
cellALength:int = cellA.length;<br />
&nbsp;&nbsp;&nbsp;var
cellBLength:int = cellB.length;<br />
&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;//
网格中所有对象间的比较<br />
&nbsp;&nbsp;&nbsp;for(var i:int
= 0; i &lt; cellALength; i++) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;var
objA:DisplayObject = cellA[i];<br />
&nbsp;&nbsp;&nbsp;&nbsp;for(var
j:int = 0; j &lt; cellBLength; j++) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var
objB:DisplayObject = cellB[j];<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_checks.push(objA,
objB);<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />

&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function get
checks():Vector.&lt;DisplayObject&gt;
{<br />
&nbsp;&nbsp;&nbsp;return
_checks;<br />
&nbsp;&nbsp;}<br />
&nbsp;}<br />
}<br />
大多数代码与前面的例子相同。有一些已经被优化过了，特别是使用了 Vector （向量）。Vector 是 Flash 10
的新特性，本质上是数组类型。因为编译器知道向量中的元素是同一类型，它可以在运行时创建出更高效的字节编码。用 Vector
替换数组能让我们的程序效率提高近两倍！</P>
<p>&nbsp;&nbsp;&nbsp;
drawGrid() 方法与前面的没有差别，用来绘制网格！</P>
<p>&nbsp;&nbsp;&nbsp; check()
方法是与这个类交互的公共方法，需要传一个显示对象的向量给它。我选择 DisplayObject 是因为用于碰撞检测的对象通常是
Sprite、MovieClip、Shape 或 Bitmap，它们都是从 DisplayObject
继承过来的。DisplayObject 都有 x 和 y 属性，用来获取坐标从而判断它们在网格中的位置。如果你使用没有从
DisplayObject 继承来的自定义类，那么请更改此类型。</P>
<p>&nbsp;&nbsp;&nbsp; check()
方法创建一个 _grid 和一个 _checks 向量。大家对 _grid
很熟悉，但是这里它的实现方法有些不同——一维向量可以用巧妙运用下标代替二维数组。这样做的原因是效率更高并且遍历一维数组占用的资源要比二维数组少。简单的过一下，_checks
向量用于保存碰撞检测对象列表。注意 CollisionGrid
类本身不做碰撞检测。它创建一个网格，分配对象，生成一个碰撞对象列表。是否要遍历这个数组进行碰撞检测取决于你。</P>
<p>&nbsp;&nbsp;&nbsp; 接下来，遍历传入的
DisplayObject 向量，并将每个对象分配到网格中，这小段代码可能需要解释一下：<br />
&nbsp;for(var i:int = 0; i &lt; numObjects;
i++) {<br />
&nbsp;&nbsp;var obj:DisplayObject =
objects[i];<br />
&nbsp;&nbsp;// 用下标表示在一维网格中的位置<br />
&nbsp;&nbsp;var index:int =
Math.floor(obj.y / _gridSize) * _numCols + Math.floor(obj.x /
_gridSize);<br />
&nbsp;&nbsp;if(_grid[index] == null)
_grid[index] = new
Vector.&lt;DisplayObject&gt;;<br />
&nbsp;&nbsp;// 将对象放入格子中<br />
&nbsp;&nbsp;_grid[index].push(obj);<br />
&nbsp;}<br />
重申一遍，我们使用的是一维向量代替二维数组。通过 index 变量找出向量中相对应的行和列。基本公式如下，x 和 y
是行和列的下标：<br />
&nbsp;&nbsp;&nbsp; index = y *
numColumns + x<br />
图 1-21 应该能够解释。<br />
<a HREF="http://blog.photo.sina.com.cn/showpic.html#url=http://static12.photo.sina.com.cn/orignal/3ecb9b11t8779a171eb9b" TARGET="_blank"><img SRC="http://static12.photo.sina.com.cn/middle/3ecb9b11t8779a171eb9b&amp;690" />
</A><br />
<strong>图 1-21</STRONG> 使用一个平坦化数组作网格<br /></P>
<p>这个网格有五行五列。物体在二行三列的位置上，因此 x = 3 并且 y = 2。因此下标为 2 * 5 + 3 =
13，这就是我们在网格中看到的。</P>
<p>代码中，还像之前那样获得行和列下标：<br />
&nbsp;&nbsp;&nbsp;
Math.floor(obj.x / _gridSize)<br />
&nbsp;&nbsp;&nbsp;
Math.floor(obj.y / _gridSize)<br />
唯一不同的是，我们将所有事情都写在一行代码中：<br />
&nbsp;&nbsp;&nbsp; index:int =
Math.floor(obj.y / _gridSize) * _numCols +<br />
&nbsp;&nbsp;&nbsp;
Math.floor(obj.x / _gridSize);<br />
下面一行代码又是一个优化技巧。为每个格子创建一个向量而不是循环创建，有些格子可能永远不会用到。我们只判断是否存在一个向量，如果不存在，则创建。这是一个懒汉式的例子。在这里“懒汉”并不是一个贬义词。</P>
<p>它是指如果你不需要某些对象就先不去创建它们。有些情况下这种方式有意义而有些情况没有意义。在这里使用它是个好点子：<br />
&nbsp;&nbsp;&nbsp;
if(_grid[index] == null) _grid[index] = new
Vector.&lt;DisplayObject&gt;;<br />
下面是循环的最后一行代码，向量已存在并将对象 push 进去：<br />
&nbsp;&nbsp;&nbsp;
_grid[index].push(obj);<br />
check() 的最后一行调用 checkGrid()，在这里复述一遍：<br />
&nbsp;private function checkGrid():void {<br />
&nbsp;&nbsp;// 循环遍历每个格子<br />
&nbsp;&nbsp;for(var i:int = 0; i
&lt; _numCols; i++) {<br />
&nbsp;&nbsp;&nbsp;for(var j:int
= 0; j &lt; _numRows; j++) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;//
第一个格子中所有的对象间的碰撞检测<br />
&nbsp;&nbsp;&nbsp;&nbsp;checkOneCell(i,
j);<br />
&nbsp;&nbsp;&nbsp;&nbsp;checkTwoCells(i,
j, i + 1, j);<br />
&nbsp;&nbsp;&nbsp;&nbsp;checkTwoCells(i,
j, i - 1, j + 1);<br />
&nbsp;&nbsp;&nbsp;&nbsp;checkTwoCells(i,
j,
i,&nbsp;&nbsp;&nbsp;&nbsp;
j + 1);<br />
&nbsp;&nbsp;&nbsp;&nbsp;checkTwoCells(i,
j, i + 1, j + 1);<br />
&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;}<br />
&nbsp;}<br />
这里和前面的例子没有任何不同。</P>
<p>&nbsp;&nbsp;&nbsp;
checkOneCell() 和 checkTwoCells()
方法本质是相同的。它们都用一维向量代替二维数组，首先判断格子是否为空，只有在真正需要格子的时候才会创建向量。我们只把要做碰撞检测的两个对象放在
_checks 向量中，而不是直接进行碰撞检测。</P>
<p>&nbsp;&nbsp;&nbsp;
全部结束后，_check 中保存了要相互碰撞检测的对象列表。这是个简单的列表，其中每两个元素之间都需要做碰撞检测（也就是，元素 0 和
1进行判断，2和3，4和5等等）。最终，我们提供一个名为 checks 的 public getter 方法来访问该列表。</P>
<p>&nbsp;</P>
<p><font STYLE="FonT-siZe: 24px"><strong>使用这个类</STRONG></FONT><br />
&nbsp;&nbsp;&nbsp;
好的，我们已经有了这个可爱的类，下面看看它是如何运行的。这里我已经修改了 main 类，命名为
GridCollision2。和其它类一样，可以在 <a HREF="http://www.friendsofed.com/">www.friendsofed.com</A> 下载。<br />
package {<br />
&nbsp;import flash.display.Sprite;<br />
&nbsp;import flash.display.StageAlign;<br />
&nbsp;import flash.display.StageScaleMode;<br />
&nbsp;import flash.utils.getTimer;<br />
&nbsp;import flash.display.DisplayObject;</P>
<p>&nbsp;public class GridCollision2 extends Sprite
{<br />
&nbsp;&nbsp;private const GRID_SIZE:Number
= 80;<br />
&nbsp;&nbsp;private const RADIUS:Number =
25;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;private var
_balls:Vector.&lt;DisplayObject&gt;;<br />
&nbsp;&nbsp;private var
_grid:CollisionGrid;<br />
&nbsp;&nbsp;private var _numBalls:int =
100;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function
GridCollision2() {<br />
&nbsp;&nbsp;&nbsp;stage.align =
StageAlign.TOP_LEFT;<br />
&nbsp;&nbsp;&nbsp;stage.scaleMode
= StageScaleMode.NO_SCALE;<br />
&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;_grid = new
CollisionGrid(stage.stageWidth, stage.stageHeight,
GRID_SIZE);<br />
&nbsp;&nbsp;&nbsp;_grid.drawGrid(graphics);<br />

&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;makeBalls();</P>
<p>&nbsp;&nbsp;&nbsp;var
startTime:int;<br />
&nbsp;&nbsp;&nbsp;var
elapsed:int;<br />
&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;//
循环十次并计算耗时<br />
&nbsp;&nbsp;&nbsp;startTime =
getTimer();<br />
&nbsp;&nbsp;&nbsp;for(var i:int
= 0; i &lt; 10; i++) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;_grid.check(_balls);<br />

&nbsp;&nbsp;&nbsp;&nbsp;var
numChecks:int = _grid.checks.length;<br />
&nbsp;&nbsp;&nbsp;&nbsp;for(var
j:int = 0; j &lt; numChecks; j += 2) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;checkCollision(_grid.checks[j]
as Ball, _grid.checks[j + 1] as Ball);<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />

&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;elapsed =
getTimer() - startTime;<br />
&nbsp;&nbsp;&nbsp;trace("Elapsed:",
elapsed);<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;private function
makeBalls():void {<br />
&nbsp;&nbsp;&nbsp;//
创建小球，加入显示列表和 _balls 列表<br />
&nbsp;&nbsp;&nbsp;_balls = new
Vector.&lt;DisplayObject&gt;(_numBalls);<br />

&nbsp;&nbsp;&nbsp;for(var i:int
= 0; i &lt; _numBalls; i++) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;var
ball:Ball = new Ball(RADIUS);<br />
&nbsp;&nbsp;&nbsp;&nbsp;ball.x
= Math.random() * stage.stageWidth;<br />
&nbsp;&nbsp;&nbsp;&nbsp;ball.y
= Math.random() * stage.stageHeight;<br />
&nbsp;&nbsp;&nbsp;&nbsp;ball.vx
= Math.random() * 4 - 2;<br />
&nbsp;&nbsp;&nbsp;&nbsp;ball.vy
= Math.random() * 4 - 2;<br />
&nbsp;&nbsp;&nbsp;&nbsp;addChild(ball);<br />

&nbsp;&nbsp;&nbsp;&nbsp;_balls[i]
= ball;<br />
&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;private function
checkCollision(ballA:Ball, ballB:Ball):void {<br />
&nbsp;&nbsp;&nbsp;//
两个小球间的碰撞检测<br />
&nbsp;&nbsp;&nbsp;var dx:Number
= ballB.x - ballA.x;<br />
&nbsp;&nbsp;&nbsp;var dy:Number
= ballB.y - ballA.y;<br />
&nbsp;&nbsp;&nbsp;var
dist:Number = Math.sqrt(dx * dx + dy * dy);<br />
&nbsp;&nbsp;&nbsp;if(dist
&lt; ballA.radius + ballB.radius) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;ballA.color
= 0xff0000;<br />
&nbsp;&nbsp;&nbsp;&nbsp;ballB.color
= 0xff0000;<br />
&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;}<br />
&nbsp;}<br />
}<br />
主要的变化在构造函数中。因为创建和绘制网格的工作都封装在 CollisionGrid 类中，因此这里只用一行代码就搞定了，我把原有的
makeGrid() 和 drawGrid() 方法移除，直在构造函数中完成这些工作。</P>
<p>&nbsp;&nbsp;&nbsp; 接下来调用
makeBalls() 方法。除了使用向量代替数组以后，其它都和前面的例子完全相同。</P>
<p>&nbsp;&nbsp;&nbsp;
这里只有一个计时器，因为只对这个新的类的测试感兴趣。你完全可以再为基本的检测方法创建另一个计时器加以对比，不过你应该已经知道它需要多少时间了。这个循环中，调用
_grid.check(_balls) 方法前面已经深入地讲解过了。当这个方法完成以后，在 _grid.checks
中就有了一个可比较对象的向量。下面这个循环告诉我们如何使用它：<br />
&nbsp;for(var j:int = 0; j &lt; numChecks;
j += 2) {<br />
&nbsp;&nbsp;checkCollision(_grid.checks[j]
as Ball, _grid.checks[j + 1] as Ball);<br />
&nbsp;}<br />
这里循环遍历这个向量，每次递增 2；然后获取后两个元素，下标为 j 和 j + 1。将它们转型为 Ball 并传给
checkCollision() 方法。</P>
<p>&nbsp;&nbsp;&nbsp;
在我的测试中，这个程序比之前的例子快了近一倍，主要因为使用了向量以及在用到格子的时候才创建向量（懒实例化）有关。重头戏要开始了，可以开始编动画了。</P>
<p>&nbsp;&nbsp;&nbsp;
动画与单独碰撞没有太大的区别；恰恰是我们最常做的。由于我们已经提前调整了引擎为舞台大小、对象数量并且计算出需要处理的网格数量，因此可以删除计时循环。但是别忘了，在新项目中使用基于网格的碰撞检测时，需要根据应用改变其参数，并对新的变化做一些计时测试。</P>
<p>&nbsp;&nbsp;&nbsp; 我们的 main
类将变成这样：<br />
package {<br />
&nbsp;import flash.display.Sprite;<br />
&nbsp;import flash.display.StageAlign;<br />
&nbsp;import flash.display.StageScaleMode;<br />
&nbsp;import flash.display.DisplayObject;<br />
&nbsp;import flash.events.Event;</P>
<p>&nbsp;public class GridCollision3 extends Sprite
{<br />
&nbsp;&nbsp;private const GRID_SIZE:Number
= 80;<br />
&nbsp;&nbsp;private const RADIUS:Number =
25;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;private var
_balls:Vector.&lt;DisplayObject&gt;;<br />
&nbsp;&nbsp;private var
_grid:CollisionGrid;<br />
&nbsp;&nbsp;private var _numBalls:int =
100;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function
GridCollision3() {<br />
&nbsp;&nbsp;&nbsp;stage.align =
StageAlign.TOP_LEFT;<br />
&nbsp;&nbsp;&nbsp;stage.scaleMode
= StageScaleMode.NO_SCALE;<br />
&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;_grid = new
CollisionGrid(stage.stageWidth, stage.stageHeight,
GRID_SIZE);<br />
&nbsp;&nbsp;&nbsp;_grid.drawGrid(graphics);<br />

&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;makeBalls();<br />

&nbsp;&nbsp;&nbsp;<strong>addEventListener(Event.ENTER_FRAME,
onEnterFrame);</STRONG><br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
<strong>&nbsp;&nbsp;function
onEnterFrame(event:Event):void {<br />
&nbsp;&nbsp;&nbsp;//
每个小球的速度向量增加<br />
&nbsp;&nbsp;&nbsp;updateBalls();<br />

&nbsp;&nbsp;&nbsp;//
确认哪些小球需要判断<br />
&nbsp;&nbsp;&nbsp;_grid.check(_balls);<br />

&nbsp;&nbsp;&nbsp;var
numChecks:int = _grid.checks.length;<br />
&nbsp;&nbsp;&nbsp;for(var j:int
= 0; j &lt; numChecks; j += 2) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;checkCollision(_grid.checks[j]
as Ball, _grid.checks[j + 1] as Ball);<br />
&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;}</STRONG><br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;private function
makeBalls():void {<br />
&nbsp;&nbsp;&nbsp;_balls = new
Vector.&lt;DisplayObject&gt;(_numBalls);<br />

&nbsp;&nbsp;&nbsp;for(var i:int
= 0; i &lt; _numBalls; i++) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;var
ball:Ball = new Ball(RADIUS);<br />
&nbsp;&nbsp;&nbsp;&nbsp;ball.x
= Math.random() * stage.stageWidth;<br />
&nbsp;&nbsp;&nbsp;&nbsp;ball.y
= Math.random() * stage.stageHeight;<br />
&nbsp;&nbsp;&nbsp;&nbsp;ball.vx
= Math.random() * 4 - 2;<br />
&nbsp;&nbsp;&nbsp;&nbsp;ball.vy
= Math.random() * 4 - 2;<br />
&nbsp;&nbsp;&nbsp;&nbsp;addChild(ball);<br />

&nbsp;&nbsp;&nbsp;&nbsp;_balls[i]
= ball;<br />
&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
<strong>&nbsp;&nbsp;private function
updateBalls():void {<br />
&nbsp;&nbsp;&nbsp;for(var i:int
= 0; i &lt; _numBalls; i++) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;//
移动每个小球，遇到墙时反弹<br />
&nbsp;&nbsp;&nbsp;&nbsp;var
ball:Ball = _balls[i] as Ball;<br />
&nbsp;&nbsp;&nbsp;&nbsp;ball.update();<br />

&nbsp;&nbsp;&nbsp;&nbsp;if(ball.x
&lt; RADIUS) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ball.x
= RADIUS;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ball.vx
*= -1;<br />
&nbsp;&nbsp;&nbsp;&nbsp;}
else if(ball.x &gt; stage.stageWidth - RADIUS) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ball.x
= stage.stageWidth - RADIUS;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ball.vx
*= -1;<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />

&nbsp;&nbsp;&nbsp;&nbsp;if(ball.y
&lt; RADIUS) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ball.y
= RADIUS;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ball.vy
*= -1;<br />
&nbsp;&nbsp;&nbsp;&nbsp;}
else if(ball.y &gt; stage.stageHeight - RADIUS) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ball.y
= stage.stageHeight - RADIUS;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ball.vy
*= -1;<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />

&nbsp;&nbsp;&nbsp;&nbsp;ball.color
= 0xffffff;<br />
&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;}<br /></STRONG>&nbsp;&nbsp;<br />

&nbsp;&nbsp;private function
checkCollision(ballA:Ball, ballB:Ball):void {<br />
&nbsp;&nbsp;&nbsp;//
两个小球间进行比较<br />
&nbsp;&nbsp;&nbsp;var dx:Number
= ballB.x - ballA.x;<br />
&nbsp;&nbsp;&nbsp;var dy:Number
= ballB.y - ballA.y;<br />
&nbsp;&nbsp;&nbsp;var
dist:Number = Math.sqrt(dx * dx + dy * dy);<br />
&nbsp;&nbsp;&nbsp;if(dist
&lt; ballA.radius + ballB.radius) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;ballA.color
= 0xff0000;<br />
&nbsp;&nbsp;&nbsp;&nbsp;ballB.color
= 0xff0000;<br />
&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;}<br />
&nbsp;}<br />
}<br />
主要的变化在新添加的 onEnterFrame() 和 updateBalls() 方法。构造函数只是创建网格和小球并开启
ENTER_FRAME 侦听。onEnterFrame() 方法通过 updateBalls()
方法更新每个小球的位置并做碰撞检测。updateBalls()
方法负责移动物体并将小球控制在屏幕范围内，以及在每帧开始的时候将小球颜色设置回白色。只有在 checkCollision()
方法产生碰撞时才将它们设置为红色。</P>
<p>&nbsp;&nbsp;&nbsp;
当然，你现在可以使用不同的碰撞作用力让小球有真正碰撞后的反弹效果。这些内容在 <em>Making Things Move</EM>
中的“动量守恒”中有具体的介绍。</P>
<p>&nbsp;&nbsp;&nbsp;
这种碰撞检测的方法通过几次反作用力会增加物体在屏幕上移动的次数。要记住调优的秘诀就是测试，测试，测试到最佳状态并且保证碰撞检测的<em>精确性</EM>。</P>
<p>&nbsp;</P>
<p><font STYLE="FonT-siZe: 24px"><strong>碰撞检测：不只用于碰撞</STRONG></FONT><br />
&nbsp;&nbsp;&nbsp;
当你看到碰撞检测这个词，自然会想到两个物体相互碰撞。特别在使用基于距离的检测时，我们更容易想成两个物体的空间关系。你也许不只对碰撞感兴趣，更对两个物体是否在某个范围感兴趣。比如在游戏中，为了能看到敌人，那么它必须有许多像素是“好人”。</P>
<p>&nbsp;&nbsp;&nbsp;
我们仍然可以使用基于网格的碰撞检测，但是不再由物体的大小决定网格的大小，最重要的替换是两物体间的距离。在 Making Things
Move 中有一个粒子引力的示例，是从 Jared Tarbell 的 Node Garden （<a HREF="http://www.levitated.net/">www.levitated.net</A>）中获得的灵感。我发现这是一个转换网格完美的例子，于是就把它写了出来。首先来看一下原始的代码：<br />

package {<br />
&nbsp;import flash.display.Sprite;<br />
&nbsp;import flash.display.StageScaleMode;<br />
&nbsp;import flash.display.StageAlign;<br />
&nbsp;import flash.events.Event;<br />
&nbsp;import flash.geom.Point;</P>
<p>&nbsp;[SWF(backgroundColor=0x000000)]<br />
&nbsp;public class NodeGardenLines extends Sprite
{<br />
&nbsp;&nbsp;private var
particles:Array;<br />
&nbsp;&nbsp;private var numParticles:uint =
30;<br />
&nbsp;&nbsp;private var minDist:Number =
100;<br />
&nbsp;&nbsp;private var springAmount:Number
= .001;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function
NodeGardenLines() {<br />
&nbsp;&nbsp;&nbsp;init();<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;private function init():void
{<br />
&nbsp;&nbsp;&nbsp;stage.scaleMode
= StageScaleMode.NO_SCALE;<br />
&nbsp;&nbsp;&nbsp;stage.align =
StageAlign.TOP_LEFT;<br />
&nbsp;&nbsp;&nbsp;particles =
new Array();<br />
&nbsp;&nbsp;&nbsp;for(var
i:uint = 0; i &lt; numParticles; i++) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;//
创建所有粒子<br />
&nbsp;&nbsp;&nbsp;&nbsp;var
particle:Ball = new Ball(3, 0xffffff);<br />
&nbsp;&nbsp;&nbsp;&nbsp;particle.x
= Math.random() * stage.stageWidth;<br />
&nbsp;&nbsp;&nbsp;&nbsp;particle.y
= Math.random() * stage.stageHeight;<br />
&nbsp;&nbsp;&nbsp;&nbsp;particle.vx
= Math.random() * 6 - 3;<br />
&nbsp;&nbsp;&nbsp;&nbsp;particle.vy
= Math.random() * 6 - 3;<br />
&nbsp;&nbsp;&nbsp;&nbsp;addChild(particle);<br />

&nbsp;&nbsp;&nbsp;&nbsp;particles.push(particle);<br />

&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;addEventListener(Event.ENTER_FRAME,
onEnterFrame);<br />
&nbsp;&nbsp;}</P>
<p>&nbsp;&nbsp;private function
onEnterFrame(event:Event):void {<br />
&nbsp;&nbsp;&nbsp;graphics.clear();<br />

&nbsp;&nbsp;&nbsp;for(var
i:uint = 0; i &lt; numParticles; i++) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;//
更新所有的粒子，并控制在屏幕内<br />
&nbsp;&nbsp;&nbsp;&nbsp;var
particle:Ball = particles[i];<br />
&nbsp;&nbsp;&nbsp;&nbsp;particle.x
+= particle.vx;<br />
&nbsp;&nbsp;&nbsp;&nbsp;particle.y
+= particle.vy;<br />
&nbsp;&nbsp;&nbsp;&nbsp;if(particle.x
&gt; stage.stageWidth) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;particle.x
= 0;<br />
&nbsp;&nbsp;&nbsp;&nbsp;}
else if(particle.x &lt; 0) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;particle.x
= stage.stageWidth;<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />

&nbsp;&nbsp;&nbsp;&nbsp;if(particle.y
&gt; stage.stageHeight) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;particle.y
= 0;<br />
&nbsp;&nbsp;&nbsp;&nbsp;}
else if(particle.y &lt; 0) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;particle.y
= stage.stageHeight;<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />

&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />

<strong>&nbsp;&nbsp;&nbsp;for(i=0;
i &lt; numParticles - 1; i++) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;var
partA:Ball = particles[i];<br />
&nbsp;&nbsp;&nbsp;&nbsp;for(var
j:uint = i + 1; j &lt; numParticles; j++) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//
粒子间的弹性运动<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var
partB:Ball = particles[j];<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;spring(partA,
partB);<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />

&nbsp;&nbsp;&nbsp;}</STRONG><br />

&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;private function
spring(partA:Ball, partB:Ball):void {<br />
&nbsp;&nbsp;&nbsp;var dx:Number
= partB.x - partA.x;<br />
&nbsp;&nbsp;&nbsp;var dy:Number
= partB.y - partA.y;<br />
&nbsp;&nbsp;&nbsp;var
dist:Number = Math.sqrt(dx * dx + dy * dy);<br />
&nbsp;&nbsp;&nbsp;if(dist
&lt; minDist) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;//
如果粒子足够近，则绘制一条线并面对面做弹性运动<br />
&nbsp;&nbsp;&nbsp;&nbsp;graphics.lineStyle(1,
0xffffff, 1 - dist / minDist);<br />
&nbsp;&nbsp;&nbsp;&nbsp;graphics.moveTo(partA.x,
partA.y);<br />
&nbsp;&nbsp;&nbsp;&nbsp;graphics.lineTo(partB.x,
partB.y);<br />
&nbsp;&nbsp;&nbsp;&nbsp;//
加速度与距离成正比<br />
&nbsp;&nbsp;&nbsp;&nbsp;var
ax:Number = dx * springAmount;<br />
&nbsp;&nbsp;&nbsp;&nbsp;var
ay:Number = dy * springAmount;<br />
&nbsp;&nbsp;&nbsp;&nbsp;//
在每个轴上加上加速度<br />
&nbsp;&nbsp;&nbsp;&nbsp;partA.vx
+= ax;<br />
&nbsp;&nbsp;&nbsp;&nbsp;partA.vy
+= ay;<br />
&nbsp;&nbsp;&nbsp;&nbsp;partB.vx
-= ax;<br />
&nbsp;&nbsp;&nbsp;&nbsp;partB.vy
-= ay;<br />
&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;}<br />
&nbsp;}<br />
}<br />
我不去深入解释这段代码。主要就是创建一些粒子，并让它们运动。如果两个粒子间的距离小于特定范围，它们将相互作弹性运动，然后在它们之间绘制一条线。粒子越近，相互作用越大，线条也就越亮。注意，舞台的颜色在类的顶部用
SWF 元数据标签被设置为黑色：<br />
&nbsp;&nbsp;&nbsp;
[SWF(backgroundColor=0x000000)]<br />
这个元数据标签会在 Flex Builder 或 Flash CS4 中起作用，但是 Flash CS3
会忽略它，需要你在属性面板中设置背景颜色。由于我们要使用 Flash 10 的某些新特性，我就假设大家使用的是 Flash CS4
了。</P>
<p>&nbsp;&nbsp;&nbsp;
这个文件同样用到一个类名为 Ball，这个类与前面的有一点点不同，但效果同样不错。</P>
<p>&nbsp;&nbsp;&nbsp; 这个例子使用了
30 个粒子，在 100
像素或更少的距离时产生反作用力。例子本身看起来很好不需要什么改进。下面让我们改变一些参数让它看起来不那么舒服：<br />
&nbsp;&nbsp;&nbsp; private var
numParticles:uint = 500;<br />
&nbsp;&nbsp;&nbsp; private var
misDist:Number = 50;<br />
将粒子的数量增加到 500 个，然后将距离设置为 50。如果你使用 Flash
官方的开发环境，可能需要把舞台的尺寸设置大一点儿才能让这些粒子不那么拥挤——比如 1000 &times;
800。当运行这个文件的时候，你将感到非常的卡，也许每秒只有几帧。</P>
<p>&nbsp;&nbsp;&nbsp;
现在看看如何让网格级碰撞检测来帮助我们。所有粒子间的循环判断用粗体字标注。这是我们需要用网格替代的部分。这部分要替换成网格，同时还将做一些简单的改进将数组变成向量。如果你很好奇，可以先试一下将
Array 转换为 Vector.&lt;DisplayObject&gt;
对比效率提高了多少。你也需要导入 flash.display.DisplayObject 类，并在使用的时候将对象转换为 Ball
类，如下：<br />
&nbsp;&nbsp;&nbsp; var
particle:Ball = particles[i] as Ball;<br />
在我的测试中，虽然有些改进，但是太小了。500 个对象的双重循环每帧需要 124750
次判断。我们势必要减少这个数量，因为真正可能碰撞的物体比例很小。基于网格的碰撞检测将判次数减少到 10000
以下。下面是代码，在一个新的 NodeGardenGrid 类中（加粗的部分是和前面不同的地方）：<br />
package {<br />
&nbsp;<strong>import
flash.display.DisplayObject;</STRONG><br />
&nbsp;import flash.display.Sprite;<br />
&nbsp;import flash.display.StageScaleMode;<br />
&nbsp;import flash.display.StageAlign;<br />
&nbsp;import flash.events.Event;<br />
&nbsp;import flash.geom.Point;</P>
<p>&nbsp;[SWF(backgroundColor=0x000000)]<br />
<strong>&nbsp;public class NodeGardenGrid extends
Sprite {<br />
&nbsp;&nbsp;private var
particles:Vector.&lt;DisplayObject&gt;;<br />

&nbsp;&nbsp;private var numParticles:uint =
500;<br />
&nbsp;&nbsp;private var minDist:Number =
50;</STRONG><br />
&nbsp;&nbsp;private var springAmount:Number
= .001;<br />
&nbsp;&nbsp;private var
grid:CollisionGrid;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;public function
NodeGardenGrid() {<br />
&nbsp;&nbsp;&nbsp;init();<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;private function init():void
{<br />
&nbsp;&nbsp;&nbsp;stage.scaleMode
= StageScaleMode.NO_SCALE;<br />
&nbsp;&nbsp;&nbsp;stage.align =
StageAlign.TOP_LEFT;<br />
&nbsp;&nbsp;&nbsp;<br />
<strong>&nbsp;&nbsp;&nbsp;grid
= new CollisionGrid(stage.stageWidth, stage.stageHeight, 50);<br />
&nbsp;&nbsp;&nbsp;particles =
new
Vector.&lt;DisplayObject&gt;();</STRONG><br />

&nbsp;&nbsp;&nbsp;for(var
i:uint = 0; i &lt; numParticles; i++) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;//
创建所有的粒子<br />
&nbsp;&nbsp;&nbsp;&nbsp;var
particle:Ball = new Ball(3, 0xffffff);<br />
&nbsp;&nbsp;&nbsp;&nbsp;particle.x
= Math.random() * stage.stageWidth;<br />
&nbsp;&nbsp;&nbsp;&nbsp;particle.y
= Math.random() * stage.stageHeight;<br />
&nbsp;&nbsp;&nbsp;&nbsp;particle.vx
= Math.random() * 6 - 3;<br />
&nbsp;&nbsp;&nbsp;&nbsp;particle.vy
= Math.random() * 6 - 3;<br />
&nbsp;&nbsp;&nbsp;&nbsp;addChild(particle);<br />

&nbsp;&nbsp;&nbsp;&nbsp;particles.push(particle);<br />

&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;addEventListener(Event.ENTER_FRAME,
onEnterFrame);<br />
&nbsp;&nbsp;}</P>
<p>&nbsp;&nbsp;private function
onEnterFrame(event:Event):void {<br />
&nbsp;&nbsp;&nbsp;graphics.clear();<br />

&nbsp;&nbsp;&nbsp;for(var
i:uint = 0; i &lt; numParticles; i++) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;//
更新粒子，包装舞台<br />
<strong>&nbsp;&nbsp;&nbsp;&nbsp;var
particle:Ball = particles[i] as
Ball;<br /></STRONG>&nbsp;&nbsp;&nbsp;&nbsp;particle.x
+= particle.vx;<br />
&nbsp;&nbsp;&nbsp;&nbsp;particle.y
+= particle.vy;<br />
&nbsp;&nbsp;&nbsp;&nbsp;if(particle.x
&gt; stage.stageWidth) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;particle.x
= 0;<br />
&nbsp;&nbsp;&nbsp;&nbsp;}
else if(particle.x &lt; 0) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;particle.x
= stage.stageWidth;<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />

&nbsp;&nbsp;&nbsp;&nbsp;if(particle.y
&gt; stage.stageHeight) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;particle.y
= 0;<br />
&nbsp;&nbsp;&nbsp;&nbsp;}
else if(particle.y &lt; 0) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;particle.y
= stage.stageHeight;<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />

&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;//
确定哪些粒子需要检测<br />
<strong>&nbsp;&nbsp;&nbsp;grid.check(particles);<br />

&nbsp;&nbsp;&nbsp;var
checks:Vector.&lt;DisplayObject&gt; =
grid.checks;<br />
&nbsp;&nbsp;&nbsp;trace(checks.length);<br />

&nbsp;&nbsp;&nbsp;var
numChecks:int = checks.length;<br />
&nbsp;&nbsp;&nbsp;for(i=0; i
&lt; numChecks; i += 2) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;var
partA:Ball = checks[i] as Ball;<br />
&nbsp;&nbsp;&nbsp;&nbsp;var
partB:Ball = checks[i + 1] as Ball;<br />
&nbsp;&nbsp;&nbsp;&nbsp;spring(partA,
partB);<br />
&nbsp;&nbsp;&nbsp;}</STRONG><br />

&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;private function
spring(partA:Ball, partB:Ball):void {<br />
&nbsp;&nbsp;&nbsp;var dx:Number
= partB.x - partA.x;<br />
&nbsp;&nbsp;&nbsp;var dy:Number
= partB.y - partA.y;<br />
&nbsp;&nbsp;&nbsp;var
dist:Number = Math.sqrt(dx * dx + dy * dy);<br />
&nbsp;&nbsp;&nbsp;if(dist
&lt; minDist) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;graphics.lineStyle(1,
0xffffff, 1 - dist / minDist);<br />
&nbsp;&nbsp;&nbsp;&nbsp;graphics.moveTo(partA.x,
partA.y);<br />
&nbsp;&nbsp;&nbsp;&nbsp;graphics.lineTo(partB.x,
partB.y);<br />
&nbsp;&nbsp;&nbsp;&nbsp;var
ax:Number = dx * springAmount;<br />
&nbsp;&nbsp;&nbsp;&nbsp;var
ay:Number = dy * springAmount;<br />
&nbsp;&nbsp;&nbsp;&nbsp;partA.vx
+= ax;<br />
&nbsp;&nbsp;&nbsp;&nbsp;partA.vy
+= ay;<br />
&nbsp;&nbsp;&nbsp;&nbsp;partB.vx
-= ax;<br />
&nbsp;&nbsp;&nbsp;&nbsp;partB.vy
-= ay;<br />
&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;}<br />
&nbsp;}<br />
}<br />
确认你的影片是以 Flash 10 格式发布的，并且 CollisionGrid.as 文件在你的类路径中，这样的结果会是每帧
6500 次。注意网格的大小是 50，与 minDist
相同。这段特别的代码不依赖粒子的半径，只计算它们间的距离。大家最好做一些实时的测试并调整网格的大小直至性能最佳。较大的格子会有更多的碰撞检测，却会减少数组循环次数。通过调整会得到一个最佳性能的平衡点。即使在最小值
50，它的表现也相当不错。</P>
<p>&nbsp;</P>
<p><font STYLE="FonT-siZe: 24px"><strong>总结</STRONG></FONT><br />
&nbsp;&nbsp;&nbsp;
至此高级碰撞检测就讨论完了。这两种技术（基于位图和网格的碰撞检测）有很多方法可以使用，给大家启蒙的例子中概念不多。同时，最重要的是领悟其中的思想，尤其在基于网格的系统中，就是要测试，测试；考量性能；微调碰撞检测引擎。并且要记住这种方法在物体多的时候表现最佳，但是系统开销要比物体数量更重要。</P>
<p>接下来是一个完全不同的主题，转向行为。我们也将涉及一些人工智能方面的内容。</P>]]></description>
            <author>FL车在臣</author>
            <category>AdvancED_AS3_Animation!</category>
            <comments>http://blog.sina.com.cn/s/blog_3ecb9b110100iss3.html#comment</comments>
            <pubDate>Wed, 26 May 2010 14:19:44 +0800</pubDate>
            <guid>http://blog.sina.com.cn/s/blog_3ecb9b110100iss3.html</guid>
        </item>
    </channel>
</rss>

