CS/IMGD 4100 (B 14)
Homework Assignment #6
Due by Web Turn-In: Midnight, Sunday, November 16
(See general homework instructions for turn-in details.)
The purpose of this assignment is to familiarize you with the simple use of Lua for scripting in games. You will modify the code in the ScriptedStateMachine folder to add support for global and blip states to the state machine implementation and use these new facilities to define a new behavior for the Miner character.
The new Miner behavior is frequent urination. After a fixed number of update cycles, the Miner will need to interrupt his current activity, empty his bladder, and then return to whatever he was doing before.
Here's some implementation tips:
- First, extend the code in ScriptedStateMachine.h to remember the previous state and to check for a global state, as in the state machine implementation used in WestWorld (except that the global state in this case will be scripted, just like the other states in ScriptedStateMachine).
- Expose the RevertToPreviousState method in Lua, so that "blip" states can be implemented in scripts.
- Add a private int bladder member to Miner and appropriate public methods, such as bool BladderFull, void EmptyBladder, void FillBladder(int), and expose them in Lua.
- Define a new state script in StateMachineScript.lua implementing the urination behavior and make this the global state in the Miner's state machine.
What to Turn In
- Output file.
- include 'output.txt' file at toplevel of submitted zip file containing output of successful run, which demonstrates the new Miner behavior.
- see cut & paste instructions in Hello West World assignment
- Modified ScriptedStateMachine folder only (do not include Debug or ipch subfolders or .sdf or .ncb files--see homework instructions).
- Don't forget to add a brief comment starting with '//*' before every change or addition you made to the original downloaded source files (one comment covering multiple lines is fine)
Please post any questions to the myWPI forum for the course.
- 4 points - Correct and complete implementation.
- 1 point - Software engineering quality (modularity, comments, coding style).