9000 generative on-chain dungeons

Crypts and Caverns is a generative, on-chain, Lootverse ‘lego’. Each NFT is programmatically generated within the contract, meaning no two maps are alike. The data within each map has been carefully optimized to play nicely within the loot ecosystem, supporting text, 2d, and 3d worlds. This means that developers, designers and artists alike can call the contract directly to integrate their own mechanics, adventures and tilesets on top.

['X', 'X', 'X', 'X', 'X'],
['X', ' ', ' ', 'X', ' '],
['X', ' ', 'X', 'd', ' '],
['X', 'd', ' ', ' ', 'X'],     becomes...
['X', ' ', 'p', ' ', 'X'],
['X', 'X', ' ', 'X', 'X']
low-fidelity rendering of a crypts and caverns example dungeon
Pixel art
hi-fidelity rendering of a crypts and caverns example dungeon2D top-down game (by Gareth)
There are 9,000 generative dungeon maps on the Ethereum blockchain.
223 are reserved for promotions and key contributors.

Sorry we're sold out

Waiting for assets to load

What is an on-chain map?

Using a seed derived from the blockhash and tokenId, each map is randomized with a set of probabilities for every aspect of the map. For example, there is a 70% chance that the dungeon will be a 'room-based' dungeon (meaning a series of square rooms connected by hallways) and a 30% probability that the map will be a 'cavern-based' dungeon (meaning a series of hallways bored into the walls). The end result is a map stored as on-chain data (in bytes and uint8[]) with contract read functions to retrieve this information for each token. Think of this like an open source, publicly available API.

What can I do with these maps?

These maps are a minimal 'lego' that can be used to build out adventures and games. They play nicely with the Loot ecosystem but could also fit into other universes. Dungeons are designed to support 2D, 3D, and text-based worlds.

This is a primitive and is designed to play nicely with many other primitives. Similar to how @dom left Loot open-ended, I hope that game developers and dungeon masters take this output and make as many important decisions as possible, such as defining monsters, visual style, spawn points, and more. All the data is exposed via the Solidity API (vs proprietary formats) which gives maximum flexibility for those interested in creating adventures, such as the following:

You can represent them as a 2D array for text-based adventures:
['X', 'X', 'X', 'X', 'X'],
['X', ' ', ' ', 'X', ' '],
['X', ' ', 'X', 'd', ' '],
['X', 'd', ' ', ' ', 'X'],
['X', ' ', 'p', ' ', 'X'],
['X', 'X', ' ', 'X', 'X']

You can also represent this array with 2d graphics in low fidelity (using my pixel art style packaged with each NFT):
low-fidelity rendering of a crypts and caverns example dungeon

Or you could take this same array and render it using higher fidelity (credit to @Gareth who rendered this from a test contract):
hi-fidelity rendering of a crypts and caverns example dungeon

You could also render an entire 3D space using this same data. the options are only limited by the game developer’s imagination.

Here are some more interesting use cases that could become possible over time:
* Maps can be chained together with spawn points (think of these like 'links' between web pages) to form a more persistent world.
* Maps can be chained with larger 'world maps' (e.g. Realms) to provide structured exploration and adventure in small spaces.
* Maps could have encounters (enemies, spawn points, NPCs, etc) laid on top of the 2D grid which can also be generated/rendered on-chain and allow for fully procedural game content.
* Maps can be queried, for example, allowing a game designer to select maps with two or more doors.
* Maps could belong to 'factions' or have different incentive structures laid on top for owning them

There are many more possibilities but these ideas are only a starting point. The beauty of a simple composable nft is that it can be used in many different ways when combined with other on-chain content.

Why did you create these maps?

I believe that four important inventions are coming together to change the way we interact online:
* Ethereum is a distributed computing platform (no servers required)
* Wallets are distributed identity (no logins required)
* NFTs create digital ownership/property rights (no brokers required)
* DAO's allow strangers to take collective action (no corporations required)

When you combine these aspects, you see communities and teams form around ideas, have all the tools to make them happen, and both parties are incentivized to help each other win. Ownership of the idea and project is shared between the creators and the community.

When I saw Loot, I realized that this future was closer than I had thought. An NFT can be more than art. It can be a data structure. That was a lightbulb moment.

Building on-chain is challenging. There are many constraints (compute/memory, storage, etc) and things that were previously trivial are now challenging or seemingly impossible due to the cost associated with a distributed computing platform that is manifested in the price of gas.

If a developer wants to build an on-chain game, they have to create everything from scratch: characters, enemies, items, combat systems, and more.

Just as Defi and DEXes have created composable/reusable swapping services, we can make sure developers don't have to re-build maps or other core entities. That's why I want to take advantage of the composable nature of the blockchain and provide a map that can be extended into future on-chain games.

At its core, I believe that you need three things to build a compelling gaming experience:
* People (wallet -> identity -> characters/enemies)
* Places (maps -> structures -> sense of place)
* Things (objects -> items -> objects with attributes, physical properties, etc.)

While Loot has tackled the objects and items of a game and other projects like The Genesis Project are exploring the characters, Crypts and Caverns aim to become the the fundamental on-chain data structure needed to provide a sense of place.

Whether you aim to build a 2D dungeon crawler, such as Zelda, a complex 3D MMORPG, or a dynamic virtual world, places start with a floorplan: walls and floor. I've sprinkled in some additional metadata (such as doors and points of interest) which can be utilized or ignored.

This map structure is designed to be simple to use (as a developer) and unopinionated. Like Loot, I tried to give a minimum set of opinions so that designers and developers can fill in the gaps for their own experience or with other components.

The data structure is very portable (bytes for the layout and uint8[] for the entities) and other smart contracts can easily consume this data without spending much gas to read or manipulate.

I also worked with Loot community members to develop a standard (Coming soon), with contributions from Ira Fudmore, Matto, Dom, Gareth, cjpais, and a host of others.

My hope is that these maps are just the starting point and that many community members launch additional map projects following this standard. This will lead to all maps being interoperable and offer unlimited variety to the community.

I firmly believe that the future doesn't need one canonical set of maps. It needs an infinite set of maps that evolves as new designers and developers bring new ideas.

Whether you're an experienced game designer or someone just looking to start your first game or experience, these maps can work for you.

What does the actual NFT contain?

An on-chain map means that all aspects to create the map start and end on the blockchain. No human input (other than the solidity code uploaded to the blockchain) is required.

There are two components to our maps: the image and the metadata.

The image is purely a simple pixel art representation of the map that is created. I thought it would be fun to visualize the map (versus inspecting a getLayout() endpoint all day) and gave each map some character with a very low-fi pixel representation.

I rendered each map with an 'environment' which has a color palette that maps to the mood or feel I hope the map conveys:

each dungeon has an environment to set the mood

The metadata is a structured representation of each map that can be interpreted by other contracts (on-chain) or game engines (off-chain) with the following attributes:
* Size: The width and height of the map. Maps are always square so size 6 means 6x6 and maps can have a minimum size of 6 and a maximum size of 25.
* Layout - A square set of 0s and 1s representing walls (0) and floor (1).
* Entities - I've included two 'entities' in this project that can represent special tiles on the map. I've designated Doors (0) and Points of Interest (1). What these variables actually mean is up to the developer/designer.
* Environment - A number representing a 'mood' for the map. For the artistic portion, I chose to give each environment a name. For example, (5) is called "Ember's Glow" which uses fiery red tones to resemble a volcano.
* Name - A name for the map. Most of which are unique. I chose fantasy names in line with Loot's 'For Adventurers' theme.

It is up to the designer/developer to decide which if any of these fields they want to use and how to interpret them in their future game development.

With respect to rarity, the actual map layout itself does not have a weighting or rarity. For example it is just as likely to get a 6x6 map as one that is 25x25. I believe that all of these maps can serve a purpose and be useful. And like any good fantasy game, the predefined rarity tiers are purely cosmetic, namely residing in the Environment and Name attributes.

You can find more information at the Crypts and Caverns Etherscan contract page or view the source code on Github. You can see the output of the predefined images on the official Opensea project page.

What benefits do I get from holding the maps?

Today, the benefits are purely speculative. If you believe in the vision of composable, on-chain components to build games and experiences, you may find this to be a good bet in that space.

In the future, I hope that game designers find ways to reward map holders for owning a map. This could be as simple as giving map holders special access to experiences or drops.

I anticipate that game designers will find ways to reward map holders such as creating incentives for different factions (Guilds, DAOs, or other structures) to hold maps or giving the owner a 'take' (percentage of profits) whenever a party completes an adventure in that particular map they hold. Truly, the possibilities are endless and are made possible by the composable nature of the blockchain.

The first step, however, is for these maps to exist, which is why I brought this project to life. At the least, as a Crypts and Caverns holder, you'll be the first to know about any future rewards or additional projects or features I develop in this space. I am deeply invested in making this idea succcessful and believe this is the start of something big. Plainly put, this is not a one-and-done project for me.

What is your roadmap?

* Step 1: Ship this project.
* Step 2: Share sample code and other use cases to show what's possible.
* Step 3: Find other interested projects and developers and help them build projects using these maps.
Beyond that.. the possibilities are endless :)
Along the way, I'm expecting a baby in December. In full disclosure, I'll likely be less active in the community for a few months. I want to be upfront about this from the get-go - while you may not see me quite as active, having the ability to spend time with my family during this special time is paramount. I thought it was better to put this idea out in the world, even if I'll be sporadically available for a bit, than to let it sit on my hard drive and collect dust. I will look to ramp back up to regular involvement with the project beginning in late January or early February.

Where can I learn more?

* Contract: Etherscan, Github

* Read the Map Standard (Github coming soon) and Sample Code (Github coming soon)

* Join our Discord

Can I use your code/concepts?

These maps are offered under a Creative Commons Zero (CC0) license. This means that you can copy, edit, remix, or do whatever you want with all aspects of the maps (code, names, etc). Treat them as your own and build awesome stuff.

What is your background?

I've worked in games and consumer products for years, typically in cutting edge technology (such as virtual reality). I have a passion for games and learned to code when I was a kid. This has carried over to the blockchain and is a driving factor of why I created Crypts and Caverns.

Born in the 80's


I'm a child of the 80's who never grew up. I make pixel art using javascript and solidity.