Skip to content
This repository has been archived by the owner on Oct 16, 2024. It is now read-only.
/ ds Public archive
forked from playmint/ds

Downstream Game Client

Notifications You must be signed in to change notification settings

1kx-network/ds

 
 

Repository files navigation

Downstream

Contracts, client libraries, and plugins for the on-chain Downstream game.

How to play and build on top of Downstream

See the docs

How to build this project

Building with Docker

If you only need a local copy of the game built (without development helpers like hot reloading etc), then the easist way is to provision using Docker Compose.

You need to build the unity map project first:

make map

Then to build and start the client and supporting services run:

docker compose up --build

Client will be available at locahost:3000

Building from Source (For Development) - macOS/Linux

If you are working on the client, then you will need to build everything yourself.

You will need the following tools installed:

  • Javascript toolchain (node lts/gallium)
  • Go toolchain (go v1.19)
  • Solidity toolchain (foundry)
  • Ethereum binaries (abigen)
  • Git (The in-house frontend is Fork)
  • Git-LFS
  • Unity Editor (2021.3.13f1)
    • Unity WebGL submodule

Make sure LFS is initialised and then clone this repository:

git lfs version
git clone --recurse-submodules https://github.com/playmint/ds.git

build and start the client and supporting services in development mode run:

make dev

Client will be available at localhost:3000

Building from Source (For Development) - Windows

This guide provides a detailed, step-by-step process for Windows users who are setting up a development environment for the client.

What You Need

These are the tools you will be installing:

  • OS Tools:
    • Git
    • Unity Editor 2021.3.13f1
    • Unity WebGL submodule
  • Terminal Tools (Using WSL):
    • make
    • gcc
    • node
    • go (version go1.19.13 - similar versions may be fine)
    • forge (version 0.2.0)
    • solc (version 0.8.15 to 0.8.21)

Please refer to the instructions below for setup guidance.

Installation Instructions

1. Install Unity (for Windows)

  • Install Unity Hub
  • Install Unity Editor version 2021.3.13f1 via Unity LTS archive
    • Use "C:\Program Files\Unity\Hub\Editor\2021.3.13f1" as your install path (be sure to change the default path and folder name)
    • Install WebGL submodule

2. Clone the Repository

  • Install Git: Visit Git SCM for download and installation.
  • Clone the Repository: Use the following command, (do not clone within WSL):
    git clone --recurse-submodules https://github.com/playmint/ds
    

3. Setting Up WSL (Windows Subsystem for Linux)

  • Install WSL: Follow the guide at Microsoft WSL Install. Note that enabling virtualization might vary based on your CPU model.
  • Initial Setup in PowerShell:
    • Run wsl --install.
    • Restart your PC.
    • Upon reboot, follow the on-screen instructions to complete Ubuntu setup.
    • Create a username and password as per Microsoft's best practices.
  • Switch to WSL1: The default WSL2 can be changed to WSL1, which works better for our purposes.
    • In PowerShell, run wsl --list --verbose to find your Ubuntu distribution name.
    • Switch to WSL1 with wsl --set-version [distribution name] 1. Example: wsl --set-version Ubuntu 1.

4. Installing Tools via WSL

  • Access WSL: Use wsl command in PowerShell or open the Ubuntu application.

  • Install gcc & make: (From now on we should be in WSL)

    sudo apt update
    sudo apt install build-essential
    
  • Install Node:

    • Recommended to use nvm (nvm install script).

    • Run the following commands:

      curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash
      

      Navigate to the ds directory and run nvm install.

      e.g. $ cd /mnt/d/playmint/ds (Where you cloned the ds repository) - Take note of /mnt/ as the path will look different to the normal Windows path

  • Install Go:

  • Install solc:

    sudo add-apt-repository ppa:ethereum/ethereum
    sudo apt-get update
    sudo apt-get install solc
    sudo apt-get install abigen
    
  • Install Foundry (forge and anvil):

    • Follow instructions at Foundry Installation:
      curl -L https://foundry.paradigm.xyz | bash
      foundryup
      

5. Node Configuration

  • Set environment variable:
    NODE_OPTIONS=--max-old-space-size=4096
    
  • Restart your machine.
  • Update Node packages:
    npm update -g
    
  • Update Node packages:
    npm cache clean -f
    

6. Build & Run

  • In the ds directory, run
    make dev
    
  • In your browser, open http://localhost:3000/
Building from source (for production)

Github Actions will build production ready Docker images on merge to main available: ghcr.io/playmint/ds

To build the image yourself run:

docker build -t ghcr.io/playmint/ds:latest .

Packages

No packages published

Languages

  • TypeScript 47.8%
  • Solidity 26.9%
  • C# 14.1%
  • JavaScript 8.6%
  • ShaderLab 1.6%
  • HLSL 0.5%
  • Other 0.5%