Skip to content

The Reactive Semantic Entity Component System is meant to be the core of the game engine which represents the game state as the one and only truth using entities and semantic relations in a graph that controls and runs the game logic using reactive technologies.

License

Notifications You must be signed in to change notification settings

aschaeffer/rust-ecs-poc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Inexor Reactive Semantic Entity Component System

Inexor is an open-source project which ???.

The main objective of this repository is the development of a entity component system based on Rust, a graph database,

Inexor is licensed under the MIT license.

About

The Reactive Semantic Entity Component System is meant to be the core of the game engine which represents the game state as the one and only truth using entities and semantic relations in a graph that controls and runs the game logic using reactive technologies.

Goals

The minimal valuable product (MVP) contains the following goals:

  • The entity system is a network of entities which are connected with semantic and directional relations in a graph
  • The entity system is a network of properties which are connected with connectors in order to control the data flow from one entity to another
  • The underlying data store technology is a graph database which is embedded in the application
  • The entities/relations are reactive. This means the properties of the entity/relation are processed internally using reactive technologies (for example an entity of type AND outputs the result of a boolean and operation of the two boolean inputs)

Stories

Developer

  • As a developer I can define components using the API
  • As a developer I can create entities (with properties) using the API
  • As a developer I can create relations (with properties) using the API
  • As a developer I can connect and disconnect two properties which data flows from one to the other using the API
  • As a developer I can create an entity of type AND-operation which outputs the AND-operation of two inputs using the API

Flow Designer

JSON

  • As a flow designer I can define components which can be used as building block for entities using a JSON file
  • As a flow designer I can create entities with properties using a JSON file
  • As a flow designer I can connect and disconnect two properties which data flows from one to the other using a JSON file

JavaScript

  • As a flow designer I can define components which can be used as building block for entities using JavaScript
  • As a flow designer I can create entities with properties using JavaScript
  • As a flow designer I can connect and disconnect two properties which data flows from one to the other using JavaScript
  • As a flow designer I can create flows using JavaScript

GraphQL

  • 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 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

Library Integrations

The goal is to integrate a set of strategically important libraries and glue them together in order to archive the goals:

  • Dependency Injection (waiter_di)
  • Embedded Graph Database (indradb)
  • Reactive Streams (bidule)
  • Logging
  • Websockets Server
  • HTTP Server
  • GraphQL Server
  • JavaScript Runtime (deno)

Further libraries might be of interest (asset management, remote procedure calls, ...) but these four libraries are the essential ones.

Setup

  • Readme
  • License
  • Code of Conduct
  • Changelog
  • Code Documentation (cargo doc)
  • Unit tests (cargo test --package rust-ecs-poc --bin rust-ecs-poc -- --nocapture --exact -Z unstable-options --show-output)
  • Source Code Format (cargo fmt)
  • Reference Documentation (rst, wiki)
  • Logging Framework
  • GitHub Actions
    • Compile
    • Run tests
    • Generate Code Documentation
    • Create GitHub Release by Tag
  • Packaging
    • Create snap package

Implementation

Models

Base Models (Serializable)

  • Component
  • EntityType
  • EntityInstance
    • From Vertex Properties
  • RelationInstance
    • From Edge Properties
  • Flow
    • List of entity instances
    • List of relation instances

Reactive Models (Non-Serializable, Managed by a Registry)

  • ReactivePropertyInstance
    • Not serializable
    • Getter
    • Typed Getters
    • Setter
    • Send (Send but not set)
    • Tick (Resend)
  • ReactiveEntityInstance
    • Not serializable
    • Construct ReactiveEntityInstance from Vertex
    • Construct Properties
    • Typed Getters
    • Setter
  • ReactiveRelationInstance
    • Not serializable
    • Construct ReactiveRelationInstance from Edge
    • Construct Properties
    • Typed Getters
    • Setter
  • ReactiveFlow
    • List of ReactiveEntityInstance
    • List of ReactiveRelationInstance

Behaviours

The idea is to wrap functionality around ReactiveEntityInstances and ReactiveRelationInstances.

A ReactiveEntityInstance has properties with streams but doesn't do anything yet.

The reactive behaviour implements the behaviour of a type. For example the AND

EntityInstanceBehaviours

  • ConstValue
    • Unit-Test: Fill ConstValue with external data
    • Drop
  • LogicalGate
    • AND
      • Unit-Test: One AND-Gate R = (B1 && B2)
      • Unit-Test: Three AND-Gates R = ((B1 && B2) && (B3 && B4)) -> Using Connectors
    • OR
      • Unit-Test: One OR-Gate R = (B1 || B2)
      • Unit-Test: Three OR-Gates R = ((B1 || B2) || (B3 || B4)) -> Using Connectors
  • ArithmeticGate
    • ADD
      • Unit-Test: One ADD-Gate R = (N1 + N2)
      • Unit-Test: Three AND-Gates R = ((N1 + N2) + (N3 + N4)) -> Using Connectors
    • SUB
      • Unit-Test: One SUB-Gate R = (N1 - N2)
      • Unit-Test: Three SUB-Gates R = ((N1 - N2) - (N3 - N4)) -> Using Connectors
  • TrigonometricOperation
    • SIN
    • COS
  • SimpleClosure
    • PRINT
    • LOG

RelationInstanceBehaviours

  • Connector
    • Connector::from_relation(ReactiveRelationInstance)
    • Connector::new(OutboundEntity, OutboundPropName, InboundEntity, InboundPropName)
    • Connector::connect
    • Connector::disconnect
    • Optionally: Initially send value down the stream
    • Optionally: Pause + Resume

APIs

  • Component Manager
  • EntityTypeManager
  • EntityVertexManager
  • EntityInstanceManager
  • ReactiveEntityInstanceManager
  • RelationTypeManager
  • RelationEdgeManager
  • RelationInstanceManager
  • ReactiveRelationInstanceManager
    • Resolves which behaviour(s) should be applied on an entity
    • Delegation to Registry
  • ReactiveEntityManager delegates to EntityBehaviourManager
  • ReactiveRelationManager delegates to RelationBehaviourManager
  • EntityBehaviourManager delegates to EntityBehaviourRegistries
  • RelationBehaviourManager delegates to RelationBehaviourRegistries
  • EntityBehaviourRegistry
  • RelationBehaviourRegistry
  • EntityBehaviourFactory
  • RelationBehaviourFactory
  • EntityBehaviour
  • RelationBehaviour
  • FlowManager
  • ReactiveFlowManager

Service Layer Implementations

  • ComponentManagerImpl
    • Store references of Component
    • Has Component by Name
    • Register Component
    • Get All Components
    • Get Component By Name
    • Delete Component By Name
    • Export Component To JSON File
    • Import Component From JSON File
    • Unit Tests
  • EntityTypeManagerImpl
    • Store references of EntityType
    • Has Entity Type by Name
    • Register Entity Type
      • Expand Effective Properties From All Components (merge properties with the properties provided by the components)
    • Create Entity Type
    • Get Entity Type by Name
    • Delete Entity Type By Name
    • Export Entity Type To JSON File
    • Import Entity Type From JSON File
    • Unit Tests
  • RelationTypeManagerImpl
    • Store references of RelationType
    • Has Relation Type by Name
    • Register Relation Type
      • Expand Effective Properties From All Components (merge properties with the properties provided by the components)
    • Create Relation Type
    • Get Relation Type by Name
    • Delete Relation Type By Name
    • Export Relation Type To JSON File
    • Import Relation Type From JSON File
    • Unit Tests
  • EntityVertexManagerImpl
    • Has Vertex by UUID
    • Get Vertex by UUID
    • Get Vertex Properties by UUID
    • Create Vertex
    • Create Vertex with UUID
      • Check if id exists in Datastore (must not exist)
      • Create Vertex Properties
    • Delete Vertex
    • Unit Tests
  • RelationEdgeManagerImpl
    • Has Edge by Outbound-UUID, type-name and Inbound-UUID
    • Get Edge by Outbound-UUID, type-name and Inbound-UUID
    • Get Edge Properties by Outbound-UUID, type-name and Inbound-UUID
    • Create Edge
    • Delete Edge By Outbound-UUID, type-name and Inbound-UUID
    • Unit Tests
  • EntityInstanceManagerImpl
    • Has Entity Instance by UUID
    • Get Entity Instance by UUID
    • Create Entity Instance
    • Create Entity Instance with UUID
    • Delete Entity Instance By UUID
    • Import EntityInstance from JSON
    • Export EntityInstance to JSON
      • Create EntityInstance from Vertex
    • Unit Tests
  • RelationInstanceManagerImpl
    • Has Relation Instance by Outbound-UUID, type-name and Inbound-UUID
    • Get Relation Instance by Outbound-UUID, type-name and Inbound-UUID
    • Create Relation Instance
    • Delete Relation Instance By Outbound-UUID, type-name and Inbound-UUID
    • Import Relation Instance from JSON
    • Export Relation Instance to JSON
    • Unit Tests
  • ReactiveEntityInstanceManagerImpl
    • Central registry of all ReactiveEntityInstances
    • Create ReactiveEntityInstance by UUID
    • On Instantiation: Instantiate EntityBehaviour
    • Check if id exists in HashMap (must not exist)
    • Check if id exists in Datastore -> Manager
    • Unit Tests
  • ReactiveRelationInstanceManagerImpl
    • Central registry of all ReactiveRelationInstances
      • These are the actually "running" / "living" instances
    • Create ReactiveRelationInstance by UUID
      • Get Relation Instance by EdgeKey from RelationInstanceManager
      • On Instantiation: Instantiate ReactiveRelationInstanceBehaviour by TYPE
        • Connector
    • Unit Tests
  • EntityInstanceBehaviourManager
    • Instantiate Behaviour
    • Remove Behaviour
  • RelationInstanceBehaviourManager
    • Instantiate Behaviour
    • Remove Behaviour
  • FlowManagerImpl
    • Create Flow: Creates entity and relation instances contained in the flow
    • Delete Flow: Deletes entity and relation instances contained in the flow
    • Import, Export
    • Unit Tests
  • ReactiveFlowManagerImpl
    • Map<FlowId, List>
    • Has
    • Get
    • Create
    • Commit
    • Delete
    • Export
    • Import
    • Unit Tests

Behaviours

WebSocket

GraphQL

Command System Flow

  • Websocket endpoint for command input
  • Command parsing
  • Rename behaviour simple_closure (log, print, ...) to command
  • Make sure a simple_closure can have access to managers in order to get/create/update entities/relations
  • Implement a terminal in the flow editor

System Environment Flow

  • Implement Flow for the Environment Variables
  • Implement Flow for the Command Line Arguments
  • Implement Flow for the System / OS Constants

Beyond the Core

Permission Model

  • Game API (JavaScript Access)
    • Map = Flow
    • Game Mode = Flow
    • Game State = Flow
    • Player = Flow
  • System = Flow

About

The Reactive Semantic Entity Component System is meant to be the core of the game engine which represents the game state as the one and only truth using entities and semantic relations in a graph that controls and runs the game logic using reactive technologies.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages