TEAM
LAST LINE
SHADING
GALLERY
AI
SOFTWARE DESIGN
VIRTUAL EFFECT
LINKS
DOWNLOADS

SOFTWARE DESIGN


Finite state machines are heavily used in the implementation of Last Line. Each component has its own finite state machine. For the following, it is a detail explanation of how to the finite state machines and data structures used to keep track of the state of each component.

Finite State Machine:

Enemy:

    Normal:
         patrolling
         wait for some period and go to Fire
     Get Hit:
         go to Die routine
     Die:
         explosion and disappears
         go to Wait
     Wait:
         wait for a certain time
         come back to life
         go to Normal
     Fire:
         get player coordinates and fire the bullet
         go to Normal
 

Boss:


    Normal:
         patrolling
         wait for some period and go to Fire
     Get Hit:
         reduce some energy
         if energy = 0 then go to Die
         else go to Normal
     Die:
         explosion and disappears
         go to Wait
     Wait:
         wait for a certain time
         come back to life
         go to Normal
     Fire:
         get player coordinates and fire the bullet
         go to Normal

Bullet:

       Normal:
         wait
         time to fire and go to Fire
     Flying:
         if collide with something then go to Die
         else wait for time and go to Die
     Die:
         explosion and disappears
         go to Normal
     Fire:
         get player coordinates and fly toward that coordinate
         go to Flying

 

Different Data Structure:

Enemy Bullet:

We use an array to implement the FSM for the enemy bullets:

 
Bullet ID Duration of Flying X Coordinate of player Y Coordinate of player Y Coordinate of player Flying Status
 

Enemy and Boss:

We use an array to implement the FSM for the boss and enemy:

 
Enemy ID Starting Time of Flying Duration of Flying Signal to Turn Get Hit Time to Wait for Next Shoot Signal to Shoot X Coordinate in First Quadrum Y Coordinate in First Quadrum X Coordinate in Second Quadrum Y Coordinate in Second Quadrum X Coordinate in Third Quadrum Y Coordinate in Third Quadrum X Coordinate in Fourth Quadrum Y Coordinate in Fourth Quadrum Current Index for Quadrum Coordinates Starting Time for Enemy Die Duration of Enemy Die