This repository contains the MongoDB Leafsteroids demo. A game developed by the MongoDB team, featuring a 2D arcade-style space shooter. Built with Unity3D and .NET, it includes a game client, an ASP.NET Web API, and a website using Blazor pages. Players aim to destroy bricks (asteroids) and achieve the highest score within 60 seconds by collecting power-ups and destroying targets quickly, while competing against each other within the concept of an event (tournament). The backend uses MongoDB Atlas for data storage, including Atlas Vector Search to match players based on gameplay style, score, and speed. The game is playable on tablets, mobiles, and desktop/laptop, with real-time scoreboards for competitive play.
Follow the instructions in this README to run a clone of your own to get your MongoDB development jump started.
You can also register and create your own event to share with your friends and play live anywhere here.
The demo and repository consist of the following parts:
- Game Client (Unity3D, .NET, C#)
 - Game Server (ASP.NET Web API, .NET, C#)
 - Website (Blazor Server Application, .NET, C#)
 
- Create a new Atlas project
 - Create a new cluster (M0)
 - Create a new database 
Leafsteroids:- Create a collection 
configand add thedeployment/templates/config.templatedocument to it. - Create a collection 
eventsand add thedeployment/templates/event.templatedocument to it. 
 - Create a collection 
 
You can adjust the config to change how the game behaves and add more events to have several to choose from.
To get started, it is recommended to use those default documents.
- Switch into the 
rest_servicefolder. - Make a copy of the 
.env.templatefile and call it.env. - Grab the connection string for your Atlas cluster and
exchange it in the 
.envfile in therest_servicefolder. - Also replace the 
DATABASE_NAMEin the.envfile with the database name you created earlier. 
dotnet run --urls "http://0.0.0.0:8000"Open http://127.0.0.1:8000/ to verify the REST service is running.
- Switch into the 
websitefolder. - Make a copy of the 
.env.templatefile and call it.env. - Grab the connection string for your Atlas cluster and
exchange it in the 
.envfile in thewebsitefolder. - Also replace the 
DATABASE_NAMEin the.envfile with the database name you created earlier. 
dotnet run --urls "http://0.0.0.0:8001"Open http://127.0.0.1:8001/ to verify the website is running.
- Switch into the 
game_clientfolder. - In the 
Assetsfolder, make a copy of the.env.templatefile and call it.env. - Adjust the REST_SERVICE_IP in the 
.envfolder to yourrest_service. Leave as is when running locally. - Adjust the EVENT_ID to the event you want to use (from the 
eventscollection). - Adjust the WEBSITE_URL to your local website with port (don't add a trailing 
/). - Run the game.
 
