Skip to content

mikyll/UnityDOTS-Thesis

Repository files navigation

Contributors Forks Stargazers Issues MIT License
Unity C# Visual Studio

Multiplayer Applications and Games Project
on Unity DOTS Architecture

This project was carried out as an integral part of my bachelor's degree thesis in Computer Engineering, concerning the new Unity DOTS architecture. The goal of the paper, in addition to analyzing the new data-oriented layout provided by the ECS-based model, was to create a working multiplayer game prototype made entirely using DOTS.
Explore the docs »

View Demo · Thesis · Presentation · Report Bug | Request Feature · Italiano

Table of Contents

  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgements

About The Project

Data-Oriented Technology Stack (DOTS) is a set of libraries created by Unity over the last few years, which is still under development at the time of writing (2021).

DOTS proposes to replace the old architecture & programming pattern of the game engine, that was based on a component model (GameObject + MonoBehaviour), with a new one based on ECS (Entities, Components, Systems). The goal is to obtain an architecture that is not limited by the object-oriented programming, which is known to have several pifalls and problems - mainly related to polymorphism, inheritance chains and reference types.

In this regard, through a data-oriented layout, DOTS allows to obtain performance by default, as the code becomes organized through the separation between data (placed inside the components) and behaviour (confined inside systems). Runtime "things" are no longer heavy objects, with data scattered in memory, but simple numeric indexes representing entities, which we can compare to the keys of a database. Among the many advantages that come with this new architecture, what stand out is the possibility to make the most of modern CPUs, exploiting the potential of multiple cores and allowing efficient use of caches, which are not satured by the myriad of useless or unnecessary data present in objects. Moreover, thanks to the separation logic, the code that developers write becomes a good low-level approximation of an already correct and efficient solution, which therefore doesn't need, if not in rare cases, to be optimized.
The main packages used to make the prototype are:

The following animations show an example run of the prototype, with an headless server and two connected clients: one running in the Unity editor, the other as a standalone application on a different computer. With the NetCode package, when entering PlayMode inside the editor, Unity runs the server, a client and an arbitrary number of thin clients (in this demo we didn't make use of any of those).

EditorGIF StandaloneGIF
PC1: Unity Editor PC2: Standalone Build

Built With

Getting Started

To get a local copy up and running follow these simple steps.

Prerequisites

  • Git
  • Unity Hub
  • Unity 2020.2.1 or higher

Installation

  1. Install Git at Download Git.
  2. Clone the repo.
    git clone https://github.com/mikyll/UnityDOTS-Thesis
  3. Download Unity Hub at Download Unity.
  4. Install a proper Unity version (2020.2.1 or higher) at Download Archive or from Unity Hub.
  5. Add the project directory on Unity Hub: Projects > Add > Select Directory.

Usage

To test the prototype in multiplayer you can create a build for a standalone client, then enter PlayMode in the editor and connect the standalone application; otherwise you can create one build for the server and one for the client and connect several clients to the server.

For more examples, please refer to the Documentation.

Roadmap

See the open issues for the full list of proposed features (and known issues).

Open Issues

  • The third person camera sometime starts flickering.
  • Physics simulations with dynamic entities are not synchronized between different clients.
  • Standalone builds sometime crash.

Future developments

  • Clients disconnection handle.
  • Main menu where and pre-match lobby.
  • Player scoreboard.
  • Inventory mechanic.

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project.
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature).
  3. Commit your Changes (git commit -m 'Add some AmazingFeature').
  4. Push to the Branch (git push origin feature/AmazingFeature).
  5. Open a Pull Request.

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Michele Righi - [email protected]

Project Link: github.com/mikyll/UnityDOTS-Thesis

Acknowledgements

LinkedIn GitHub followers