SOFTWARE DEISGN

 

Emotion Module

 

Coding for EVA’s emotional state is done through a huge 8-state machine. The prescalar on Timer0 of the Mega32 chip was set to 64 and made to overflow every 125 ticks. This means that Timer0 overflow interrupt occurs once every 1 ms. The state machine is executed once every millisecond.

 

Overall Game Timers and Counters

 

It is of utmost importance to keep a detailed and clear record of specific physical and emotional timers of EVA. There is an overall clock that counts the number of seconds that have elapsed since the start of the game. This game clock will synchronize every single action-reaction state of EVA. Besides the game clock, there are state-clocks that tracks the amount of time EVA spends in a particular state. It is reset every time EVA transitions from one state to another.

 

Next are the physical clocks of EVA. They are the:

  1. TimeToHungry and TimeToStarve clocks – These two counters keep track of when EVA is going to get hungry next and when EVA is going to starve (i.e. when Health points start decreasing). Upon being fed sufficiently, these counters will be updated to store the next time when EVA gets hungry again.

 

  1. TimeToToilet and TimeToRelease – Tracks when EVA needs to go to the toilet and when EVA will defecate anywhere she pleases and making a mess (i.e. discipline points will start decreasing). If the user brings her to the toilet before she releases her waste, the times will be updated. However if the user fails to bring her to the toilet before the TimeToRelease, EVA will have made a mess and require cleaning up. The counters will also be updated at this point in time.

 

  1. TimeToSick – determines when EVA is going to be sick.

 

 

General Coding in each State

 

Although each state is unique in its own ways, there are several similarities in the code that runs in each of the state. Upon transitioning from one state to another state, there are several variables that will be computed once and ‘remembered’ for that state alone. These variables include:

  1. TimeToNaughty – The time that EVA will become naughty from the current state. This time is computed randomly at each state but ‘better’ states (Happy, Excited) will tend to have longer TimeToNaughty values that ‘worse’ states (Angry, Sad). This is achieved by assigning points to each state and applying reasonable computations such that EVA will take a longer time to become naughty if she is happy or excited.

 

  1. ImprovedState – Randomly determine which state EVA will transition to if the user gives it sufficient attention (Play or Tickle).

 

 

  1. Randomly assigns points (1 or 2) to the ‘Play’ and ‘Tickle’ interaction so that it creates the effect that EVA prefers playing at some points in time and prefers being tickle at others.

 

  1. TimeToDegenerate – The time that EVA will move to a worse state than she is currently in. Thus, this will cause EVA to switch between states even when there is no user interaction. This variable is determined by finding the time that EVA was last in either the Happy or Excited state. If EVA was in the Happy or Excited state more recently, she will take a longer time to degenerate as compared to the case when she was in Happy or Excited state a very long time ago.

 

 

  1. TTDDueToUselessActions – Determines how much ‘useless’ user interactions was given to EVA before she goes to a worse state. Useless interactions is basically defined as interactions with EVA that has no value to her (feeding when she is not hungry, bringing her to the toilet when she does not need to go).

 

The above variables are the most basic variables that are repeated in every state. However their method of computation changes depending on the state as described above. Nevertheless, all these values are computed using a random number generator multiplied by some predefined weight.

 

Thus, at the first entry into a state from another, all these variables are predetermined, and as long as EVA remains in the same state, she will transition to other states depending on which counter (variable) is up. However upon leaving the state, a whole new set of values are computed in the new state.

 

Besides these once-through variables in each state, there are other similar computations in every state. They include:

  1. Counting the number of attention-points given to EVA at each state. Attention points are defined by the number of play or tickle-button presses multiplied by the randomly assigned point to that action (see point 3 above).
  2. Counting the number of useless actions given by the user in that state.

 

Similar State Transition Condition Checks

 

In every state, there is a set of basic checks to determine when EVA needs to respond to the user. The most basic of these checks are those that takes care of her physical needs. Thus when any of the counters that track her physical well-being is up, she will demand an appropriate user interaction.

 

Hungry Timer

For example, if the TimeToHungry timer is up, EVA will display a ‘hungry-indicator’, telling the user that she needs to be fed. If the user fails to feed her past her hunger-level when the TimeToStarve is up, another counter will be activated to determine the amount of time EVA has been starving. EVA will then transition to either the Sad or Angry state. Based on a randomly generated cut-off point, when the amount of time EVA has been starving exceeds that level, EVA’s health will drop by 1 point. EVA’s health will continue to drop until the user feeds her.

 

Toilet Timer

Very similar to the hungry timer, when EVA needs to go to the toilet, she will display an urgent-indicator and demand the user’s attention. If the user fails to bring her to the toilet by the time the variable TimeToRelease is up, EVA will defecate and make a mess which requires cleaning up. EVA will also transition to either the Sad or Angry state. Again, a counter will count the amount of time the user takes to clean up the mess. If the time exceeds a randomly generated cut-off point, EVA’s discipline will decrease by 1 point.

 

Sick Timer

The description for the sick timer is identical to the above 2 timers, except that the moment EVA is sick, a counter counts the amount of time the user fails to bring medication to her. Depending on the length of time and the cutoff point, EVA’s health will decrease correspondingly.

 

In all the above 3 timers described, if the user attends to the needs of EVA before she starves or releases her waste, another counter (HealthUpgradePoints) will be incremented. This counter will represent the number of times the user is careful in attending to EVA’s needs, and after a certain number of counts, EVA’s health will increase.

 

Additional Points