GithubHelp home page GithubHelp logo

oultrox / eicomponent Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 1.0 2.08 MB

A framework to develop and make games with good performance and multi-threaded system for Unity.

License: MIT License

C# 100.00%

eicomponent's Introduction

EiComponent

A framework to develop and make games with good performance and multi-threaded system for Unity.

How to use!

Everything that is supposed to be attached on game objects should inherit from 'EiComponent' Everything that is not a component but still want to use system of updates and messages should inherit from 'EiCore'

To subscribe on update loops, write SubscribeUpdate() in awake or constructor to make it subscribe on that specific update loop. Loops that exists currently are:

  • PreUpdate
  • Update
  • LateUpdate
  • FixedUpdate
  • ThreadedUpdate

Pre Update and Threaded Update is only new things from Unity, where Pre Update is just called before normal Update and Threaded Update is subscribing on one of n number of threads depending on processor count.

Utility classes

EiTimer - Simple Coroutine wrapper to make timers that is called Once, on repeat, or as lerp over time, aka Animation EiTask - Simple way of doing multi threaded tasks with both callbacks for Non-Unity thread and Unity thread. EiTask.Run(MyFunction, MyLoggingMethod, MyUnityThreadCallback); one small example on how to use it.

EiMessage - everything can subscribe to this class with different messages and everyone can Publish messages so all subscribed get a callback.

  • EiMessage.Publish(new MyMessageClass("Hello World"));
  • EiMessage.Subscribe<MyMessageClass>(MyListener);

EiBuffer - Serializer to save and load data as well send packets for servers.

{
  EiBuffer buffer = new EiBuffer(sizeOfBuffer);
  buffer.SetDynamic(); <- Makes it dynamic and scale as a list, but becomes slower and creates GC on new sizes.
  buffer.Write(myInt);
  buffer.Write(myTexture2D);
  buffer.Write(myPositionVec3);
  buffer.WriteToFile(pathToFile);
}

EiPropertyEvent - A simple way of doing a property where you can subscribe to on changes. Supports multi thread with callbacks on Unity Thread.

    {
  EiPropertyEvent<float> health = new EiPropertyEvent<float>(100f);
  health.Subscribe(OnHealthChanged);
  health.Value = 74f;
}

EiSyncronizedList + EiSyncronizedQueue - Two wrappers for having threading support with lists and queues.

Both EiComponent and EiCore also has a Singleton structure to be able to create singleton easier.

public class MyComponent : EiComponentSingleton<MyComponent>{}

This will make a singleton out of this script, it will search in resource folder for a prefab that shares the same name as the script. If it doesnt find any, it will create a new game object.

eicomponent's People

Contributors

eitrum avatar oultrox avatar

Watchers

James Cloos avatar  avatar

Forkers

huangjk

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.