Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

UML Modelization

Vaubourg Mandel edited this page Sep 10, 2017 · 62 revisions

UML Modelization

Here you will find the UML modeling of our project.

You will find :
  • Composants diagrams
  • Package diagrams
  • Class diagrams
  • Sequence diagrams

Composants Diagram

Composants Package

There are many components:

  • The firts one is the DAO, to create a connexion between our program and the database and to interact with it.
  • The worldloader create a map tahnks to the dats from the dao or to load a map from a text file and to send it to the database, with the dao's interfact IMap.
  • The menu used to to launch the differents from the game.
  • The game use IMap interfact to load and launch the map and use IFinishWorld to finish the level.
  • The engine use IWorld to interact with the elements of the world. With that, it loads the map, play sounds and bring contexts to entities.
  • The world containt all the elements of the map, and the characteristics of this elements.

Package Diagram

Diagram Package

Here you can see the differents packages which compose our game.

  • The DAO package contains the classes that allow communication of the game to the database.

  • The menu package shows the differents menu and submenu which allow the launching of a level, or load a map into the database, This package needs the DAO package to display the differents map to load or to load a map into the database.

  • The game package will create the menu and launch the game via the engine package.

  • The engine package manage all the elements of the game, it load map's elements, generate ticks, display HUD, play sounds, give a context to the entities.

  • The world package represente the map and the elements that compose it and their entities. Each element contains its view. Moreover, the entities have behavior and reactions.

  • The worldLoader package is a factory which need some allows to change the map, given by the DAO in world usable by the engine.


Class Diagrams

DAO (Data Access Object)

DAO Class diagram

The DAO allows to establish a connection between the game and the database.

(in green its a test class)

  • The DAO Class is a singleton it allow to create only one connection between game and dataBase.

  • The MapDao use DAO to get the connection with dataBase. This class Allow to interact with database (execute CRUD) It execute a stocked routines dataBase to add, get, remove map, object which compose the map or Object type (Dirt, Diamond, etc...)

  • The Parameters Class is a generic class. It allows to represent the parameters that will be sent in the stored procedures. Since the parameters can be set to IN, OUT or INTOUT, it contains an Enum TypeParameters, and finally a generic object that represents the element of the parameter.

  • The ObjectType enumeration represents the elements which compose a map.

  • IMap is an interface that makes it possible to make the bridge between the DAO and the rest of the program.

  • RawMap and RawElement represente the Database Map and DataBase element. They are not yet objects usable by the game engine. They will be objects usable by the engine when they will be transformed by the worldloader into World and Elements (Block & Entity).


GAME

Game Diagram Game

  • Game boot allow to display a menu, instanciate engine, Dao, With interface IFinishWorld engine can sent to gameBoot if the game is finish. And Ilauch is a interface for the menu to launch the game.

MENU

Menu Diagram class

  • The menu displays different button to start a game, load a world in the database each button can display submenu (example the button displays the directory menu to load map in database)

  • IMenuAction is a Interface which corresponds a each possible actions when player press a button.

  • WorldPanel is a submenu for displays the button to load the map.

  • FinalScreen represente the menu when player win or lose.


ENGINE

Engine diagram class

(zoom your navigator to see better diagram)

  • The engine is the central element of the game, it rhythms the entities using the tickGenerator, allows to play sounds, it also gives the entities their contexts of evolutions in the world.

  • IEngine is a interface between Engine and World, allow to entities access engine method (get their context for example)

  • Each element of our game Is rhythmic by ticks at each ticks the entities will be able to perform an action. So each entity is a TickListener. The TickGenerator class generates the ticks.

  • We do not use an array to stores the elements of the map. So our entities dont know what is around them. So they need to know the context in they evolve. So the Context class returns them this context. A context is the element in front of the entity that requests it.


WORLD

class diagram world

(zoom your navigator to see better diagram)

  • IWorld is an interface between World and engine. it allows to perfom action on element in world.

  • ICreateWorld is an interface allows to add entity or blocks.

  • World contain Elements block or entities in ArrayList each Element has a coordonate (Position Class).

  • IControllable is an interface used by Entities to move in the world.

  • IComponent is an interface which represente the Entities and the Blocks in the map.

  • IEntity is an interface used by Entities to load their behavior.

behavior

  • Each entity has behaviors defined by these classes (Each entity can be has many behavior. we can add Gravity with MonsterMove if we want)

  • ArrowKeyControl is a behaviors character because the character is controllable by the user.

  • Gravity is a behavior given to entities that may have fallen (diamonds and rocks).

  • MonsterMove is simply the movement to and from the monster.

elements

  • The Element class is at the very top of the inheritance hierarchy of blocks and entities. This is also a JComponent (we used swing to handle collisions between element via interact() ).

  • Each Element has a sprite manager to manage its sprite (allows to change sprite in the direction of the element).

  • Interface IAction represente the possible action by an Element or Reactions associated with it.

Entities

  • The entities is a Runnable (Thread). They implement IMovement which represents their basic movement and basic management.

  • Each entity has a state manager that manages their state (the state manager contains a stack of states that the entity has had).

  • A State represente the state of the entity (WAITING, MOVE UP, MOVE DOWN, MOVE UP, etc... ). The state is an indication, for example if the entity is facing a wall but which wishes to advance, the state will be MOVING-BLOCKED, and the entity will not advance but will remain in this state of wishes to advance.

  • The state allows us to have a good information on the evolution of the entities and thus to be able to manage behaviors more easily.

Blocks

  • The blocks are the no moveable elements. For exemple, a Dirt, a Wall or an Exit.

The dirt will be mined by the player.

The player will not be able to cross the walls

The player will have to join the exit

reaction

  • The reaction is a result of an interaction between Element (each element can have many reactions)

The kill reaction, will be executed when a player hit a monster for example.

Push will be executed when the player push a stone.

Heap when the player retrieves a diamond.

Remove when the player dig the dirt.

etc ...

  • The Enumeration Side allow to know which side of the element interacts with another, will trigger an action (You can define all sides).

WORLDLOADER

class diagram worldLoader

(in green is a Class Test)

  • WorldLoader allows to load a map from dataBase by the DAO or load the map from a text file

  • FactoryElement allows the worldloader to create the elements which compose the map. But also to group in the same place the creation of the elements.


Sequence Diagram


LaunchSequence

  • This sequence diagram allows to explain temporarily the sequence of launch of the game.
  1. We have the GameBoot which instantiates the engine and the menu.

  2. The menu recovers the list of available worlds given by the DAO.

  3. The menu (via user action) asks the GameBoot to start the game.

  4. The GameBoot asks the DAO to provide the map requested by the user, once received, it sends the RawMap to the worldloader which will transform this RawMap into World usable by the engine.

  5. The gameBoot send to the engine the map and the game starts!


TickSequence

  • This sequence diagram allows to explain temporarily the sequence of the creation of the "tick", the metronome of the game.
  1. Generate a new tick for an entity A

  2. This entity will get his context thanks to the the engine, then his context (from the Context), his reaction from his enteraction with the other entitry, entity B and finaly check his the previous reaction exist, this will perform this reaction

  3. The engine instanciate a new context for the entity