Skip to content

MPW Meta Model

Fumapps edited this page Apr 13, 2021 · 14 revisions

Entity Types

MPW meta model

MiniProgrammingWorld

Represents the root class of the world. It contains the Stage and the CommandStack.

Stage

Represents the 2D grid-based world which consists of Tiles. A stage is able to process commands, e.g. to initialize the tiles.

Inherits: Entity from command-package.

Example Hamster-Simulation: Inherited by Territory which can contain Grains, Walls and Hamsters.

Tile

Represents one place on the 2D grid and defines a unique Location, which stores the column and row indices.

Inherits: Entity from command-package.

TileContent

Represents a component which might be placed on a Tile.

Inherits: Entity from command-package.

Example Hamster-Simulation: Grain, Wall or Hamster.

Actor

Special sub-type of TileContent which represents the client object on the Stage. An actor provides the typical commands to control the game state like movement. Additionally it provides several queries to obtain game state information.

Example Hamster-Simulation: Hamster with Move, PickGrain, PutGrain or TurnLeft commands and FrontIsClear, MouthEmpty, Direction, or Location queries.

Prop

Represents a requisite on the Stage which has no own commands. A prop can have the ability to block a Tile, so no Actor is able to move on it.

Example Hamster-Simulation: Grain or Wall.

Commands

MPW meta model

Entity

Base class of an entity which defines property modifications used by commands. It makes use of Objects to provide a reflection-like possibility to set values by property-names.

Note: In Java it can be simply realized by reflection, but in languages like C++ not.

Object

Represents a base type of any value. In java this is simply the type java.lang.Object. In C++ this may be an union of possible values: it can be a primitive value like integers, booleans or strings. Alternatively it can be a reference/pointer.

Command

Defines the basic type for PrimitiveCommand or CompositeCommand which represent behavior which can be executed. It provides the ability to: execute, undo or redo.

Commands are processed in context of an Actor or the Stage.

CommandStack

Tracks the executed Commands which allow to undo and redo their behavior.

PrimitiveCommand

Defines a primitive command which can set, add or removes values regarding to a property of an Entity.

AddEntityCommand

A primitive command which adds an entity to a collection property.

SetPropertyCommand

A primitive command which sets a generic value (Object) to a property.

RemoveEntityCommand

A primitive command which removes an entity from a collection property.

CompositeCommand

A more complex type of commands which makes use of multiple sub-commands. Usually the sub-commands are PrimitiveCommands.

Example Hamster-Simulation: Game commands: Move, PickGrain, PutGrain or TurnLeft. Editor commands: InitTerritory or InitHamster.