Subversion Repositories shark

Rev

Go to most recent revision | Blame | Last modification | View Log | RSS feed

RTOS PROJECT – ILLA (GAME)

                                                GROUP MEMBERS:  BANTI MODI
                                                                        RAJAT AHUJA
                                                                        PRAKASH RAMACHANDRAN



Description of Game:

We had tried to make a game in which from has to jump on leaves flowing through the water, go to the lowest level and then come up. There is enemy of a from moving around on land. Enemy will try to kill the frog by touching it when frog is on the land. There is timer, after the expiration of timer the game will finish.

Details:

Tasks used:

1) Scorer Task:
This is a hard task which keeps track of Timer and score of the player. The time for the game is 50 sec. We initialize the counter to 100 and then each time we reduce the counter and when timer is zero we exit. Currently we user update rate of 500000 microsecond and WET as 5000000 microsecond.(According to shark manual the WET will be ignored)

2) MovePlayerUp and MovePlayerDown Tasks:
These are the soft tasks Which are created at beginning but they are not activated. These tasks are activated when user presses up or down key. These tasks move change the Y co-ordinates of a player during each cycle and redraws player till the player reaches next leaf level. When Player reaches the next level this task is blocked using task_disable. For this tasks we have default period of 25000 microsecond, WCET 500 microsecond and MET 100.


3) Enemy Task:
This is soft task which is created during initialization. It Moves Enemy by 10 pixels during each execution cycle and checks if enemy touches the player co ordinates if it touches then we exit.  For this tasks we have default period of 50000 microsecond, WCET 500 microsecond and MET 100.

4) Leaves Task:
These are soft tasks which are created during Initialization. Each task is responsible for moving a single leaf in water. It also check if player is on leaf if it is then it also changes the co ordinates of player and redraws it.
For this tasks we have default period of 50000 microsecond, WCET 5000 microsecond and MET 1000.

5) Others: 
Apart from this we handle left or right move of player in Keyboard event. This is System Task and by default its soft TASK.

Synchronization:

We use following mutexs for synchronization:

We use Mutexs when accessing the co ordinates of players, leaves and Graphics card. Various tasks use those mutexs. Some tasks need to access various mutexs at same time. So in order to avoid cyclic wait we made some rules as we assign levels to each mutex. and when acquiring any high level mutex we must first release  the lower level mutexs first. And after acquiring higher mutex we can take lower mutexs again.

1) grx_mutex: This mutex is used before doing any graphical output function. This mutex is highest level. Before taking this mutes we must release any leaves and player mutex if any.

2) player_mutex: This mutex is used before accessing any player co ordinates. This is second level of mutex. Before Acquiring this mutex we must release any leaves mutex if acquired.

3) Leaves_mutex: These mutexs are used before accessing any co ordinates of any leaf. This is lowest level of mutexs.