Technical Portfolio - Programming 2

Programming part 2/2

Event System

The Event System is a key system of the game which allows processing of user input with regards to components.  The Input System sends across references to the just interacted with object and whether it is being attached or detached.

The Event System then processes this information: firstly determining what the object was, e.g. an ABC, a button or a wire (wires are then further broken down into Ethernet, CommsDB9 and VDC24).

Secondly, an appropriate response is made, e.g. if a button was clicked, that buttons activation script is called.

Thirdly, it's important to keep track of the users progress in the puzzle, so the relevant information is then passed into the State Monitor in two variables;

an enum of what state is being changed and a true/false representing attachment/detachment respectively.

The State Monitor further processes these events and determines how far into the puzzle the player is. The State Monitor has two lists.

Lists.PNG

One list contains the order of disassembly and repair, the other for reassembly. Each step has an importance value used for scoring.

When events are processed, it's determined whether this event was the correct or incorrect step to perform. Then this state is removed from the list. When all of the disassembly and repair steps have been completed, the State Monitor then switches to track the reassembly steps. Scoring is applied based on whether the action was correct or incorrect.

The Scoring System is a relatively simple system which can either decrease or increase a users score, with a Scoring Importance multiplier. This system can be called by any other script which allows the game to apply scores based on more than just puzzle steps, such as asking G.U.S. (the Guided User System) for help.