-
-
https://bafkreiaohsd2gy7tnkzuqqxpyold7hdjz4knuo74sjrgr3oatsqrjnt2zi.ipfs.nftstorage.link/
-
https://bafkreibpz2jkmmxjcjw7yuc7o65hxtkla2jfjrd7ufjmihbie2zi2mtwqm.ipfs.nftstorage.link/
-
https://bafkreihr6hfm5q4d7emsmr6cpajp34lhtcoimrpohs4puqfv6lb7rfiyay.ipfs.nftstorage.link/
-
https://bafkreiewfhldux3ywyn3gpwpopjsccxpg34p6z7cllqndzi3ayb63kq77i.ipfs.nftstorage.link/
-
https://bafkreihelu4mjnum2yw6hwftrzukz2ng2qq3zpxujdkv5verxvtfnsusay.ipfs.nftstorage.link/
Inspiration
Inspired by https://twitter.com/dhof/status/1566823568616333316
I forked w1nt3r's skeleton and added my own ideas while implementing the full game. The idea is to actually put your monkey photos to use buy using it as your character in a simple on chain strategy game where the stakes are very very high, and the gameplay is deliberately slow.
What it does
Players can only join by proving ownership of an NFT and putting it up as collateral to be confiscated in the case of bad behavior. Players join with a minimum buy in (their spoils). Only one player or alliance remains at the end of the game and collects spoils of all others who have been knocked out along the way.
The game follows a cycle of Submit, Reveal, Resolve stages. Players submit a hash of their intended move in the Submit stage. We make it this way so that other players cannot decide their move based on what other players intend to do. Everyone then reveals their move to the public in the Reveal stage. The Chainlink Automation Upkeep then verifies the revealed move corresponds to the commitment from the previous stage and processes the move. There are penalties such as NFT confiscation or a confiscation of spoils depending on the severity of the bad behaviour (such as a commitment that does not match the reveal).
How we built it
- Chainlink Automation Upkeeps: make the gameplay tick. Each
updateIntervalthe upkeep will check the game stage and during the Resolve phase, process all thependingMoveCommitments. The upkeep also checks whether the win condition has been met each cycle, and if so moves on the calculate the winning spoils and moves the game to thePendingWithdrawalsphase. Once the winnings have been withdrawn, the upkeep updates the Game Stage toFinishedand then upkeep no longer will run (checkUpkeepwill simply return false). There is a WIP implementation ofGameFactorywhich would then launch the next iteration of the game with a clean state.
I had imagined at first that the gameplay would be extremely janky and no one would want to play such a game where they need to come back every X hours to submit or reveal. However with Chainlink Keepers it was quite trivial to code a bot player with a basic strategy to play the game to completion. I could imagine a future with an array of much more sophisticated strategies.
Chainlink VRF: are basically the dice roll function of the game. When the game finally starts, a dice roll is made to randomly determine where the
jailCellwill be on the grid. When players collide and engage in abattle(), the randomness provided by the VRF will determine what percent of the player's total attack will be applied as actual effective damage on their opponent.While the focus of this submission was on the smart contracts, the UI side had some fun stuff too. I wanted the grid to show up with each of the player's NFTs in each cell. For testing purposes I deployed a basic NFT contract and generated some random game characters with Stable Diffusion ex #1, ex #2, ex #3, ex. #4, ex. #5 . This wasn't very technical but it really demonstrates the power of merging Generative AI with NFTs, for the next cycle if we ever recover from this.
Challenges we ran into (Accomplishments that we're proud of)
Gas limit in perform upkeep: because so much computation would have to happen before the potential internal calls would be made to resolve every player's move,
performUpkeepwould have exceeded the maximum gas limit. I overcame this by splitting the computation of necessary calls per active player into thecheckUpkeepfunction then passing the encoded calls toperformUpkeepthroughperformData.Custom NFT collection: I am no artist nor SVG wizard and I wasn't about to pay someone on Fiverr for this so it was quite a pleasant surprise to see Stable Diffusion come out as I was ideating this! Very cool and would definitely use it for desigining future ERC1155 items and power-ups :)
Contract size: the reason the GameFactory never got deployed was that it would exceed the maximum contract size. I would need some help from a real Solidity wizard for this part.
Automated Register Upkeep: Unfortunately FWICT there is no way around using the UI for registering Chainlink Upkeeps. This would have been very useful for completely automating the deployment of bot players (as they are also run on Chainlink Keepers).
What's next for Domination Strategy Game
- Contract size: the reason the GameFactory never got deployed was that it would exceed the maximum contract size. I would need some help from a real Solidity wizard for this part.
- Governance for dispute resolution (such as what to do with the spoils if the game contract wins)
- ERC1155 items for power-ups and special abilities, a marketplace for this
- Swanky UI
- A suite of gameplay bot strategy templates ;)
Built With
- chainlink
- filecoin
- ipfs
- keepers
- nft.storage
- pinata
- solidity
- solmate
- stablediffusion
- vrf


Log in or sign up for Devpost to join the conversation.