Jump to content

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


Recommended Posts

On 10/13/2019 at 12:14 AM, xrystal said:

Hello,

first things first, I know this is an oddly specific request, however, since asking is cheap and neither time nor success is crucial on this (still it would be very convenient ;)), I will put it anyway: Does anybody has - maybe somewhere hidden in his always growing pile of data or on a old, dust covered hdd lying lonely in some dark corner - network traffic probe files which may randomly include sacred 2 lobby traffic and would be willing to share them (for wireshark, the filter to check for potential traffic would be "tcp.port == 6800" in files, if I remember right, from somewhere between october 2008 and april 2012) for analysis purposes?

I am currently looking into the tincat3.dll and it seems like an actually not impossible, but still time-consuming task to reconstruct the packages sent. I am willing to try this, but also I am more or less only able to work on my rare free weekends on this, so this would take a long time and long time projects in my experience tend to fail. Further more, since the first Sacred - according to this thread - uses the older version tincat2.dll which seems quite similar, it would be likewise useful traffic as well, probably not only for me. However, because of it's age I assume the odds are even worse?

Playing with friends on a VPN works nice & flawless, but is for sure not convenient enough for the majority of other players and I kinda miss the simplicity of the old lobby system - even if it never was that busy there, the people you met were always nice to play and talk with and you did not have to scare them away with technical client-side stuff like you are nowadays forced to... :P

HI Xrystal and welcome to DarkMatters!

I wish I had the info you're looking for.  The community has been trying to get a easy, robust solution for this for many years now, ever since the TinCat closed ten years ago (lol was it more :lol: ) ... YOu ou hit the nail on the head with the critique of the VPN and while it can work, most people have a challenge getting into it the first time...

I'm hoping this post gives your post the bump it needs to connect to someone out there in the nethers of the net,  and happy to see that we have have another member of the community who's as interested in getting people together over this game as we are.

Once again, welcome to the boards

:)

 

gogo

Link to comment
  • 4 weeks later...
On 10/13/2019 at 6:14 AM, xrystal said:

Playing with friends on a VPN works nice & flawless, but is for sure not convenient enough for the majority of other players and I kinda miss the simplicity of the old lobby system - even if it never was that busy there, the people you met were always nice to play and talk with and you did not have to scare them away with technical client-side stuff like you are nowadays forced to...

Hi xrystal,

do you by chance have a guide or similar that'd enable people to set up such VPN in order to play Sacred 2 coop? Or would any VPN guide from the web will do?

Best regards,

Martin

Link to comment

This sounds perfect and of course I'll wait for your notes patiently. I was sad that multiplayer wasn't really available anymore but if it works with a VPN maybe there is an option also to eventually have a Dark Matters community VPN for this purpose.  :superman:

Link to comment
3 hours ago, xrystal said:

Hey ameaeth, sure, if you can wait round about till tommorrow evening, I can write up my own notes into something comprehensible and provide files which should work out of the box for especially this purpose on any cheap virtual server for max. 3-4€/month. And yes, generally speaking VPN guides from the net will do (probably easier if you know a bit about networking and server administration, because often you find configurations which are similar to your own goals and environment but not exactly equal needing a few adjustments), but you need to make sure you choose a configuration with peer-to-peer enabled and a TAP interface since Sacred needs to Broadcast network trafic which will not work on TUN based solutions.

If you want to try out how this works for the client after setup beforehands, you (or of course anyone else) can also pm me and I can send you a temporary access to a running vpn (for testing purposes only, not as a long term solution and also tomorrow since I am not here for the rest of this day ;)). And, furthermore, seeing that german flag on your profile picture, at least in personal messages don't hesitate to write me in german as I will probably be able to answer faster in that language :P

Also, totally unrelated at this opportunity @gogoblender, thanks for the warm welcome :)

You are welcome for the welcome friend ! :lol: We're in love with our community and everyday here, it seems like members come up with new ways to keep this game engaging... this vpn and guide sounds like a great help for fans wanting to play together

:bounce:

gogo

Link to comment
On 11/9/2019 at 12:27 PM, ameaeth said:

This sounds perfect and of course I'll wait for your notes patiently. I was sad that multiplayer wasn't really available anymore but if it works with a VPN maybe there is an option also to eventually have a Dark Matters community VPN for this purpose.  :superman:

Regarding the idea of a community VPN, imho this is a rather difficult topic. Or at least, there are quite a few reasons I have avoided providing web services like that publicly in the past and currently only hosting them for close friends I know and trust (but feel free to soothe my mind on this ;)):

Usually I would not only provide the peer-to-peer connection between clients, but also route all network traffic of the client over the VPN (including traffic of web browsing for example). On the one hand this simplifies the configuration effort on the client-side and on the other hand I remember a few cases client computers redirected part of the game network traffic wrong resulting in some games not working correctly over the VPN which I can circumvent by just forcing everything to resolve over my server. But of course, this means I have to install some kind of bandwidth quota for not having that one guy watching a youtube-stream at 8k-resolution or seeding a few torrents in the background ruin the fun of everyone else with latency spikes during gameplay.

Also, there is legal stuff: If I provide a VPN, I am responsible for the traffic it routes. If somebody decides to not just use it for gaming but route illegal traffic over it instead, in the worst case I have to deal with it. Of course, I could try to at least be able to proof it is not my fault in case something bad happens by logging usage extensively and of course stating I prohibit such usage of my service, but that would lead straight to the next issue, namely protection of privacy and over engineered laws like our German DSGVO, meaning, I would have to provide some kind of opt-in / terms of service to be fine in terms of law.

Furthermore, since everyone exposes his computer like in a local network to other participants of the same network, security issues arise. I remember someone once in a virtual network exposing his complete C:\ partition as a shared network drive without password protection. That was probably convenient for him in his home network to copy files from one pc to another, but is of course a complete disaster with unfamiliar internet users in the very same network. Briefly speaking, the VPN is just an additional risk for inexperienced internet users.

Also, as the operator of such a server, it will consume quite some of your time to host it. Some Users will probably complain to you over certain issues which are caused by themselves, but can't be fixed by themselves needing you to support them like for example:
- their own firewall blocking port 6800 for a hosted server
- their antivirus snake-oil program decides to silently block your openvpn application but not tell anyone about it,
- a broken* operating system which resets the network configuration all the time (*the user will claim his PC is alright :P)
- that one special guy insisting you have to make your guide working for his beloved windows vista
Such and other things are borderline fine for a few friends but a massive headache with dozens or hundreds of people... ;)

Concerns like that led to my wish/hope to reverse engineer the old lobby network protocol instead of building various duct-tape services around it. It would be a safe network (for both server administrator and client), limited to network traffic of only Sacred itself and minimal to none client side effort.

And btw. I think it might take me a few days more writing my stuff, because instead of just cleaning up my notes of my current setup (like I intended originally) it appears to me now like a much better approach to configure a fresh server from zero up and documenting what has to be done to do so (and actually checking it still works like intended a few years earlier), to be sure I don't miss out any things which might have been already configured on my currently running servers implicitly in the past but are also relevant for the networking of the VPN.

Link to comment
  • 3 weeks later...

It took me a while because of networking and the weird issue that I needed to compile the debug target myself instead of the precompiled (release?) binary you provided (probably some missing dependencies on my side or something like that), but I was able to get this running under Win 10 and Windows Server 2016 or something like that. First I did a local test, then on the server and set up a lobby there and registered multiple game servers to it (not from localhost, but from a different location meaning even splitting the load between lobby and actual gameservers works which is great) - and accessed them successfully over WAN, so yes this works!

Reconnecting to the lobby after tabbing out of the game seems to cause issues sometimes (connecting with no response), but those are solvable by providing wrong credentials once (which will trigger the "invalid parameter" response) and after that connecting will work again. But it is also possible, that this was already the case with the original lobby, as I remember, it was always a little bit wonky.

In my opinion your work is pretty much the greatest contribution to Sacred 2 since the CM Patch, I can't say "thank you!" enough.

Do you have any specific plans on public deployment if there are no serious bugs found after further testing? Or are we free to use your code to host services as we like? With a bit of coordination aside from private usage, we could create some kind of unofficial "hub" domain for game servers hosted by the community which would be epic. Also, if the CM-Patch guys are still active, they could probably bring back the "Open Net" Button which they removed from the Multiplayer menu which could allow usage not only for the base game, but also the more stable and better versions :P

@ameaeth: Sorry for my massive delay with the VPN Server, but at least I have a perfect excuse now to delay that even further: The VPN will not be necessary anymore because we will have something way better now thanks to cocomed which is worth every server owners full attention ;)

I have to go to work in four hours, so testing today ends here for me, but I probably have to start experimenting with dockerizing your application in the next days as I prefer my linux servers or rent  another windows machine if that is not possible.

  • Respect! 1
Link to comment

 

That is useful information NegativeOne, thanks. Glad to see that Public Domain Entry there, I oversaw that yesterday.

 

On 12/2/2019 at 7:37 PM, NegativeOne said:

I also wanted to test it with the CM Patch for Sacred 2 Gold, so I made this to enable the buttons on the multiplayer screen: https://www.dropbox.com/s/0kawzl5zkn99pwh/Sacred 2-CM-OpenNet-UI.7z?dl=1

It's for CM Patch 1.60 and if you unpack it into the game directory, it will create this file:


Sacred 2 Gold\pak\Windows\OutGameMenu\Internet.xml

 

And that is even better, because I have zero knowledge regarding modding sacred2, so this will probably help a lot, I will check that out. If you want to test interaction between players alongside with these unknown packages, we could also meet up on a test server.

Maybe we can take a few days to fiddle around with all these new possibilities and after that seeing how much resources the systems need to run fine and start a little public list or something alike regarding the things we need or can supply as individuals for a centralized community hosted infrastructure? Seeing how small the community is, it would probably be a good idea to keep the players together, I.e. don't split them over too many lobbies or servers but provide them as stable as possible with Sacred ;). I mean, this could be a perfect self hosted Christmas present to all of us... :D

[Edit] FYI: Just in case someone did not know: The sacred 2 gameserver runs without additional configuration under linux within wine (just tested it on a debian stretch server). So you can host the lobby standalone on a windows machine and the gameservers on a separate one. This makes hosting a little bit cheaper as you need a server with a windows licence only for the lobby itself but not for its registered gameservers which will probably consume the most ressources (and at least for me that is also way less of a hassle to manage... ;)). For the lobby however it seems rather difficult to let it run in a non windows environment on the first glance, because of all this .NET stuff, but if it is only the lobby running on windows (even the database could be separated easily from windows by using another driver than sqlite and as a nice bonus would allow shared user accounts between lobby instances) it might be acceptable in terms of costs. I still want to experiment with that a little more.

Edited by xrystal
  • Appreciation 1
Link to comment
  • The topic was featured

Hey, that's very nice, in a few days from a no-lobby-situation to being able to host everything under Linux. I really have to check that out.
And yes, Mysql mostly works, I just have to fix one issue I could not get right yesterday with it and I will have time today evening or on the weekend for that.
Maybe we should move the code to a public git repo? Seems akward if everybody works on his local copy and has to up- and download files selectivly... ;)

Link to comment
On 12/4/2019 at 9:56 PM, NegativeOne said:

 If you find a nice way to replace sqlite with mysql or postgresql, please share. I don't have much time to experiment with that at the moment.

'Nice' would be an exaggeration, but for now and simply testing these changes should do. If there are no other ideas on how to collaborate on this, you can just use the linked github repository which I used for experimenting with this and will continue to use so we can all utilize and improve the same lines of code without the hassle of file sharing (imho version control makes life easier a lot ;)).

Mysql-Database Usage for now is simply an additional 5-line file "db.cfg" in the executable directory with the following format:

DB_IP
DB_PORT
DB_NAME
DB_USER
DB_PASS

Because of the dependency change from SQLite to MySQL however, it will probably not work right now with Linux (or at least not with the mentioned interop library which would have to be replaced with another one for MySQL), but if it does not yet runs ootb with another lib I am pretty sure to have that fixed for Linux by tomorrow, too, because I will have tested (and adjusted if necassary) it with your mono solution until then.

[Edit]: Actually, that dependency causes no issues, MySQl.Data.MySqlClient seems to be available in mono, I could just run it with my existing installation to which I think I have not added any non default libs in the past.

Later, I would like to add a more generic solution for configuration and also clean up the code a bit, but for now, it seems okay.

Edited by xrystal
tested with mono
  • Respect! 1
Link to comment
53 minutes ago, Dax said:

Stupid question, but can someone explain the matter to me in a few simple words?

Asking is not stuipid at all, this turned into a quite chaotic thread ;)
The core matter is, that the user cocomed programmed a replacement for the Open Net Sacred2 Lobby which officially ceased to operate many years ago. This will allow us for example to host Sacred 2 servers which can be joined and played on together without all the sometimes quite technical hassle of previous workarounds for the no more existing online multiplayer. Currently we are just exchanging ideas on how to make best use of this new situation (on a rather technical level:P).

Edited by xrystal
  • Appreciation 1
Link to comment
9 hours ago, xrystal said:

Asking is not stuipid at all, this turned into a quite chaotic thread ;)
The core matter is, that the user cocomed programmed a replacement for the Open Net Sacred2 Lobby which officially ceased to operate many years ago. This will allow us for example to host Sacred 2 servers which can be joined and played on together without all the sometimes quite technical hassle of previous workarounds for the no more existing online multiplayer. Currently we are just exchanging ideas on how to make best use of this new situation (on a rather technical level:P).

I love this thread! You've all breathed fire into the idea of the community playing online again.  We have brought this topic up so many times, and time over and over eveyone said that the code was last and noone can bring it back.

Seeing all of you talk is very exciting.  Yes, it is very technical and miles above my head... but I'm still delighted that this game's power is still to bring out the best in people, keep people together and create great things

If any of you need poutine, we have lots of supplies here in Montreal

:hugs:

 

gogo

Link to comment
On 12/9/2019 at 10:49 AM, NegativeOne said:

That's great. I'll clone the github repository later. I'll also try to get everything to work on Linux with MySQL and post the results here when everything works.

Are you trying to set that up on Linux with some scripts or in a container? If it is the later one, I could share my current work-in-progress files for a docker-compose.yml after I am back from work. They seem to run fine for the lobby and database so far, however for the game servers there seems still to be a port forwarding issue or something alike I have not yet solved if running from wine within docker instead of running just via wine (I.e. servers are listed, but can't connect from client side if hosted via docker, but can connect if started solely with wine but I would prefer to have everything contained for easier deployment on servers). I assume this has to do with the external IP parameter of the s2gs.exe and my understanding of it or it's just a mistake in my port/network configuration I have not found yet... ;)

Edit: I Finally found the time to search for and find my mistake: For some odd reason I expected the gameservers to be UDP traffic and mapped it instead of TCP inside my containers (which obviously was pretty dumb of me... ;)). I will put up a test server (with lobby and game servers in the EU-region) up today or tomorrow for vanilla and cm-patch game and after that also clean up and attach the related dockerfiles.

Edited by xrystal
Update
Link to comment
  • The title was changed to SACRED 2 ONLINE MULTIPLAYER: HOW-TO, DISCUSSION & DEVELOPMENT
  • The topic was pinned

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