{"id":28075277,"url":"https://github.com/epintos/oasis-moncraft-game","last_synced_at":"2025-05-13T00:55:52.988Z","repository":{"id":292584151,"uuid":"980514700","full_name":"epintos/oasis-moncraft-game","owner":"epintos","description":"Catch monsters in a Pokémon-style game powered by on-chain randomness, privacy, and ROFL.","archived":false,"fork":false,"pushed_at":"2025-05-11T10:46:32.000Z","size":3729,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-13T00:55:47.590Z","etag":null,"topics":["hackathon","oasis-sapphire","privacy","rofl","smart-contracts","solidity"],"latest_commit_sha":null,"homepage":"","language":"Solidity","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/epintos.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-09T08:56:39.000Z","updated_at":"2025-05-11T06:32:50.000Z","dependencies_parsed_at":"2025-05-10T22:37:21.121Z","dependency_job_id":null,"html_url":"https://github.com/epintos/oasis-moncraft-game","commit_stats":null,"previous_names":["epintos/oasis-moncraft-game"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/epintos%2Foasis-moncraft-game","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/epintos%2Foasis-moncraft-game/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/epintos%2Foasis-moncraft-game/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/epintos%2Foasis-moncraft-game/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/epintos","download_url":"https://codeload.github.com/epintos/oasis-moncraft-game/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253850892,"owners_count":21973672,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hackathon","oasis-sapphire","privacy","rofl","smart-contracts","solidity"],"created_at":"2025-05-13T00:55:52.564Z","updated_at":"2025-05-13T00:55:52.965Z","avatar_url":"https://github.com/epintos.png","language":"Solidity","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Oasis MonCraft\n\n\u003cimg src=\"./frontend/images/logo.webp\" alt=\"Logo\" width=\"200\"/\u003e\n\n## Introduction\n\n**Oasis MonCraft** is a project built for the 2025 ETHDam Hackathon. It’s a retro-inspired, top-down RPG where players explore a grid-based world, encounter wild Monsters, and attempt to catch them — blending on-chain privacy with real-time gameplay.\n\n## Implementation\n\n### Smart Contracts\n\nThe game leverages **Oasis Sapphire** and **ROFL** to introduce on-chain privacy and secure randomness into the gameplay, ensuring fairness and decentralization.\n\n### Monster Encounters and Catching Mechanics\n\nThe game client connects to a ROFL instance via WebSockets. As the player moves around the grid, ROFL invokes a view function on the `MonCraft` smart contract to determine if a Monster appears. This logic uses secure randomness on Sapphire to make each encounter unpredictable and tamper-proof.\n\nIf a Monster appears, the player may choose to attempt a capture. To ensure smooth gameplay, player movement is recorded off-chain in ROFL until the capture is initiated. When a capture is attempted, ROFL sends a transaction to the smart contract, which again uses secure randomness to decide the outcome. If successful, the Monster is added to the player's current session, and the player's state is synchronized on-chain.\n\nEach Monster is represented as an NFT with unique attributes such as HP, attack damage, appearance rates, and capture probabilities.\n\nTo prevent abuse (e.g., rerolling movements to force favorable outcomes), player movements are kept off-chain until a decision point, minimizing the attack surface while preserving game feel.\n\n\nIn the following diagram, you can see how the moves are persisted only in ROFL until the player attempts to catch a Monster. At that point, the moves are synced on-chain and the NFT is minted.\n\n![Moves flow](./images/moves.png)\n\n### Game Sessions\n\nTo lower the barrier to entry, the game supports **gasless gameplay**: no wallet is required to start. When a session begins, a unique access code is generated, allowing players to return and resume progress later. ROFL signs transactions on behalf of the player during gameplay.\n\nAdvanced users can optionally link their wallet and withdraw their Monster NFTs to trade, transfer, or import them into other game sessions.\n\n### Fights\n\nA game admin can create a fight between two sessions. Each player can join the fight by selecting a Monster from their inventory. Once both players have joined, the fight takes place off-chain in ROFL. ROFL calls a view function that returns random damage caused by each Monster. It then simulates multiple rounds automatically until one Monster's HP reaches zero. When that happens, the winner is synced on-chain, and the losing Monster's NFT is burned.\n\n![Moves flow](./images/fight.png)\n\n## Repo structure\n\nWe have a monorepo structure with the following components:\n\n- [Frontend](./frontend): Includes the game UI\n- [Smart Contracts](./smart-contracts): Includes the Smart Contracts using Hardhat\n- [ROFL](./rofl): Includes the Oasis ROFL implementation\n\n## Usefull commands\n\n### Install dependencies\n\nWe are using pnpm in each mono repo:\n\n```bash\n  pnpm install\n```\n\n### Envs\n\n```bash\n  cp .env.example .env\n```\n\nand complete the missing values.\n\n### Compile\n\n```bash\n  pnpm hardhat compile\n```\n\n### Deploy\n\nThe following compile and deploy to the different networks:\n\n```bash\n  pnpm deploy-local\n```\n\n```bash\n  pnpm deploy-tesnet\n```\n\n### Generate ABIs\n\n```bash\n  pnpm generate-abi\n```\n\n### UI Deploy\n\nInstall Vercel:\n```bash\n  npm install -g vercel\n```\n\nDeploy site:\n```bash\n  vercel\n```\n\n\n### Contributors\n\nDeveloped by [@epintos](https://github.com/epintos) and [@federava](https://github.com/federava).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fepintos%2Foasis-moncraft-game","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fepintos%2Foasis-moncraft-game","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fepintos%2Foasis-moncraft-game/lists"}