/pxls-in-golang

Rework of Pxls, clone of /r/place, in Golang

Primary LanguageJavaScriptOtherNOASSERTION

pxls.space in Golang

Rework of the pxls.space (a r/Place clone) backend in Golang.

This started from the frustration of getting the original, Java version, to work; and was impulsed by other Pxls' Developers talking about a rework in either Golang or Rust.

I'm fairly new to Rust and had learned Golang a few months ago, so prefered trying to refresh what I knew about Golang instead.

With some hope (and luck), this might eventually become the live version of the game.

Development

Setup

  1. Install Golang 1.12.9 or later
  2. Clone this repository and cd to it
  3. Run go mod download to install dependencies
  4. Clone reference.pxls.conf, rename it to pxls.conf and configure to your liking

For running

  1. Run go run src/*
  2. Go to https://localhost:4567 (or whatever port you configured in pxls.conf)

Implemented

  • Load pxls.conf
  • Load boarddata.bin
  • Webserver
    • Sending static content to the client
    • /info endpoint
    • /boarddata endpoint
    • /whoami endpoint
    • Oauth endpoints
    • other endpoints...
  • Websocket
    • send userinfo message
      • IP-based
      • Token-based
    • handle pixel placing
    • handle pixel stacking
    • other message types...
  • User roles
  • [-] Database
    • [-] users table
      • basic information (name, login)
      • placing information (cooldown expiry, stacked pixel count)
      • punishment information (ban, chat ban)
    • sessions table (token)
    • [-] pixels table
      • basic information (position, color, is most recent pixel at that location)
      • undo information (secondary id, etc.)
  • Console commands
  • Board backups
  • Logs

Plans

  • Separate frontend-serving code from game-handling backend code

Ambitious ideas

  • Tools
    • /stats in Golang
    • Database overview for moderators in Golang
    • boarddata.bin maker
  • Frontend