Dojo Unity Concepts
Building on-chain games and worlds with Unity involves understanding several key concepts and components. Let's go over them to give you a clearer picture:
World Manager
- Function: The World Manager acts as the central hub for your Dojo world within Unity. It's the starting point where all entities from your Dojo world will be managed.
- Implementation: In your Unity scene, you'll find a
WorldManager
game object. Under this object, all entities from your Dojo world will be instantiated. - Customization: The WorldManager script component comes with default values, but you have the option to modify these. Specifically, you can update the URLs for your Katana and Torii instances and set your own world address.
Synchronization Master
- Role: This component is crucial for managing the synchronization of entities between your Dojo world and the Unity world.
- Features: In the SynchronizationMaster, you can specify the maximum number of entities you want to synchronize. It also handles the synchronization of your models' components.
- Models Component:
- Purpose: These are the components that will be synchronized between the two worlds.
- Management: You have the flexibility to add as many models as needed. However, it's important to ensure that the models you add here are also present in your Dojo world for proper synchronization.
Models
You should have a deep understanding of models in dojo if not checkout out models here before continuing.
What are Models in Dojo?
-
Definition: In Dojo, models are essential state that represent various parts of entities within your game. They are the building blocks that make up the content of your game world. Read about ECS.
-
Synchronization Role:
- Models act as the key elements that are synchronized between the onchain Dojo world and the Unity world (your game's visual and interactive representation).
- This synchronization ensures that changes or interactions happening within the Unity environment are accurately reflected in the Dojo world, and vice versa.
-
Flexibility in Adding Models:
-
Future Developments:
- An important aspect to note is that in future versions of the Dojo-Unity integration, the process of adding and synchronizing models will be further streamlined.
- The plan is to have these models auto-generated, which would significantly simplify the development process and reduce the manual effort required for synchronization.
-
Importance of Understanding Models:
- Before diving into game development with Dojo in Unity, itβs recommended to have a solid understanding of how models work in the Dojo environment.
- This knowledge is crucial for effectively designing and implementing game elements that interact seamlessly between the blockchain and the game's user interface.
In summary, models are the bridge between the onchain (Dojo) and off-chain (Unity) aspects of your game.
Adding Models
The process to add models is:
- Define in your dojo cairo contracts
- Define in your Unity world making sure they accurately reflect
Adding Systems
[insert]
Entities
Via toriiClient models are synced to Unity and are comprised of the models that you defined.