Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running a Multiplayer Server! #28

Open
terraflops1048576 opened this issue Dec 10, 2023 · 11 comments
Open

Running a Multiplayer Server! #28

terraflops1048576 opened this issue Dec 10, 2023 · 11 comments

Comments

@terraflops1048576
Copy link

terraflops1048576 commented Dec 10, 2023

There is server software built here: https://github.com/team-penguin/tribaltrouble with nice enhancements like more players and bigger islands. However, for the less technically-inclined who want to do the bare minimum with the installed game, I'm providing a list of instructions + some knowledge I discovered while doing this project over the weekend.

This has been tested to run on Java 11.

TL;DR

If you just want to play multiplayer without hassle, install the full-version singleplayer game according to the instructions in this repo and skip to step 8.

Multiplayer Installation Instructions

  1. Install the game and add the registration file.
  2. (Optionally use the pre-hosted multiplayer server and skip all of Step 2-7) Install a MySQL server and configure it. Run the database creation script in the team-penguin fork.
  3. Locate the public_reg_key file in the attached ZIP, and put it into the common/static folder in the repository (there should already be a fonts folder).
  4. Replace all instances of result.first() with result.next() in the DBInterface.java server/classes/com/oddlabs/matchserver/DBInterface.java file.
  5. Use ant to build the repository.
  6. Replace the matchmaker and router launch scripts with the ones I've provided, or use the team-penguin ones, but beware that you will have to pass an extra cmdline argument -Djdk.crypto.KeyAgreement.legacyKDF=true.
  7. Unzip the JARs from the attached zip into the server folder, and then run matchmaker and router.
  8. Configure your game to use the correct servers. Run the game at least once, MAKE SURE YOU CLOSE IT COMPLETELY, and then locate the settings file. It should be in the same folder that you put the registration file in Step 1. If you have set up steps 2-6, add the following lines to the settings file:
matchmaking_address=localhost
router_address=localhost

If you elect to use the pre-hosted multiplayer server that I'm leaving up for a while, add the following lines:

matchmaking_address=tribaltrouble.freewifidns.com
router_address=tribaltrouble.freewifidns.com
  1. Launch the game and register! Keep in mind that if you have set up your own server, you will only be able to register a single full-version account, and your friends will have to play as Guests, unless you still have your registration file from Tribal Trouble from all the way back when it was online. I have patched the game a little to get around this limitation on the pre-hosted server, so multiple people can be registered. The associated DBInterface.java for this feature is included in the attached zip file.

Attached ZIP file with pre-made parts: ez_bundle.zip

Technical notes

I have provided a mysql.jar which is a much more recent version of MySQL Connector/J than the original one. This is because the old connector does not connect to most recent versions of MySQL server. The patches to DBInterface are to make this new one work.

Additionally, since replacing pub_reg_key requires modification of the client, we are stuck patching the matchmaker to allow multiple registrations, since we cannot generate new registrations for this particular key.

The -Djdk.crypto.KeyAgreement.legacyKDF=true is because Java 11 deprecates certain cryptography that Tribal Trouble uses in its client/server communication.

I have disabled launching the matchmaker the security policy file, because it somehow makes the MySQL connector break. Neither security policy is required for either the matchmaking or router server to function.

Questions for OddLabs (if they're even still around)

Can we have the private key that corresponds to pub_reg_key? This would enable free registration and significantly unblock our ability to launch multiplayer servers.

@Gedehamsen001
Copy link

can you give the server with builded files?
because i tried run ant and not work

@terraflops1048576
Copy link
Author

Yeah sure, pre-built server JARs are attached. I can't vouch that they work on all Java versions, since I can't remember how I compiled them.
server_bundle.zip

@Gedehamsen001
Copy link

i builded but i got errors on try launch the server in windows

@Gedehamsen001
Copy link

fixed but the server only start and stop

Instead use ":" just replace with ";"

-Djdk.crypto.KeyAgreement.legacyKDF=true -server -ea -cp matchmaking.jar;mysql.jar;commons-pool-1.2.jar;commons-dbcp-1.2.1.jar;commons-collections-3.1.jar com.oddlabs.matchserver.MatchmakingServer

@terraflops1048576
Copy link
Author

Please consolidate/delete all of your debugging comments so other people don't get confused by the mess.

It honestly seems like you lack familiarity with some basic concepts, such as the difference in the path separator between Windows and Linux and in building the GitHub project. I encourage you to try to figure these things out as a learning experience instead of posting about every error that you encounter -- it was part of my process to get this to work (and you can indeed see that I have a working server).

I run the server on Linux, so my instructions were written for that, and it should just work out of the box for that. To my knowledge, adapting to Windows is simply a matter of changing the path separator in the launch scripts.

As for the error that you are encountering, you should debug it by trying to find where the exceptions are actually thrown and printing their stack traces (the multiplayer framework in TT is notorious for swallowing them and rethrowing them as InvocationTargetExceptions).

My best guess is that you have failed to carefully follow the instructions, specifically step 2, which involves setting up a MySQL server and creating the database correctly, because I have seen no mention of your doing that, and this is honestly one of the most tedious steps. Given your lack of familiarity with the systems, I don't believe that you did this correctly or even at all.

@Gedehamsen001
Copy link

sure, the database works normaly, the server starts without any mysql problem, i put other debug points in the server, i tried used the team-pinguim TT build but return the same byte size = -1 (this is my problem over my 2 years trying make this work 😢 , i will try use server on linux to see if is a incompatibility with windows

proof of database
image

@Gedehamsen001
Copy link

hm, i think it's a problem here in my pc, i tried connect to your server and return the same message

@terraflops1048576
Copy link
Author

terraflops1048576 commented Mar 3, 2024

Did you follow the steps to set the settings file correctly? There is a specific sequence that you have to follow...

Did you use the original registration file (not the team penguin one?)

@Gedehamsen001
Copy link

i downloaded the builded penguin
put the penguin registration
opened the game
closed
configured the IP

with the original registration file just saying to buy and when i click in multiplayer return the same problem

@Gedehamsen001
Copy link

Gedehamsen001 commented Mar 3, 2024

nvm, with the original register works, i just changed to 1.8 java
but my game still in demo

@terraflops1048576
Copy link
Author

terraflops1048576 commented Mar 4, 2024

Okay, let me add some clarification here. This multiplayer server setup guide is for setting up multiplayer on the original version of Tribal Trouble. If you wanted multiplayer with the team penguin version, you should've followed their instructions instead. The value add here is not a version of Tribal Trouble that runs multiplayer -- the Team Penguin version does exactly that. The value add here is getting multiplayer to work on the commonly installed version through a settings file tweak -- i.e. minimal installation friction for anyone who still wants to play this game.

Your game is still in demo because you are using the team penguin version and not the original version of Tribal Trouble.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants