A Functional Reactive Game Engine
NPM
Reventex is published on NPM with full typing support. To install use
npm install reventex
This will allow you to import Reventex entirely using:
;
Event-driven architecture
Bus
The Bus is a one-to-many communication and implements a publish/subscribe event distribution model. A publisher sends a event on a channel. Any active subscriber listening on that channel receives the event. Subscribers can register interest in wildcard channels.
Client (Subscriber/Publisher)
Subscribers express interest in one or more channels, and only receive events that are of interest, without knowledge of what publishers there are.
Events sent by other clients to these channels will be pushed by Bus to all the subscribed clients.
A client subscribed to one or more channels should not issue commands, although it can subscribe and unsubscribe to and from other channels. The replies to subscription and unsubscription operations are sent in the form of events, so that the client can just read a coherent stream of events where the first element indicates the type of event. The commands that are allowed in the context of a subscribed client are:
-
publish(event: Event): Void
-
subscribe(channel: String): Void
-
unsubscribe(channel: String): Void
-
match(pattern: Pattern, generator: Generator): Void
-
exit(): Void
-
delay(ms: Int): Void
-
call(callback: Function, ...args): Void
Channel Naming Conventions
Channel names, including reply channel names, are case-sensitive and must be non-empty alphanumeric strings with no embedded whitespace, and optionally token-delimited using the dot character (.
), e.g.:
FOO
, BAR
, foo.bar
, foo.BAR
, FOO.BAR
and FOO.BAR.BAZ
are all valid channel names
FOO. BAR
, foo. .bar
and foo..bar
are not valid channel names
Reventex supports the use of wildcards in channel subscriptions.
- The asterisk character (
*
) matches any token at any level of the channel. - The greater than symbol (
>
), also known as the full wildcard, matches one or more tokens at the tail of a channel, and must be the last token. The wildcarded channelfoo.>
will matchfoo.bar
orfoo.bar.baz.1
, but notfoo
. - Wildcards must be separate tokens (
foo.*.baz
orfoo.>
are syntactically valid;foo*.bar
,f*o.b*r
andfoo>
are not) For example, the wildcard subscriptionsfoo.*.quux
andfoo.>
both matchfoo.bar.quux
, but only the latter matchesfoo.bar.baz
. With the full wildcard, it is also possible to express interest in every channel that may exist in Reventex.
Github Issues
Please use Github Issues to report bugs or request features.
Reporting bugs
Please follow these steps to report a bug
-
Search for related issues - search the existing issues so that you don't create duplicates
-
Create a testcase - Please create the smallest isolated testcase that you can that reproduces your bug
-
Share as much information as possible - everything little helps, OS, node/browser version, all that stuff.
Pull Requests
If you are contributing a bug-fix or a very minor addition, feel free to do a pull request on the master branch.
If it is something else create a new (or existing) feature branch (eg: feature/my-feature
) and issue a pull request on that.
If unsure, create an issue to discuss.
Contact us
- Twitter: https://twitter.com/reventexjs
License
Reventex is released under the MIT License.