• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            天行健 君子當(dāng)自強(qiáng)而不息

            Controlling Players and Characters(13)

             

            Automatic Control of Characters
             

            Ever get the feeling you aren’t in control? With your role-playing game that just
            might seem like the case. However, when scripting comes into play, you want to
            control the PCs at times—for example, to advance the story in some way. This
            involves automatic control.

            Automatic control of a character means that the game decides which control method to
            use and where to move the character. Automatic control takes place in the artificial
            intelligence settings. To temporarily control a PC, you can use the following steps:


            1. Change the PC to an NPC.
             

            2. Change the artificial intelligence setting of the PC (now an NPC) to follow
            a route (or other movement type).

            3. Perform movements and continue updating until the last route point is
            reached or until you want to stop using automatic control.
             

            4. Switch the character back to a PC type.

             

            Conversation among Characters
             

            That’s right, chat it up! Character interaction is also a major part of a role-playing
            game, but have you seriously thought about how to implement conversation into a
            game? Thankfully, there are easy ways to make your characters talk to each other,
            and not wanting to stray from the easy path, let me show you some of the basic
            character conversation methods.

             

            The Talking Dummy
             

            The easiest conversation method to use has got to be the talking dummy. Every roleplaying
            game has at least one character (the talking dummy) that says the same
            thing again and again; no intelligence is involved. Programming a talking dummy
            into your game is as easy as assigning a line of text that is displayed whenever a
            character is spoken to.

            The problem is that the talking dummy can say only one thing at a time, which
            isn’t very useful. Also, rather than inserting the code for a character’s dialogue into
            the game engine, you can use an external source for the conversation text, which
            takes us to the next topic, how to improve the basic talking dummy design.

             

            Script-Driven Talking Dummies
             

            You knew this was coming, didn’t you? Scripting is the heart and soul of computer
            role-playing games, so you should try to use it to the fullest degree, including when
            your characters converse with each other. By assigning a script to each character
            in your game, the scripting engine can take the basic talking dummy concept and
            expand it.

            Adding the ability to use conditional code in the script enables talking dummies to
            decide what to say based on internal flags and variables. Say that you have a script
            that tracks the status of a flag, a flag that states whether you’ve visited a nearby town.


            When it comes to a script-driven talking dummy, your script engine decides which
            text to display based on the flag it receives. That character (the dummy) tells you
            to visit the nearby town, or if you’ve been to the town, the dummy might comment
            on the town’s population. One such script might look something like this (in a textual
            format):


            If flag 0 is TRUE then
              Print message “I see you’ve visited GranWell to the south!”
            Else
              Print message “You should head south to the town GranWell.”
            Endif

            As you can see in the preceding script, a flag (flag 0) tracks a TRUE or FALSE value
            (the flag is set to TRUE whenever the player visits the town GranWell).

             

            Displaying Conversational and Other Text
             

            No matter which way you look at it, you need to display the conversation among
            characters in one way or another. You know the routine—whenever your player
            talks to another character, a small window pops up and displays text. Every once in
            a while, the character can choose from a list of actions displayed, and the conversation
            goes on.

            Using 2-D techniques, you can display a conversation window (or text window to be
            more precise), with the conversation text displayed inside the window. Because
            only so many text characters can fit within the window at one time, multiple windows
            are displayed with each page holding a portion of the complete conversation.
            A player pushes a button to navigate through each page of text that is displayed in
            the window. When the text finishes, the conversation ends.

            To keep things simple, I developed a system (a text window class called cWindow)
            that can render a text window of any size anywhere on the display. This window
            can be moved at any time, and may contain any string of text you assign. As a
            bonus, the window can act as a text-bubble of sorts, whereas the window has a
            pointer to a talking character.Following snap shows the text window class in action.

            Technically, the window is two rectangles drawn on top of each other, with both
            rectangles contained within a vertex buffer. One rectangle is white and is slightly
            larger than the inner colored rectangle. When you draw them in order (from the
            larger white rectangle to the smaller colored window), you achieve a bordered window
            look as shown in prior snap.

            The window text is drawn on top of the two windows. Text can be set at any time, but
            presetting a string of text gives you the extra ability of calculating a window size that’s
            guaranteed to fit the entire string of text within the window. Once you define a window’s
            size, you can dynamically change the string of text drawn without re-creating
            the vertex buffer defining the window.

            Realistically, you can use the text window for anything. Say that you want to open a
            window to display an image using a text window class and texture object. It becomes
            a matter of drawing one and then the other.


            posted on 2007-11-14 17:12 lovedday 閱讀(210) 評論(0)  編輯 收藏 引用


            只有注冊用戶登錄后才能發(fā)表評論。
            網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


            公告

            導(dǎo)航

            統(tǒng)計(jì)

            常用鏈接

            隨筆分類(178)

            3D游戲編程相關(guān)鏈接

            搜索

            最新評論

            97精品伊人久久久大香线蕉 | 久久99热只有频精品8| 精品多毛少妇人妻AV免费久久| 久久久久青草线蕉综合超碰 | 久久综合久久综合久久综合| 精品久久久久久久中文字幕 | 韩国三级大全久久网站| 欧美777精品久久久久网| 久久综合久久鬼色| 欧美一区二区三区久久综| 久久精品国产一区二区三区不卡| 一本色道久久88—综合亚洲精品| 久久综合久久综合九色| 久久精品国产亚洲AV忘忧草18| 国产激情久久久久影院老熟女免费 | 久久亚洲欧美国产精品| 精品无码人妻久久久久久| 精品久久人妻av中文字幕| 无码人妻久久一区二区三区蜜桃| 久久精品aⅴ无码中文字字幕重口| 一本久久免费视频| 久久99精品久久久久久秒播| 久久精品国产99久久无毒不卡| 久久亚洲精品国产亚洲老地址| 国产精品VIDEOSSEX久久发布| 精品人妻久久久久久888| 亚洲熟妇无码另类久久久| 中文精品99久久国产| 久久久WWW免费人成精品| 狠狠精品干练久久久无码中文字幕| 久久久久亚洲精品天堂| 久久精品国产亚洲αv忘忧草 | 久久97精品久久久久久久不卡| 久久精品国产亚洲AV高清热| 亚洲AV无码久久精品狠狠爱浪潮| 中文成人无码精品久久久不卡| 无码任你躁久久久久久老妇| 人妻少妇精品久久| 精品国产乱码久久久久软件| 亚洲精品无码久久毛片 | 国内精品久久久久久久97牛牛|