Question
Genetic algorithms are used to influence the behaviour of non-playing characters (NPCs) in role-playing games (RPGs). NPCs are computer-controlled characters that the player interacts with but does not control.
A series of generic NPCs are being developed for use in any multi-player RPG. The environmental and social interactions of these NPCs are being developed using supervised learning and will continue to develop as the game is played.
Once NPCs have completed their supervised training, they are placed in a dynamic game environment. Each NPC learns to adapt its behaviour to its environment.
At this stage of the training, NPCs will not be verbally communicating with other characters in their environment.
a. Outline two advantages of developing NPCs using genetic algorithms.[4]
b. Explain how supervised learning of a genetic algorithm could be used to support the way NPCs learn.[6]
c. Describe the way an NPC in a game could adapt its behaviour when moving and interacting with its environment.[6]
d. The last stage of NPC development is verbal communication with player characters and other NPCs. To assist with this process, it was decided [4]
to explore research related to chatbots.
Explain the benefits of giving NPCs the functionality of chatbots.
▶️Answer/Explanation
Ans:
a. )
No need to anticipate and code in advance the reactions that NPCs need to display; since the supervised training will ensure the characters can adapt their responses;
Save programmers development time; because NPCs can be used in similar RPG games;
Provides greater game realism; NPC characters would evolve to behave more like real people;
NPCs would remember previous encounters with players; thus, altering their gameplay rather than running through a loop;
b. )
Start with a set of “units” (here, NPCs) with some predetermined code/behaviour with added randomness / genetic algorithms work successively towards a solution from a starting point;
Apply a process of selection to the units, so that the probability of survival depends on their success against some predetermined criteria; Supervised learning has training data with a known set of responses to a known set of problems; The fitness function (defined by the programmers) limits the adaptability of a given population of NPCs to the skills or tasks defined by the fitness function;
A (fitness) function is used to measure the effectiveness of a solution / offspring (respawned NPCs) are evaluated using a fitness function; The best solutions are retained / worse solutions are discarded / the most adaptive NPCs will remain in the population and others removed (die); The retained solutions are mutated (randomness) to generate another set of solutions / retained NPCs are mutated and respawned / recloned; This process is repeated until the best solution is identified / repeated until the most adaptable NPC model is identified;
Accept other reasonable reasons or examples.
c. )
The NPC makes a random set of moves;
Records the location/identity of objects relative to its current position;
Building up a map of identifyable surrounding objects;
This is repeated until all objects in the space have been placed in distance and direction from a starting point;
The NPC would learn how to react to the object (e.g. swim in a river / walk on a path);
NPC would learn where it could walk and where it could not (e.g. river would need to be avoided);
NPCs that die could be regenerated from ones that had avoided dying up to that point in the game;
NPC would adapt to a changing environment e.g. a house built in a game;
d. )
Chatbots are designed to output language in response to human language;
Most NPC conversations are scriptive speeches / repetitive…
so using chabots will add more realism to the game;
NPCs could verbally communicate in script or sound form;
There would still need to be some hardcoded responses that relate to the game storyline;
Natural language processing (NLP) could be applied to chatbot conversations;
Question
Optical character recognition (OCR) is a method where printed text or handwritten text is converted to machine-encoded text.
Recognizing handwritten characters presents more of a problem because people have different handwriting styles.
For example, the digitized handwritten letter $\mathrm{X}$ in Figure 3 does not exactly match the digitized letter $\mathrm{X}$ in Figure 4 .
Artificial neural networks (ANNs) can be used to assist with recognizing handwritten characters that do not exactly match the expected pattern.
Predictive text, where the computer predicts the next word in the sentence, can be programmed to utilize a neural network.
The sentence “The child is feeling” is entered into an application that uses predictive text and three options are suggested: better, like, a. Upon entering the two characters “hu” the word hungry issuggested.
a. Outline one problem that may lead to printed text characters not being detected correctly.[2]
b. Outline why an ANN can be used to overcome the challenges outlined in this scenario.[2]
c. Explain how ANN pattern recognition techniques are applied to ensure that the handwritten letter $\mathrm{X}$ in Figure 3 is recognized as a letter $\mathrm{X}$.
d. Identify two features that would be required by the ANN to predict the next word in the sentence.[2]
e. Explain how the application uses a neural network to suggest suitable words.[6]
f. Outline two potential problems with training the ANN to suggest appropriate words.[4]
▶️Answer/Explanation
Ans:
a. )
Printed text quality may be poor or faint/may use an unusual typeface e.g. BrushScript/ln certain typefaces some characters can look similar e.g.
sans serif;
For example, 5 and S may be confused/Numbers may be confused with letters 1 or I;
b. )
ANN can be trained to recognise handwriting styles / supervised learning;
ANN can learn to apply existing knowledge to new handwriting styles / unsupervised learning;
ANN can recognize parts of the image to determine if it is a match / doesn’t require the entire image to be a match;
c. )
The ANN accesses a database of correctly stored characters;
ANN breaks the image into smaller parts / applies a filter (2 or 3 pixels) to a section of the image;
Calculate whether the pixels match / multiple each image pixel to the feature pixel, add them up, divide by number of pixels / perfect match will be 1;
Apply convolution / repeat the application of the filter over and over;
Apply a ReLU (Rectified Linear Units) layer (remove negative values) to reduce the mathematical calculations;
Apply pooling to shrink the image stack;
Use the stack of filter images / convolution layer to see if the image is a match;
d. )
Dictionary of words;
Predictive text algorithms;
The ability to recall the previous words in the sentence / memory;
An understanding of language structure e.g. nouns, verbs, adverbs, etc.;
Previous words must be added back into the neural network;
e.)
If they have used a diagram should include:
Award [1] Input for previous words;
Award [1] Input for new characters the user enters;
Award [1] Hidden layers;
Award [1] Weights inputted into the network;
Award [1] Combining the two inputs;
Award [1] Non-linear regression / sigmoid function;
Award [1] Merge layers to produce output;
Award [1] Back propagation / Output that re-enters the ANN;
f. )
Unsupervised learning may have a poor set of words / text-speak is used;
So the ANN database doesn’t contain text-speak words so doesn’t learn;
Vanishing gradient problem / Exploding gradient problem;
Gradient signal is multiplied many times by weight matrix / The gradient signal can become smaller at every training step (vanishing) / can become excessively large at every training step (exploding) / This can make learning very slow or stops it completely;