Transcript Lecture 6
COIT23003 Games Development
8. Elaboration: Behaviour
References
• Meigs, T., 2003. Ultimate Game Design:
Building Game Worlds, McGraw Hill.
• Fairclough, C. et al, 2001. Research Directions
for AI in Computer Games
http://www.comp.dit.ie/bmacnamee/papers/
ResearchDirectionsForGameAI.pdf
• McGugan, W., 2007. Beginning Game
Development with Python and Pygame: From
Novice to Professional. Apress.
Behaviour
• Entity behaviour is critical for providing an
interesting/realistic/challenging gaming
experience
• Two major approaches:
– Scripting
– Artificial Intelligence (AI)
Scripted Behaviour
• Entity behaviours are predefined and hard
coded, (ie scripted) eg
If (monster.canSeePlayer)
Monster.attack();
Else if (monster.canSeeWeapon()
…
• Not to be confused with scripting languages
Scripting Languages
• Scripting languages are languages that are
– (Perceived to be) simpler to use (eg JavaScript, Python,
Lua, …) than “real” languages (C++, Java, etc) and/or
– Used to control applications (eg DOS Batch Language,
Visual Basic) or libraries (eg Python)
• Games development typically employs scripting
languages because of their “simplicity”. Typically, the
whole game is developed in the scripting language,
although languages like Python allow you to access
libraries developed in other languages.
Scripting Languages
• Eg Pygame is a wrapper for the SDL library
(written in C/C++)
Class Discussion
• What do you think might be the
pluses/minuses in developing games using
Python/Pygame vs C++/SDL?
Scripted Behaviour
• Scripted behaviours can occur either through
– Entity deliberation (what should I do next) or
– Environmental triggers (what should I do in
response to in response to event x)
• The two approaches are not exclusive –
triggers can result in deliberation (I’ve been
shot at, what do I do?). The issue is that with
scripting, the choices have been determined
(and hard coded) by the developer
Scripted Behaviour: Summary
• Introducing variability into entity behaviours
can be challenging
• Scripted behaviour is simple and
straightforward to implement
Intelligent Behaviour
• Intelligent behaviour (among other things)
requires the ability to plan and to learn. The
routine implementation of these abilities is a
long way off, so they are rarely seen in
computer games. Rather, what we do see is
the incorporation of simple and robust
techniques from AI that make it easier for
developers to produce entities that appear to
behave intelligently.
AI Techniques
Examples of the use of commonly used AI
techniques include
• Specialised search techniques (eg A*) for
route planning
• Finite state machines for structuring entity
behaviour
• Flocking algorithms for coordinated group
movements
Implementation
• For an example of simple state machine
implementation, refer to McGugan, Chapter 7.
• Discussion question:
– Is there any fundamental difference between
using state machines or scripting to represent
behaviour? i.e. are entities that employ state
driven behaviour any more “intelligent” than
entities that employ scripting?
Applications
• Game AI is different to conventional applied AI
– the objective is to produce realistic and
interesting behaviour as opposed to solving
difficult problems. Hence AI might be used to
produce
– Challenging, but not invincible entities
– “Dumb” entities
– Entities that predict what the player might do next
(Fairclough et al, 2007)
Intelligent Behaviour: Summary
• Focus remains on simple, robust techniques
(Fairclough et al, 2007)
• Provision of “real” intelligence remains a
research issue
A Design Example
• Meigs, pp. 154-159
• Discussion Question:
• Variability is introduced through random number
generation. Do you think that this, by itself, would
provide for interesting gameplay? How might you
improve the gameplay experience?