IMGD 3000 Project 3

Pyramid!

Dodge the mummy guardians to escape!

Due date: Suday, December 1st (11:59pm)


Top | Setup | State | Mummy | AI | Gameplay | Submission | Grading

Overview

The goal of this project is do hands-on coding of a finite state machine and related game engine code in the context of game AI. Objectives:

Game overview

In Pyramid, you control the Hero, seeking to exit the already plundered tomb. Mummies wandering for all eternity can sense interlopers and seek them out, attacking them until the intruders are dead, dead, dead. Unfortunately for the Mummies, magical Ankhs are scattered throughout the crypt and cause them to cower in fear. Does the Hero make it to the exit safely? The only way to find out is to play ... Pyramid!

Project overview

You are provided with the framework for the game, including the game world with obstacles, the hero that responds to keyboard control, mummies to be dodged and that cause damage, the ankhs that can be picked up, and the exit that causes the game to end. What is not implemented is the behavior (AI) for the mummies. You are to implement their AI in the form of a finite state machine.

You work solo for this project.

Development must be in C++ using either your game engine from Project 2 or the Dragonfly game engine from Project 1.

Tip! If you want to use your engine, you may want to make a static library out of your code. You do not have to do this, but doing so will keep your project 3 separate from your engine code. To do this:

       ar rcs libdragonfly.a Box.o Object.o ...

The result will be a static library you can link in to your Pyramid (or other game).


Setup

To prepare for the project:

  1. Download the game framework code from one of:

  2. Extract by unzipping. Tip! If you put it at the same directory level as Project 1 - Saucer Shoot, the accompanying Makefile and Visual Studio solution should allow compilation without changes.

  3. Compile. Adjust any #include and library directories as needed.

  4. Run. Windows users will need to ensure access to the SFML dll files.

Once successful, you should see a game screen similar to:

The player controls the Hero (in the upper left corner) with arrow keys. Running into the white Mummies will deplete health, depicted at the top of the screen. When health reaches 0, the Hero dies and the game exits. Running over a cyan Ankh starts a countdown timer from 10, but has no other effect at the moment. Running into the green Exit allows the Hero escapes and the game exits.


State Machine Infrastructure

Base Classes

Create base classes that are used by all Dragonfly state machines.

This includes both .h and .cpp definitions. While these class could be in the Dragonfly engine, but it is ok to keep them in game code for this project.

Tip! See the class slide deck for more information.

Game-specific Classes

Create Pyramid-specific classes for the Mummy derived from State:

Stub all of the above out (meaning, make the full .h files but just provide empty definitions in the .cpp files) and make sure it compiles and runs.

In the Mummy class, add attributes for each. e.g.,

// In Mummy.h.
 private:
  StateMachine m_machine;
  StateCower m_state_cower;

and add methods to get a pointer to each state. e.g.:

// In Mummy.h.
 public:
  StateCower *getStateCower();

// In Mummy.cpp
StateCower *Mummy::getStateCower() {
  return &m_state_cower;
}

In the Mummy constructor, set the state machine (m_machine) owner and the initial state to the "wander" state (m_state_wander).

In the Mummy eventHandler(), handle the step event to update the state machine (m_machine) each step.

Again, make sure this all compiles and runs before proceeding.

Tip! See the class slide deck for more information.


Mummy Behavior

Each Mummy should exhibit the following behavior.


Implementing AI

A general methodology for an agent that has artificial intelligence is the "sense-think-act" model. With this model, the agent senses information about the world (e.g., what can be seen or heard), then thinks about what to do (e.g., attack or flee) and then acts appropriately (e.g., run away from an enemy).

Tip! Before starting the AI implementation below, familiarize yourself with the code base.

Sensing

Mummy sensing is done by implementing "seeing" and "sensing" capabilities in the Mummy.

Thinking

Mummy thinking is done by using information from sensing to decided upon what state transitions to make in the Execute() methods in each state.

Acting

Mummy acting is done by implementing actions that move the Mummy in the Execute() methods in each state.

Tip! Draw a picture of the states and transitions before you implement them and refer to the picture while coding.

The exact actions taken when acting (e.g., how, exactly, a Mummy wanders and how fast) is up to you. Similarly for the implementation of seeing and sensing and the ranges. The behavior just needs to achieve the spirit of what is described for a Mummy.

Tip! The file game.h has some game parameters you can use and adjust to suit the gameplay experience you desire.


Gameplay

It should be easy to see the Mummy states in the final game implemented (note, this is not always desirable for games but is fine for this project). This means Meaning wandering Mummies should be visible and the Hero should be able to move to trigger seeking and attacking behavior. The game does not have to be balanced (it can be too easy or too hard to get out).

However, if you are interested in using the Pyramid (with AI) as the foundation for a game, there are numerous possibilities to extend what is already started:

Again, all of the above are optional and not required.


Submission

Your assignment is to be submitted electronically via Canvas by 11:59pm on the day due. You must hand in the following:

  1. Source code:

    Important! Make sure to include all the original code, too, not just the code you added.

    Important! Make sure your code is well-structured and commented. Failure to do so will result in a loss of points.

    Important! You must include Dragonfly (whether your own or the downloaded version) when you submit. You do not need to submit the SFML files.

  2. A README.txt file explaining: platform, files, code structure, how to compile, and anything else needed to understand (and grade) your game.

Important! Make sure your name and WPI user name is included in the README file.

Before submitting, "clean" your project:

This will remove all the .o/.obj files. Failure to do may mean you file is too big to submit!

Use zip to archive your files. For example:

mkdir lastname-proj3
cp * lastname-proj3 // copy all the files you want to submit
zip -r proj3-lastname.zip lastname-proj3 // package and compress

To submit your assignment (proj1-lastname.zip) via Canvas:

Open: Assignment - Project 3 Click: Submit Assignment
Click: Choose File
Select the zip file: proj3-lastname.zip
Click: Submit Assignment

Important - you must click the Submit Assignment button at the end or your file will not be submitted!

When successfully submitted, you should see a message similar to:

Submission
- Submitted!
Dec 3 at 11:51pm


Grading Guidelines

Breakdown

States:

Wander - 20% : The white Mummy wanders in a reasonable fashion, stopping sometimes.

Seek - 15% : The yellow Mummy wanders more quickly, stopping less often.

Attack - 15% : The red Mummy moves quickly seeking collisions with the Hero.

Cower - 10% : The cyan Mummy stops, cowering in place.

Transitions:

Sense - 10% : A Mummy can sense when a Hero is within range.

See - 20% : A Mummy can see a Hero when within range and no obstacles block sight.

Cower - 5% : The Hero has the Ankh.

Resume - 5% : The Hero stops having the Ankh.

Rubric

100-90. The submission clearly exceeds requirements. The game compiles and runs without problems. The Mummy states are all easily verifiable and the transitions work as expected. Actions during the states clearly work as required.

89-80. The submission meets requirements. The game compiles and runs without problems. The Mummy states are verifiable and the transitions mostly work as expected. Actions during the states work as required.

79-70. The submission barely meets requirements. The game compiles and runs but there be warnings. The Mummy states and transitions may not be easily verifiable. Actions during the states work may not work completely as required.

69-60. The project fails to meet requirements in some places. The game compiles but with warnings. The Mummy states and transitions are not verifiable or are missing. Actions during the states do not always work completely as required.

59-0. The project does not meet many of the requirements. The game either does not compile or crashes sometimes. Some Mummy states and transitions are missing. Actions during the states often do not work as required.


Top | Setup | State | Mummy | AI | Gameplay | Submission | Grading

Return to the IMGD 3000 home page