28.10.2014 Views

Game Design and Artificial Intelligence - Bournemouth University

Game Design and Artificial Intelligence - Bournemouth University

Game Design and Artificial Intelligence - Bournemouth University

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Game</strong> <strong>Design</strong> <strong>and</strong> <strong>Artificial</strong> <strong>Intelligence</strong><br />

David Hopkins<br />

Fig 2.2 – The layout for the crew AI working state.<br />

“ Because game character behaviour can be modeled (in most cases) as a sequence of different<br />

character “ mental states” – where change in state is driven by the actions of the player or other<br />

characters, or possibly some features of the game world – game programmers often find that finitestate<br />

machines are a natural choice for defining character AI.” – p284 AI wisdom [Houlette00]<br />

For the Crew AI, there are two FSMs. One that isn't fully implemented in the game which is the<br />

basic FSM for working state (see fig 2.2), the second is the emotion state machine. The working<br />

FSM is designed to find out whether an NPC is working on a job (eg. Gunning, piloting etc.) or is<br />

idle due to refusing orders or finishing a current one or if it is moving to a new location based on a<br />

new order. The emotion state machine works slightly differently but uses the same theories.<br />

<strong>Artificial</strong> Emotion.<br />

As previously mentioned in the design, the artificial emotion is a method for the NPCs to judge the<br />

player through the decisions made based on his statistics. Each NPC carries an OPINION statistic<br />

on each character in the crew, including the player. This counter, between 0 <strong>and</strong> 100, changes as<br />

the game progresses based on the input from the player <strong>and</strong> events happening through the ship. The<br />

emotion state machine then uses this counter as part of the calculations to figure if there any<br />

changes in emotional states. The class for the AI is defined below:<br />

class crewAI : public crewMember<br />

{<br />

public:<br />

std::string getType(void);<br />

int state;<br />

int emotion_state;<br />

int wages;//WAGES is 1­4, 1 being minimum, 4 being max<br />

int aggression;// use this to judge orders.<br />

int discipline;// <strong>and</strong> this!<br />

bool refuse_order;<br />

int ORDER;<br />

double OPINION_player;<br />

double OPINION_crewAI;<br />

Page 14 of 22

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!