Multi-user Plugin for Unity Editor
For my final in Networked Games, I got together with a small group of programmers to create a plugin for Unity that would allow for multiple users to interact with a single scene at once. We faced many hurdles that range from typical computer science problems, to user experience design.
The problem that we tried to overcome with this plugin is that in a project that requires the attention of various members on a team, how do you streamline the process of editing the levels? The classic way is to use a repository that lets each person work on their own local changes before putting the new content up. But the issue with complex meta data that go into a Unity scene means that you can't merge old and new scene data like you can with just code. Thus, we needed a way for people to work on the same scene simultaneously, but without the danger of people overriding each other unknowingly.
Our plugin support several baseline features and some other extra things that try to make the experience of using this system as intuitive as possible:
Server Side Auto Saving
View and Edit Modes
To optimize the finding and setting of gameobject information, we created a map of the game objects in the scene when the server is started. Each object is given a unique ID by the server, which is then translated into a hash code, pointing it to an index in the map. After we implemented this structure to organize our data, we saw a significant increase in synchronization speeds. When new objects are created, they are also given a unique ID, but there is prefix for the editor instance that created it, preventing any form of conflicting IDs between different editor instances.
Because Unity utilizes an entity component system (ECS) architecture, we were very successful in taking individual gameobjects, serializing their data, and sending it over a network. One challenge however is communicating reference data between those components in the scene. Luckily, the aforementioned map IDs provided a fantastic method of saving references. Thus, one could save a component field reference with the gameobject ID and the component type of that field when sending. Then when receiving such data, simply set that component field to that component type on that gameobject.
With this system running on a project, we envision work sessions where developers in different disciplines can work on scenes simultaneously. They can give one another live feedback and see how the world changes with each interaction in real-time.
You could have a team lead be in "View Mode" and review each member's progress as they are working. Highlighting areas that need work directly to the team rather than waiting for a check-in.
Made in Unity with RakNet backend. Programming by Aaron Hamilton, James Smith and myself.