All Projects → Dvergar → OSIS

Dvergar / OSIS

Licence: other
Entity Component System with network support (for haxe)

Programming Languages

haxe
709 projects
Batchfile
5799 projects

Projects that are alternatives of or similar to OSIS

SpaceWar-ECS
A space war game made with ECS and JobSystem in Unity.
Stars: ✭ 26 (-35%)
Mutual labels:  multiplayer, entity-component-system
UnityDOTS-Thesis
Bachelor's degree thesis on Unity DOTS architecture
Stars: ✭ 14 (-65%)
Mutual labels:  multiplayer, entity-component-system
space
A SCI-FI community game server simulating space(ships). Built from the ground up to support moddable online action multiplayer and roleplay!
Stars: ✭ 25 (-37.5%)
Mutual labels:  multiplayer, entity-component-system
Entitas Sync Framework
Networking framework for Entitas ECS. Targeted at turnbased games or other slow-paced genres.
Stars: ✭ 98 (+145%)
Mutual labels:  multiplayer, entity-component-system
Openage
Free (as in freedom) open source clone of the Age of Empires II engine 🚀
Stars: ✭ 10,712 (+26680%)
Mutual labels:  multiplayer, entity-component-system
Gdk For Unity Fps Starter Project
SpatialOS GDK for Unity FPS Starter Project
Stars: ✭ 119 (+197.5%)
Mutual labels:  multiplayer, entity-component-system
Gdk For Unity
SpatialOS GDK for Unity
Stars: ✭ 296 (+640%)
Mutual labels:  multiplayer, entity-component-system
Ore Infinium
Ore Infinium, Open Source multiplayer Terraria-inspired Sci-fi game, focused on technology, devices and researching. Written in Kotlin (JVM), LibGDX. Cross platform
Stars: ✭ 139 (+247.5%)
Mutual labels:  multiplayer, entity-component-system
gdk-for-unity-blank-project
SpatialOS GDK for Unity Blank Project
Stars: ✭ 33 (-17.5%)
Mutual labels:  multiplayer, entity-component-system
UGUIDOTS
Converting UGUI to be DOTS compliant
Stars: ✭ 105 (+162.5%)
Mutual labels:  entity-component-system
Entitas-Redux
An entity-component framework for Unity with code generation and visual debugging
Stars: ✭ 84 (+110%)
Mutual labels:  entity-component-system
trilogymp
Trilogy Multiplayer (TMP) is a work in progress nonprofit open source multiplayer software project for Grand Theft Auto: The Trilogy. This repository serves as a base for discussions and project management.
Stars: ✭ 105 (+162.5%)
Mutual labels:  multiplayer
harmony-ecs
A small archetypal ECS focused on compatibility and performance
Stars: ✭ 33 (-17.5%)
Mutual labels:  entity-component-system
HeroesArena
A turn-based arena multiplayer role-playing game
Stars: ✭ 16 (-60%)
Mutual labels:  multiplayer
SuperCTF
A multiplayer capture the flag game made in Godot with love and blood. Running live at www.superctf.com
Stars: ✭ 26 (-35%)
Mutual labels:  multiplayer
level10
Phoenix LiveView multiplayer card game
Stars: ✭ 51 (+27.5%)
Mutual labels:  multiplayer
arcomage-hd
Web-based, free and open source, remastered 3D clone of 3DO/NWC's 2000 card game Arcomage. 13 languages. Desktop or mobile Android iOS. Online or offline PWA. Against AI or Multiplayer (w/o server). 🧝👾🃏 (ts+react+redux+rxjs, CSS-based anim, WebRTC)
Stars: ✭ 55 (+37.5%)
Mutual labels:  multiplayer
RockBottom
A 2D-sidescrolling resource collection game - Now open sourced!
Stars: ✭ 16 (-60%)
Mutual labels:  multiplayer
king of tokyo
👑 King of Tokyo Multiplayer Board Game using Phoenix LiveView
Stars: ✭ 25 (-37.5%)
Mutual labels:  multiplayer
cloud-game-servers-examples
Collection of examples for using Google Cloud Game Servers.
Stars: ✭ 28 (-30%)
Mutual labels:  multiplayer

OSIS Logo

API here : http://dvergar.github.io/osis/ (latest, 0.8.0)
Available on haxelib.

Entity Component System architecture with networking support (for haxe).

  • Simple API
  • Simple source
  • Networking is optional, none of the network API is polluating the ECS
  • API support for shared code betwen client & server
  • Automatic & fine-grained serialization of components via PODStream
  • Avoids magic !

(Iteration from old ECS-Networking-Haxe)

Check out the sample for a quick overview of the architecture. The library assumes you are in a client/server architecture where the server is authoritative.

ECS ?

Entity is an aggregation of data-only components
Logics are in systems
Systems act on components

Networking

  • Components updates are always done from server to clients (not the other way) and only at your demand.
  • Messages are the only types of network events that can go both ways.
  • In a game w/ this framework, communications should sum up to the client sending a list of pressed keys and/or events and the server dispatching everything else.

Notes

  • Based on my network library Anette TCP (no websockets)
  • 64 components max, 64 entity sets max
  • Will soon make it network-library agnostic via an API as i want to have websockets w/ hxWebSockets soon. And udprotean for UDP later.

Usage

Setup

var em:EntityManager = new EntityManager();

If you're going networked you can get the network entity manager via.

var net = em.listen("127.0.0.1", 32000);

on the server and

var net = em.connect("127.0.0.1", 32000);

on the client.

EntitySet

An entity set will allow to manipulate entities having the specified components; here CPosition and CMonster.

var entitySet = em.getEntitySet([CPosition, CMonster]);

You will then be able to iterate through entitySet.adds, entitySet.changes, entitySet.removes and entitySet.entities. entitySet.applyChanges() will update the entity set to the last changes.

System

A system is a really simple structure that will give you a loop where you can iterate over your entity sets and an init where you will initialize your entity sets.

Example :

class MovementSystem extends System
{
    var entitySet:EntitySet;

    public override function init()
        entitySet = em.getEntitySet([CPosition, CMonster]);

    public override function loop()
    {
        entitySet.applyChanges();

        for(entity in entitySet.entities)
        {
            var pos = entity.get(CPosition);
            pos.x += 0.1;
            net.markChanged(entity, pos, entitySet);
        }
    }
}

net.markChanged here will notify the change to all the clients.

Network event

The content of an event is called a Message and will be shared among client & server, here is an example :

class MessageHello implements Message
{
    @String public var txt:String;

    public function new() {}
}

The receiver registers to the event

net.addEvent(MessageHello, function(msg:MessageHello, connection:Connection) {
    trace(msg.txt);
});

And the sender sends the message

var msg = new MessageHello();
msg.txt = "coucou";
net.sendEvent(msg);

Templates

A template is a set of components defining a specific entity

public function player()
{
  var entity = em.createEntity();
  var pos = em.addComponent(entity, new CPosition());

  return entity;
}

Adds a template like this em.addTemplate("player", player); and call the template like that em.createEntity("player");

Plugging everything together

class Server
{
    var em:EntityManager = new EntityManager();
    var net:NetEntityManager;

    public function new()
    {
        net = em.listen("127.0.0.1", 32000);
        net.onConnection = onConnection;
        net.onDisconnection = onDisconnection;
        net.addEvent(MessageHello, onMessage);

        em.addSystem(new MovementSystem());

        while(true)
        {
            em.fixedUpdate(function()
            {
                em.processAllSystems();
            });
        }
    }

    function onMessage(msg:MessageHello, connection:Connection)
    {
        trace("Message: " + msg.txt);
    }
    
    function onConnection(connection:Connection)
    {
        var player = net.createEntity("player");
        net.bindEntity(connection, player);
        net.sendWorldStateTo(connection);

        var msg = new MessageHello();
        msg.txt = "youhou";
        net.sendEvent(msg);

        net.addComponent(player, new CHealer());
    }

    function onDisconnection(conn:Connection)
    {
        var boundEntity = net.getBoundEntity(conn);
        net.destroyEntity(boundEntity);
    }

    static function main() {new Server();}
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].