Skip to content

A simple asteroids game example made on Unity using LeoECS Lite.

License

Notifications You must be signed in to change notification settings

Scrawach/asteroidecs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Asteroidecs

A simple example of asteroids game using Entity Component System (ECS) implementation by LeoEcs Lite for gameplay logic and Unity Engine for rendering, physics, resource management and other.

Gameplay

Gameplay

How to play

This is an endless game, the objective is to destroy asteroids and aliens and earn points for it. Any collision with an asteroid or an alien ends in defeat. After that, the game can be started from the beginning with zero points.

Difficulty

The game has only one difficulty level. However, it can be configured in the json file settings: change player's spaceship stats, increase or decrease spawn time for asteroids and aliens, and their stats - movement speed, health and destruction bonus.

Control

  • WASD - spaceship movement direction.
  • Mouse Position - spaceship firing direction.
  • Left Click - a simple laser that destroyed on collision with something, because it has only 1 health point.
  • Right Click - a red laser that has 2 health point and can destroy 2 asteroids or 1 alien ship before self destroying by collision.

All control logic is encapsulated in a class UnityInput.

Architecture

An important issue is how the core logic communicates with the engine's external logic. For dependency inversion uses interfaces within the core assembly referenced by the engine assembly. Thus, the core assembly does not know anything about the game engine used. ECS dictates a flat architecture and there is nothing special in core assembly.

In engine assembly, game engine (Unity) interacts with ECS core via MonoLinks.

Entry Point

The game starts without an initial scene, instead using a pure C# class with the RuntimeInitializeOnLoadMethod attribute. This is default main method imitation from pure C#. Resource management uses Unity Addressables to load resources from the prefab folder.

The game is constructed at the entry point (composition root).

Diagram

Flat Architecture

Screenshots

Gameplay Gameplay

About

A simple asteroids game example made on Unity using LeoECS Lite.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published