Skip to content

Wepwawet

Lukas Härtel edited this page Jun 12, 2017 · 3 revisions

Wepwawet uses change tracking to generalize undo operations. They are defined using an embedded DSL. The ultimate goal is to make an out-of-the-box synchronization solution for complex multiplayer games.

Entry Points

See an example of a game that runs two parallel players randomly acting on a shared game state.

Entity DSL

Entities are subtypes of Entity, the constructor must take the Container as an argument and can itself have some more arguments. Entities are created by calling create from another entity. Entities may have Attributes and Functions, as given hereafter.

EDSL Element Scope Behaviour
prop Attribute Creates a tracked property of arbitrary type.
key Attribute Creates a property that is also part of the primary key
holdOptional Attribute Creates a property owning zero to one entity.
holdOne Attribute Creates a property owning exactly one entity.
holdMany Attribute Creates a property owning a list of many entities.
impulse Function Creates an impulse, i.e., an exchanged method.

Entities may have members that are not tracked, these should not have any meaning for the game state, as they are not synchronized and memorized for undo. They can be however be used for user interface calculations.

Owning

In this scope, owning means that once an entity is removed from the attribute, it is deleted.

Impulses

Impulses are used to include user input in a synchronized manner. Impulses can also be called from within other impulses, in that they just execute the method without exchanging the call (this is done by the root impulse). Impulses can also be queued by calling them with the delay as index. Arguments to impulses may also be entities. Upon execution of impulse, an entity is mapped to it's primary key for exchange.

// Direct invocation
entity.f(arg)

// Delayed invocation
entity.f[5.0](arg)

// Impulse with entity argument
entity.g(entity2)

Time

Time should be assigned to a synchronized milliseconds since start value, as an integer. The time also gives the maximum revision until which the calls are executed. Queued calls may be dormant until the current time is set to a time that is after the queued call's time.

Clone this wiki locally