Jump to content
coconut

[Release] Sturmovik Server Control

Recommended Posts

I'm announcing a new tool I have just developed to control and monitor DServer through the web.

 

Binaries can be downloaded there: https://bitbucket.org/johdex/sturmovikservercontrol/downloads

 

Source code: https://bitbucket.org/johdex/sturmovikservercontrol/src

 

The interface is pretty simple, as shown on the screenshots below:
 

post-31381-0-05490600-1456593519_thumb.png

 

This is the admin login page. Enter your secret password (not your ingame password, this one is a different one) and you get access to a number of functions described in the next shots. This step is optional, the site is also usable for regular non-privileged users.

 

post-31381-0-45794100-1456593519_thumb.png

 

The shot above shows the status page, which displays the status of the server, including its current load. It's not very useful, since DServer typically starts acting up long before the SPS falls below 50, but in the future I'm hoping I can show the tick delay, which is a better figure to show. The enigmatic "Reduce load" button simply triggers a server input MCU in the mission (configurable). It's then up to the mission logic to deactivate non-essential entities. Everybody gets to click that button, but it won't do anything unless you are logged in. Below is the list of players, empty in this case. The page auto-updates every 60 seconds.

 

post-31381-0-74517500-1456593519_thumb.png

 

Here comes the interesting part. This page is visible to all, but only editable if you are logged in. It allows one to schedule a number of events. It's all pretty self-explanatory, I believe. It may take up to a minute for the server to execute an event whose time has come.

 

The list is saved to disk, meaning if you need to restart the controller (for instance after an upgrade; it should not crash - if it does, you get all your money back ;)), the list will still be there. Note that events that should have executed but were missed will be simply dropped.

 

One last detail before I forget: event times in the GUI are UTC, keep that in mind. The format is year-month-day hour:minute, where year, month and day are optional. If left out, today's values will be used. The button on the right retrieves the current time of the server (UTC), so the easiest is probably to just click that button and edit the field.

Edited by coconut
  • Upvote 14

Share this post


Link to post
Share on other sites

I've put online a new version 1.0.2.0. Previous versions created temporary files every minute, but did not delete them. Sorry about that, make sure you update to the new version, or your disk will slowly fill up (but it's easily cleaned up by running Windows' disk cleanup tools).

  • Upvote 1

Share this post


Link to post
Share on other sites

Version 1.1.0.0 is out.

  • Added support for running multiple instances of DServer (must be from different directories).
  • Upvote 1

Share this post


Link to post
Share on other sites

Ok got it up and running!

 

Will keep you posted on my usage...  This looks like a great tool.  

 

This may be wishful thinking on my part, but is there a way to parse the mission that is running and have it return the names of all the server inputs in the mission?  Then maybe have them displayed as an array of buttons that can be clicked?  Would need to have deactivate loops back to the server input MCU in mission, so it is not triggered more than once (unless on a timer)  Just a thought.  Stuff like this gets me all excited but I unfortunately have not the skills to write programs...  I know you were working with these server inputs so I thought I'd see what you thought.

 

post-71670-0-52532100-1462139555_thumb.jpg

Edited by MF-Belgarufo

Share this post


Link to post
Share on other sites

just scheduled a chat string and had it execute flawlessly.

 

So far so good!

 

Would be nice to get a return on chats, instead of having to split the log and open it everytime I want to see if my message got through, and if there is any response. Maybe something that splits the log once a minute and displays the chat as a continuous string. I like very much to be able to chat to players in game without having to be ingame, especially when I have the ME open. 

 

 

 


ooo ooo I know! how about a timer for scheduling chat string at regular intervals?  This is easily done in the ME, but not as easy to add to and modify translators across ALL my missions after the missions have been written, where as a timed chat string would work perfectly. Heck you've got nearly everything in place to do it.  

Edited by MF-Belgarufo

Share this post


Link to post
Share on other sites

Repeating schedule tasks have been on my mind for a while, I'll add them at some point. Same thing about the button array for the inputs. I need to plug in talek's log parser first, to know what is the mission currently running.

Share this post


Link to post
Share on other sites

I am trying to get this up and running however ive run into an issue where it seems to ignore the config file, is there anything I need to do for it read the config.json?

Share this post


Link to post
Share on other sites

Probably a syntax error in the file somewhere. Normally an error message should be printed out, but maybe it's lost. I would recommend opening a cmd window and launching the program from there, rather than double-clicking on the exe.

 

In any case I see it's not a good idea to just run on the default config when the config file cannot be read. That's just weird. I'll change it so that it makes clear what the problem is. I'll make a new build and publish that. Since the last release I've changed the syntax to yaml, which should be a bit more user-friendly. Json is known to trick humans by making it easy to forget commas.

Share this post


Link to post
Share on other sites

Any chance this can be used to run the next mission based on a win or loose result. I am dreaming of a moving war server

Share this post


Link to post
Share on other sites

I have just published version 1.4. I should be better able to give support for this version rather than the older one from one+ year ago.

 

https://bitbucket.org/johdex/sturmovikservercontrol/downloads/SturmovikServerControl-1.4.0.0.zip

 

Any chance this can be used to run the next mission based on a win or loose result. I am dreaming of a moving war server

 

Yes, I actually use this to control my dynamic campaign, however the campaign system itself is not available to the public. The campaign system is implemented as a plugin, and you could build your own plugin instead. But I guess that the reason you are asking this question is because you do not want to do that yourself.

 

To give you an idea, this is roughly what I do:

  • 5 minutes before the mission end, the plugin extracts mission results from the mission log
  • It builds a new mission based on those results
  • It calls resaver.exe to generate an msnbin file
  • The msnbin file is overwritten over the old one
  • The plugin sends a server input to DServer.exe, which in the mission is linked to an EndMission MCU

If you have a fixed set of missions, you can skip the resaver.exe step, and the next mission "generation" is trivial, simply pick the mission files from your collection.

 

For the technically minded people, these are the interface types:

namespace CampaignServerControl.Api

open System

/// An async computation that is scheduled at a specific time and
/// returns a list of following scheduled async computations.
type ScheduledTask =
    | SomeTask of DateTime * Async<ScheduledTask> * string
    | NoTask
with
    static member SomeTaskNow description t =
        SomeTask(
            DateTime.UtcNow,
            async {
                let! res = t
                return res
            },
            description
        )

/// Append messages to the server controller log.
/// Implemented by the server controller.
type LoggingApi =
    abstract LogError : string -> unit
    abstract LogInfo : string -> unit

/// Identify a player uniquely.
/// Implemented by the server controller.
type PlayerId =
    abstract GetName : unit -> string

/// Identify a team (axis, allies) uniquely.
/// Implemented by the server controller.
type TeamId =
    abstract GetName : unit -> string

/// Interaction with the game server.
/// Implemented by the server controller.
type ServerControlApi =
    abstract SkipMission : Async<unit>
    abstract GetPlayerList : Async<PlayerId list>
    abstract GetAxisTeam : unit -> TeamId
    abstract GetAlliesTeam : unit -> TeamId
    abstract MessagePlayer : PlayerId * string list -> Async<unit>
    abstract MessageTeam : TeamId * string list -> Async<unit>
    abstract MessageAll : string list -> Async<unit>

type SupportApis =
    { Logging : LoggingApi
      ServerControl : ServerControlApi
    }

/// Interface between SturmovikServerControl and the campaign system.
/// Implemented by the campaign system.
type CampaignServerApi =
    /// Called by the server controller to provide the logging and server control APIs
    abstract Init : SupportApis -> unit
    /// Start or resume the campaign system, and return the next scheduled updates
    abstract StartOrResume : config:string -> Choice<ScheduledTask, string>
    /// Reset campaign state and then start the camapign
    abstract Reset : config:string -> Choice<ScheduledTask, string>

Most interfaces are implemented by Sturmovik Server Control, only the last one CampaignServerApi is implemented by the plugin.

Edited by coconut

Share this post


Link to post
Share on other sites

Minor update: https://bitbucket.org/johdex/sturmovikservercontrol/downloads/SturmovikServerControl-1.4.2.0.zip

 

The gremlins I mentioned in an earlier post were solely on my PCs, not in the software. Do not allow binding to http://+:1234/ (or some other port number), that seems to confuse the web server.

To remove it, execute as admin in a cmd window:

 

netsh http remove urlacl url=http://+:1234/

Edited by coconut

Share this post


Link to post
Share on other sites

I am trying to start the new version and when I set the config to the following it just says "E main: ControllerUrls cannot be empty":

 

Server:
  AdminPassword: PasswordHere
  ControllerUrl: http://localhost:8083/
  Instances:
    - Name: Primary
      Description: No description yet.
      ServerHostname: localhost
      ServerPort: 8991
      Login: LoginHere
      Password: PasswordHere
      OffLoadServerInput: ReqKill
      GameDirectory: C:\IL2
      LogDirectory: 
      CompactedLogDirectory: 
      ProcessedLogDirectory: 

Share this post


Link to post
Share on other sites

Ok that worked thanks, I am getting the message "Failed to load symbols: C:\pathtolocation\ploggy.pdb" is that something I should be concerned about?

 

Also which Url should I be setting it to so I can access it externally? The internal IP, the external ip/url, localhost?

Share this post


Link to post
Share on other sites

Ok that worked thanks, I am getting the message "Failed to load symbols: C:\pathtolocation\ploggy.pdb" is that something I should be concerned about?

 

Also which Url should I be setting it to so I can access it externally? The internal IP, the external ip/url, localhost?

 

The message is harmless. Try with the internal IP.

Share this post


Link to post
Share on other sites

The message is harmless. Try with the internal IP.

Yep internal IP is working, should come in usefulness for managing the server while im at work :P

Share this post


Link to post
Share on other sites

Been trying to make this software work externally to my network and have failed. Looks like it doesnt play nicely with NAT, is there any way to get it to repond on a network interface in general instead of a specific IP? it would make NAT much easier to set up.

Share this post


Link to post
Share on other sites

It works with NAT, I'm using it that way. But you have to configure the windows firewall properly and that can be tricky. The way I did it was to open a tcp port. Check also if edge traversal is allowed in the advanced properties. Do not try to open the firewall for the EXE file, that doesn't work for unknown reasons.

Share this post


Link to post
Share on other sites

Any progress on the tick delay?

I finally worked out why I wasnt able to access it remotely, turns out I was using the wrong DNS name... I had a typo in my link /facepalm

Share this post


Link to post
Share on other sites

The shot above shows the status page, which displays the status of the server, including its current load. It's not very useful, since DServer typically starts acting up long before the SPS falls below 50, but in the future I'm hoping I can show the tick delay, which is a better figure to show. The enigmatic "Reduce load" button simply triggers a server input MCU in the mission (configurable). It's then up to the mission logic to deactivate non-essential entities. Everybody gets to click that button, but it won't do anything unless you are logged in. Below is the list of players, empty in this case. The page auto-updates every 60 seconds.

As noted above, you were hoping to be able to display the tick delay on the page.

Share this post


Link to post
Share on other sites

I see. I had asked in the questions to devs if they could add a command to show the tick delay, instead of the SPS. Han answered positively, but that hasn't been implemented AFAIK. They probably forgot. I suppose I could use the CPU usage by the DServer process instead.

Share this post


Link to post
Share on other sites

Coconut,

thank you very much for your programming effort. You have done an outstanding work. I'm planning to set up your software in a modest server and test it.

Share this post


Link to post
Share on other sites

ok so just going through the process of setup now. 

 

 

First questions!

 

From installation instructions 

 

Edit the configuration file of SturmovikServerControl to point at the plugin you just installed.

In the server instance you want to use:
 
      CampaignPluginAssembly: C:\Campaign\Bin\Campaign.dll
      CampaignPluginType: Campaign.ServerControlPlugin.Plugin
      CampaignPluginConfig: C:\Campaign\Bin\Config.yaml
 

Can you confirm the structure of the zip?

I have 2 folders in the zip

Campaign 

and

CampaignControlApp

both have bin subfolders, both have campaign.dll files but the CampaignControlApp has additional files.

 

 

 

 

Also  in the SturmovikServerControl config file 

 

Server:

# URLs on which the web interface will be reachable.
  ControllerUrls: ["http://localhost:8083/]
# Hash of the password used in the web interface to get access to scheduling operations.
# Use SetPassword.fsx on the host to set the password.
# If empty, these operations are disabled.
  AdminPasswordHash: ""
  Instances:
# Concise and human-readable identifier for a DServer instance.
    - Name: Primary
# Human-readable description of the DServer instance.
      Description: No description yet
# URL where the remote console of the DServer instance is listening.
      ServerHostname: localhost
# Port where the remote console of the DServer instance is listening.
      ServerPort: 8991
# Remote console login.
      Login: rconlogin
# Remote console login password.
      Password: rconpassword
# Optional name of a server input MCU in missions that triggers action to lighten CPU load.
      OffLoadServerInput: ReqKill
# Base game directory of the DServer instance.
      GameDirectory: D:\IL2
# Optional directory where game logs are written by DServer.
      LogDirectory: ""
# Optional directory where game logs written by DServer are concatenated. If unset or empty, this is the same as LogDirectory.
      CompactedLogDirectory: ""
# Optional directory where game logs written by DServer are moved after concatenation. If unset, logs are deleted after concatenation.
      ProcessedLogDirectory: ""
# Optional path to campaign system assembly
      CampaignPluginAssembly: ""
# Optional name of plugin type in campaign system assembly
      CampaignPluginType: ""
# Optional configuration string of campaign system
      CampaignPluginConfig: ""
    - Name: Secondary
      Description: No description yet
      ServerHostname: localhost
      ServerPort: 8992
      Login: rconlogin
      Password: rconpassword
      GameDirectory: D:\IL2
      CampaignPluginAssembly: C:\Campaign\bin\Debug\Campaign.dll
      CampaignPluginType: Campaign.ServerControl.plugin
      CampaignPluginConfig: "expert.yaml"

 

Theres a couple differences in paths(bin\debug\campaign.dll), and in pluginType (ServerControl.plugin  vs Servercontrolplugin.plugin)

 

and in the above config file.. theres 2 locations to input these paths. Primary and Secondary? Is secondary even required?

 

I tried all combinations but got similar results either way 

"failed to load type 'Campaign.Servercontrolplugin.plugin'  from assembly 'C:\Campaign\Bin\Campaign.dll'

Could not load file or assembly or one of its depencies. Operation is not supported. 

Exception from HRESULT 0x80131515

Edited by =IL2AU=chappyj

Share this post


Link to post
Share on other sites
Can you confirm the structure of the zip? I have 2 folders in the zip Campaign and CampaignControlApp both have bin subfolders, both have campaign.dll files but the CampaignControlApp has additional files.

 

Correct.

 

Theres a couple differences in paths(bin\debug\campaign.dll), and in pluginType (ServerControl.plugin vs Servercontrolplugin.plugin)

The paths have to be adjusted to the layout of your own system.

 

 

 

and in the above config file.. theres 2 locations to input these paths. Primary and Secondary? Is secondary even required?

You can manage more than one DServer instance under control. If you have only one, remove the second instance.

 

 

 

I tried all combinations but got similar results either way "failed to load type 'Campaign.Servercontrolplugin.plugin' from assembly 'C:\Campaign\Bin\Campaign.dll' Could not load file or assembly or one of its depencies. Operation is not supported.

Might be a security issue. Check if you need to unblock the zip/dll first. This applies to all other dlls beside campaign.dll too

 

See e.g. https://stackoverflow.com/questions/21753979/visual-studio-could-not-load-file-or-assembly-operation-is-not-supported-erro

Edited by coconut

Share this post


Link to post
Share on other sites

yep you're right it seems the dlls were blocked on install

 

I now have the server controller up and running and can schedule a task etc.. 

 

I've  run the campaign plugin via the reboot schedule and it generates mission, runs resaver and creates the msnbn file. from there it attempts to load Dserver with the arg for the sds file however never actually succeeds. Dserver loads but without the SDS file. .. instructions were relative to the data folder and i've set it up to mirror what was in the sample config anyway  sds/campaign.sds. In the CMD window it appears correct (ie data/sds/campaign.sds)

 

when it fails on dserver load, I can however then run a scheduled task to load the same sds and it does so fine.

 

any ideas?

 

 

onto more customisation related questions

 

In the campaign config i am able to choose from planesets Moscow, Stalingrad, EarlyAccess

could you point me in the direction to where i might create a custom planeset? if it's even possible.

 

 

as always thanks for your patience and assistance!

Share this post


Link to post
Share on other sites

when it fails on dserver load, I can however then run a scheduled task to load the same sds and it does so fine.

 

any ideas?

 

 

I have the same problem. As I remember now, DServer only admits relative paths with respect to \data dir or absolute pahts without blank spaces. This may be the problem. A solution is to move/reinstall IL2 into a new path without blank spaces in it.

  • Upvote 1

Share this post


Link to post
Share on other sites

I have the same problem. As I remember now, DServer only admits relative paths with respect to \data dir or absolute pahts without blank spaces. This may be the problem. A solution is to move/reinstall IL2 into a new path without blank spaces in it.

SOLVED

copied game to new folder structure with no spaces. Dserver now loads with the arg and loads the SDS file.

Share this post


Link to post
Share on other sites

Excellent. I've been also able to start it up.

I have a problem with the web interface, I cannot reach the web from the outside, but this probably has to do with firewalls, routers or related stuff. Right now a minor issue.

Share this post


Link to post
Share on other sites
Posted (edited)

Further on the idea for customisable planeset 

I wonder if an option would  be to have a planeset.mission file that could be adjusted via editor 

It could have 1 axis 1 allied fakefield in which the user could define which aircraft are used and on which side and even in what ratios of common -> rare 

Could also have a patrol attack and bomber group for each side where the aircraft type is changeable along with payload and custom skins

 

 

I've spun up my first attempt at a customised campaign structure on the kuban map. Also added the discord webhook which is a pretty cool feature 

Working really well and amazingly easy to setup and make changes to

Edited by =IL2AU=chappyj

Share this post


Link to post
Share on other sites

New version 1.16.5.0 of the dynamic campaign:

v1.16.5.0       Compatibility with IL-2 version 3.001:

  • Added option UseTextMissionFile to use textual mission files instead of msnbin files. Needed because resaver in 3.001 generates files DServer can't read.
  • Missions are now published in <ServerDataDir>/Multiplayer/Dogfight. Two sets of files suffixed respectively with _1 and _2 are created. Use these two in the rotation in the DServer config file. Because of locked files, the currently running mission files cannot always be updated, but the other set can, and it's that set that is used when the server rotates the missions.
  • Adjusted durability of static objects with strategic value.

https://bitbucket.org/johdex/sturmovikcampaign/downloads/SturmovikCampaign-1.16.5.0.zip

 

On 02/03/2018 at 11:42 PM, =IL2AU=chappyj said:

Further on the idea for customisable planeset 

I wonder if an option would  be to have a planeset.mission file that could be adjusted via editor 

It could have 1 axis 1 allied fakefield in which the user could define which aircraft are used and on which side and even in what ratios of common -> rare 

Could also have a patrol attack and bomber group for each side where the aircraft type is changeable along with payload and custom skins

 

Sorry, I'm just seeing this. That's a good idea.

Share this post


Link to post
Share on other sites

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

×