Jump to content

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


Recommended Posts

Hello @NegativeOne, after all this distracting Christmas and new-year stuff I have finally merged your changes... :)

In the development branch they are now usable with the Mysql setup, too. However, since I see that Mysql might just be an additional hassle for most users - especially for those who just want to host a lobby directly under windows right out of the box -, I will make a patch soon which will render Mysql an configurable option but keep Sqlite as default database driver. So you don't need to setup Mysql but can keep working on your base or the branch I put your changes into . I will put everything together in case anything diverges afterwards and also try to make the configuration files a bit nicer to use.

Those lobby changes will be applied to the testing server probably later today. I am currently setting up the new server which will replace the testing server in the long run and should have a few more mods supported.

Edit: The changes are now on the lobby server and I have some issues with the lobby chat which sometimes is not connecting (still have to figure out depending on which condition the connections works or does not work). Since it locally seems fine, I assume the issues are solely related to networking in my hosting instance or might be related to my Mysql-merge, not your original diff. Also I noticed yesterday I totally oversaw you already wrote about the SqLite/MySql topic. I was too focused on your list of changes apparently, forgive me my ignorance. But good to read we think the same about that :wink:. Anyway that improved lobby looks already very nice, thank you.

Edited by xrystal
  • Respect! 1
Link to comment

That sounds good. I'll try your updated lobby soon. The important question about the lobby to get answers for is if my changes work with multiple players in the lobby because I could only test it with 2 accounts on the same computer.

I'm currently trying to understand how the buddy list and ignore list work, but so far I can't get it to work in the lobby.

EDIT: Here is a small fix for the warning you get when multiple people log in to lobby chat: https://pastebin.com/w5BD1pmJ

Edited by NegativeOne
Link to comment
  • 3 months later...
On 12/31/2019 at 2:21 PM, NegativeOne said:

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.

I have almost set up a server on my own on linux, but I got the always restarting problem maybe bound to port misconfiguration on firewall or sorta kind of that. However I was thinking about a possible implementation of a closed net server. We may wrap the connection message sent by client into connection manager and redirecting it into an open server storing account name. In database table we may store that account's characters and allow users to only create new characters or use the local stored characters created directly on server lobby.

Hoping on an answer, I'd like to have an advice for configuring iptables to allow connections. I'm using OVH as hosting provider.

Kind Regards

  • Like! 1
Link to comment

I feel a bit awkward because I didn't get to put gameserver files into gs folder :P
Tomorrow I'm going to put it online. I'm looking forward to work on the server side storing of characters. If you're used to any kind of instant messaging platform, I'd like to join you for leading me through better understanding on the server protocol used by gs for working on this subject.

Have a good night!

Link to comment
8 hours ago, firelite91 said:

I have almost set up a server on my own on linux, but I got the always restarting problem maybe bound to port misconfiguration on firewall or sorta kind of that. However I was thinking about a possible implementation of a closed net server. We may wrap the connection message sent by client into connection manager and redirecting it into an open server storing account name. In database table we may store that account's characters and allow users to only create new characters or use the local stored characters created directly on server lobby.

Hoping on an answer, I'd like to have an advice for configuring iptables to allow connections. I'm using OVH as hosting provider.

Kind Regards

Just here to say hello, hiya and welcome to DarkMatters! May the Sacred Serving be successful!

:gogo:

 

gogo

  • Appreciation 1
Link to comment
5 hours ago, firelite91 said:

I'm looking forward to work on the server side storing of characters. If you're used to any kind of instant messaging platform, I'd like to join you for leading me through better understanding on the server protocol used by gs for working on this subject.
 

Yeah sure, even through I am not entirely confident I will be able to actually help you with that undertaking in detail as I am not that deep into the reverse engineered code and I don't think ClosedNet will be an easy task. Actually, I am already amazed OpenNet works this good. Otherwise, a few months earlier even that seemed impossible, so... ;)

Anyway, for everything I can give support for, just write me a private message with the name of the messenger you prefer and your contact data, I will just install & setup that one (because currently I just use things like Steam/TS3 for communication as none of my friends has used IRC and alike messenging for years rendering it kind of pointless for me even through I really liked those things... :P). Since I have tinkered the whole night with my server (luckily I have holidays right now :)), I will probably sleep over the day and be back online sometime in the evening, maybe ~10 hours from the time of this post or something like that.

Btw., the Lobby URL has been updated from hex41.de to s2cm.png.3c7737f746c567841115421f1e672879.png (this is an image because the forum messes around with this specific address) as I finally put most things together on the new server which did nothing but idle for the last three months - good to have been reminded of the things which had to be done ;). The old domain is currently still working, because I will continue to use it for testing and have not restricted the access, but it will probably not be usable anymore someday in the future, so use the new one instead from now on, please. That one will stay online.

  • Thanks! 1
Link to comment

Actually I'm having problem starting the lobby. 

sacred2_charax_db   | Version: '10.4.12-MariaDB-1:10.4.12+maria~bionic'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  mariadb.org binary distribution
sacred2_charax_lb   | [Log system ready]
sacred2_charax_lb   | 
sacred2_charax_lb   | Unhandled Exception:
sacred2_charax_lb   | System.DllNotFoundException: System.Data.SQLite.dll assembly:<unknown assembly> type:<unknown type> member:(null)
sacred2_charax_lb   |   at (wrapper managed-to-native) System.Data.SQLite.UnsafeNativeMethods.sqlite3_config_none(System.Data.SQLite.SQLiteConfigOpsEnum)

 

This is my folder structure

 

find . -name \* -print
.
./gameserver.docker-compose.yml
./volume
./volume/lb
./volume/lb/BouncyCastle.Crypto.dll
./volume/lb/S2Lobby.exe.config
./volume/lb/S2Library.dll
./volume/lb/System.Data.SQLite.dll
./volume/lb/S2Lobby.exe
./volume/lb/lobby_log.txt
./volume/lb/ip.cfg
./volume/gs
./volume/gs/vanilla
./volume/gs/vanilla/pak
./volume/gs/vanilla/pak/spawn.zip
./volume/gs/vanilla/pak/generic.zip
./volume/gs/vanilla/pak/persector.zip
./volume/gs/vanilla/scripts
./volume/gs/vanilla/scripts/autoexec.txt
./volume/gs/vanilla/scripts/behaviour.txt
./volume/gs/vanilla/scripts/genMipMapInfo.txt
./volume/gs/vanilla/scripts/shared
./volume/gs/vanilla/scripts/shared/itemtype.txt
./volume/gs/vanilla/scripts/shared/typification.txt
./volume/gs/vanilla/scripts/shared/staticinfo.txt
./volume/gs/vanilla/scripts/shared/iteminfo.txt
./volume/gs/vanilla/scripts/shared/spells.txt
./volume/gs/vanilla/scripts/shared/material.txt
./volume/gs/vanilla/scripts/shared/defines.txt
./volume/gs/vanilla/scripts/shared/creatureinfo.txt
./volume/gs/vanilla/scripts/shared/books.txt
./volume/gs/vanilla/scripts/server
./volume/gs/vanilla/scripts/server/questscripts.txt
./volume/gs/vanilla/scripts/server/weather.txt
./volume/gs/vanilla/scripts/server/blueprint.txt
./volume/gs/vanilla/scripts/server/equipsets.txt
./volume/gs/vanilla/scripts/server/pathObjects.txt
./volume/gs/vanilla/scripts/server/spawn.txt
./volume/gs/vanilla/scripts/server/quest.txt
./volume/gs/vanilla/scripts/server/region.txt
./volume/gs/vanilla/scripts/server/heroes
./volume/gs/vanilla/scripts/server/heroes/dryadin.txt
./volume/gs/vanilla/scripts/server/heroes/templeguard.txt
./volume/gs/vanilla/scripts/server/heroes/seraphim.txt
./volume/gs/vanilla/scripts/server/heroes/centurio.txt
./volume/gs/vanilla/scripts/server/heroes/highelve.txt
./volume/gs/vanilla/scripts/server/heroes/inquisitor.txt
./volume/gs/vanilla/scripts/server/heroes/dragonmage.txt
./volume/gs/vanilla/scripts/server/waypoints.txt
./volume/gs/vanilla/scripts/server/triggerarea.txt
./volume/gs/vanilla/scripts/server/faction.txt
./volume/gs/vanilla/scripts/server/portals.txt
./volume/gs/vanilla/scripts/server/worldobjects.txt
./volume/gs/vanilla/scripts/server/worldobjecthints.txt
./volume/gs/vanilla/scripts/server/treasure.txt
./volume/gs/vanilla/scripts/server/weaponpool.txt
./volume/gs/vanilla/scripts/server/creatures.txt
./volume/gs/vanilla/scripts/server/triggervolumes.txt
./volume/gs/vanilla/scripts/server/respawn.txt
./volume/gs/vanilla/scripts/server/spawnpos.txt
./volume/gs/vanilla/scripts/server/drop.txt
./volume/gs/vanilla/scripts/server/balance.txt
./volume/gs/vanilla/scripts/landscape.txt
./volume/gs/vanilla/scripts/startPos.txt
./volume/gs/vanilla/scripts/roadmap.txt
./volume/gs/vanilla/scripts/heightmap.txt
./volume/gs/vanilla/system
./volume/gs/vanilla/system/plugin_win32platform.dll
./volume/gs/vanilla/system/orcSystem.dll
./volume/gs/vanilla/system/plugin_filesystem.dll
./volume/gs/vanilla/system/memmgr.dll
./volume/gs/vanilla/system/s2gs.exe
./volume/gs/vanilla/system/s2core.dll
./volume/gs/vanilla/system/zlib1.dll
./volume/gs/vanilla/system/tincat3.dll
./volume/gs/vanilla/system/plugins_srv.cfg
./volume/gs/vanilla/system/s2logicdll.dll
./volume/gs/vanilla/system/s2logic.dll
./volume/gs/vanilla/system/plugin_filezip.dll
./volume/gs/vanilla/system/s2vista.dll
./volume/gs/vanilla/system/stlport.5.0.dll
./volume/db
./volume/db/multi-master.info
./volume/db/ib_buffer_pool
./volume/db/ib_logfile1
./volume/db/aria_log_control
./volume/db/mysql
./volume/db/mysql/*
./lobby.docker-compose.yml
./.env
./gameserver.dockerfile

 

  • Like! 1
Link to comment
  • 3 weeks later...

Hello everyone!

Let me start by saying this is PURE GOLD! I was actually considering writting the same thing, I'm so glad someone did it.

I've been trying around and here's the experience so far:

 -The login / listing works well!

 - If I create a game myself, and my friend tries to connect (and vice versa) we get a 61 error code, "login failed" (not a port issue, same thing with DMZ activated)

 - If I try to join any online server, the game just crash

 

I am using Win10, CM 1.60 & all DLC (Sacred 2 Gold).

I havent been able to play multiplayer yet, but I can see we're getting very close, this is super exciting ! Thanks for the hard work, and thanks in advance if anyone can provide some help on why this is happening :D

 

cheers

 

  • Like! 1
Link to comment

Welcome to DarkMatters azukaar, I hope you enjoy your time on the boards and with these wonderful games.

I haven't yet used this impressive piece of coding myself, but here's hoping you get up this multiplayer and running. 

  • Like! 1
Link to comment
5 hours ago, azukaar said:

Hello everyone!

and thanks in advance if anyone can provide some help on why this is happening :D

 

cheers

 

Hello friend, and welcome to DarkMatters!

I'm always floored by the fans' love for this game.  For more than a decade now and still going...there always seems to be a new project that someone has taken up with passion. 

We're happy you have made your way to these boards, and I'm sure these valiant coders are grateful for your recognition.

Keep enjoying Sacred

:)

 

gogo

Link to comment
8 hours ago, azukaar said:

 - If I create a game myself, and my friend tries to connect (and vice versa) we get a 61 error code, "login failed" (not a port issue, same thing with DMZ activated)

 - If I try to join any online server, the game just crash

Hi azukaar,

I have just looked into it and can confirm there was a server-side issue with joining. I didn't notice it as it caused no entry in the log files. Sorry for the inconvenience, if you don't mind, please try again to join a gamserver and report back if it works now as expected.

For the self hosted server, maybe that was related to the same issue as well, if you are sure about the port redirection beeing fine. Usually, this error arises if the server cannot be reached from the client which tries to connect to it.

Edited by xrystal
  • Appreciation 1
Link to comment

Hey thanks a lot Flix and Globo !

Cheers Xrystal, I have been able to connect to the available servers, it works! Amazing

I still have the 61 when connecting to my own game, I have forwarded the port 7011 which is the one that is usd by default, may be I need to more port than that?

I would assume DMZ would have worked then

Thanks this is great, let me know if I can help with anything around the code BTW

Cheers

 

Link to comment
  • 3 weeks later...

Hey, just a little update on a short notice as I just got the email notificiation I have been waiting for a very long time:

sacred2-domain-transfer.png.0a51206f38dab7ec0f70c7264f6ae9d0.png

Of course after all this time it had to happen of all things on a monday morning! :B6nFRAh:
But this evening when I am back from work I should be able to finally get it ready and update quite a bit of outdated information. After that domain is configured then, no one will need to change a URL in his config files anymore, it will just work because that domain I finally got registered is the original offical lobby address, which will very soon point to the emulated one. It is all coming back together, horray! :D

 

  • Respect! 1
Link to comment
10 minutes ago, xrystal said:

Whoever has a mod installed, which is the only minor nuisance remaining, might still need that additional file for the OpenNet button. But that is the only client side hassle remaining at all now and I guess if the modders see this working reliable enough they might be willing to enable the multiplayer buttons in their next releases by default again if asked kindly.

Yes I can do that.  It should never have been removed IMO.

  • Thanks! 1
Link to comment
  • 2 weeks later...

Fyi, if you encounter a bug or have feature requests of any kind, you can of course post them here, but also in case you are used to github, you could as well put those directly in it's related issue section. I track every known bug or possible improvements in the usual feature branch workflow manner there. Not only, to keep it transparent and easy to get into it or to get a quick overview of "construction sites" in case somebody is interested in joing the codeing, but even more as a reliable reminder to myself about what I actually wanted to do every now and then*... :P

As you can see there are a few things I still want to change and most of them are related to server side infrastructure, I.e. easier deploy and better monitoring of server health and status. Quality-of-life stuff for hosting in general.

For the client side, the currently rather static server list (docker .env file) is sometimes not optimal. Because for example, due to most players playing with new characters, at some peek times at weekends the bronze or silver campagin servers were either full or not usable for everyone because the single server beeing active for a selected difficulty was not of their alignment (for example having a shadow char but everyone else plays light and thus "blocks" the campaign server for shadow players).

Accordingly, the thing I am working on right now is a small daemon which will start additional instances of server configurations on demand saving me from having to keep more servers open than actually needed by default, but still being able to have more room whenever needed. Since this is technically optional and I dont want to pollute the lobby code more than neccassary with my additional requirements, that daemon will run in a separate process. As a nice side effect, because I need a communication layer between those two and feel like a separete database will fullfill that purpose better than a direct api, it will most likely be possible to use that additional database to provide an external list of servers on some web page as well with the same list of servers as ingame but viewable in your browser.

*btw. now working on it again, I finally did the small change from the text config file to a xml file - just to notice that the .config files for .NET applications really lack flexibillity and even if they are an improvement I still don't really like them, but well, better than before at least... :D 
 

Edited by xrystal
  • Like! 1
Link to comment
  • 3 weeks later...
  • 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