A GameSpy replacement MasterServer for Project Reality: BF2
1.8K
A GameSpy replacement Master Server for Project Reality: BF2. This emulates the GameSpy API in order to keep PR:BF2 playable after the Battlefield 2 GameSpy shutdown.
Supports Battlefield 2's GameSpy implementation. No other games are supported (yet?). If you wish to modify the code and add support for your game, or add any additional features, please feel free to make a fork and submit a pull request.
The docker image includes the binary, dependencies, and the MaxMind GeoIP2 Country database.
# Test run
docker run --rm -it -p 29900:29900/tcp -p 29901:29901/tcp -p 28910:28910/tcp -p 27900:27900/udp -p 29910:29910/udp startersclan/prmasterserver:latest
# Run with support for bf2 and fh2
printf "bf2\nfh2\n" > modwhitelist.txt
docker volume create data-volume
docker run --rm -it -p 29900:29900/tcp -p 29901:29901/tcp -p 28910:28910/tcp -p 27900:27900/udp -p 29910:29910/udp \
-v $(pwd)/modwhitelist.txt:/app/modwhitelist.txt:ro \
-v data-volume:/data \
startersclan/prmasterserver:latest
# Now launch Battlefield 2, and try creating a multiplayer account and logging in and out
MaxMind.GeoIP2.Exceptions.AddressNotFoundException: The address 192.168.192.3 is not in the database∑
A: This error may be safely ignored. The error is seen when the IP of the registering BF2 server is a private IP address instead of a public IP address as seen by PRMasterServer (for example, when using docker). For example:
[2023-11-07 15:34:11.556] [ServerReport] MaxMind.GeoIP2.Exceptions.AddressNotFoundException: The address 192.168.192.3 is not in the database.
at MaxMind.GeoIP2.DatabaseReader.Execute[T](String ipStr, IPAddress ipAddress, String type, Boolean throwOnNullResponse)
at MaxMind.GeoIP2.DatabaseReader.Execute[T](String ipStr, String type, Boolean throwOnNullResponse)
at MaxMind.GeoIP2.DatabaseReader.Country(String ipAddress)
at PRMasterServer.Servers.ServerListReport.ParseServerDetails(IPEndPoint remote, Byte[] data) in /source/PRMasterServer/Servers/ServerListReport.cs:line 304
Be sure to have Visual Studio 2013 installed. You might be able to compile it using previous versions of Visual Studio or using Mono, but this is untested and may not work.
Open PRMasterServer.sln, and build. This should download via NuGet any extra packages required.
Grab the latest MaxMind GeoIP2 Country database, or use the free GeoLite2 Country database. Put it in the same folder as PRMasterServer.exe.
Create a modwhitelist.txt file containing line separated mod names (i.e. bf2, pr, fh2) to allow servers running these mods to register with the master server. Or, just use % to allow all mods. If you don't have a modwhitelist.txt file, it will default to Project Reality: BF2 mod names (pr and pr!_%).
Tip: % is wildcard, _ is placeholder, ! is escape, # at the start of the line is a comment, empty lines are ignored.
Run PRMasterServer.exe +db LoginDatabase.db3 and it should start up with no errors. You can use an optional +bind xxx.xxx.xxx.xxx paramter to bind the server to a specific network interface, or by default it will bind to all available interfaces.
If there's issues, unlucky, I'm sure you'll be able to figure them out :).
Of course, no project is ever really complete, there's plenty of other stuff that could be done. Maybe in the future it just might happen.
Luigi Auriemma for reverse engineering the GameSpy protocol and encryption.
Content type
Image
Digest
sha256:8962f6914…
Size
82.6 MB
Last updated
almost 4 years ago
docker pull startersclan/prmasterserver