Giter Site home page Giter Site logo

zkapp-ui's Introduction

Mina zkApp: Tictacsign

Updated version of template Tictactoe to create smartcontract who need only signature of 2 players for validate the game and generate a wintoken for the winner.

The goal is to create a game with godot and use player 2 as IA, once the game is done you can send a transaction and get a WinToken if your win the game.

Contracts

Source code of smartcontracts deployed on Barkeley

UI

Source of webpage who host the game and implement zkworker

To update the Game in the UI, just export the game as HTML5 in Godot and copy the 3 files GodotMina.js/GodotMina.pck/GodotMina.wasm in ui/public folder, accept to replace the old files

Godot

Source of tictactoe game create with Godot 3.5 in C#

Player 2 is an AI, and if you win he'll create a signature you need to create proof of your victory on the mina blockchain.

UI Unity

Source of webpage who host the game and implement zkworker

To update the Game in the UI, just export the game as HTML5 in Unity and copy the files except index.html in ui-unity/public folder, accept to replace the old files

Unity

Source of tictactoe game create with Unity 2021.3.13f1

Player 2 is an AI, and if you win he'll create a signature you need to create proof of your victory on the mina blockchain.

Assets from DCR Gaming

C# Library used to sign in Godot/Unity

Godot game version

Unity game version

Deploy to github page

Replace github page directory name in these 3 files : reactCOIServiceWorker.tsx, ghp-postbuild.mjs, next.config.js

build your version with yarn run deploy or npm run deploy

push the files in out folder in your github page repository

How it's work

The smartcontract created with o1js are in the /contracts folder, they are imported in respective /ui folders (one for unity and another for godot), the ui template was duplicated from mina example.

The game was created with godot game engine and unity game engine.

To interact with JS from godot you need to use Javascript object (Check Main.cs in godot folder)

Godot Javascript docs

To interact with JS from unity you need to create a jslib file and a class who import method from this file (check MinaInteraction files from Unity Assets folder)

Unity Javascript docs

You need to export the build from these games and copy it in respective public folder in ui

I choose to initialize the game once the smartcontract are loaded and compiled, but you can choose an other method

The code to load game engine are split between _app.page.tsx and index.page.tsx

I choose to store essential information from smartcontract in js object window.tictactoe, it's a good method to interact between react app and the game

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.