Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data-oriented events #482

Open
martin-azpillaga opened this issue Nov 24, 2020 · 0 comments
Open

Data-oriented events #482

martin-azpillaga opened this issue Nov 24, 2020 · 0 comments
Assignees
Labels
a development Add functionality to the project possibility Research for viability status

Comments

@martin-azpillaga
Copy link
Owner

Separate the code in events and responses. Designers can then match the events with the desired amount of responses.
In Pong:
Events:
Tick: ...
Overlap: a @ overlaps(b)

Responses:
Respawn: a.position = b.respawnPosition
Serve: a.velocity = random(a.serveVelocity)
Score: foreach c { c.score += a.worth }
Restart: foreach c { if c.score > c.max { c.score = c.reset } }
Control: foreach a { a.velocity = a.direction * readNumber(a.controlInput) }

Wiring:
Tick: Control
Overlap: Respawn, Serve, Score, Restart

Possible improvement:
While wiring events to responses, entity names can overlap. For example, A and B appear both in the Overlap event as well as in the Respawn response. By default, these are assumed to be the same entity. In this case, in order to Overlap+Respawn to run, a must have position and a collider and b must have respawnPosition and a collider.
This limits the naming capabilities. It should be possible to wire the names if wanted.
For example,
Overlap: Respawn(a=a,b=b), Serve, Score(a=c), Restart

Here, the linking is made explicit in respawn, still implicit with the same effect in serve. In score, c must be an a, and in restart, c is independent from a and b.

@martin-azpillaga martin-azpillaga added possibility Research for viability status a development Add functionality to the project labels Nov 24, 2020
@martin-azpillaga martin-azpillaga self-assigned this Nov 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a development Add functionality to the project possibility Research for viability status
Projects
None yet
Development

No branches or pull requests

1 participant