diff --git a/src/SUMMARY.md b/src/SUMMARY.md index c27daa21..5802d4be 100644 --- a/src/SUMMARY.md +++ b/src/SUMMARY.md @@ -39,9 +39,9 @@ - [Origami](./cairo/origami.md) - [SDKs](./client/overview.md) - - [dojo.js](./client/dojojs.md) - - [unity](./client/torii/unity.md) - - [c](./client/torii/c.md) + - [dojo.js](./client/sdk/dojojs.md) + - [unity](./client/sdk/unity.md) + - [c](./client/sdk/c.md) # ⛓️ Toolchain diff --git a/src/client/torii/c.md b/src/client/sdk/c.md similarity index 100% rename from src/client/torii/c.md rename to src/client/sdk/c.md diff --git a/src/client/sdk/dojojs.md b/src/client/sdk/dojojs.md new file mode 100644 index 00000000..d650fd10 --- /dev/null +++ b/src/client/sdk/dojojs.md @@ -0,0 +1 @@ +# dojo.js diff --git a/src/client/sdk/unity.md b/src/client/sdk/unity.md new file mode 100644 index 00000000..a1a00058 --- /dev/null +++ b/src/client/sdk/unity.md @@ -0,0 +1,99 @@ +# dojo.unity + +### Prerequisites + +Before getting started, there are a few steps you must follow in order to get the project up and running. + +#### Dojo + +Ensure that you're using the latest supported Dojo [version](https://github.com/dojoengine/dojo/releases). + +#### Binaries + +If you are using Windows or Linux, you will need to build [dojo.c](https://github.com/dojoengine/dojo.c) yourself. Make sure that you're using the latest supported version + +```bash +git clone git@github.com:dojoengine/dojo.c.git +cargo build --release +``` + +This will generate a `.dll` or `.so` binary in the `target/release` directory, depending on your platform. You will need to copy it to the following location `Packages/Dojo/Libraries` + +--- + +## 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 + +![world-manager](../../images/unity/world-manager.png) + +- **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 + +![world-manager](../../images/unity/sync-master.png) + +- **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 + +![models](../../images/unity/models.png) + +You should have a deep understanding of models in dojo if not checkout out models [here](../../cairo/models.md) before continuing. + +### What are Models in Dojo? + +1. **Definition**: In Dojo, [models](../../cairo/models.md) are essential state that represent various parts of [entities](../../cairo/entities.md) within your game. They are the building blocks that make up the content of your game world. Read about [ECS](../../cairo/hello-dojo.md). + +2. **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. + +3. **Flexibility in Adding Models**: + + - You have the freedom to add as many [models](../../cairo/models.md) as needed for your game's design and functionality. + - It's vital, however, to ensure that these [models](../../cairo/models.md) are consistent across both the Dojo and Unity. This means that for every model you have in Unity, there should be a corresponding model in your Dojo world. + +4. **Future Developments**: + + - An important aspect to note is that in future versions of the Dojo-Unity integration, the process of adding and synchronizing [models](../../cairo/models.md) will be further streamlined. + - The plan is to have these [models](../../cairo/models.md) auto-generated, which would significantly simplify the development process and reduce the manual effort required for synchronization. + +5. **Importance of Understanding Models**: + - Before diving into game development with Dojo in Unity, it’s recommended to have a solid understanding of how [models](../../cairo/models.md) 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](../../cairo/models.md) are the bridge between the onchain (Dojo) and off-chain (Unity) aspects of your game. + +### Adding Models + +The process to add models is: + +1. Define in your dojo cairo contracts +2. Define in your Unity world making sure they accurately reflect + +### Adding Systems + +[insert] + +### Entities + +Via toriiClient [models](../../cairo/entities.md) are synced to Unity and are comprised of the models that you defined. + +### Starter Project + +Get started by: + +0. [Prerequisites](#prerequisites) +1. Cloning the [dojo.unity](https://github.com/dojoengine/dojo.unity) +2. Open project within Unity +3. Run the [dojo-starter](https://book.dojoengine.org/cairo/hello-dojo.html) project and make sure to have Katana and Torii running. diff --git a/src/client/torii/torii-wasm.md b/src/client/torii/torii-wasm.md deleted file mode 100644 index a0c1b614..00000000 --- a/src/client/torii/torii-wasm.md +++ /dev/null @@ -1 +0,0 @@ -# wasm diff --git a/src/client/torii/unity.md b/src/client/torii/unity.md deleted file mode 100644 index 00e840b2..00000000 --- a/src/client/torii/unity.md +++ /dev/null @@ -1,3 +0,0 @@ -# Unity - -[Dojo Unity SDK](https://github.com/dojoengine/dojo.unity) diff --git a/src/images/unity/models.png b/src/images/unity/models.png new file mode 100644 index 00000000..0c608585 Binary files /dev/null and b/src/images/unity/models.png differ diff --git a/src/images/unity/sync-master.png b/src/images/unity/sync-master.png new file mode 100644 index 00000000..e4a25a6f Binary files /dev/null and b/src/images/unity/sync-master.png differ diff --git a/src/images/unity/world-manager.png b/src/images/unity/world-manager.png new file mode 100644 index 00000000..0979a2de Binary files /dev/null and b/src/images/unity/world-manager.png differ