Sour Save

Sauerbraten for the web in a single Docker image.

Project README

🍋Sour

Sour Cover Image

Sour Gitpod Development Environment TypeScript Language Go Language Google Chrome iOS Sour License Badge MIT

Sour is a multiplatform modernization of Cube 2: Sauerbraten delivered as a single Docker image. Give it a try.

Features

  • A complete web version of Sauerbraten
    • All original game assets and features
    • Support for mobile devices
    • Connect to all existing Sauerbraten community servers and crossplay with desktop players
    • Open and play back Sauerbraten demos by dragging them to the page
    • Arbitrary game mods
    • Sophisticated load-on-demand system for assets that allows for loading arbitrary content that has been packaged for the game
    • Links to servers (/server/[ip]/[port]) and maps (/map/complex)
  • An advanced Sauerbraten game server
    • Supports connections both from the web and from desktop Sauerbraten clients
    • Server multiplexing: you can run arbitrary game servers with their own maps, modes, and configurations and allow users to move between them without disconnecting from the server
    • Players can create private game servers and invite other players on-demand
    • Discord authentication both for web and desktop clients
    • 1v1 matchmaking and persistent ELO scores for users
    • Persistent map editing: edits users make to maps are stored on the server side and visible to other clients who join (no more /getmap and /sendmap)
    • User-owned spaces that they can edit (player housing, basically)
    • User sessions can be saved as demos for debugging
    • Automatically sends game maps to desktop clients that don't have them
    • Mechanism for running client-side CubeScript on desktop clients
  • Utilities and libraries for working with Sauerbraten
    • sourdump, a tool for calculating all of the files a Sauerbraten map, model, or .cfg file uses so that you can only send the minimum set of assets a client needs
    • Go library for opening, manipulating, and saving Sauerbraten game maps
    • Go library providing interoperation between Go and CubeScript

Goals

  • Modernize Sauerbraten. The gaming landscape has changed. Provide a modern multiplayer experience with matchmaking, private games, rankings, and seamless collaboration on maps. Make as much of this functionality available to the unmodified desktop game as possible.
  • Preserve the experience of playing the original game. While it is possible that Sour may someday support arbitrary game modes, assets, clients, and server code, the vanilla game experience should still be available.
  • Be the best example of a cross-platform, open-source FPS. Deployment of Sour on your own infrastructure with whatever configuration you like should be easy. Every aspect of Sour should be configurable.

Running

docker run --rm -it -p 1234:1234 -p 28785:28785/udp ghcr.io/cfoust/sour

You can then access Sour at http://localhost:1234/ or by connecting in the desktop client with /connect localhost.

Deploying

If you wish to deploy Sour more seriously, I provide an example configuration for docker-compose here using letsencrypt-nginx-sidecar.

Architecture

Here is a high level description of the repository's contents:

  • services/game: All of the Cube 2 code and Emscripten compilation scripts. Originally this was a fork of BananaBread, kripken's original attempt at compiling Sauerbraten for the web. Since then I have upgraded the game to the newest mainline version several times and moved to WebGL2.
  • services/go/: All Go code used in Sour and its services.
    • A Go program that calculates the minimum list of files necessary for the game to load a given map.
    • The Sour game server, which provides a number of services to web clients:
      • Gives clients both on the web and desktop client access to game servers managed by Sour.
      • Periodically fetches Sauerbraten server information from the master server, pings all of the available servers, and broadcasts the results to web clients. This is so we can fill in the server browser.
  • services/assets: Scripts for building web-compatible game assets. This is an extremely complicated topic and easily the most difficult aspect of shipping Sauerbraten to the web. Check out this section's README for more information.
  • services/ingress/: nginx configurations for development, production, and Gitpod.
  • services/proxy/: A fork of wsproxy. This allows web clients to connect to all of the existing Sauerbraten servers and crossplay with desktop clients.
  • services/client/: A React web application that controls Sauerbraten, pulls assets, and proxies all game communication over WebSockets.

Contributing

Join us on Discord to chat with us and see how you can help out! Check out the issues tab to get an idea of what needs doing.

The easiest way to hack on Sour is in Gitpod using the button below. Gitpod is a web-based VSCode environment that runs everything necessary for development in a cloud-based container, meaning that everything is set up and working for you right away. You do not even have to use VSCode; Gitpod supports custom dotfiles which allows me to use my full vim-based setup from a browser tab.

Open in Gitpod

If you want to run things locally all you need is Docker, Earthly, and docker-compose. After that, just run ./serve. Then navigate to http://localhost:1234. All of the game's services will recompile and restart when you make changes.

Inspiration

Some years ago I came across BananaBread, which was a basic tech demo that used Emscripten to compile Sauerbraten for the web. The project was limited in scope and done at a time when bandwidth was a lot more precious.

License

Each project that was forked into this repository has its own original license intact, though the glue code and subsequent modifications I have made are licensed according to the MIT license specified in LICENSE.

Open Source Agenda is not affiliated with "Sour" Project. README Source: cfoust/sour
Stars
144
Open Issues
31
Last Commit
5 months ago
Repository
License
MIT

Open Source Agenda Badge

Open Source Agenda Rating