Create and Play your PacMan Game with the GEMOC Studio · Create and Play your PacMan Game with the...

15
Create and Play your PacMan Game with the GEMOC Studio Dorian Leroy 1 Erwan Bousse 2 Manuel Wimmer 2 Benoit Combemale 3 Wieland Schwinger 1 1 JKU Linz 2 TU Wien 3 University of Toulouse (UT2J) September 17th 2017

Transcript of Create and Play your PacMan Game with the GEMOC Studio · Create and Play your PacMan Game with the...

Page 1: Create and Play your PacMan Game with the GEMOC Studio · Create and Play your PacMan Game with the GEMOC Studio Dorian Leroy 1 Erwan Bousse 2 Manuel Wimmer 2 Benoit Combemale 3 Wieland

Create and Play your PacMan Game with the GEMOC Studio

Dorian Leroy 1 Erwan Bousse 2 Manuel Wimmer 2 Benoit Combemale 3

Wieland Schwinger 1

1JKU Linz

2TU Wien

3University of Toulouse (UT2J)

September 17th 2017

Page 2: Create and Play your PacMan Game with the GEMOC Studio · Create and Play your PacMan Game with the GEMOC Studio Dorian Leroy 1 Erwan Bousse 2 Manuel Wimmer 2 Benoit Combemale 3 Wieland

Introduction Overview of the Approach Demo Conclusion

Context

Behavioral models often need to interact with the outsideworld during their execution, eg. to process incomingdomain-level event occurrencesAdds complexity to the operational semantics of a DSL:

impacts content and scheduling of execution rules,requires an interruption mechanism,requires an interface allowing external actors to send events.

Processmessage

incomingmessage

Tedious and error-prone task that must be repeated for each executable DSL

Dorian Leroy , Erwan Bousse , Manuel Wimmer , Benoit Combemale , Wieland Schwinger JKU Linz, TU Wien, University of Toulouse (UT2J)

Page 3: Create and Play your PacMan Game with the GEMOC Studio · Create and Play your PacMan Game with the GEMOC Studio Dorian Leroy 1 Erwan Bousse 2 Manuel Wimmer 2 Benoit Combemale 3 Wieland

Introduction Overview of the Approach Demo Conclusion

Context

Behavioral models often need to interact with the outsideworld during their execution, eg. to process incomingdomain-level event occurrencesAdds complexity to the operational semantics of a DSL:

impacts content and scheduling of execution rules,requires an interruption mechanism,requires an interface allowing external actors to send events.

Processmessage

incomingmessage

Tedious and error-prone task that must be repeated for each executable DSL

Dorian Leroy , Erwan Bousse , Manuel Wimmer , Benoit Combemale , Wieland Schwinger JKU Linz, TU Wien, University of Toulouse (UT2J)

Page 4: Create and Play your PacMan Game with the GEMOC Studio · Create and Play your PacMan Game with the GEMOC Studio Dorian Leroy 1 Erwan Bousse 2 Manuel Wimmer 2 Benoit Combemale 3 Wieland

Introduction Overview of the Approach Demo Conclusion

Context

Behavioral models often need to interact with the outsideworld during their execution, eg. to process incomingdomain-level event occurrencesAdds complexity to the operational semantics of a DSL:

impacts content and scheduling of execution rules,requires an interruption mechanism,requires an interface allowing external actors to send events.

Processmessage

incomingmessage

Tedious and error-prone task that must be repeated for each executable DSL

Dorian Leroy , Erwan Bousse , Manuel Wimmer , Benoit Combemale , Wieland Schwinger JKU Linz, TU Wien, University of Toulouse (UT2J)

Page 5: Create and Play your PacMan Game with the GEMOC Studio · Create and Play your PacMan Game with the GEMOC Studio Dorian Leroy 1 Erwan Bousse 2 Manuel Wimmer 2 Benoit Combemale 3 Wieland

Introduction Overview of the Approach Demo Conclusion

Example: The PacMan DSL

Execution Rules

Abstract Syntax

entities0..*

tiles0..*

BoardAbstractTile

PassableTileWallTileEntity

+initialTile

Pacman Ghost

Execution Metamodel

PassableTile

Ghost

targetTile1

top0..1

bottom0..1

left0..1 right

0..1

SuperPellet Pellet

AbstractPellet

currentTile1

AbstractTile

0..1pellet

Tile

Pacman+pelletsEaten: int+lives: int+energized: boolean

Entity+speed: int

Tile GhostHouseTile

merges

run(Board: board)

update(Board: board, int: deltaTime)

update(Entity: entity, int: deltaTime)

modifySpeed(Entity: entity, int: speed)

activate(Ghost: ghost)

energize(Pacman: pacman)enterNextTile(Entity: entity)

imports

initialTile

1

up(Pacman: pacman) down(Pacman: pacman) left(Pacman: pacman) right(Pacman: pacman)

Dorian Leroy , Erwan Bousse , Manuel Wimmer , Benoit Combemale , Wieland Schwinger JKU Linz, TU Wien, University of Toulouse (UT2J)

Page 6: Create and Play your PacMan Game with the GEMOC Studio · Create and Play your PacMan Game with the GEMOC Studio Dorian Leroy 1 Erwan Bousse 2 Manuel Wimmer 2 Benoit Combemale 3 Wieland

Introduction Overview of the Approach Demo Conclusion

Example: The PacMan DSL

Execution Rules

Abstract Syntax

entities0..*

tiles0..*

BoardAbstractTile

PassableTileWallTileEntity

+initialTile

Pacman Ghost

Execution Metamodel

PassableTile

Ghost

targetTile1

top0..1

bottom0..1

left0..1 right

0..1

SuperPellet Pellet

AbstractPellet

currentTile1

AbstractTile

0..1pellet

Tile

Pacman+pelletsEaten: int+lives: int+energized: boolean

Entity+speed: int

Tile GhostHouseTile

merges

run(Board: board)

update(Board: board, int: deltaTime)

update(Entity: entity, int: deltaTime)

modifySpeed(Entity: entity, int: speed)

activate(Ghost: ghost)

energize(Pacman: pacman)enterNextTile(Entity: entity)

imports

initialTile

1

up(Pacman: pacman) down(Pacman: pacman) left(Pacman: pacman) right(Pacman: pacman)

How to safely call these execution rules, while main execution loop of the game is ongoing?

Dorian Leroy , Erwan Bousse , Manuel Wimmer , Benoit Combemale , Wieland Schwinger JKU Linz, TU Wien, University of Toulouse (UT2J)

Page 7: Create and Play your PacMan Game with the GEMOC Studio · Create and Play your PacMan Game with the GEMOC Studio Dorian Leroy 1 Erwan Bousse 2 Manuel Wimmer 2 Benoit Combemale 3 Wieland

Introduction Overview of the Approach Demo Conclusion

Problem and Idea

How to avoid rewriting operational semantics to define domain-specific eventsthat may safely interrupt the execution flow?

IdeaTake the tedious and repetitive part out of the hands of the language engineer byproviding:

An annotation mechanism to easily define events,The generation of an interface to send events at runtime,Generic event management reusable across DSLs.

Dorian Leroy , Erwan Bousse , Manuel Wimmer , Benoit Combemale , Wieland Schwinger JKU Linz, TU Wien, University of Toulouse (UT2J)

Page 8: Create and Play your PacMan Game with the GEMOC Studio · Create and Play your PacMan Game with the GEMOC Studio Dorian Leroy 1 Erwan Bousse 2 Manuel Wimmer 2 Benoit Combemale 3 Wieland

Introduction Overview of the Approach Demo Conclusion

Problem and Idea

How to avoid rewriting operational semantics to define domain-specific eventsthat may safely interrupt the execution flow?

IdeaTake the tedious and repetitive part out of the hands of the language engineer byproviding:

An annotation mechanism to easily define events,The generation of an interface to send events at runtime,Generic event management reusable across DSLs.

Dorian Leroy , Erwan Bousse , Manuel Wimmer , Benoit Combemale , Wieland Schwinger JKU Linz, TU Wien, University of Toulouse (UT2J)

Page 9: Create and Play your PacMan Game with the GEMOC Studio · Create and Play your PacMan Game with the GEMOC Studio Dorian Leroy 1 Erwan Bousse 2 Manuel Wimmer 2 Benoit Combemale 3 Wieland

Introduction Overview of the Approach Demo Conclusion

Summary of the Approach

A generative approach to obtain a domain-specific event language and itsinterpreter from annotated execution rules,A generic event queue manager, incorporating event queuing and dispatch intothe execution loop.

EventQueueManager

processEvents()

loop

EventInterpreter

[for evt in eventQueue] dispatchEvent(evt)

canProcessEvent(evt)

canProcess

opt [canProcess] executeRule (evt.name,evt.params)

manageEvents()

ExecutionEngine

Dorian Leroy , Erwan Bousse , Manuel Wimmer , Benoit Combemale , Wieland Schwinger JKU Linz, TU Wien, University of Toulouse (UT2J)

Page 10: Create and Play your PacMan Game with the GEMOC Studio · Create and Play your PacMan Game with the GEMOC Studio Dorian Leroy 1 Erwan Bousse 2 Manuel Wimmer 2 Benoit Combemale 3 Wieland

Introduction Overview of the Approach Demo Conclusion

Event Metamodel and Interpreter Generation

The generative approach relies on annotated execution rules to locate eventhandlers and event preconditions.Event metaclasses are generated from event handlers to populate the eventmetamodel.An event interpreter mapping instances of event metaclasses to event handlerand precondition calls is generated.

Dorian Leroy , Erwan Bousse , Manuel Wimmer , Benoit Combemale , Wieland Schwinger JKU Linz, TU Wien, University of Toulouse (UT2J)

Page 11: Create and Play your PacMan Game with the GEMOC Studio · Create and Play your PacMan Game with the GEMOC Studio Dorian Leroy 1 Erwan Bousse 2 Manuel Wimmer 2 Benoit Combemale 3 Wieland

Introduction Overview of the Approach Demo Conclusion

Event Metamodel and Interpreter Generation

The generative approach relies on annotated execution rules to locate eventhandlers and event preconditions.Event metaclasses are generated from event handlers to populate the eventmetamodel.An event interpreter mapping instances of event metaclasses to event handlerand precondition calls is generated.

Dorian Leroy , Erwan Bousse , Manuel Wimmer , Benoit Combemale , Wieland Schwinger JKU Linz, TU Wien, University of Toulouse (UT2J)

Page 12: Create and Play your PacMan Game with the GEMOC Studio · Create and Play your PacMan Game with the GEMOC Studio Dorian Leroy 1 Erwan Bousse 2 Manuel Wimmer 2 Benoit Combemale 3 Wieland

Introduction Overview of the Approach Demo Conclusion

Event Metamodel and Interpreter Generation

The generative approach relies on annotated execution rules to locate eventhandlers and event preconditions.Event metaclasses are generated from event handlers to populate the eventmetamodel.An event interpreter mapping instances of event metaclasses to event handlerand precondition calls is generated.

Dorian Leroy , Erwan Bousse , Manuel Wimmer , Benoit Combemale , Wieland Schwinger JKU Linz, TU Wien, University of Toulouse (UT2J)

Page 13: Create and Play your PacMan Game with the GEMOC Studio · Create and Play your PacMan Game with the GEMOC Studio Dorian Leroy 1 Erwan Bousse 2 Manuel Wimmer 2 Benoit Combemale 3 Wieland

Introduction Overview of the Approach Demo Conclusion

Demo

...

Dorian Leroy , Erwan Bousse , Manuel Wimmer , Benoit Combemale , Wieland Schwinger JKU Linz, TU Wien, University of Toulouse (UT2J)

Page 14: Create and Play your PacMan Game with the GEMOC Studio · Create and Play your PacMan Game with the GEMOC Studio Dorian Leroy 1 Erwan Bousse 2 Manuel Wimmer 2 Benoit Combemale 3 Wieland

Introduction Overview of the Approach Demo Conclusion

Conclusion & Future Work

Adapting semantics to event handling is difficultProposed solution:

non-intrusive annotation of execution rules and generation of ageneration of an interface to inject event occurrencesreuse of an event queue and interruption mechanism

Eclipse Research Consortium GEMOC: sustains theGEMOC studio as a research platform to experiment onthe globalization of, possibly executable andheterogeneous, modeling languagesContributors are welcome!

http://gemoc.org/https://github.com/eclipse/gemoc-studio-modeldebugging

Dorian Leroy , Erwan Bousse , Manuel Wimmer , Benoit Combemale , Wieland Schwinger JKU Linz, TU Wien, University of Toulouse (UT2J)

Page 15: Create and Play your PacMan Game with the GEMOC Studio · Create and Play your PacMan Game with the GEMOC Studio Dorian Leroy 1 Erwan Bousse 2 Manuel Wimmer 2 Benoit Combemale 3 Wieland

Introduction Overview of the Approach Demo Conclusion

Conclusion & Future Work

Adapting semantics to event handling is difficultProposed solution:

non-intrusive annotation of execution rules and generation of ageneration of an interface to inject event occurrencesreuse of an event queue and interruption mechanism

Eclipse Research Consortium GEMOC: sustains theGEMOC studio as a research platform to experiment onthe globalization of, possibly executable andheterogeneous, modeling languagesContributors are welcome!

http://gemoc.org/https://github.com/eclipse/gemoc-studio-modeldebugging

Dorian Leroy , Erwan Bousse , Manuel Wimmer , Benoit Combemale , Wieland Schwinger JKU Linz, TU Wien, University of Toulouse (UT2J)