Search code examples
design-patternsumldiagramsoftware-designactivity-diagram

Activity Diagram for Game Functions/Interaction


I am creating an activity diagram for a game, although I am not sure if I am using the correct diagram. Is this the correct diagram to represent the functions of the game?

Functions: The aim of the game is for the character to move around the screen to collect 'good' objects, avoiding 'bad' objects or the wall. When 10 'good' objects have been collected the player moves to the next level. There are 3 levels in the game, after level 3 the game is complete and ends there. There is a high score function which updates when the play exceeds the current high score.

https://www.dropbox.com/s/vlsxyipmbi665o1/Untitled%20Diagram.png.jpg?dl=0


Solution

  • It is practice in software design in UML to define several views on system. Usefull functionality (called services) are usually declared using UseCase elements. Behavior of system (game in your case) is defined using behavioral elements. If interaction is focused, proper behavioral element is Interaction (most popular is sequence). But, some aspects of interaction could be defined in activity diagram as well. Consequently you model should consist of several types of diagrams. Structural definitions are necessary too.

    Your choice is correct, I recommend to use Activity diagram for definition of function you described.