Skip to content
This repository has been archived by the owner on Jan 7, 2019. It is now read-only.

Holds tight like glue

License

Notifications You must be signed in to change notification settings

inexorgame-obsolete/gluegun

Repository files navigation

gluegun

gluegun

gluegun pieces together individual parts of inexor.

Imagine the gluegun having a conversation with other parts of inexorgame like this:

Plugin:

Hey man, I would like to be part of Inexor, how does it work?

gluegun:

Sure. Tell me how can I reach you out?

Plugin:

You can find me under this address!

gluegun:

Nice. You will need to meet some other fellows in order to get this up and running and then you're done.

In order to be able to understand each other one must built a "plugin".

About plugins

A plugin has two items in it's receipt:

  • a list of SIGNALs that can be issued by this plugin
  • the data that is sent over the wire when a specific SIGNAL is triggered

This way a plugin is able to interchange with other plugins across different languages, platforms and setups.

An example plugin would look like this:

namespace inexorgame.plugins;

/// Signals issued by this component
enum Signal : byte {
    JOKE
}

/// The root type for this plugin
table PluginMessage {
    signal:Signal;
    joke:string;
}

root_type PluginMessage;

Technically, we use flatbuffers and nanomsg to realize this pattern.

The above process can be visualized like this:

visualization of the registration process

Running gluegun

Running gluegun is quite easy, given that you have go and flatc installed:

  • cd ${GOPATH}/github.com/inexorgame/gluegun (you should have cloned this repository here)
  • go get -u github.com/google/flatbuffers/go
  • flatc gluegun.fbs --go -o ../../ (this will generate the files to github.com/inexorgame/plugin)
  • dep ensure
  • go run gluegun.go

Building a component

We have illustrated how one can built plugins in different languages.

Please have a look at the plugins folder.

You will always need to include the gluegun.fbs schema in your respective language in order to be able to talk to gluegun