•     Please make sure you check the Support FAQ and relevant Guides before you create a new thread in this section!

Hosting Server Start three servers on one host machine

Puppytine

Slayed dreamer
Posts
2,237
Likes
1,487
jampDed.exe didn't work for me, but using openjkded.x86.exe I successfully created three servers on same PC. Didn't test them a lot, though.
Download openjkded.x86.exe here:
index · powered by h5ai 0.26.1 (http://larsjung.de/h5ai/)
More info:
openjk - Поиск в Google

You'll need three config files, pass them as command line parameter:
"G:\Program Files\JediAcademy\GameData\openjkded.x86.exe" +set dedicated 2 +set fs_game mbii +exec jampserver1.cfg +set net_port 666
"G:\Program Files\JediAcademy\GameData\openjkded.x86.exe" +set dedicated 2 +set fs_game mbii +exec jampserver2.cfg +set net_port 777
"G:\Program Files\JediAcademy\GameData\openjkded.x86.exe" +set dedicated 2 +set fs_game mbii +exec jampserver3.cfg +set net_port 31337

I don't have enough experience hosting servers, I cannot guarantee this will work.

d9e9e89e0921.png
 
Last edited:

Puppytine

Slayed dreamer
Posts
2,237
Likes
1,487
Work. This errors nothing bad?
If you about autoexec.cfg and banip.dat, that's ok.
VM_Create is different story; jampDed.exe simply stopped after VM_Create, openjkded.x86.exe used VM_CreateLegacy and worked fine, but I really don't know how bad it is.

You'd better just test it on yourself until somebody who actually has knowledges about hosting, like @Cat Lady and @ent post here, explaining the situation.
 

kikili

Movie Battles II Team
Posts
151
Likes
46
U can also simply duplicate the MBII folder, named it differently (like MBII_#1, MBII_#2, MBII_#3) and launch the 3 servers by :
"G:\Program Files\JediAcademy\GameData\openjkded.x86.exe" +set dedicated 2 +set fs_game MBII_#1
"G:\Program Files\JediAcademy\GameData\openjkded.x86.exe" +set dedicated 2 +set fs_game MBII_#2
"G:\Program Files\JediAcademy\GameData\openjkded.x86.exe" +set dedicated 2 +set fs_game MBII_#3
and then do the particular setup for each server in the normal jampserver.cfg in each folder.
Also all the files written will be particular to each folder, so I think you can give a try to this solution.
 

ent

Movie Battles II Team
Posts
848
Likes
390
You'll need three config files, pass them as command line parameter:
"G:\Program Files\JediAcademy\GameData\openjkded.x86.exe" +set dedicated 2 +set fs_game mbii +exec jampserver1.cfg +set net_port 666
"G:\Program Files\JediAcademy\GameData\openjkded.x86.exe" +set dedicated 2 +set fs_game mbii +exec jampserver2.cfg +set net_port 777
"G:\Program Files\JediAcademy\GameData\openjkded.x86.exe" +set dedicated 2 +set fs_game mbii +exec jampserver3.cfg +set net_port 31337
I wonder why it did not throw VM Create error. It supposed to extract jampgamex86.dll from pk3 each exe launch and overwrite already existed ones.
But if one is already running then it cannot overwrite and fails.
I can only guess ojk tries to load the already extracted one if the extraction fails.
:S
 

Puppytine

Slayed dreamer
Posts
2,237
Likes
1,487
U can also simply duplicate the MBII folder, named it differently (like MBII_#1, MBII_#2, MBII_#3) and launch the 3 servers by :
"G:\Program Files\JediAcademy\GameData\openjkded.x86.exe" +set dedicated 2 +set fs_game MBII_#1
"G:\Program Files\JediAcademy\GameData\openjkded.x86.exe" +set dedicated 2 +set fs_game MBII_#2
"G:\Program Files\JediAcademy\GameData\openjkded.x86.exe" +set dedicated 2 +set fs_game MBII_#3
and then do the particular setup for each server in the normal jampserver.cfg in each folder.
Also all the files written will be particular to each folder, so I think you can give a try to this solution.

You can try as well with jampDed.exe, perhaps it will works in this case as well
Now I've copied MBII folder, then launch two jampDed.exe with different fs_game and it worked fine.
I mentioned possible necessary of having duplicate installation of MBII to TS in PM, but when he created this topic I've switched to searching more elegant solution.

The dark side of using openjkded.x86.exe with same MBII folder is that I don't know would it be some not obvious, hard-to-discover problems.
So if @Silvio would ever have some weird issues with the servers, I would suggest him to fall back to three MBII folders or to jampDed.exe with three MBII folders.
I wonder why it did not throw VM Create error. It supposed to extract jampgamex86.dll from pk3 each exe launch and overwrite already existed ones.
But if one is already running then it cannot overwrite and fails.
I can only guess ojk tries to load the already extracted one if the extraction fails.
:S
Ha, now I've found it applies not only to servers, but to clients as well.
I can run only one instance of jamp, second one dies with "VM_Create on UI failed", same about jaMME.
But it possible to run two instances of mbii.x86.exe, both in full-screen and windowed mode. I can even watch how game goes on two servers simultaneously!
And I guess you can launch as many instances as your hardware can take, and spectate/play on as many servers as your network allows. :)

1f62b35dd4ef.jpg


688b0f9e70a0.png


5fedf6c14048.png
 
Last edited:

ent

Movie Battles II Team
Posts
848
Likes
390
Ha, now I've found it applies not only to servers, but to clients as well.
Weird, because client fatal errors are the most known ones. Google the UI ones.
If you use jaMME on mme folders then you can has cheeseburger multiple instances (it doesn't extract anything).
 
Posts
20
Likes
1
@Puppytine, problems with the servers I do not see. They are stable even at max. players online.
I use command in .bat file:
mb2server.bat
openjkded.x86.exe +set dedicated 2 +set net_port 60001 +set fs_game MBII +exec server.cfg
mb2server2.bat
openjkded.x86.exe +set dedicated 2 +set net_port 60002 +set fs_game MBII +exec server2.cfg
mb2server3.bat
openjkded.x86.exe +set dedicated 2 +set net_port 60003 +set fs_game MBII +exec server3.cfg

and other your files on GameData and no problems.
 
Last edited:

Puppytine

Slayed dreamer
Posts
2,237
Likes
1,487
@Puppytine, problems with the servers I do not see. They are stable even at max. players online.
I use command in .bat file:
mb2server.bat
openjkded.x86.exe +set dedicated 2 +set net_port 60001 +set fs_game MBII +exec server.cfg
mb2server2.bat
openjkded.x86.exe +set dedicated 2 +set net_port 60002 +set fs_game MBII +exec server2.cfg
mb2server3.bat
openjkded.x86.exe +set dedicated 2 +set net_port 60003 +set fs_game MBII +exec server3.cfg

and other your files on GameData and no problems.
Great. If your players doesn't report any errors, just keep it as it is.
BTW the more "clean" way is still to have a full mb2 folder dedicated to each server instance.
Not sure about "clean", but it's definitely not so elegant/pretty. It shouldn't be necessary to duplicate installation just to run a second instance of application.
Weird, because client fatal errors are the most known ones. Google the UI ones.
Ha! I've done some research, now I know why it happens.

jamp.exe and mbii.x86.exe both unpack dll and both whining when destination file is locked. The reason why it's possible to run a second instance of mbii is that it uses different folder to extract file but loads from JediAcademy\GameData\MBII!
So that's how it goes:
  1. mbii starts, unzip to uix86.dll to My Documents\My Games\OpenJK\MBII.
  2. My Documents\My Games\OpenJK\MBII\uix86.dll isn't locked now.
  3. mbii calls LoadLibrary, which pick uix86.dll from JediAcademy\GameData\MBII, which was placed there by jamp.exe.
  4. JediAcademy\GameData\MBII\uix86.dll is locked (for writing) now.
  5. Second copy mbii starts and successfully unpacks dll to My Documents\My Games\OpenJK\MBII\uix86.dll
  6. My Documents\My Games\OpenJK\MBII\uix86.dll still isn't locked now.
  7. ... I think it's obvious now.
Therefore it needs to have uix86.dll in JediAcademy\GameData\MBII to have multiple instances running. If mbii.x86.exe will not find some other copy of uix.86.dll to load, it will load and lock the one from "My Documents", and next copy of game will just fail to start due a sharing violation.

So here is universal way to run multiple instances of jamp, jampDed, jaMME etc: just copy all three files (cgamex86.dll, jampgamex86.dll, uix86.dll) to somewhere on search way, to "JediAcademy\GameData", for example.
Dlls in JediAcademy\GameData\MBII and My Documents\My Games\OpenJK\MBII will be overwritten over and over again, but they never be locked.
I've already tested it, and it works just fine!

But there's more of it. I looked at old source code, and that's what I've seen:
Code:
//make sure the dll can be opened by the file system, then write the
759 //file back out again so it can be loaded is a library. If the read
760 //fails then the dll is probably not in the pk3 and we are running
761 //a pure server -rww
762 bool Sys_UnpackDLL(const char *name)
763 {
764 void *data;
765 fileHandle_t f;
766 int len = FS_ReadFile(name, &data);
767 int ck;
768
769 if (len < 1)
770 { //failed to read the file (out of the pk3 if pure)
771 return false;
772 }
773
774 if (FS_FileIsInPAK(name, &ck) == -1)
775 { //alright, it isn't in a pk3 anyway, so we don't need to write it.
776 //this is allowable when running non-pure.
777 FS_FreeFile(data);
778 return true;
779 }
780
781 f = FS_FOpenFileWrite( name );
782 if ( !f )
783 { //can't open for writing? Might be in use.
784 //This is possibly a malicious user attempt to circumvent dll
785 //replacement so we won't allow it.
786 FS_FreeFile(data);
787 return false;
788 }
789
790 if (FS_Write( data, len, f ) < len)
791 { //Failed to write the full length. Full disk maybe?
792 FS_FreeFile(data);
793 return false;
794 }
795
796 FS_FCloseFile( f );
797 FS_FreeFile(data);
798
799 return true;
800 }
Jedi-Academy/win_main.cpp at d71d53e8ecc1edd300c7a9dd22b8fbc39c095423 · grayj/Jedi-Academy · GitHub
According to this, jamp/jampDed won't bother unpacking in case files are found on drive and files aren't in pk3.
So I deleted 3 dlls both from JediAcademy\GameData\MBII\MBII.pk3 and from JediAcademy\GameData\base\assets2.pk3, and after that I didn't get any errors launching second instance of jamp, jampDed and jaMME!
This is the second way to have multiple instances.

Then I explored new sources, there's some differences:
Code:
void *Sys_LoadLegacyGameDll( const char *name, VMMainProc **vmMain, SystemCallProc *systemcalls )
451 {
452 void *libHandle = NULL;
453 char filename[MAX_OSPATH];
454
455 Com_sprintf (filename, sizeof(filename), "%s" ARCH_STRING DLL_EXT, name);
456
457 #if defined(_DEBUG)
458 libHandle = Sys_LoadLibrary( name );
459 if ( !libHandle )
460 #endif
461 {
462 UnpackDLLResult unpackResult = Sys_UnpackDLL(filename);
463 if ( !unpackResult.succeeded )
464 {
465 if ( Sys_DLLNeedsUnpacking() )
466 {
467 FreeUnpackDLLResult(&unpackResult);
468 Com_DPrintf( "Sys_LoadLegacyGameDll: Failed to unpack %s from PK3.\n", filename );
469 return NULL;
470 }
471 }
472 else
473 {
474 libHandle = Sys_LoadLibrary(unpackResult.tempDLLPath);
475 }
476
OpenJK/sys_main.cpp at aa57c85e59f6067ec234f176255a4b73d03b0e64 · JACoders/OpenJK · GitHub
Code:
UnpackDLLResult Sys_UnpackDLL(const char *name)
505 {
506 UnpackDLLResult result = {};
507 void *data;
508 int len = FS_ReadFile(name, &data);
509
510 if (len >= 1)
511 {
512 if (FS_FileIsInPAK(name, NULL) == 1)
513 {
514 char *tempFileName;
515 if ( FS_WriteToTemporaryFile(data, len, &tempFileName) )
516 {
517 result.tempDLLPath = tempFileName;
518 result.succeeded = true;
519 }
520 }
521 }
522
523 FS_FreeFile(data);
524
525 return result;
526
}
527
528 bool Sys_DLLNeedsUnpacking()
529 {
530 #if defined(_JK2EXE)
531 return false;
532 #else
533 return Cvar_VariableIntegerValue("sv_pure") != 0;
534 #endif
535 }
OpenJK/sys_win32.cpp at db94c70b13df7ca22072f846ea324ff451b0ceb4 · JACoders/OpenJK · GitHub

As you can see, modern openjk unpacks stuff to temporary folder, so there is no way to have problems with locked files. When I started openjkDed.x86.exe, I found it loaded one module from temp directory.
Also source code says "if can't unpack and sv_pure is 0 proceed anyway, if can't unpack and sv_pure != 0 die".
I restricted access to temp files' folder, write in server's config:
Code:
seta sv_pure "0"
And openjkDed.x86.exe ran normally, but when I modify config to:
Code:
seta sv_pure "1"
openjkDed refused to start.

a4e4734528d0.jpg


3fef429cade4.jpg


ee3a3aa37d2d.png


30afdc6004df.png


248bf9dc5932.png


571414585a61.png
 
Last edited:

Cat Lady

Movie Battles II Team Retired
Posts
412
Likes
237
I would also like to add that it is worthwhile to set up different files for logs in each config file - to not have mess in log and possible i/o conflicts, when all 3 servers try to write same log file, at once. Cloning MBII folder for hosting multiple servers on same machine is completely unnecessary, unless you're hosting different mods - with or without RTV, every thing like list of maps, mode, etc, can be set up in config files.

Side note 2, kind to "self" (as in, to dev team) - I was *never* fan of the whole "extract libraries from .pk3 at startup" concept. It is asking for troubles, literally. Libraries should sit where they're expected, not being replaced at runtime unless absolutely necessary for some wicked reasons.

/Cat Lady

Ps.
In any case, for hosting multi-servers (of *any* kind), I strongly suggest using operating system that is better suited for such application (like isolating CPU cores and running instances on those isolated CPU's without third party tools, etc). Hint: any Linux.

Ps 2.

Puppytime is right (as usual ;) ) that using openjkded for hosting server is better idea - if anything, due to plenthora of bugs fixed in OpenJK's implementation (9 pages long only related to openjkded, last time i checked)
 

kikili

Movie Battles II Team
Posts
151
Likes
46
I'm still thinking that having 3 folders is best, because there is not only log files, and dll extracts but also several other config and storing files that could be involved.
Storage is not really an issue nowadays and so much pain avoided with 3 folders ...
 

Puppytine

Slayed dreamer
Posts
2,237
Likes
1,487
I would also like to add that it is worthwhile to set up different files for logs in each config file - to not have mess in log and possible i/o conflicts, when all 3 servers try to write same log file, at once.
Yep, I should mention about that before.
@Silvio, you should open your server2.cfg and change
Code:
seta g_log "server.log"
to
Code:
seta g_log "server2.log"
if you didn't that already. And similar thing for server3.cfg.
This is especially important in case of using RTV, the script that allows players to change map by casting votes.
[SOLVED] - Looking for the RTV/RTM Script | Movie Battles II Community
Hint: any Linux.
Well I believe TS represents not a private person, but a company which has an experience hosting game servers, including Skyrim and Gothic-Online. So looks like they know what they are doing and they had some reason to choose Windows...
46.39.224.200 - Поиск в Google
Puppytime
Waaaaaaaaaaaaaaat?
that using openjkded for hosting server is better idea - if anything, due to plenthora of bugs fixed in OpenJK's implementation (9 pages long only related to openjkded, last time i checked)
Hm I didn't actually say that openjkded is better rather than jampDed, I started pushing openjk in the context of avoiding cloning of MBII folder. In previous message I've pointed to that it's even possible to run multiple instances of jampDed with a only one mod directory.

The real difference between old binaries and openjk project is: jamp contains old bugs, openjk contains new bugs.
For example, to run openjk binaries on Windows XP you need to patch it, and client openjk stretches HUD in widescreen mode, while old jamp displays it correctly.

But the real answer for question for "what is better for hosting" is based neither on a list of bugs nor on a list of bugfixes. It's all about actual experience (which I don't have), not theoretical discussions (which I'm master of :D ).
Since I guess you have experience hosting MBII servers (I got this impression reading your old posts, please correct me if I'm wrong), and you're advising to use openjkded, I must point that your advice *is* the one true answer for declared question.
Indeed, same rule applies in case of "single MBII folder vs multiple".
I'm still thinking that having 3 folders is best, because there is not only log files, and dll extracts but also several other config and storing files that could be involved.
Storage is not really an issue nowadays and so much pain avoided with 3 folders ...
Maybe. But I wish to know what exactly files could make conflicts. For now, I suspect only qconsole.log to be such file.
At other hand, I'm excited about having only one folder mostly because it's more pretty and entertaining than just making copies of directory.
 
Last edited:

Cat Lady

Movie Battles II Team Retired
Posts
412
Likes
237
I'm still thinking that having 3 folders is best, because there is not only log files, and dll extracts but also several other config and storing files that could be involved.
Storage is not really an issue nowadays and so much pain avoided with 3 folders ...

It creates it own set of problem - for example, while updating, you must either do it three times (!), or carefully copy content, without overwriting (same-named) config files from one folder with another one. And, despite storage being not a problem for a small scale, wasted is still wasted, and I wouldn't call it elegant solution.

Waaaaaaaaaaaaaaat?

Sorry :D Got your name correctly now, will try to remember.


The real difference between old binaries and openjk project is: jamp contains old bugs, openjk contains new bugs. (...) client openjk stretches HUD in widescreen mode, while old jamp displays it correctly.

Well, OpenJk lately added code for maintaining aspect ratio with widescreen (still not sure how it mixes with MBII's way of handling it, though). But, to be honest, I was writing about openjkded only - while I think that client is better than vanilla too, it is completely irrelevant for server hosting case.

For example, to run openjk binaries on Windows XP you need to patch it,

I'm indeed experienced with hosting servers (not only related to MB2/JKA), but I'm using GNU/Linux based OS'es exclusively for maaaaany years (swapped to it straight from windows XP, long time ago, BTW), so I was blissfully unaware of this issue. Will take note.

From a layman point of view - though - the OpenJK way of using temporary directories is much more cleaner, even not taking bugfixes into consideration (the latter *are* important, if you're not happy with people using exploits to crash servers... Yes, some of them still work with OpenJK/MBII combo, but less than with JAMP one, and some of the crashes that are still working could be blamed on MBII keeping engine compatibility with JAMP, while putting as much content as possible - see "exceed max character string" issue.)

/Cat Lady

Ps.
Well I believe TS represents not a private person, but a company which has an experience hosting game servers, including Skyrim and Gothic-Online. So looks like they know what they are doing and they had some reason to choose Windows...

Not judging anyone, as I don't have necessary data here - but, from my personal experience with hosting companies, hosting on windows is usually caused by a) lack of knowledge b) will to invest into gaining employees (or self) to gain said knowledge c) (related to all above) using windows for servers since day 1 and not being interested into using more efficient/secure approach.

Interestingly, most of those "stubborn" companies I have been working with, were "bitten in the ass" by such approach, sooner or later (albeit i must admit that there are some with really great expertise on fighting your own operating system, so they were able to prevent catastrophes so far). and yes, I am biased - but this bias comes from actual experience with both competing OS'es and server handling philosophies ;)
 

kikili

Movie Battles II Team
Posts
151
Likes
46
It creates it own set of problem - for example, while updating, you must either do it three times (!), or carefully copy content, without overwriting (same-named) config files from one folder with another one. And, despite storage being not a problem for a small scale, wasted is still wasted, and I wouldn't call it elegant solution.
That's the only issue I see. So not really a "set". Easily solved by any sync. software.
 

Cat Lady

Movie Battles II Team Retired
Posts
412
Likes
237
Well, you do realize that due to different timestamps et all, all assets are loaded THREE TIMES, too? Also, there is really no freakin' reason to do that, cause servers started from one directory work flawlessly (at least in openjk case). I don't really see why we're continuing this discussion (not that I have anything against it either, in such great company).
 
Top