Inspiration
Far from this realm we call home (though, perhaps not too far) exists another world — one of magic, mystique, darkness, and danger. It is a place called Montavera. The people there are wonderful individuals. They’re friendly to their neighbors. They’re kind to the faceless ghouls that wander the streets. And they all obsess over a single pastime into which they excitedly invest hours, days, and even weeks on end.
That pastime is a game — a trading card game.
The game is called Clan Wars TCG.
It is a game of great importance to these people because it is the city council’s chosen method of teaching history. The history of Montavera is told through the cards, particularly the history of all the battles and wars that have been fought in and around this mystic place.
Now, for the first time ever, the game has been allowed to leave the realm of Yonder, and to make its way into the hands of earthlings — and that is where we come in.
We knew that a game of such importance should be played by all people of earth, both the old and the young, and that those who play should be rewarded. For this reason, we decided that Clan Wars TCG should be a physical card game that is mirrored in an NFT counterpart. When people purchase a physical pack, they will receive a digital pack to open and enjoy. We put the utility first, then made it accessible through the cutting edge technology of NFTs. In this way, the bonds between the NFT and its utility are organic and natural, and not a forced afterthought. In Clan Wars, it just makes sense.
Clan Wars NFTs — built and distributed within the Theta Network — allow owners not just the ability to play a game.
No, that would be too simple.
These NFTs allow their owners entry into an ever-expanding lore from a world overflowing with events and adventures that tickle the human imagination. And the result has been nothing short of astounding. Already, playtesters of the game (TCG players of various age groups in local game shops, NFT owners from the Mystic Gurus community, and outside followers of the ClanWarsTCG social media accounts) are raving about the game.
“Take it. My kidney! My left femur! Take it all! Just give me more Clan Wars!” Brian, TX
“This pleases me, Mortal. You have bought yourself another day.” Chad, Sydney
“How have you achieved such a wonder? I must take this back to the Queen. She must see this! This could be the key!” Jake, Austin
And these are only a few of the game’s excited fans. Until now, TCGs have not provided a double platform of truly ownable and tradeable collectibles. Digital gaming for TCGs is nothing new, but digital gaming where players own and can buy, sell, and trade their cards digitally with players from all around the world … That is getting people excited about Clan Wars TCG!
What it does
Clan Wars is a Trading Card Game designed in the tradition of Magic: The Gathering and Yu-Gi-Oh! but is more emotionally engaging and features several brand new card types and mechanics not seen before in a trading card game.
Just as significantly, Clan Wars is an NFT-based game where the cards you play with are NFTs you own!
While Clan Wars will ultimately exist as both a physical and digital game, this Hackathon submission deals with the digital version.
The digital version of Clan Wars comes with the following features:
• A secure Web3 enabled website.
• A marketplace where the NFTs needed to play the game can be minted or traded.
• Four distinct clan deck NFTs with fundamentally different play styles to choose from.
• A lobby area where new games can be created, joined, or just spied on!
• A luscious 3D game environment that is already compatible with both Desktop and Mobile.
• A basic AI with three levels of strength for each clan that can be used to learn the game or practice with new clan decks before playing them in public.
How we built it
The idea for Clan Wars has been around since Montavera was still young. Over time the design has been refined and tested, and different styles of artwork and card designs have been experimented with. Even now the design is still being adjusted, and substantial changes have been made during this very Hackathon period that were not able to be incorporated into this version of the game. It was about three weeks into the Hackathon that we decided to freeze the design for this version.
Towards the latter part of last year we developed some code to simulate games in order to help us assess the relative strengths of the different clans and ensure a balanced game. We had this code (written in C++) at the start of the Hackathon but it hadn’t been worked on for over three months and the game elements had changed a lot in that time, as had all the cards and their effects. Furthermore, this back-end was developed to play many games as quickly as possible, an approach that isn’t suitable for a game that hosts actual players!
We mention this to highlight the fact that nearly all the game elements you see were developed during the Hackathon submission period. It was, in fact, the announcement of the Hackathon that swayed us into shifting our focus from the physical version of the game to the digital.
The first month of the hackathon was spent working entirely on the back-end. The first priority was updating it to incorporate the latest version of the rules, and adding all new cards and effects. We also had to update the AI code we had to handle the new cards and actions and remove old ones. It required a great number of changes that in the end was not far off a total rewrite!
The AI itself is fairly rudimentary. It consists of a combination of rule based decision making combined with Monte-Carlo simulation. At each turn the AI performs a number of simulations of the rest of the game based on playing each available action. Each simulation run gives a score for taking the action based on the outcome of the game at the end of the run. Averaging these scores gives an Expected Value, or EV, for each possible action. The action with the highest EV is the one that gets played. The different strengths are achieved by adjusting the number of simulation runs performed for each possible action — more runs means a more accurate result and thus better play.
As part of this update we also used the AI engine to assess the new cards and their actions to ensure there was as much balance between the different clans as we were able to achieve. Many changes were made to the card effects during this time, such as increasing or decreasing the power or frequency of individual effects, and adjusting the bribe price of boss cards (a handful of further refinements to the cards were made after the front-end was complete and test games could be played).
The second priority during the first month was restructuring the game engine to be able to handle playing games between humans – a process which involves stopping, waiting for an action and resuming where it left off when the response is received, as well as controlling the pace of the game at times where human interaction was not required.
Meanwhile, our Headmaster was working overtime on the artwork and design of the new cards, which are a combination of hand drawn artwork and carefully crafted AI generation.
In order to be able to meet the Hackathon deadline we had to omit several card types from this version of the game (Trigger, Lore and Deity cards are all absent). Each Clan deck has eight unique Boss cards and three unique Agent cards. With four Clans, that’s a total of 44 distinct cards.
From a technical perspective, the second half of the Hackathon was spent doing everything else. This included:
• Setting up a “middle-end” to handle client requests from the front-end, and connect them with game instances in the back-end. The middle-end is written in PHP and communicates with a C++ back-end and a Javascript front-end. Websocket communication protocol is used for communication between all three ends.
• The front-end is an ES6 Javascript application built using node.js and jQuery.
• The 3D game environment was built from scratch using Three.js, a Javascript library for building WebGL applications. As all the game logic is in the back-end, the 3D front-end is primarily responsible for displaying things it receives from the server, and sending information about user decisions back to the server.
• The website for the lobby, built using PHP, MySQL and jQuery. It has MetaMask integration and also includes a “Verify with Theta Rarity” option that allows you to sign in using your Theta Rarity wallet (which includes Wallet Connect support).
• The smart contract for the NFTs. To keep things simple for this Hackathon version each Clan Deck is a single NFT. That means only one NFT is needed to play the game, though having all four NFTs will allow you to play in whichever style you prefer.
• The marketplace for minting and trading Clan Deck NFTs. Using Theta Rarity’s existing tech made this pretty straightforward.
• The token-gating to ensure people can only play with the Clan Decks they own. Again, using Theta Rarity’s APIs this was quick and easy to set up. In real-time the APIs give us a list of all the NFTs from the Clan Wars collection that are in the connected wallet (and any linked wallets), and most importantly, it includes the metadata for each NFT so we can easily determine which Clan Decks the player owns.
• Servers to run all this. At present all of the above (except the marketplace) are running on an AWS EC2 instance running Amazon Linux. The architecture ensures it can easily be scaled up to meet demand, as needed.
Challenges we ran into
With a limited timeframe of two months, one of the biggest challenges was in deciding what to leave out.
The Hackathon version of this game looks amazing, but there is going to be so much more in the final version. The parts that have been left out will add tremendously to the character of the game, but the game as it can be played today is a complete game, and a lot of fun. That was not easy to achieve!
After the challenge of what to leave out, the next biggest challenge was putting the rest in, as such a large amount of work has been needed just to get the game to this early stage. It required a correct and early assessment of the task scope, and a consistent application of effort over two months to ensure its timely completion.
It also required quick, efficient and regular communication between multiple team members, who were continents apart. For a project of this magnitude to succeed, all team members needed to give 100% at all times, and they did.
The short timeframe also necessitated a different approach to development. We simply didn’t have enough time to deal with bugs, so we decided to develop the game without bugs from the beginning. On the rare occasion that a rogue bug was encountered, we took the time to squash it, then and there, rather than putting it off for later. Obviously it is more challenging to develop software that is bug free from the beginning, but it was a necessity in this case.
There are so many technical challenges that were encountered that we dare not list them all. One example was the dice rolling that was added in the last week of the competition. The dice use a physics engine to ensure they move naturally. To start a die rolling you give it various random parameters such as its starting position, rotation and momentum, then the physics engine determines how it should fall and what number it should end up on. However, for security reasons we cannot rely on the fall of the die to determine the outcome, as that would open the game up to being manipulated — the result of each roll needs to be determined server-side. It was quite a challenge to ensure that the roll of the die matches the roll from the server and in true Hackathon spirit we ended up doing it the brute force way — perform many random rolls quickly behind the scenes until we get one giving the result we want, then display it! Quick, but effective.
Another technical challenge involved getting the timing between the front-end and back-end working together. As the game is driven by the back-end, it dictates the pace — for the most part. It needs to slow itself down to make time for display elements on the client to complete before moving on to the next phase or turn. When there is a response needed from the player the game engine needs to wait for that response, but consideration is also given to situations where the player doesn't respond in time. In order to minimize syncronization issues between the back-end and front-end (for example, the back-end thinking the timer is up and moving on while the front-end was still displaying that there were two seconds to go, perhaps due to network lag) the lack of response timeout is handled by the client. But there is an override on the server should the message from the client not be received within a small extra time buffer. This ensures the pace of the game can be controlled by both the front-end and the back-end, depending on the particular game state, but that ultimately the back-end has the final say.
Accomplishments that we're proud of
To see a game you’ve created come to life is a humbling experience. To see an entire world you’ve imagined coming to life (for Clan Wars is merely a reflection —a historical retelling — of that larger world) is something else again.
Despite being so humbled, we’re also extremely proud of the fact that we’ve been able to create such a fun and engaging product in such a small space of time.
Regardless of the outcome of the Hackathon, we’ve now got a solid foundation on which we can continue building the final version of Clan Wars TCG. And that is something to be very proud of!
What we learned
The main thing we learned through this experience is, we learned we can trust each other.
The first month of development was spent entirely on the back-end, with nothing to show for it. Imagine this is your project, you have a deadline of two months, and after one month your developer still hasn’t shown you anything! How do you feel?
Or what if you can envisage the enormous amount of work that will be involved in developing the art and providing constant feedback on game design; and wonder whether it will be possible for everything to be delivered in time?
We chose to trust each other with these things, and in doing so, learned that we could.
We also learned (or had reinforced to us) the importance of experience.
To put together a product of this scope and quality in such a short period of time would not have been possible had we not been able to call upon many years of experience in our respective fields. Had we not spent countless nights building 3D worlds, designing websites, configuring servers, coding things no-one will ever see, drawing, editing, honing our skills in a multitude of seemingly fruitless endeavors … but all of which brought us to this moment … a single moment where the realization comes, that all the time we spent, not a second was spent in vain. It was all preparing us for this. It was preparing us for the ultimate battle. It was preparing us for …
CLAN WARS!
What's next for Clan Wars TCG
One of the bigger concerns within the Theta NFT space at the moment is the need to bring in new people. Proactively addressing this concern is one of our primary goals.
Clan Wars TCG is targeting the traditional TCG gaming market, which is huge. We will be using Theta Rarity’s NFTExpress (also in this Hackathon) to send out free Clan Deck NFTs to people in the TCG community who may not even be familiar with NFTs. With NFTExpress they will be able to play Clan Wars with their own NFT, but they don’t have to worry about buying TFuel or setting up wallets. This has the potential to introduce many new TCG enthusiasts to the Theta ecosystem.
Beyond that, we will continue development of the game. Some of the many things that still need to be done include:
• Updates to accommodate recent design changes (some quite significant changes).
• Implement Deity, Trigger and Lore cards.
• Implement many more Clan Decks (there are close to 30 Clans!)
• Implement “Booster Packs” which will contain a few random cards, but which can have more powerful or more interesting effects than the cards found in the standard Decks.
• Add a “Deck Building” section to the site where you can mix and match cards from Clan Decks and Booster Packs to make your own custom deck, with your preferred mix of cards. You’ll also be able to package your custom deck as an NFT and sell it on the marketplace!
• Add more social features. At present we have a leaderboard, but we intend to expand that to include profiles, tournaments, in-game reactions, and perhaps other features such as chat.
• Achievements and trophies. Keeping with the NFT theme, these could be dropped as actual NFTs, rather than just being in-game indicators.
• The physical version of the game will be an addition to the digital version. It has always been our intention that Clan Wars should be a game that brings people together, so we place a lot of importance on having a physical game as well. The physical cards will also be linked to NFTs, so owning the physical cards will allow you to use them in the digital game.
• While interpersonal interaction is the ideal, we recognize that this is not always possible. Therefore, we will also be working on improvements to the game’s AI. There has been a lot of interesting work in AI recently, so this is something we’d like to put more effort into moving forward.
• Just as the different battles between the Clans of Montavera and beyond happened in different places, so too will Clan Wars TCG allow you to play in different settings. From a mountaintop dojo, to a jungle ruin, to a tropical oasis, to a desert sunset; Clan Wars TCG will take you to the places where the battles were fought and won … or lost! You decide! Play Clan Wars today!
Built With
- amazon-web-services
- c++
- inkarnate
- javascript
- mysql
- photoshop
- php
- procreate
- theta
- thetararity
- three.js

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