Thanks to visit codestin.com
Credit goes to github.com

Skip to content

gamemann/sour

 
 

Repository files navigation

sour

License: MIT

Open in Gitpod

sour is a complete Cube 2: Sauerbraten experience in the web delivered as a single Docker image. Give it a try.

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

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.

Check out the roadmap below to see what you might be able to help with.

General

  • Better documentation
    • Configuration
  • Fix Sour in browsers other than Chrome
    • Safari
    • Firefox
  • Allow for providing the desired maps in an image as a build argument
  • Terraform recipes for deployment

Gameplay

  • Modern multiplayer
    • Update URL correctly when web user runs commands that change server
    • Make duel servers private
    • User can provide map name and mode on server create
    • User who creates private match is automatically admin
    • Support listing on master server
    • Handle failure to connect from link
    • Stretch: Discord login with ELO
  • LRU cache for cluster map fetching
  • Allow for backgrounding the tab by responding to pings
  • Simple, beautiful main menu
    • Clean loading page for slow connections
    • Add <noscript> with a plea to enable JavaScript
    • Ensure page load time isn't horrible
  • Demo player with seek/play/pause
    • Stretch: generate gifs in the browser
  • Save demos for any game played to IndexedDB and allow for download
  • Explore running Sour in a Web Worker rather than the rendering thread
  • Support all player models (right now it's just snout)
  • Stretch: ship arbitrary assets to desktop clients over the wire
  • Stretch: spectate any running Sour match

Map editing

  • Repair or port shaders that were disabled in the game upgrade
    • Fix the outline shader (pressing 7 in edit mode)
    • Water reflection and refraction (this is really hard)
  • Support saving and loading .ogz maps from the user's device

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.

About

Sauerbraten for the web in a single Docker image.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 53.9%
  • C++ 40.6%
  • Go 2.3%
  • TypeScript 0.9%
  • JavaScript 0.8%
  • Makefile 0.7%
  • Other 0.8%