Inspiration
Everyone on our team loves Marvel characters. When we got the chance to develop something using the Marvel database, we wanted to make our project as fun and interactive as possible. Each Marvel character has unique abilities and attributes, and we wanted a way to showcase that. Making a card game allows us to tell a story with our cards while highlighting the individual characters. We chose to use the X-Men characters for our project because mutants have clearly defined factions with a large number of people on each side.
What it does
Marvel cards is a two-player game (Professor X versus Magneto) where each player has a deck of cards consisting of either X-Men, for Professor X, or members of the Brotherhood of Mutants, for Magneto. Each card has attack and health values, and most have special abilities that activate with various triggers. For example, when Storm is played she creates a lightning storm that damages all enemy characters. The motive of the game is to kill the enemy player with your cards while not being killed yourself. Each character starts with 10 health, a relatively low number that helps facilitate the demo. Players must strategize to play cards that will give them the advantage and choose when to attack the enemy player and when to try to eliminate enemy cards.
How I built it
We first use the Marvel API to select character data that will be used to populate our database. To access the Marvel API we send HTTP get requests, and read the response JSON query result. Once we get the result we parse out the response in C#. Next, we initiate a connection to a local SQL server we created and load all character information, including a character image, into the database. In Unity we query the same database, though we had make our own access credentials instead of using integrated security. We pull character information out of the database and use that to populate the cards we have. The pictures are converted into texture format and inserted into the cards through a mask. The scripts in Unity contain a ton of game logic that define all the game rules, including who can attack, when they can attack, and how each special effect works. The scripts instantiate particle effects and control the AI who plays the enemy deck. We also handled the cards whose special abilities allow them to "break" the rules of the game.
Challenges I ran into
The biggest challenge in parsing out the Marvel API data arose from the fact that some necessary info was only embedded in a detail page reached by a URL embedded in the JSON response. On top of the embedded URL pointing to the wrong page at times, parsing the html file also proved to be time consuming.
We had minor difficulties creating our database as the iso image we were trying to mount on VMWare wouldn't work. We eventually decided on using a local database, Windows SQL Server 2014. In the script loading information from the API into the database we would use integrated security to connect, but in Unity our connection wouldn't work. We found out that Unity does not allow for access through integrated security so we had to make our own access credentials and connect that way.
There were a lot of challenges when creating the game logic. Since we gave characters special abilities that allow them to break the game rules, we had to make sure the abilities worked correctly for only those characters and didn't mess up the overall logic. One standout issue was with the AI. It played cards and attacked so fast it was difficult to see what was going on. We wanted to delay AI moves, but in Unity a delay or a wait would pause the entire game, which would mess up our particle effects. We eventually solved this with callbacks and a lot of trial and error.
Accomplishments that I'm proud of
We got the entire game to work! It looks polished and actually contains all the game logic. We learned a lot about how databases work, and how to connect to a database and send queries from within C# code. We also learned more about how Unity works and how to make a turn-based game against an imaginary opponent. We had a lot of difficulties, but we were able to collaborate and work through all of them.
What I learned
See above section.
What's next for 272# MarvelCards
This was the X-Men version of the game. It would be a lot of fun to add more card packs for different Marvel story lines. For example, we had considered doing Civil War sides with Iron Man versus Captain America, but we had difficulties deciding on the characters for each side. With more time and research we could create team rosters for many different groups. We also would like to add more cards to the X-Men set. We currently have ten for each side, but more cards makes for a more interesting game.
Built With
- c#
- marvel
- sql
- unity
- visual-studio
Log in or sign up for Devpost to join the conversation.