Code Monkey home page Code Monkey logo

dojo-demo-unity's Introduction

Integrate Unity with Dojo: A Quick Start Guide

This guide will walk you through the process of integrating Unity with Dojo.

Initial Setup

The repository already contains the dojo-starter as a submodule. Feel free to remove it if you prefer.

Prerequisites: First and foremost, ensure that Dojo is installed on your system. If it isn't, you can easily get it set up with:

curl -L https://install.dojoengine.org | bash

Followed by:

dojoup

For an in-depth setup guide, consult the Dojo book.

Launch the Example

Dojo Contract

After cloning the project, execute the following:

  1. init submodule
git submodule update --init --recursive
  1. Terminal 1 - Katana:
cd dojo-starter && katana --disable-fee
  1. Terminal 2 - Contracts:
cd dojo-starter && sozo build && sozo migrate

Unity

  1. Go to Unity Hub and add the unity folder as a project.
  2. In the Unity Editor, navigate to the Starknet SDK -> Setup to setup your game and do the following.
    • Select Dojo as your preferred game engine.
    • Enter http://localhost:5050 as the RPC Node.
    • Enter the World Address and System Address gotten from sozo migrate as the World Address and System Address respectively.
  3. Navigate to the Assets -> Scenes -> Game in the Project Hierarchy and open the Game scene.
  4. In the Game Hierarchy, select the Astronaut object. In the Inspector, you should see a Astronaut component. Fill in the Player Address field with the address of the player and Player key with the from Katana terminal.

Video Demo:

Video Demo

Making Requests to the Dojo Contract

The Astronaut.cs contains starter code for reading and writing to the Dojo contract. You can use this as a reference to make requests to the Dojo contract.

void Execute(string model, string[] args)

// Examples

// Spawning a new Player
string[] spwanArgs = new string[] { };
Execute("spawn", spwanArgs);

// Moving the Player to the left
string[] moveArgs = new string[] { "1" };
Execute("move", moveArgs);

dojo-demo-unity's People

Contributors

mvelascows avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.