Skip to content

mongodb-developer/leafsteroids

Repository files navigation

Leafsteroids

This repository contains the MongoDB Leafsteroids demo.
Follow the instructions in this README to run a clone of your own to get your MongoDB development jump started.

Architecture

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#)

Running your own clone

Requirements

Prepare the database (MongoDB Atlas)

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.

Run the REST service

  • Switch into the rest_service folder.
  • Make a copy of the .env.template file and call it .env.
  • Grab the connection string for your Atlas cluster and exchange it in the .env file in the rest_service folder.
  • Also replace the DATABASE_NAME in the .env file 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.

Run the Website

  • Switch into the website folder.
  • Make a copy of the .env.template file and call it .env.
  • Grab the connection string for your Atlas cluster and exchange it in the .env file in the website folder.
  • Also replace the DATABASE_NAME in the .env file 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.

Run the Game Client

  • Switch into the game_client folder.
  • In the Assets folder, make a copy of the .env.template file and call it .env.
  • Adjust the REST_SERVICE_IP in the .env folder to your rest_service. Leave as is when running locally.
  • Adjust the EVENT_ID to the event you want to use (from the events collection).
  • Adjust the WEBSITE_URL to your local website with port (don't add a trailing /).
  • Run the game.

Contributors