/exgrasia

On-chain RPG-style sandbox game where every tile is a player-made contract!

Primary LanguageTypeScriptGNU General Public License v3.0GPL-3.0

εxgrasia

Screenshot 2022-04-17 at 1 33 02 AM

εxgrasia is a procedurally generated on-chain backdrop where every tile is a player-made contract. Imagine an infinitely extensible minecraft or DayZ, where modding is the way to play the game. εxgrasia is an exploration in this sandbox direction.

I highly recommend watching the video linked above before diving into this guide!

image

Getting Started

Get started by setting up Optimism Kovan for your wallet.

  1. You can add Optimism Kovan to your wallet by visiting this link.
  2. Next, fund your wallet with some test ETH using a Faucet. Fund the wallet that's whitelisted to play εxgrasia, we'll fund your proxy address during the new user flow later.
  3. Next, follow through the new user flow on https://0xpark.exgrasia.xyz.

How to play

εxgrasia itself is rather minimal. It defines the backdrop of the sandbox, in the form of different tiles such as grass, sand, water etc., and additionally, a concept of "ownership" of each tile.

Let's talk more about ownership.

image

Anyone can claim an unowned tile. An ownership claim allows you to put a contract address in this tile. This contract is virtually unrestricted! It only needs to conform to a minimal standard that defines a pretty representation of the contract in a tile:

image

The first 3 functions define what the tile should look like in εxgrasia, while the last is a pointer to the ABI of your contract. You can choose to customise the ABI, or to simplify development, you can use the εxgrasia remix IDE which will automatically figure out the ABI hosting/pointing for your contracts on compilation.

The ABI is used to autogenerate a simple UI for your contract. In the case of the fishing stand, for instance, this UI looks like this (

image

εxgrasia serves to function as a minimal backdrop to inspire smart contract development, and this minimal interface allows for you to do virtually anything you can imagine on-chain inside the spatial world of εxgrasia.

As inspiration for things you could build, the game implements a few mechanics and puts a "Tiny Quest Master" to only allow you to put arbitrary contracts after you complete some quests, and only allow you to cross water and snow tiles after you've completed a level 2 quest.

Here are the mechanics already in tile contracts:

Tiny Fishing Stand

Fishes are randomised ERC721 with a twist -- you can only transfer fish to others/another contract if you're adjcacent to them on the map. There's another small twist to the minting process - much like real-world fishing, there's always a pool of fishes in the water bodies, and when you fish you pull from this pool. You can imagine the kinds of optimisations you can do to make sure you get your favourite Iridscent Mahi-Mahi!

  • Contract address: 0x4d9CB454F98a503a0AC8a1d7Fa4370BE2c6BD8D9

image

Tiny OpenSea Fish Market

When you're ready to part from all the smelly fish you have, or when you're looking for that one elusive fish, the Fish Market will come in handy. You can put up your fish for sale here, or buy fishes others have listed. Remember, you can only send/receive fish from the market if you're standing right next to it. Also, the fish shopkeeper of the Fish Market closes the shop between 8PM UTC - 8AM UTC every day, so make sure you do all your trades while he's around!

  • Contract address: 0x2fcBC3805cb83cA5C9EFC482970F85eaa8378CFB

image

Tiny Mine

A tiny mine is a mineshaft where you can mine for iron, gold or diamond in stone tiles. The tiny mine itself spawns a mine shaft where you the player (represented by P in the map) can move up/down/left/right using functions of the tiny mine contract, collecting metals as you walk. Be careful though, there's also walls (represented by #s) that you might need to drill through, taking more attempts.

  • Contract address: 0xbf4Eee8Ac3D8043d6c9265f712f401294679e2aE

image

I want to see someone write a boss that uses the iron, gold or diamond ores to fight. 👀

Tiny Campfire

A tiny campfire can be used to chat with other players! You can send messages to a common board if you're standing right next to a campfire, and anyone can read the board (regardless of their proximity to campfires).

  • Contract address: 0x7a0A41d987d4a09E86665Ebf990A6F876d3c1eC6

image

Tiny Farm

The tiny farm allows you to grow corn or wheat on grass tiles or cactus on sand tiles. You can harvest the plant to obtain some wheat, corn or cactus. These are ERC-20 tokens that are only transferrable to adjacent tiles (like the aforementioned Fish NFTs).

  • Contract address: 0x4e73612996AEB2901c3Bca2F17e7c3Ae05673b9c

image

Tiny Ranch

A tiny ranch allows you to keep cattle: cows and chickens! You can milk cows to obtain a milk token or get eggs from chicken. To grow your cattle farm, you'll need to feed cows wheat and chickens corn! Cows and Chickens may also die if you do not feed them for too long, so remember to check on your cattle every now and then.

  • Contract address: 0x9dCFae1be36E626263E5849F8a9Cbb7f5cfAac83

image

Note that you'll need to grant usage access to your crops (corn or wheat ERC20 token) to the Ranch contract. You can do this by putting down a contract of a bag of wheat or corn:

  • Contract address: 0xe454394D204e0F1fd43055eE5148CE5DB787528B for wheat and 0x66E2Ff0147F8548529f6D347C7cCEcBEd84f8278 for corn

Note the addresses for the other ERC20 in case you would like to control access to these:

  • Tiny Iron Token contract address: 0x18d13d255733FbDef2C6476ff26d649eA8Efb9d5
  • Tiny Gold Token contract address: 0xFCbe4a15bcF11895912b4Db7430157b249Dd2c1d
  • Tiny Diamond Token contract address: 0x8679B849D8eB1BFe1D7221BC136e81AE21065a69
  • Tiny Milk Token contract address: 0xC5acB3A46431c4D40C08b40B5e515C53694A9129
  • Tiny Egg Token contract address: 0xA646DBA2f6547dbbB1F6eb9710Ef32B5F9885172

I can't wait to hear your ideas and see what you code up with this scaffolding! Hit me up if you want to chat about more ideas 👀

Plugins

Another facet of εxgrasia is frontend plugins! εxgrasia allows you to inject arbitrary JS/HTML code into your frontend that can render onto panes.

image

This essentially allows you to completely own the frontend experience as a developer. You can add in player attributes (perhaps a health bar?) or just code a complete UI for your contract right into εxgrasia.

As a demo, here's 2 plugins I've written you can add in using the Settings pane:

image

image

Happy hacking! Hit me up if you'd like to chat more about these ideas or have any trouble with setup: I'm @nibnalin everywhere (twitter, telegram, discord etc.). I'm thankful to a number of friends who've made εxgrasia possible at all - of course the Dark Forest team, for being the giant whose shoulders εxgrasia stands upon, gubsheep and Yush, with whom some of the first visions of εxgrasia were envisioned, Leann, who helped a ton designing the look and feel of this world, lsankar, ludens, DC and everyone else in the 0xPARC community for bouncing around ideas and thoughts!