jsettlers / settlers-remake

A Remake of "The Settlers III" for Windows, Linux, Mac and Android
http://www.settlers-android-clone.com
MIT License
354 stars 100 forks source link

Multiplayer workaround #793

Closed PoxiPol closed 4 years ago

PoxiPol commented 4 years ago

I understand that the dedicated server is now down, and have found one of the other issues raised discussed briefly how to set the dedicated server .jar up, but unfortunately it doesn't seem to work. (Editing the .jsettlers file in %appdata% with a new like server=)

Could an in-depth explanation be written up, or alternatively the ability to connect to a host through an IP address be made? What ports does jSettlers use?

Thanks for any help

paulwedeck commented 4 years ago

Its actually quite straightforward:

I am not familiar with the network code but the port seams to be hardcoded to 10214 (tcp).

PoxiPol commented 4 years ago

Thank you for the prompt response. As I'm only trying to run it on my machine, I've attempted to use my local IP (starting with 192), as well as the generic localhost (127.0.0.1). Unfortunately it doesn't seem to work as intended, as the host game can't even control anything, like changing AI difficulty, which I'm assuming is due to lack of connection to the Dedicated Server. Given, the other clients can't see the hosted game either.

The server doesn't open a window, but only leaves a log of "server up and running", i assume that's the expected interaction? I can't even find it running in my task manager though.

I hope I can figure this out soon hah

paulwedeck commented 4 years ago

The player options for multiplayer aren't implemented yet (as far as I know). Localhost would only work with two instances on the very same computer. Local IP is fine as long as you don't play with others over the internet. You probably have to run the server in a terminal window. The server has some kind of command line with 'exit' and 'listMatches'. If the server doesn't have stdin (because you just run it via double click) it can't read commands from stdin and will exit immediately.

PoxiPol commented 4 years ago

Again, thank you so much in pointing me in the right direction, and it appears that we are making progress!

The server has to be ran in an admin privileged Command Prompt (as you said) using the following line: java -jar DedicatedJSettlersServer.jar

This definitely makes the Server turn on and remain open. Actually it appears responsive whenever I run an instance JSettlers, but unfortunately I still can't get the multiplayer to work. image

It appears that it is struggling to locate the streamsupport.class . Would I have to engage it in my command, or potentially my install of java lacks it?

paulwedeck commented 4 years ago

Its not your java's fault. This is an android library to support java8 functions in java7 but isn't contained in the released jar file for some reason.

PoxiPol commented 4 years ago

Thank you for the fix. I'm not completely familiar with github, how could i download and try it out?

paulwedeck commented 4 years ago

https://github.com/paulwedeck/settlers-remake/blob/upload/DedicatedJSettlersServer.jar

PoxiPol commented 4 years ago

Everything now works as intended! Thank you so much, I can't wait to try it out with my friends.

Now for future reference if anyone else attempting the same thing:

java -jar DedicatedJSettlersServer.jar

(Remember to enter the folder it is located in first)

Finally, remember that you might have to pick a map that allows for 2 players, as a lot of the imported maps will force you to share 1 civilization together.

The multiplayer is a little wonky right now, and appears to have desync issues on occasion. Hopefully at some point we will also be able to create matches with randomised maps as well as additional multiplayer options. But beyond that, happy building!

Thank you again @paulwedeck !