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
- Install Golang 1.12.9 or later
- Clone this repository and
cd
to it - Run
go mod download
to install dependencies - Clone
reference.pxls.conf
, rename it topxls.conf
and configure to your liking
For running
- Run
go run src/*
- 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...
- send userinfo message
- 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.)
- [-] users table
- 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
- Modularize/Webpacketize
- Convert to TypeScript