Giter Site home page Giter Site logo

chunks.js's Introduction

chunks.js

Chunks is an ECS implementation in JavaScript. Chunks consists of four basic objects:

  • Components have data, no logic.
  • Entities have components, no logic.
  • Aspects are lists of components which have a particular set of components.
  • System contain all the logic, operating on aspects.

Usage

Every object in your game is an entity with particular components. These entities are grouped into aspects, which are operated on by systems. The game loop consists of a number of systems being updated in order, changing the data stored in the components. For instance, an entity may have an Image and a Position. The position is changed by a system that handles player input. Then, the image gets drawn at the position by a system that draws the screen.

Pros

  • Avoid problems caused by inheritance in games with many different objects.
  • Clear code execution order.
  • High modularity makes it easy to add and remove chunks of game logic without affecting the rest. For instance, you could implement different game modes by initialising different sets of systems.
  • Data is clearly separated from logic. This makes Chunks suitable for multi-player games where data has to be synced between clients and a server.
  • Saving and loading can be easily implemented by serialising all entities and recreating them with dematerialised data.

Cons

  • More overhead for smaller projects.

chunks.js's People

Contributors

zadvorsky avatar

Watchers

James Cloos avatar anywhere3D avatar

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.