Dojo Design
On this page, you will find a comprehensive explanation of the design pattern utilized by Dojo
.
Folder Structure
When working with the Dojo
repository, it's important to focus on two key folders: Nakama
, and Unity
.
Nakama
folder is where you'll find the Docker file and Nakama module implementations.Unity
folder is the core of theDojo
package, as it contains both the package itself and example games. It is also the folder that will be opened by Unity editor.
Unity Folder
The code inside the Unity folder is split into two parts: the Dojo
package code and the example games code.
Unity/Assets/Dojo
has all the code implementation forDojo
package.Unity/Assets/Examples
contains all the example game implementations.
Dojo Package
Dojo
package has following layout:
Agent/
Editor/
Mujoco/
Nakama/
Netcode/
Plugins/
Recording/
UI/
Dispatcher.cs
DojoConnection.cs
DojoMessage.cs
DojoNetworkRole.cs
Agent
folder provide code for Unity ml-agents integration.Editor
has code that only runs in Unity editor, such as game builder scripts.Mujoco
contains the integration code for Mujoco physics engine.Nakama
integrates the Nakama multiplayer framework.Netcode
integrates the Unity Netcode for GameObjects.Plugins
contains system-specific binary files that are used inDojo
.Recording
provides code for recording game play information.UI
implements the user interface for human players and viewers.
Finally, DojoConnection.cs
is the script responsible for orchestrating the package and ensuring smooth operation by connecting all its components.
Dojo Examples
The example games follow a specific folder structure pattern:
- The parent folder is the name of the game.
Actions
contains all the keyboard/mouse action maps.Configs
has the configuration files used for this game.Materials
has the shader/physics materials used in game.Prefabs
contains the prefabs in Unity.Scenes
is where the scene files locate.Scripts
contains all the code in the game.Shaders
has custom shader implementations.Textures
contains any image textures used in the game.UIBuilder
has any custom user interface configuration for this game.
In conclusion, open a game scene by navigating to the Scenes
folder.
Dojo Components
A standard Dojo
game is composed of the following elements:
The game is based on the Nakama framework and incorporates the Dojo
Nakama integration. Additionally, it employs a human interface for human interactions, utilizes ml-agents integration for communicating with the Algorithms
code, and integrates netcode for game state synchronization.