aschaeffer/inexor-rgf-application

Inexor Reactive Graph Flow

Embedded Graph Database: indradb

Project Module Sub-Module Functionality Tests
Reactive Graph Flow Application

About Inexor

  • Inexor will be a new first-person shooter game which is based on a new octree-based game engine.
  • Inexor focuses on classic gameplay as we've seen in Cube2 or the Quake series.
  • Inexor will be written from ground up new in C++17 and Rust.
  • You can contribute anything you want: code, content, ideas..
  • Inexor and all its content is 100% open source!

About

The (RGF) manages reactive flows based on a graph database. The main interface is GraphQL.

  • Semantic: Graph database with entities and relationships as first class citizens
  • Reactive: entities and relationships are/can be reactive: If the input has been altered the entity processes its new state
  • Interoperable: Use GraphQL for queries and mutations
  • Extendable: Built in type system: components, entity types and relation types
  • Memory efficient: Rust
  • Fast: Rust
  • Secure: Rust

About this application

This repository provides the application which results in a binary.

Checkout, compile und run the application

rustup update nightly
git clone https://github.com/aschaeffer/inexor-rgf-application.git
cd inexor-rgf-application
cargo build
cargo run

Compile and configure plugins

  1. Checkout and build the plugin

    cd ..
    git clone https://github.com/aschaeffer/inexor-rgf-plugin-mqtt.git
    cd inexor-rgf-plugin-mqtt
    cargo build
    
  2. Edit config/plugins.toml and add a section for the plugin. The name must match the crate name of the plugin. Specify the path to the dynamically linked library. The path can be either absolute or relative to the working directory of the application.

    [[plugin]]
    name = "inexor-rgf-plugin-mqtt"
    active = true
    path = "../inexor-rgf-plugin-mqtt/target/debug/libinexor_rgf_plugin_mqtt.so"
    

Configure Logging

  1. Edit config/logging.toml
  2. In the section loggers add or modify the logger for a specific module
    [loggers."inexor_rgf_plugin_mqtt::behaviour::relation::mqtt_subscribes"]
    level = "debug"
    appenders = [ "file-plugin-mqtt" ]
    additive = false
    

Configure HTTP/GraphQL server

  1. Edit config/graphql.toml

  2. Configure the hostname and port

    hostname = "localhost"
    port = 31415
    

GraphQL

The most important interface for interaction with the Reactive Graph Flow is GraphQL. The GraphQL interface is useful for

  • Interaction with other instances (C2S, S2C, S2S, P2P)

    • Because of the use of uuids synchronization is possible
  • User Interfaces

    • In-game-menu
    • Server admin UI
    • Flow-Editor (Create / modify / test flows without being in-game)
    • Websites (community, clan, content-repositories, ...)
    • Tools (procedural-texture-editor)
    • Third-party (export/import from/to third party software)
  • As a flow designer I can define components which can be used as building block for entities using a GraphQL interface

  • As a flow designer I can create entities with properties using a GraphQL interface

  • As a flow designer I can create relations with properties using a GraphQL interface

  • As a flow designer I can connect and disconnect two properties which data flows from one to the other using a GraphQL interface

  • As a flow designer I can create flows using a GraphQL interface

Queries
Mutations
Subscriptions

Flow Editor

Using Libraries

The libraries are carefully chosen:

  • Dependency Injection: waiter_di
  • FRP / Reactive Streams: bidule
  • Logging: log4rs
  • HTTP Server: actix-web
  • GraphQL Server: async-graphql
  • Serialization/Deserialization: serde_json

Thanks to

  • https://github.com/xd009642/tarpaulin
  • https://codecov.io/

Sponsors

JetBrains Special thanks to JetBrains for providing us with CLion licenses!

Libraries

Library Description
IndraDB The heart of the graph is the embedded graph database IndraDB:
  • Graph Database
    • Typed Graph
    • Directed Graph
    • Property Graph
  • In Memory Storage
  • Embeddable
    • Easier to create fully featured binaries
Issues

Collection of the latest Issues

aschaeffer

aschaeffer

documentation
Comment Icon0

Goal

With a flow type, an abstract flow can be defined and instantiated multiple times. Similar flows can be instantiated using parametrization. Flow types can be nested, which allows reusage of mechanics.

Use Cases

Everything which can run multiple times at the same time:

  • A game mode
  • A mechanic of a game mode which is a building block for concrete game modes (for example: flag mechanics is used by multiple game modes)
  • A weapon mechanics
  • A mechanic of a weapon which is a building block for concrete weapons
  • A player
  • A team
  • A hardware device which exists multiple times
  • An identical or similar room which exists multiple times on a map
  • An IoT device which exists multiple times
  • ...

Specification

  • Flow types can be represented as JSON and can be imported from a JSON file and exported to a JSON file
  • Flow types contains:
    • Virtual entity instances
    • Virtual relation instances
    • Specific entity instances (with a specific UUID or path which is known at design time - usually well known singletons)
    • Named entity instances (the entity instance is not known at design time but provided at instantiation)
    • Another flow types (which allows building complex scenarios with abstract sub flows)
  • Flows can be instantiated from a flow type multiple times, because the actual UUIDs of the resulting entity instances are generated at instantiation time
  • Immediate UUIDs
    • Virtual entity instances have an immediate UUID
    • Virtual relation instances connects virtual entity instances (and uses the immediate UUIDs of the outbound + inbound virtual entity instances)
  • Dynamic Instantiation
    • Flow type parameters
      • Flow types can define named parameters
      • The value of the properties of the virtual entity instances and virtual relation instances can use named parameters
      • At instantiation of a flow from a flow type, the value of the named parameters are replaced by the provided values
    • Flow type instances
      • Flow types can define named entity instances
      • The UUIDs of virtual entity instances can use an entity instance name
      • At instantiation of a flow from a flow type, the UUIDs of the named entity instances are replaced by the provided entity instances

Tasks

  • Import a flow type from JSON
  • Export a flow type to JSON
  • Create a new flow type
  • Delete a flow type
  • Update a flow type
    • Add a virtual entity instance to a flow type
    • Remove a virtual entity instance to a flow type
    • Add a virtual relation instance to a flow type
    • Remove a virtual relation instance to a flow type
  • Create a flow (instance) from a flow type
    • Replace the immediate UUIDs in virtual entity instances and virtual relation instances
    • Replace the named parameters
    • Replace the named entity instance by the provided concrete entity instance
    • Create the flows for the nested flow types
  • Extend Plugin API
    • FlowTypeProvider
  • ChangeLog
  • Documentation
  • Tests
aschaeffer

aschaeffer

enhancement
Comment Icon0

The metadata plugin provides support for metadata of different types of objects. For example, dublin core can be used for the metadata of documents. Because of the component model of the reactive graph flow, it's possible to attach metadata via components. This is useful for different types of assets like textures (title, author, creation date) and sound (genre, album, artist, speed, ...). The metadata is useful for different types of applications like game assets and content management.

Goal

There are several meta data formats (https://en.wikipedia.org/wiki/Metadata_standard). Currently, only dublin core is provided by the metadata plugin. The goal is to provide components for different metadata formats and read it automatically if the component is applied. This is groundwork for the asset management.

Formats

Rust Libraries

Library Description
https://github.com/polyfloyd/rust-id3 A library for reading and writing ID3 metadata.
https://github.com/Serial-ATA/lofty-rs Parse, convert, and write metadata to various audio formats.
https://github.com/netvl/immeta immeta is an image metadata processing library. It allows you to inspect metadata, that is, image dimensions, color information, etc. of various image formats.
aschaeffer

aschaeffer

enhancement
Comment Icon0

Goal

Define component categories in all component definitions. These categories can be used for user interfaces to group components by category.

dublin_core.json:

The component dublin_core has an extension named component_category with the category named metadata.

aschaeffer

aschaeffer

enhancement
Comment Icon0

Goal

Provide flows and flow types from repositories.

Specification

  • Flow repositories contains
    • flows
    • flow types
  • Storage backends
    • local file system
    • git repository
    • future: webdav
    • future: REST

Tasks

  • Plugin Flow Manager
    • Configuration file for the repositories and the storage backends
    • REST API
aschaeffer

aschaeffer

user interface
Comment Icon0

Goal

Provides a simple dynamic declarative user interface.

Use Cases

  • Dashboards
  • Management UIs
  • Debugging UIs
  • Home Automation
  • Desktop Automation

Declarative Definition of a User Interface

Entity Types

Entity Type Property Data Type Socket Type
app layout object none
css string none

Web Resource Provider

  • URL /apps/{name}
    • Renders the declarative user interface
  • URL /apps/{name}/styles.css
    • Renders the stylesheet
aschaeffer

aschaeffer

enhancement
Comment Icon0

Goal

Introduce new entity types which stores, synchronizes and debounces the state of an external thing/a digital twin, for example, a user interface button or an IRL-switch.

  • Represents "something external" and stores it's state
  • Debounces propagation in order to break feedback loops

Use Cases

  • User Interface
    • Internal state of a user interface button. Synchronizes the button state and the internal state
  • Home Automation
    • Switch. Synchronizes the switch state and the internal state

Behaviours

Property Socket Type Description
set input Sets the internal state and propagates value if and only if the internal state has changed.
changed input Notifies about changed state without propagation. Only sets the internal state.
state none The internal state.
value output The debounced state.

Components

Component Properties Data Type Socket Type
value_boolean value boolean output
value_number value number output
value_string value string output
value_arrray value array output
value_object value object output
state_boolean state boolean none
set boolean input
changed boolean input
state_number state number none
set number input
changed number input
state_string state string none
set string input
changed string input
state_array state array none
set array input
changed array input
state_object state object none
set object input
changed object input

Entity Types

Entity Type Components
value_boolean value_boolean
value_number value_number
value_string value_string
value_arrray value_arrray
value_object value_object
state_boolean state_boolean
value_boolean
state_number state_number
state_number
state_string state_string
state_string
state_array state_array
state_array
state_object state_object
state_object
aschaeffer

aschaeffer

enhancement
Comment Icon0

Introduction

Lately, new components generator and action have been created to enable composable actions.

  • A trigger is a signal with is a boolean true.
  • A generator output a trigger.
  • An action will be executed on trigger input.

Different types of generators are possible, for example: a button, a keystroke, a menu item, a scheduled job, an HTTP/MQTT message, ... Different types of actions are possible, for example: a system command, an HTTP/MQTT message, ...

Goal

Use the power of components and remodel behaviours to be composable.

Steps for each Behaviour

  • Create a component
  • Make the entity type provide the newly created component
  • Make the entity type provide component action
  • Refactor the EntityBehaviour to a ComponentBehaviour
  • Test if the newly created component behaviour is composable with a generator, for example tray_menu_item
  • Implement auto trigger: trigger on trigger and a specific other input property

Behaviours

Plugin EntityBehaviour auto trigger Property action/trigger component
system-command system_command parameters
config config_file filename
binary load_binary_data filename
save_binary_data filename
data_url
json load_json filename
save_json filename
payload
http http payload
jsonrpc payload
mqtt mqtt_publisher payload
mqtt_subscriber payload
aschaeffer

aschaeffer

enhancement
Comment Icon0

Goal

Implement more complex connectors.

Connectors

Connector Description
DebounceConnector Propagate only, if incoming data has changed (the connector have to remember the last state interally)
ThreadedConnector Run propagation in a new thread
DelayedConnector Run propagation after a configurable delay, for example after one second
BufferedFifoConnector Buffer incoming data in a FIFO of a configurable size, for example 10 entries
NumericInterpolationConnector Similar to BufferedFifoConnector, but a numeric interpolation function is executed over the entries of the buffer, for example the result is calculated as the average of the last 10 entries (or min, max)
aschaeffer

aschaeffer

enhancement
Comment Icon0

Goal

The component can be added to any entity instance or relation instance which has an input property trigger.

Properties

  • duration (input)
  • trigger (input)
aschaeffer

aschaeffer

user interface
Comment Icon0

Goal

Implement widget toolkit for React using mantine.

The widgets are entirely self-managed and automatically communicates with the GraphQL interface.

Use Cases

  • Playground
  • Flow Editor
  • Asset Manager
  • Game Server List
  • Game Chat
  • Home Automation UI
  • Robotics UI

Usage Example

Widgets

Widget Mantine Component Component Property
InexorButton Button action trigger
InexorSwitch Switch state_boolean state
InexorIconSwitch Switch state_boolean state
InexorTextInput TextInput state_string state
InexorNumberInput NumberInput state_number state
InexorImage Image state_string (data_url) state
InexorColorPicker ColorPicker state_string state
InexorJsonInput JsonInput state_array / state_object state
InexorTransferList TransferList state_array state
InexorSlider Slider state_number state
aschaeffer

aschaeffer

documentation
Comment Icon0

Goal

Provide a user interface to test the functionality in a playground.

Tasks

  • Implement WebResourceProvider
  • Load entity types + load test suite for each entity type
  • Show tab for each test suite
  • Create a first test suite for AND
  • Render Test Suite

Test Suite

  • Entity Type Name
  • Title
  • Description
  • GraphQL mutation for creating the test suite
  • GraphQL mutation for updating the test suite
  • GraphQL mutation for cleaning up the test suite
  • Update interval
aschaeffer

aschaeffer

enhancement
Comment Icon0

Plugin DateTime

Name Repository
inexor-rgf-plugin-date-time https://github.com/aschaeffer/inexor-rgf-plugin-date-time

Property Type Extension

Entity Types

Name Components Properties DataType SocketType Description
timestamp action trigger bool input Returns the current timestamp
action result number output The timestamp (UNIX epoch)
now action trigger bool input Returns the current date time
action result string output The current date time as ISO8601
datetime_plus datetime string input Adds the given duration from the given date time
duration string input The duration to add (ISO8601 duration format)
result string output The calculated date time as ISO8601
datetime_minus datetime string input Subtracts the given duration from the given date time
duration string input The duration to subtract (ISO8601 duration format)
result string output The calculated date time as ISO8601
datetime_diff datetime string input Calculates the difference of two datetimes
datetime string input
result string output The calculated difference as ISO8601 duration format

Use Cases

  • Date Parsing
  • Date Calculation
  • Scheduling
  • Timers
aschaeffer

aschaeffer

plugin
Comment Icon0
  • Type System Management
    • CRUD + Navigation
      • Components
      • Entity Types
      • Relation Types
      • Property Types
    • Type Graph
      • Integrate with Type System Management CRUD
aschaeffer

aschaeffer

graphql
Comment Icon1

Currently, the GraphQL interface allows access to the type system and the instance system. This allows general access to all types and instances. But the access is done in a way that takes place on a technical level.

For example, if you are looking for a specific player, you are querying an entity instance - not the player.

The aim is to also offer a GraphQL schema that is dynamically generated from the type system.

aschaeffer

aschaeffer

user interface
Comment Icon0
  • Plugins
    • List of plugins and their state (active/inactive)
  • Instance System Management
    • CRUD + Navigation
      • Entity Instances
      • Relation Instances
      • Flows
      • Property Instances
    • Instance Graph
      • Integrate with Instance System Management CRUD
  • Flow Editor
    • Control Flow Editor
    • Integrate with Type System Management
    • Integrate with Instance System Management
aschaeffer

aschaeffer

enhancement
Comment Icon0

Plugin Assets

Name Repository
inexor-rgf-plugin-asset https://github.com/aschaeffer/inexor-rgf-plugin-asset

Components

Name Property Data Type Socket Type
Crosshair
Font
Icon
Image
Model
Skybox back_side string output
down_side string output
front_side string output
left_side string output
right_side string output
upper_side string output
SoundEffect
SoundTrack tracks array output
Texture primary_texture string output
normal_map string output
depth_map string output
specularity_map string output
glow_map string output

Entity Types

Name Property Data Type Socket Type Component Description
AssetRepository source_url string none An URL to the repository source.

  • Local repository: #404.../
  • Git repository: https://...
path string none The absolute path of the repository root in the local filesystem
trigger bool input Updates the repository
name string none Named
description string none Describable
AssetCollection trigger bool input Scans the collection
name string none Named
description string none Describable
Asset path string output The absolute path of the asset in the local filesystem
name string none Named
description string none Describable
version string none Versioned The semantic version
license string none Licensed The license identifier
attribution string none Licensed The license identifier

Relation Types

Outbound Entity Type Relation Type Inbound Entity Type
AssetRepository ProvidesCollection AssetCollection
AssetCollection ProvidesAsset Asset
AssetCollection IsCategorizedAs Category
Map DependsOn Model
Map DependsOn SoundEffect
Map DependsOn Texture
Asset IsCategorizedAs Category

Stable UUIDs

  • AssetRepository
    • Namespace AssetRepository + AssetRepository::source_url
  • AssetCollection
    • Namespace AssetCollection + (AssetRepository::source_url + AssetCollection::name)

Licenses of the assets

List of licenses: https://spdx.org/licenses/ Best practices for attribution: https://wiki.creativecommons.org/wiki/best_practices_for_attribution

Versions of the assets

Semantic Versioning: https://semver.org/

Definition of Done

  • Register Entity Types / Components
  • Integrate git library
  • Clone a remote git repository
  • Update a remote git repository
  • Walk through local repositories and create entity instances of type AssetCollection
  • Walk through asset collections and create entity instances of type Asset and apply the asset components (for example component Texture)
  • AssetCollectionFlow: Create flow which stores the AssetCollection and Asset instances
  • Store and load an AssetCollectionFlow
  • Provide a HTTP endpoint for downloading binary assets at /assets/{collection}/{asset_type}/{uuid} (returns binary data!)
  • Provide a simple user interface (Asset Library)
aschaeffer

aschaeffer

plugin
Comment Icon0

A playlist is an ordered collection of entries which are playable:

  • Soundtrack / Music
  • Rotation/Collection of maps
  • Rotation of modes
  • Rotation of sound effects

Abstraction: The mechanism is independently of the contents.

Type System

Entity Types

  • Playlist
  • PlaylistEntry
  • Asset (provided by inexor-rgf-plugin-asset)

Relation Types

  • FirstEntry (Outbound: Playlist, Inbound: PlaylistEntry)
  • LastEntry (Outbound: Playlist, Inbound: PlaylistEntry)
  • NextEntry (Outbound: PlaylistEntry, Inbound: PlaylistEntry)
  • UsesAsset (Outbound: PlaylistEntry, Inbound: Asset)
aschaeffer

aschaeffer

enhancement
Comment Icon0

User Story

As a developer, I want to benchmark the system.

Definition of Done

  • I can run a benchmark which shows me how many components are created within a fixed time span.
  • I can run a benchmark which shows me how many entity types are created within a fixed time span.
  • I can run a benchmark which shows me how many relation types are created within a fixed time span.

Resources

aschaeffer

aschaeffer

good first issue
Comment Icon0

User Story

As a user or a tester I want to download a snap package which is installable on my Linux computer.

Definition of Done

  • A snap package is available
  • Additional plugins are contained in the snap package, preferable it's possible to configure which plugins shall be contained in the snap package
  • The package can be downloaded from GitHub

Resources

A good walk through: https://snapcraft.io/blog/lets-build-a-snap-together-a-complex-snapcraft-yaml-walkthrough

Information - Updated Jul 27, 2022

Stars: 2
Forks: 0
Issues: 25

Canduma rust Graphql

A Rust authentication server with GraphQL API, Diesel, PostgreSQL session authentication and JWT

Canduma rust Graphql

rust-graphql-test

A test GraphQL API using actix-web and async-graphql

rust-graphql-test

Rust Async-GraphQL Example: Caster API

This is an example app for the upcoming Rust video series by rustup

Rust Async-GraphQL Example: Caster API

GraphQL client for Rust, with typed requests and responses, and subscriptions!

Precise types for query variables and responses

GraphQL client for Rust, with typed requests and responses, and subscriptions!

rust-graphql-sample

A sample of GraphQL in Rust

rust-graphql-sample

Zero to GraphQL Using Rust

The purpose of this example is to provide details as to how one would go about using GraphQL with the Rust Language

Zero to GraphQL Using Rust

Test Rust Graphql Server

Just playing with some graphql in rust to see what i can make

Test Rust Graphql Server

Minimal GraphQL client for Rust

Simple API, supports queries and mutations

Minimal GraphQL client for Rust

rust-actix-graphql-sqlx-postgresql

Using GraphQL with Rust and Apollo Federation

rust-actix-graphql-sqlx-postgresql

Canduma rust Graphql

A Rust authentication server with GraphQL API, Diesel, PostgreSQL session authentication and JWT

Canduma rust Graphql
Facebook Instagram Twitter GitHub Dribbble
Privacy