on Unity DOTS Architecture
Multiplayer Applications and Games Project
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 »
Italiano
·
View Demo
·
Thesis
·
Presentation
·
Report Bug | Request Feature
Table of Contents
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.
DOTS proposes to replace the old architecture 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 objective-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 by the separation between data (inside the components) and the 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, stand out the possibility of making 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:
- Entities - implements the ECS model.
- Physics - implements the physics.
- NetCode - implements the networking.
The following images show an example run of the prototype, with an headless server and two connected clients: the first one is running in the Unity editor, the second one is a standalone application running on a different computer. Using the NetCode package, when entering PlayMode in the editor, Unity runs the server, a client and an arbitrary number of thin clients (in this case we didn't set any of those).
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
- Install Git at Download Git.
- Clone the repo.
git clone https://github.com/mikyll/UnityDOTS-Thesis
- Download Unity Hub at Download Unity.
- Install a proper Unity version (2020.2.1 or higher) at Download Archive or from Unity Hub.
- 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.
- Fork the Project.
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
). - Commit your Changes (
git commit -m 'Add some AmazingFeature'
). - Push to the Branch (
git push origin feature/AmazingFeature
). - Open a Pull Request.
License
Distributed under the MIT License. See LICENSE
for more information.
Contact
Michele Righi - [email protected]
Project Link: https://github.com/mikyll/UnityDOTS-Thesis
Acknowledgements
- My co-supervisor Andrea Garbugli for having suggested me this extremely interesting thesis topic and for the help and support in drafting the paper.
- Othneil Drew for the amazing README template.