Git Product home page Git Product logo

angrybots_ecs's Introduction

AngryBots ECS

The DOTS project used for the presentation Converting Your Game to DOTS and contains an example of how DOTS could be used to replace a low performance process in your games (shooting many bullets at once, in this case). This is meant to provide a simple, targeted example. A video presentation of this project can be seen here

The basics

This project uses a combination of game objects and entities together. In this case, the player (game objets) spawns bullets (entity). There is an Enemy Spawner (game object) that spawns enemies (entities). When enemies die, they spawn particle effects (game objects).

Collision

Since the bullets and enemies are entities and the player is a game object, making them collide with the built in physics system won't work. As such, collision is handled by a system (CollisionSystem) and is very simplistic in nature. In this system general radius is used to calculate if bullets have collided with enemies or enemies with players. A more sophisticted collision algorithm, or even the new DOTS physics, could have been used, but this is meant to be a simple example and really isn't necessary.

The systems

Several systems are used to replace the monobehaviour functionality of the bullets and enemies

  • MoveForwardSystem - Moves any entity with the MoveForward component forward at some speed
  • TurnTowardsPlayerSystem - Turns enemy entities to face the player's position
  • CollisionSystem - Detects simple radius collision between bullets, enemies, and players
  • RemoveDeadSystem - Destroys any entities that have a Healt of zero or less
  • TimedDestroySystem - Destroys any entities that have run out of time to live (bullets)
  • PlayerTransformUpdateSystem - Due to the hybrid nature of the player game object, this sytem is needed to keep the entities position in sync with the game object's position

angrybots_ecs's People

Contributors

mikegeig 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.