https://github.com/ecsx-framework/ecsx

An Entity-Component-System framework for Elixir

https://github.com/ecsx-framework/ecsx

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.3%) to scientific vocabulary

Keywords

ecs elixir entity-component-system game-development game-server-framework realtime simulation
Last synced: 5 months ago · JSON representation

Repository

An Entity-Component-System framework for Elixir

Basic Info
  • Host: GitHub
  • Owner: ecsx-framework
  • License: gpl-3.0
  • Language: Elixir
  • Default Branch: master
  • Homepage:
  • Size: 235 KB
Statistics
  • Stars: 234
  • Watchers: 11
  • Forks: 11
  • Open Issues: 13
  • Releases: 0
Topics
ecs elixir entity-component-system game-development game-server-framework realtime simulation
Created over 3 years ago · Last pushed about 1 year ago
Metadata Files
Readme Changelog License

README.md

ECSx

Hex Version License Documentation

ECSx is an Entity-Component-System (ECS) framework for Elixir. ECS is an architecture for building real-time games and simulations, wherein data about Entities is stored in small fragments called Components, which are then read and updated by Systems.

Setup

  • Add :ecsx to the list of dependencies in mix.exs:

elixir def deps do [ {:ecsx, "~> 0.5"} ] end

  • Run mix deps.get
  • Run mix ecsx.setup

Upgrading

While ECSx is pre-v1.0, minor version updates will contain breaking changes. If you are upgrading an application from ECSx 0.4.x or earlier, please refer to our upgrade guide.

Tutorial Project

Building a ship combat engine with ECSx in a Phoenix app
Note: This tutorial project is a work-in-progress

Usage

Entities and Components

Everything in your application is an Entity, but in ECS you won't work with these Entities directly - instead you will work with the individual attributes that an Entity might have. These attributes are given to an Entity by creating a Component, which holds, at minimum, the Entity's unique ID, but also can store a value. For example:

  • You're running a 2-dimensional simulation of cars on a highway
  • Each car gets its own entity_id e.g. 123
  • If the car with ID 123 is blue, we give it a Color Component with value "blue"
  • If the same car is moving west at 60mph, we might model this with a Direction Component with value "west" and a Speed Component with value 60
  • The car would also have Components such as XCoordinate and YCoordinate to locate it on the map

Systems

Once your Entities are modeled using Components, you'll create Systems to operate on them. For example:

  • Entities with Speed Components should have their locations regularly updated according to the speed and direction
  • We can create a Move System which reads the Speed and Direction Components, calculates how far the car has moved since the last server tick, and updates the Entity's XCoordinate and/or YCoordinate Component accordingly.
  • The System will run every tick, only considering Entities which have a Speed Component

Generators

ECSx comes with generators to quickly create new Components or Systems:

  • mix ecsx.gen.component
  • mix ecsx.gen.system

Manager

Every ECSx application requires a Manager module, where valid Component types and Systems are declared, as well as the setup to spawn world objects before any players join. This module is created for you during mix ecsx.setup and will be automatically updated by the other generators.

It is especially important to consider the order of your Systems list. The manager will run each System one at a time, in order.

Persistence

Components are not persisted by default. To persist an entity, use the persist: true option when adding the component. The default adapter for persistence is the ECSx.Persistence.FileAdapter, which stores the components in a binary file. The adapter can be changed using the persistence_adapter application variable:

elixir config :ecsx, ... persistence_adapter: ...

Currently available Persistence Adapters (see links for installation/configuration instructions):

License

Copyright (C) 2022 Andrew P Berrien

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

Owner

  • Name: ecsx-framework
  • Login: ecsx-framework
  • Kind: organization

GitHub Events

Total
  • Issues event: 1
  • Watch event: 36
  • Issue comment event: 1
  • Push event: 2
  • Fork event: 2
  • Create event: 1
Last Year
  • Issues event: 1
  • Watch event: 36
  • Issue comment event: 1
  • Push event: 2
  • Fork event: 2
  • Create event: 1

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 107
  • Total Committers: 4
  • Avg Commits per committer: 26.75
  • Development Distribution Score (DDS): 0.121
Past Year
  • Commits: 2
  • Committers: 1
  • Avg Commits per committer: 2.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Andrew Berrien 7****5 94
Mike Binns T****r 11
Ruan Brandão r****o@g****m 1
Henricus Louwhoff h****s@h****m 1
Committer Domains (Top 20 + Academic)
hey.com: 1

Issues and Pull Requests

Last synced: 9 months ago

All Time
  • Total issues: 71
  • Total pull requests: 92
  • Average time to close issues: about 1 month
  • Average time to close pull requests: 12 days
  • Total issue authors: 12
  • Total pull request authors: 6
  • Average comments per issue: 1.14
  • Average comments per pull request: 0.25
  • Merged pull requests: 87
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • APB9785 (19)
  • TheFirstAvenger (3)
  • Binsect (3)
  • hassanshaikley (2)
  • bumbus (2)
  • BrooklinJazz (1)
  • iacobson (1)
  • hl (1)
  • artokun (1)
  • autodidaddict (1)
  • spacebat (1)
  • AdrianPaulCarrieres (1)
Pull Request Authors
  • APB9785 (31)
  • TheFirstAvenger (12)
  • hl (1)
  • Nezteb (1)
  • ruan-brandao (1)
  • cvincent (1)
Top Labels
Issue Labels
enhancement (6) documentation (3)
Pull Request Labels

Packages

  • Total packages: 3
  • Total downloads:
    • hex 3,365 total
  • Total dependent packages: 2
    (may contain duplicates)
  • Total dependent repositories: 1
    (may contain duplicates)
  • Total versions: 27
  • Total maintainers: 1
proxy.golang.org: github.com/ecsx-framework/ECSx
  • Versions: 9
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.5%
Average: 5.6%
Dependent repos count: 5.8%
Last synced: 5 months ago
proxy.golang.org: github.com/ecsx-framework/ecsx
  • Versions: 9
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.5%
Average: 5.6%
Dependent repos count: 5.8%
Last synced: 5 months ago
hex.pm: ecsx

An Entity-Component-System framework for Elixir

  • Versions: 9
  • Dependent Packages: 2
  • Dependent Repositories: 1
  • Downloads: 3,365 Total
Rankings
Stargazers count: 6.5%
Dependent packages count: 10.6%
Forks count: 13.8%
Average: 18.3%
Dependent repos count: 18.8%
Downloads: 41.9%
Maintainers (1)
Last synced: 5 months ago

Dependencies

mix.exs hex
  • dialyxir ~> 1.0
  • ex_doc ~> 0.28
  • excoveralls ~> 0.14
.github/workflows/elixir.yml actions
  • actions/cache v3 composite
  • actions/checkout v3 composite
  • erlef/setup-beam 988e02bfe678367a02564f65ca2e37726dc0268f composite