TL;DR

Another changelog is out, showing off the electronic infrastructure system for wiring up game logic without any scripting at all.

This week…

Watch The Video!

  • Code-less game logic
  • Rewiring security systems on the fly

Under The Hood

The entire of the Electronic-Infrastructure (EI) plugin is open source, if you’re really interested in how it works under the hood you can grab the source code from here and can even start wiring things up - just make yourself a new uni test to play around in.

The core of EI is the messaging system, everything else is built on top of that. The messaging system is, at heart, just two interfaces:

  • IMessageConsumer<TMessage>
  • A thing which receives messages, as well as connection and disconnection messages

  • IMessageProducer<TMessage>
  • A thing which can be subscribed to (by a consumer), after subscribing the consumer will receive all messages the producer sends.

This basic layout is pretty much a direct clone of the Reactive Extensions (Rx) but obviously much simpler. In fact internally some of the implementations of these interfaces do use Rx, but that’s hidden away internally.

Once you have this abstraction implementing devices becomes trivial. For example a button (implements IMessageProducer) just has to listen for the engine generated “use” event (triggered when a player presses the use key whilst looking at the button) and when it receives this event it just sends along a value indicating that it was pressed.