Skip to content

zdw19840929/Entitas-CSharp

 
 

Repository files navigation

Entitas


🎉 Happy birthday Entitas! 🎉
3 years of clean code
Please support the development
Thank you!


Join the chat at https://gitter.im/sschmid/Entitas-CSharp

<a href="https://twitter.com/intent/follow?original_referer=https%3A%2F%2Fgithub.com%2Fsschmid%2FEntitas-CSharp&screen_name=s_schmid&tw_p=followbutton">
    <img src="https://img.shields.io/badge/twitter-follow%20%40s__schmid-blue.svg" alt="Twitter Follow Me"></a>

<a href="https://twitter.com/intent/follow?original_referer=https%3A%2F%2Fgithub.com%2Fsschmid%2FEntitas-CSharp&screen_name=entitas_csharp&tw_p=followbutton">
    <img src="https://img.shields.io/badge/twitter-follow%20%40entitas__csharp-blue.svg" alt="Twitter Follow Me"></a>

<a href="https://travis-ci.org/sschmid/Entitas-CSharp">
    <img src="https://travis-ci.org/sschmid/Entitas-CSharp.svg?branch=master" alt="Build Status"></a>

<a href="https://github.com/sschmid/Entitas-CSharp/releases">
    <img src="https://img.shields.io/github/release/sschmid/Entitas-CSharp.svg" alt="Latest release"></a>

Entitas - The Entity Component System Framework for C# and Unity

Entitas is a super fast Entity Component System Framework (ECS) specifically made for C# and Unity. Internal caching and blazing fast component access makes it second to none. Several design decisions have been made to work optimal in a garbage collected environment and to go easy on the garbage collector. Entitas comes with an optional code generator which radically reduces the amount of code you have to write and makes your code read like well written prose.

CSharp Unity3d Unite Europe 2015 Unite Europe 2016 Wooga Gram Games.png



Unity Unite Talks

Entity system architecture with Unity ECS architecture with Unity by example
Unite Europe 2015 Unite Europe 2016
» Open the slides on SlideShare: Unite Europe 2015 » Open the slides on SlideShare: Unite Europe 2016

First glimpse

The optional code generator lets you write code that is super fast, safe and literally screams its intent.

public static GameEntity CreateRedGem(this GameContext context, Vector3 position) {
    var entity = context.CreateEntity();
    entity.isGameBoardElement = true;
    entity.isMovable = true;
    entity.AddPosition(position);
    entity.AddAsset("RedGem");
    entity.isInteractive = true;
    return entity;
}
var entities = context.GetEntities(Matcher<GameEntity>.AllOf(GameMatcher.Position, GameMatcher.Velocity));
foreach(var e in entities) {
    var pos = e.position;
    var vel = e.velocity;
    e.ReplacePosition(pos.value + vel.value);
}

Overview

Entitas is fast, light and gets rid of unnecessary complexity. There are less than a handful classes you have to know to rocket start your game or application:

  • Entity
  • Context
  • Group
  • Entity Collector

Read more...

Code Generator

The Code Generator generates classes and methods for you, so you can focus on getting the job done. It radically reduces the amount of code you have to write and improves readability by a huge magnitude. It makes your code less error-prone while ensuring best performance. I strongly recommend using it!

Read more...

Unity integration

The optional Unity module integrates Entitas nicely into Unity and provides powerful editor extensions to inspect and debug contexts, groups, entities, components and systems.

Read more...

Entitas.Unity MenuItems
Entitas.Unity.VisualDebugging Entity Entitas.Unity.VisualDebugging Systems

Entitas deep dive

Read the wiki or checkout the example projects to see Entitas in action. These example projects illustrate how systems, groups, collectors and entities all play together seamlessly.

Download Entitas

Each release is published with zip files containing all source files you need.

Show releases

Contributing to Entitas

The project is hosted on GitHub where you can report issues, fork the project and submit pull requests. Entitas is developed with TDD (Test Driven Development) and nspec. New features are introduced following the git-flow conventions.

Fork the repository, then run

$ git clone https://github.com/<username>/Entitas-CSharp.git
$ cd Entitas-CSharp
$ git branch master origin/master
$ git flow init -d

Open Entitas.sln and run the Tests project to ensure everything works as expected. Alternatively run the test script

$ ./Scripts/test

If you plan to make changes to the Entitas.Unity project, run

$ ./Scripts/update

This will copy all required Entitas source files to the Entitas.Unity project's Library folder. Entitas must be considered as a dependency. Any changes to Entitas source code within the Library folder in the Entitas.Unity project won't be committed and will be overwritten when running update again. Changes to Entitas must be done in the Entitas.sln project.

Create a new ticket to let people know what you're working on and to encourage a discussion. Follow the git-flow conventions and create a new feature branch starting with the issue number:

$ git flow feature start <#issue-your-feature>

Write unit tests and make sure all the existing tests pass. If you have many commits please consider using git rebase to cleanup the commits. This can simplify reviewing the pull request. Once you're happy with your changes open a pull request to your feature branch.

Thanks to

Big shout out to @mzaks, @cloudjubei and @devboy for endless hours of discussion and helping making Entitas awesome!

Maintainer(s)

Different language?

Entitas is available in

About

Entitas is a super fast Entity Component System (ECS) Framework specifically made for C# and Unity

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 99.2%
  • Shell 0.8%