Jump to content

SACRED 2 ONLINE MULTIPLAYER: HOW-TO, DISCUSSION & DEVELOPMENT


Recommended Posts

  • The topic was pinned
On 12/22/2019 at 12:33 PM, Androdion said:

@xrystal - Let me just thank you for all your work with this, I've stickied the thread for it to be readily available at all times. Keep it up! :thumbsup:

That gratitude belongs to cocomed, he did the actually difficult and time consuming part. I am just happy to be able to work with his lobby code now... ;)

On 12/22/2019 at 11:10 PM, JJDynomite said:

Just wanted to let you know I followed your instructions from the Steam discussion to connect to the lobby and it worked for me, thanks for your hard work!

Thanks for testing, nice to hear it's working so far.

---

I have a few more general questions I am sure everybody has an opinion about:
1) Since I have not recently played with any mods beside the CM-Patch but am still seeing many to me unknown ones in the modding section, I am wondering: Which ones are played currently, maybe are already known to work in LAN mode and might be of interest regarding providing online servers for them?
2a) What regions have the most active player base or the worst connection to the servers which I currently host in Germany? Where in the world would we have to put additional servers up if everything runs fine?
2b) And if we knew where to put additional servers, are there maybe community members which have server capacity with unused resources in those regions on which they maybe would want to host a few game servers in the future and could ensure their availability?
3) How would you prefer the lobby to be organized: Everything in one lobby including different countries and mods? Different lobbies by country like the original lobby had? Or split by mod? I personally would prefer to have everything in one big list, but it would be a quite long scrollable list with all possible permutations of server/mod configurations. However, assuming most people are able to communicate in English and might want to find each other and play together, splitting an already small community even further seems counterproductive to me which is why I would currently tend to just dump everything in one big list as long as the lobby server can handle it in terms of performance.

---

Besides that - only for those who want to setup their own lobby on Linux, too, not only game servers - I have added the files I am currently using for hosting to my github repo. It still requires a bit of effort to get it up and running and will hopefully be more convenient someday, but for now it should do.

precondition
- docker and docker-compose installed and ideally you already know what it is and how to use it
- all necessary ports open (see in compose files port mappings which ones are used)

configuration
- I have not uploaded the server files themselves for copyright reasons, but added a file serverfiles.txt with the lists of files you need to copy from your games installation folder and where to put them. If you want to play another modded version of Sacred2, just add the files to a new sub folder next to vanilla and cm160hf and try if it works for you
- There are two files, one to start the lobby with it's database and a separate one to start one or more game servers which will register to the lobby
- In the lobby.docker-compose.yml I have used local-persist driver (https://github.com/MatchbookLab/local-persist) volumes. You may want to replace these with "normal" docker volumes in case you don't want to install an additional docker plugin to your system.
- Configure everything in the .env file - see the comments in the file for details. With local-persist volumes, you have to create the folder you have specified for "CONTAINER_VOLUME" first, create three sub folders db for the database, gs with the game server files and  lb for the lobby files there and ensure your docker user has full permissions at that location. Copy the lobby files to the lb folder and ensure that you have set the same values as in the db.cfg file which you have saved in the .env file. The db.cfg then should look like this:

172.68.0.2
3306
s2lobby
root
YOUR_MYSQL_PASSWORD

The address in the ip.cfg has to be 127.0.0.1

- If you want to have multiple game servers, in the gameserver.docker-compose.yml copy the sacred-gameserver1 service as many times as you need it with another name and add environment variables for each individual configuration in .env accordingly

usage
- First start the lobby:

docker-compose -f lobby.docker-compose.yml up -d


- Then the gameserver(s):

docker-compose -f gameserver.docker-compose.yml up -d


  If a game server service keeps restarting or is listed in the lobby but cannot be joined you most likely have port configuration issues.

 

Edited by xrystal
added missing information
  • Respect! 1
Link to comment
On 12/22/2019 at 2:39 AM, xrystal said:

Hello holidays, hello Sacred! I have a full lobby setup running now public with game servers of each difficulty tier in free or campaign mode for community patch and vanilla game version in the same lobby. This is still a work in progress and mainly for testing and finding bugs. Currently, the game servers hosted by me are all in the EU-Region. For the lobby, this does not matter. However, for the game servers there might of course be some additional latency depending on your location, so after everything is proven to run stable, this should and will change.

If you want to try it out yourself, do this:
    1. Ensure you have either the latest Version of Sacred with Ice&Blood (2.65.2) or CM-Patch 1.60 with hotfix.
    2. In your Explorer navigate to "C:\Users\YOUR_USER_NAME\AppData\Local\Ascaron Entertainment\Sacred2"
    3. Create a file there called "OptionsCustom.txt", insert following single line and save it:
        network.lobby_ip = "hex41.de"
    4. If you want to use the CM-Patch, copy these files into your game directory.
    5. Launch Sacred2 and go to Multiplayer > OpenNet
        5.1 Create a new Account:
            Please do not enter sensitive data into the account registration form (I.e don't enter your actual game key and alike; also you do not have to use your real email address as it does not matter). I will look at the related log files and database entries for debugging purposes sometimes so again don't put anything private in there.
        5.2 Enter the lobby with your credentials and create or select an existing character
        5.3 Join any server which matches your game version and have fun
            If you get a black screen or "connection aborted" message while doing so, you have most likely tried to join a cm-patched server with an unpatched game version or vice versa (or, the server previously crashed but was not unlisted from the lobby).

If you notice you successfully crashed a single game server or even the whole lobby somehow, please describe here how you killed it as that may help in making it a more stable experience ;)

Remember to save often... :)

Bravo to everyone who's contributed to this amazing gift! Xrystal, once it looks like its stable and is as effective as you wish, we can bring in signage for Sacred Multi play via a link or a button on this forum and the Wiki to show people the road to where people are playing. Also you could change the title of this thread to something like "How to play Sacred 2 Online etc etc "...just so that when folks search for instruction, Google will hit the topic as a return and get them to this info

Will this help?

:)

 

gogo

  • Thanks! 1
Link to comment

Known Issues:
- player count of logged in players is not displayed in the server browser
- chat probably only works ingame right now but not in the lobby
- servers which shutdown are not removed from the lobby until the lobby is restarted
- servers with password don't ask for a password and are thus inaccessible

Currently, the issues with the player count and the one with the private servers which are not unregistered cleanly again from the lobby are imho currently the most important ones to solve, as the first bug makes it more difficult to find other active players on the servers and the second one spams the lobby with unusable servers or forces me to schedule restarts for the lobby which otherwise would not be necessary.

@gogoblender Yeah, that would be a nice idea after it's ready. Also, at some point before, I will try to reorganize all the information spread over the discussion in this thread into the opening post.

Edited by xrystal
update
Link to comment
19 hours ago, xrystal said:

 

@gogoblender Yeah, that would be a nice idea after it's ready. Also, at some point before, I will try to reorganize all the information spread over the discussion in this thread into the opening post.

Perfect!

This holiday season is getting more and more hectic by the day... when we have some breathing room we can look at an effective way to spread your work to the masses

Still amazed... great job guy. Everyone saying it couldnt be done...but this little community keeps pulling in the best talent and the biggest hearts

Bless you

:hugs:

gogo

Link to comment
10 hours ago, NegativeOne said:

I figured it out. Took a moment but I think I got it right, so with this diff the lobby server will notify the game UI and remove server that are closed or crashed. Please integrate this diff into your repo and then merge or rebase it with your latest changes: https://pastebin.com/iYnPJPCN

The diff should be applied to the older commit 6e4113c8a3a689a3e76e548d9a5fcd9a3756091f in your repo

That's looks very promising, thank you - I will try that out in a few hours and merge it afterwards. Also in case you have been wondering and send me the diff because of that: the development branch is locked for direct commits because I know and like that workflow from work, but if you want to push something every user can create pull requests from a feature branch to development in that repository. The only restriction is that every pull request has as least to be approved by one other person (doesn't matter which one) before it is possible to merge it into development.

Edit: Yes, works fine. I have merged the diff and updated the test servers with that bugfix of yours.

Ah, and aside from that: merry christmas! ;)

Edited by xrystal
Link to comment
On 12/22/2019 at 8:55 PM, xrystal said:

Since I have not recently played with any mods beside the CM-Patch but am still seeing many to me unknown ones in the modding section, I am wondering: Which ones are played currently, maybe are already known to work in LAN mode and might be of interest regarding providing online servers for them?

I believe the most common setups would be:

  • Fallen Angel
  • Sacred 2 Gold
  • Sacred 2 Gold + CM Patch 1.60
  • Sacred 2 Gold + CM Patch 1.60 + Enhanced Edition
  • Sacred 2 Gold + CM Patch 1.60 + Dmitriy's Addendum
  • Sacred 2 Gold + CM Patch 1.60 + Diablo 2 Fallen

 

By the way, I'm amazed at what you all are doing.  I never played multiplayer in Sacred franchise because I came so late to it.

  • Thanks! 1
Link to comment

This is probably not the correct way to do it, but it kind of works: https://pastebin.com/bf7JFdkq

Password protected servers are showing with a small lock symbol in the list and you are asked to enter the password for the server when you try to join it. If the password is correct, all works well, but if the password is wrong it kicks you out of the lobby as if your login password was wrong. Should still be good enough for now.

I still want to figure out how to decode the cipher that is sent by password protected servers, I assume that there is more information that can be used to improve the password checks in the lobby UI.

@xrystal I don't have an account for Github and don't want to make one just for this. As long as the diffs work, I'll keep working this way and you can decide if you want to take the changes into your repo.

  • Thanks! 1
Link to comment

@NegativeOne: Yes sure, your diffs are good to work with, thank you, I'll just keep merging them into the repo to have it all together.

And imho that behavior of your patch is already very nice - even if the player is kicked out of the lobby after a wrong password attempt, because of the symbol and question for the password before he knows why he was kicked and thus should not be confused anymore.

@Flix: Thanks for the overview. In case Fallen Angel is actually still used without all the patches, I'll have to see if I can find & install my old retail disk version to get game servers up for that one, too. However, as all the other mods you mentioned seem to be based on Sacred 2 Gold version, I would suggest to split the Fallen Angel Lobby to another lobby address & list from the Gold Edition list hinting in both the setup instructions and the lobby welcome message of FA that there is a newer version with patches out as probably most players will be found there.

Edited by xrystal
Link to comment

I'm currently trying to get this bit to work: https://I.imgur.com/JRdvKZb.png and as you can see I made a little bit of progress already.

It's a mess and only half working so far, whoever designed that part of the system made it very complicated for some reason and every step takes me 3 or 4 attempts and failures before I get it right. I hope to have the core part of it working in a few days and I'll post the changes here as soon as it works good enough for a first public test.

Link to comment
37 minutes ago, NegativeOne said:

I'm currently trying to get this bit to work: https://I.imgur.com/JRdvKZb.png and as you can see I made a little bit of progress already.

It's a mess and only half working so far, whoever designed that part of the system made it very complicated for some reason and every step takes me 3 or 4 attempts and failures before I get it right. I hope to have the core part of it working in a few days and I'll post the changes here as soon as it works good enough for a first public test.

Honestly, it is a joy seeing you work, you're making visible progress so fast even with these difficult things and thanks to you the usability of the lobby has already improved a lot in a short time (and judging by that screenshot, it will improve even further).

I suspect it will take me about a week more until I will finally able to contribute something useful on the code part again, too, but at least in the meanwhile I am making a bit progress on the infrastructure stuff:
In probably a few days I will have access to my new slightly more powerful server which - other than the current testing one - will be dedicated to the purpose of sacred 2 only now that I can roughly estimate performance usage and am sure this all will turn out nice and is worth the investment. Hosting the lobby and 20 servers (vanilla + cm) currently boils down to roughly 33% of cpu usage on an i7-6700k. On the new System, I should be able to host most of the Mods listed by Flix additionally, depending on how much performance I want to reserve for load caused by user hosted servers to the lobby and depending on the capability of the lobby to handle that many servers (if I remember right, back in the days there never have been so many servers registered to just one lobby). From my observations, players on a server don't increase cpu usage much compared to their idle state (also, there will never be that many players as there are slots on servers), so you don't have to arrange for many resources in spare (I will try to target around 80% of load on my server without players and see how that works out).

Only one thing that really bothers me: For a few weeks now, I have tried to purchase the old lobby domain (because that of course would make setup even easier for the clients, because they would not have to do anything), but until now, the seller never responded despite me offering to pay his desired price. Probably inactive on that domain selling platform. I hope that will change someday, but for now it seems like we will have to stay entering our own domains as lobby ip.

  • Like! 1
Link to comment

I'm mostly throwing stuff blindly at a wall hoping that something sticks. But having the payloads helps a lot to guess how things work and the details can be discovered in the DLL files. The old packet logs from Coco are also very useful. In some of them are packets between game and chat server. It would help if we had longer packet logs with more games connected to a lobby and chat server but right now I have to work with what we have.

  • Like! 1
Link to comment

Are you sure these are actually old? From the date I saw for example in the packet data of "net_dump - 3.txt" I guessed he had created them with his lobby code in progress just recently, not back in the days and thus we should be able to create the same kind of packets with our lobby instances. The client actions on game servers should at least produce unhandled packages logged by the debugging compilation of the lobby.
I am not sure, If it would help you, but after Silvester I could try to install tcpdump (I just have to see if I can kind of pre-filter it because I don't want private stuff in there or have to wait a few days more for the new server which would be cleanly separated) to the test server and make it accessible as a wire shark packet capturing source to you, too for remote debugging together with the log of unhandled packages. That way there would at least be some additional package data from a few players and different servers a day to the testing input we do ourselves on purpose on our local development environments.

Edited by xrystal
  • Like! 1
Link to comment

That's the strange thing about those packet logs. They contain recent dates, so they are not very old. But some of the packets I see in these logs are not made with the lobby we got. To me it looks like a more complete lobby exists somewhere and the logs were probably made using it.

The packets in the logs that are showing chat server communication for instance they are what I'm using to somehow figure out how to get chat to work but there is no code in the lobby emulator to handle them, otherwise I would not have to do this work.

I'll try to get more information from Coco, hopefully I'll get a reply. If it's possible for us to get longer packet logs we could get a better understanding of the whole chat protocol. As I said before the chat system is more complicated than the other things I see in the lobby, there are 2 different ways to send and receive packets in chat and for every type I need to experiment to figure out how it needs to be sent to make it work.

  • Respect! 1
Link to comment
On 12/22/2019 at 8:39 AM, xrystal said:

Hello holidays, hello Sacred! I have a full lobby setup running now public with game servers of each difficulty tier in free or campaign mode for community patch and vanilla game version in the same lobby. This is still a work in progress and mainly for testing and finding bugs. Currently, the game servers hosted by me are all in the EU-Region. For the lobby, this does not matter. However, for the game servers there might of course be some additional latency depending on your location, so after everything is proven to run stable, this should and will change.

If you want to try it out yourself, do this:
    1. Ensure you have either the latest Version of Sacred with Ice&Blood (2.65.2) or CM-Patch 1.60 with hotfix.
    2. In your Explorer navigate to "C:\Users\YOUR_USER_NAME\AppData\Local\Ascaron Entertainment\Sacred2"
    3. Create a file there called "OptionsCustom.txt", insert following single line and save it:
        network.lobby_ip = "hex41.de"
    4. If you want to use the CM-Patch, copy these files into your game directory.
    5. Launch Sacred2 and go to Multiplayer > OpenNet
        5.1 Create a new Account:
            Please do not enter sensitive data into the account registration form (I.e don't enter your actual game key and alike; also you do not have to use your real email address as it does not matter). I will look at the related log files and database entries for debugging purposes sometimes so again don't put anything private in there.
        5.2 Enter the lobby with your credentials and create or select an existing character
        5.3 Join any server which matches your game version and have fun
            If you get a black screen or "connection aborted" message while doing so, you have most likely tried to join a cm-patched server with an unpatched game version or vice versa (or, the server previously crashed but was not unlisted from the lobby).

If you notice you successfully crashed a single game server or even the whole lobby somehow, please describe here how you killed it as that may help in making it a more stable experience ;)

Remember to save often... :)

Hello there,

 

I just decided to get back to Sacred 2 for the first time in an eternity and I just so happened to stumble arcross this post when researching possibilities to play online multiplayer.
First of all I want to say that I am amazed by this project and I want to thank everyone taking part in it. 
Which brings me to the second reason I am posting here, which is that I am a big dumbo and can't seem to get this to work for me. I am playing this game unmodded on steam, and it is on the latest update (2.65.2). I followed the steps given here, but still can't select the "OpenNet" option on the multiplayer menu. Any suggestions on what I am doing wrong?

Thanks again and have a good start heading into 2020.

Link to comment
1 hour ago, Kadolek said:

 I am playing this game unmodded on steam, and it is on the latest update (2.65.2). I followed the steps given here, but still can't select the "OpenNet" option on the multiplayer menu.

Hello Kadolek, "can't select" as in the OpenNet Button is greyed out and unclickable or as in the complete button does not exist? If it is the later one and you are sure your game is unmodded I.e. not community patched which would require the file from step 4, I would try to validate the game files via steam to restore from potential file changes as it really should be there in the default installation. If it is just grayed out, the button should be clickable if you enter your credentials. In a vanilla installation with the additional file "OptionsCustom.txt", it should look like this for you.

If that still does not work, please be patient until we have a better setup guide ready or if you find something which differs on your screens from mines post again and we might figure it out ;)

  • Like! 1
Link to comment
2 hours ago, Kadolek said:

Hello there,

 

I just decided to get back to Sacred 2 for the first time in an eternity and I just so happened to stumble arcross this post when researching possibilities to play online multiplayer.
First of all I want to say that I am amazed by this project and I want to thank everyone taking part in it. 
Which brings me to the second reason I am posting here, which is that I am a big dumbo and can't seem to get this to work for me. I am playing this game unmodded on steam, and it is on the latest update (2.65.2). I followed the steps given here, but still can't select the "OpenNet" option on the multiplayer menu. Any suggestions on what I am doing wrong?

Thanks again and have a good start heading into 2020.

Happy you've found this great topic they have put together in trying to figure out the secrets of the servers! :D ... This stuff is, as well, way above my head, but I wont let it stop me from posting my appreciation and respect for all the time all these members have put into figuring out this solution, and to welcome you, Kadolek, to DarkMatters!

:gogo:

 

gogo

Link to comment
15 minutes ago, xrystal said:

Hello Kadolek, "can't select" as in the OpenNet Button is greyed out and unclickable or as in the complete button does not exist? If it is the later one and you are sure your game is unmodded I.e. not community patched which would require the file from step 4, I would try to validate the game files via steam to restore from potential file changes as it really should be there in the default installation. If it is just grayed out, the button should be clickable if you enter your credentials. In a vanilla installation with the additional file "OptionsCustom.txt", it should look like this for you.

If that still does not work, please be patient until we have a better setup guide ready or if you find something which differs on your screens from mines post again and we might figure it out ;)

Thanks for these hints. I verified everything, repaired the game data and restarted my pc. Don't know which of these fixed it, but one of these did and I can now do everything as described. Great work here, will definitly keep an eye on this topic.

Link to comment
18 hours ago, ChrisJohnson said:

Is it possible to have exclusive characters so people can't import their own ones?

That was closed net and I don't think we will get that working. If you start the game server with parameters for closed net you will see an error message that states it's not supported. They probably had special servers for closed net and unless someone figures out what the differences are we have to stick to open net servers.

  • Like! 1
Link to comment
  • The title was changed to SACRED 2 ONLINE MULTIPLAYER: HOW-TO, DISCUSSION & DEVELOPMENT

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...
Please Sign In or Sign Up