H&D2 Server Manager Source Code

1 year 5 months ago - 1 year 5 months ago #7 by snowman
Replied by snowman on topic H&D2 Server Manager Source Code
 

Here's a screenshot showing that maps in the Selected Maps column can be added back to Available maps. Server starts fine even as it is. There are no errors, warning or problems in the server log. Right now our map count in mpmaplist is 275(46 VTM missions), but with shorter map/missions, that number can grow, until it gets close to 11.8 K lines... then we have this problem.

"Straight and narrow is the path."
Attachments:

Please Log in or Create an account to join the conversation.

1 year 5 months ago - 1 year 5 months ago #8 by Stern
Replied by Stern on topic H&D2 Server Manager Source Code
2 bugs i remember:
1. Client connection is lost after some time.
2. Some secondary window (on top of main window) shows error if closed or was it error when re-opened.
So this maplist reading bug is 3.

Good news and bad news:
*The code of ServerManager is PASCAL, it means i can understand it 100%, same i used for my programs.
*When i load it to Delphi i get list of errors and warnings 10 meters long...its coded in older version, Delphi 7 ??? dont know.
Does he remember what version of Delphi was used ?

If this maplist bug is connection bug then maybe Johnny RSC Sniper should know better, he will also understand the code,
RSC is also coded in Pascal and RSC also uses Server <-> Client connection.

Also what i noticed:
This program requires mpmaplist data to be in correct standard form, if not, then it cannot read it.

if "<gamestyle" is written as: "< gamestyle"
with space after "<" then the list will be empty.
Because it searches "<gamestyle" 
this part of code: 
if Pos ('<gamestyle',Ln)<>0 then

         if Pos ('<gamestyle',Ln)<>0 then
         begin
            if Pos ('type="',Ln)<>0 then
            begin
               Delete (Ln,1,Pos ('type="',Ln)+5);
               Delete (Ln,Pos ('"',Ln),length (Ln));
               SetLength (Maps,length (Maps)+1);
               Maps [length (Maps)-1]:='<'+Ln+'>';
            end;
         end;

         if Pos ('<map',Ln)<>0 then
            if Pos ('name="',Ln)<>0 then
            begin
               Delete (Line,1,Pos ('name="',Ln)+5);
               Delete (Line,Pos ('"',Line),length (Line));
               SetLength (Maps,length (Maps)+1);
               Maps [length (Maps)-1]:=Line;



Fix for that is to use StringReplace and replace all spaces and tabs to create temporary standard line to work with.

The one who hesitates is lost !
The following user(s) said Thank You: snowman

Please Log in or Create an account to join the conversation.

1 year 5 months ago - 1 year 5 months ago #9 by snowman
Replied by snowman on topic H&D2 Server Manager Source Code
Thank you, Stern

Yes, you are right about the "bugs":
1. It would be better if connection times out after a longer period or never, if possible. I don't know how this affects the SM when more users connect to it, working on different server configs.
2. Yes, when you close the window by "X" and try to edit another config you get the error "Cannot focus on invisible window". The fix is using the "Close" button.
3. Also waiting for advice... from our generous friend, DnA

Fis mentioned he released the last version in 2011, and he was trying to install Delphi 5 to make everything work again.

Already contacted JonnySniper, hoping he will have a look too

Checked the <gamestyle ... at least this looks fine. When I get the chance, I will tidy up the maplist again. It's mostly some recent missions that could use more attention at the structure and removing unnecessary comments.

Suggestions
The best additional feature I can think of, suggested by our Sergeant Major, would be to have a "Duplicate" button both for servers and configs. It's speeds up the process. If it would also be possible to create a standard template for each of the 4 styles, that would be even better. Cheers

"Straight and narrow is the path."

Please Log in or Create an account to join the conversation.

1 year 5 months ago #10 by Stern
Replied by Stern on topic H&D2 Server Manager Source Code
No item and objectives comments in mpmapllist ?
item comments are useful to make changes.

Server only reads what is inside < >
anything else is ignored. 

Here is a program that adds both type of comments:

HD2mcV2 (2018)


***
I try to find some older Delphi version to import project files.

The one who hesitates is lost !
The following user(s) said Thank You: snowman

Please Log in or Create an account to join the conversation.

1 year 5 months ago #11 by MeToX
Replied by MeToX on topic H&D2 Server Manager Source Code
After I had a nice talk with snow about this program I can now share my thoughts here.

Because I have no experience at all with PASCAL (my home is C/C++) I can not contribute improving the code or fix the bug with the 11.8k lines it currently reads, so I hope Stern or JohnySniper will find a solution to this.

However, because this was asked in the initial post I wanted to mention that this won't get us much closer to run a server on linux. Essentially it is similar to the ServerLauncher.exe but with more functionalities.
Since it still depends in the HD2DS_SabreSquadron.exe and all its .dll files it won't be enough to just compile this server manager for a linux environment, unless you can somehow make it work with wine.

In order to make it possible to launch a server (without using additional software) on a operating system based on linux, the whole HD2DS_SabreSquadron.exe and its .dll's need to be reverse engineered, so that the code can be re-constructed and compiled. This takes a lot of time, not just to construct the code, also because you have to find (or create) replacements for all the windows functions its currently using, like WinSock. Then, even if you got that far, you still have to make sure that the (linux) server can communicate with the (windows) clients correctly, which is not easy since they are based on 2 different systems.
The following user(s) said Thank You: snowman

Please Log in or Create an account to join the conversation.

1 year 5 months ago - 1 year 5 months ago #12 by Stern
Replied by Stern on topic H&D2 Server Manager Source Code
Running HD2 server on Linux is no problem, there's a servers named Blair Coop, that runs on Linux and these servers are stable and have less bugs (for Clients) than RPR servers.
As i understand (i cannot confirm that) the main problem is using altered Title for HD2DS_SabreSquadron.exe
Original title is "Hidden & Dangerous II Console"
ServerManager changes that to work with multiple servers, it must have something to recognize each server to pinpoint correct one if user makes changes.
That Title altering crashes Console in Linux.
Idea is to make ServerManager  work with pre-named Console files.
I tested it already (in Windows), but as i remember Blair coop Admin uses this kind of modification to run multiple servers.
This way each console can have different mpmaplist.txt files to make server management easy.
 

The one who hesitates is lost !
The following user(s) said Thank You: snowman

Please Log in or Create an account to join the conversation.

  • reamy birthday is in 3 days (71)
  • czSemtex birthday is in 5 days (27)
  • Gendolf birthday is in 5 days (38)
  • Jetswinger birthday is in 6 days (35)
  • kerrand birthday is in 9 days (26)
Powered by Kunena Forum