Giter VIP home page Giter VIP logo

retrowars-servers's Introduction

Public Super Retro Mega Wars Servers

Super Retro Mega Wars is a free software multiplayer game. To support the multiplayer aspect, a server is required. To ensure that multiple people are able to offer servers for the community, we maintain a public list of servers in this repository:

./docs/.well-known/com.serwylo.retrowars-servers.json.

This in turn is then made available at:

https://retrowars.github.io/retrowars-servers/.well-known/com.serwylo.retrowars-servers.json.

The retrowars game queries this JSON file in order to ascertain which servers are available for playing.

Contributing

Running a public server

Retrowars is a community driven project. We will try to make sure that there are servers run by the maintainers, but it would also be wonderful if others who enjoy the game and have the skills/resources were able to contribute a server to the pool of publicly available servers.

Using Docker

The latest server image can be pulled from pserwylo/retrowars on Dockerhub.

Here is an example docker-compose file you could use:

version: '3.1'
services:

  your-retrowars-server.com:

    image: pserwylo/retrowars:latest

    expose:
      - 80

    environment:
      - PORT=80

      # Example configuration options:
      - MAX_ROOMS=10
      - ROOM_SIZE=4
      - FINAL_SCORE_DURATION=7500

    # volumes:

      # If you want to customise the logging format:
      # - ./logback.xml:/etc/retrowars/logback.xml

      # If you want to retain logs:
      # - retrowars-latest-logs:/var/log/retrowars/

Using the portable executable .jar file

Obtaining a .jar file by either:

Once you have obtained a .jar file, run it using: PORT=80 java -jar server.jar (choosing whatever port you wish).

Note: Requires Java 8 and will likely not work with later versions due to the way the libgdx library works.

To keep the process running even if it crashes, you may wish to wrap this in a script that is periodically called via a cron job. Here is the script used by retrowars2.serwylo.com which runs on a small AWS EC2 machine:

#!/bin/bash
@
# Makes sure the retrowars process is always running by regularly running this script.
# If it is already running, this script will do nothing.
#
# https://stackoverflow.com/a/911146/2391921
#

if ps ax | grep -v grep | grep retrowars-server.jar > /dev/null
then
    exit
else
    PORT=8080 java -jar /home/ubuntu/retrowars-server.jar >> /home/ubuntu/retrowars-server.log
fi

exit

Using an existing Apache2 server and adding an additional virtual host

If the server you are using already has Apache2 configured with other virtual hosts, you probably want to proxy traffic from Apache2 to the retrowars server process. To do this, ensure you enable the mod_proxy and mod_proxy_wstunnel modules and add the following virtual host config (based on the official docs):

<VirtualHost *:80>
	ServerName retrowars2.serwylo.com

	# The more specific path has to come first, or else all requests
    # will be proxied via the HTTP proxy endpoint at "/*"
	ProxyPass /ws ws://localhost:8080/ws
	ProxyPass / http://localhost:8080/
</VirtualHost>

This is the approach used by retrowars2.serwylo.com where traffic is proxied through Apache2 to the underlying Java process running as an unprivileged user on port 8080.

Using Nginx

Websocket proxy from nginx docs.

server {
	server_name _;
	
	proxy_pass http://localhost:8080;
    	proxy_http_version 1.1;
    	proxy_set_header Upgrade $http_upgrade;
    	proxy_set_header Connection "upgrade";
}

Maintaining this list

Adding servers

If you are the maintainer of a public retrowars server, or if you want to help the maintainer be added to the official list of publicly available servers, you can file a pull request to this repository to update the list of servers.

Removing servers

If a server becomes defunct, the game will quietly ignore it (after trying to reach it and failing). This means that the players wont see defunct servers, other than a status message saying it tried to connect to the server (a message which will disappear after failing to connect).

However, it would be polite to prevent the game from even bothering to talk to a server which is defunct. To do that, we should remove the server from the list.

retrowars-servers's People

Contributors

azlux avatar pserwylo avatar the7thnightmare avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.