Sign in to follow this  
Mthec

[ABANDONED] Community Server Launcher - with mod support and console menu

Recommended Posts

Introduction:

When I started looking into modding I realised, as others have, that any changes or additions made to the Wurm Unlimited code could cause conflicts, especially so with the launcher, as that would be a common point of entry.  So I decided to have a go at creating a replacement server launcher, based around the official launcher, which would allow the community to work on improving it without getting in each others way, and also to make it easy for modders to add extras options to the launcher without having to overwrite any files.  It's a little rough around the edges still, but I thought now would be a good point to get it out and get some feedback on it and find out whether it could be of use to the community.  I think I have all the features of the official launcher included, plus a few extra features such as message broadcasting as you can see in the screenshot below.

 

It also incorporates ago's mod and server hook system, so I'd like to say thank you to ago for his work on his ModLoader, and thank you for letting me include it.  If other mod files are already in a mods directory with an accompanying mod.properties file they should just work.

 

If people are interested I could upload it to GitHub or similar and then the community could contribute additions or fixes.  However I don't want people to think I'm trying to push this onto the community, I just thought it might be a good base to build on or place holder until something better comes along.

 

Wurm Server Launcher - Mod Edition

Screenshot:

broadcasting.jpg

 

 

Description:

This is a proposed community version of the Official Wurm Server Launcher, which doesn't overwrite any files in the official code and allows modders to add their own settings pages (and possibly more) to the launcher.  There has also been a slight re-design of the layout, and a few more options have been added.  In working on this launcher I've split out most, if not all, of the server controlling "logic" into a base class.  What makes this worth mentioning is that now there is a ServerConsoleController class, currently just using the code the official launcher uses for non-GUI launching, but it might provide a nice base for anyone interesting in working on a console based menu system.

 

I've moved the database copying into it's own tab, and also added a basic new database section.  It takes the current database's map, and possibly some other features, removes the servers and adds a single new one.  If you look at the screenshot above you can see the broadcasting controls at work.  Alert creates the orange text, normal the white, and safe the green.  Incidentally, when I spotted this in the server code I thought it could make for a very interesting story based system.

 

If anyone has any suggestions or comments, please feel free to post below.

 

Install instructions:

 

Note:  I've renamed this version of the .bat file so you can try this launcher out and switch back to using ago's mod launcher without having to make any changes.  You can either replace the javassist.jar or not, since it's the same.

 

  • Download the serverlauncher.zip from the releases page.
  • Copy the contents into the appropriate Wurm Unlimited server folder:
  • Steam/steamapps/common/Wurm Unlimited/WurmServerLauncher or
  • Steam/steamapps/common/Wurm Unlimited Dedicated Server
  • Run the serverlauncher.bat for Windows or the serverlauncher.sh for Linux.

 

You can run the launcher from it's icon, but it's better to run it from the command-line so that any errors are not lost on exit.

 

Source code

 

 

Known issues:

The window layout is odd when first started, I haven't gotten to the root of the cause yet, but just click once or resize the window and it will sort itself out.

 

For Modders:

More detailed instructions can be found here, but below is should serve as a quick reference.

 

  •  
Spoiler

 

  • WurmMod
    • This is the interface used by ago's mod code, and is required.
  • Configurable
    • Another one by ago, this allows you to access any settings you put in your mod.properties file.
  • WurmUIMod
    • This is used by mods that wish to integrate into the UI of the launcher.
    • You need to provide a:
      • getName method, to provide a nicer looking name for the Server settings list.
      • getRegion method, to provide any of the JavaFX containers that inherit from Region (Pane, GridPane, VBox, HBox, etc.).  You can either create these programmatically, or create an FXML file for more complex layouts and load that.  In turn this provides you with access to the controller itself, should you need to access any of the current server information.
  • WurmArgsMod
    • Add command-line arguments to be captured by the launcher.
    • You need to provide a:
      • getArgs method which passes a Set<String> to the launcher.  This allows you to provide the options however you wish, in code, or in the mod.properties file using Configurable to fetch the values.
      • Optional parseArgs method, to get the options if you don't plan on using WurmUIMod.
  • WurmLoadDumpMod
    • Add per database settings to a server_settings.properties file.
    • You need to provide a:
      • loadSettings method, that takes a Properties object.  For loading any settings provided.
      • dumpSettings method, that returns a Properties object.  Properties keys should start with the name of your mod, followed by a full stop, followed by the actual key name.  e.g. serversettings.SERVERID for the SERVERID value of the official Wurm Server Settings.
      • getComment method, that returns a String that will be added to the .properties file as a header comment to help break things up.

 

 

 

TODO list:

 

Spoiler

 

These are things I plan to get to eventually.  No guarantee of when, or in what order, so if you fancy having go at any of them, go ahead.

 

  • Move the "Gameplay tweaks" panel from Network settings, to it's own slot on Server settings
    • Currently the Network settings tab has the settings panel from the official launcher, but since I've separated the settings to their own tab some of them are a little misplaced.  Just need to create the appropriate "mods".
  • Run Server "widgets"
    • As well as allowing modders to add settings "pages", I think it would be interesting to convert the Run Server tab to use "widgets/gadgets" whatever you want to call them.  Little blocks of controls that can be placed as people want.  If you look at the current Run Server tab imagine the Broadcast and Shutdown controls as two separate groups.  If a user doesn't want the ability to broadcast they could remove it, or if someone creates a widget for, say, setting various weather settings live could add that.  Making a pick-and-choose interface to suit the user.
  • Internationalisation
    • Not sure how much demand there would be for this, but I will probably go through putting all the messages through i18n, then a file can be generated for people interested in translating which will allow them to contribute without even looking at the code.
  • Multiple local servers
    • Currently the launcher and it's associated code only allow for one local server (the server that is run) per database.  I'm hopeful it shouldn't be too difficult to expand this.
  • Running multiple servers
    • As above, but this one might be more tricky.  Assuming the computer is powerful enough, and/or the servers are small/have a low population it seems feasible.  I haven't had time to dig very deep into the launching code though.
  • Running intensive tasks/running servers in another thread
    • Currently the window locks up when heavy tasks are being performed.  This should be resolvable by running the tasks in a background thread, however I'm not sure what effect that might have on the server.  If anyone knows more about the subject I would welcome some advice.
  • More database management (e.g. delete)
  • Expand Neighbours tab
    • When I first started this project I had an idea of a grid of servers with moveable arrows and the like.  Not sure how easy it will all be, but should prove extra helpful once multiple local servers are possible.
  • Expand Players settings
    • Ban management, etc.
  • Automatic or user requested update of local ips.

 

Other features:

 

These are some interesting features I thought of, but may or may not ever get around to doing for various reasons (e.g. lack of knowledge).

 

  • Map loading
    • Select maps for servers, possibly some kind of map preview?  I haven't been keeping up to date with all the map making work, so this might be already mostly implemented.
  • .exe
    • The client launcher currently calls WurmServerLauncher.exe when you click Manage servers.  It would be nice I guess for the launcher to work without needing the .bat file.
  • ServerConsoleController
    • As mentioned above, most of the server launcher logic has been moved into a base class, and I've created a basic ServerConsoleController class that uses the code used by the official launcher.  This might provide a nice base for anyone interested in creating a console menu system for use on servers that don't have a GUI environment, or just when people don't want the window.

 

Edited by Mthec
Title change.
  • Like 5

Share this post


Link to post
Share on other sites

I have created a new version of the instructions for users, modders and translators, which can be found here.


They should hopefully get you started.  Please feel free to ask any questions and I shall try and answer them.

 

 

Edited by Mthec
Moved instructions to GitHub wiki.

Share this post


Link to post
Share on other sites

Would it be possible to create non-db focused configuration files or something that would make this a lot easier to take advantage of when using linux based servers?


 


Right now most of my configuration requires me to either shutdown the server, copy files to a windows machine, make db and gui changes as appropriate and then copy it all back. Results in more downtime then I would prefer.


 


I like what you are trying to do here. It would be nice if we could do some of this at least non-gui. With a configuration file I can use "vi" and make some easy changes that result in little downtime if any.


Share this post


Link to post
Share on other sites

Would it be possible to create non-db focused configuration files or something that would make this a lot easier to take advantage of when using linux based servers?

 

Right now most of my configuration requires me to either shutdown the server, copy files to a windows machine, make db and gui changes as appropriate and then copy it all back. Results in more downtime then I would prefer.

 

I like what you are trying to do here. It would be nice if we could do some of this at least non-gui. With a configuration file I can use "vi" and make some easy changes that result in little downtime if any.

 

That certainly sounds possible, and follows along with the general thoughts I've been having about where to go next.  At the moment this launcher uses the same server control classes that the official launcher does (Servers, ServerEntry, ServerLauncher, etc.), and I think that in order to make multiple local servers work I may have to tweak or completely replace these classes.  So far I haven't dug too deep into them, I'm hopeful there is some wiggle room to do what you say, but some features might require significant changes to the whole Wurm code and may be beyond this project.  Maybe other people who have been looking at the code have seen something different to me, there is a lot to look at.  At the very least, as I get to more time to look at them I will try and do as I've done so far and keep the code that makes the changes separate so that even if I can't make the changes myself, it could be expanded to use configuration file at some point.

 

An expansion of ServerConsoleController would certainly help with linux based management, but I don't have enough knowledge about console based menus (not that that has stopped me with the other things I've been doing...) to do much work on it.

 

Another option would be to create these configuration files and rather than using menus just have a load command that takes the files and sets everything as needed.  Wouldn't give quite the same flexibility when managing a server, but would help limit the downtime.

 

This is exactly whats needed.. keep up the good work!!

Thank you.  :)

Share this post


Link to post
Share on other sites

Another option would be to create these configuration files and rather than using menus just have a load command that takes the files and sets everything as needed.  Wouldn't give quite the same flexibility when managing a server, but would help limit the downtime.

 

 

My initial impression is that this would be great and likely do most, if not all, that is needed. Same with the current new command line arguments that CodeClub added in a recent patch. If they could all be set through a configuration file and then autoloaded to the database etc then life would certainly be tons easier.

 

Again, really appreciate your help with this.

 

~Nappy

Share this post


Link to post
Share on other sites

runtime/jre1.8.0_60/bin/java "-Dworkdir=%CD%" "-Djava.library.path=%CD%/nativelibs" -Xmn256M -Xms512m -Xmx2048m -XX:+OptimizeStringConcat -XX:+AggressiveOpts -jar serverlauncher.jar

For people who want it for Linux, just a slight change in the directory from a \ to a / :P

Share this post


Link to post
Share on other sites

Is there any way to add what users are currently online or in the least how many are online to something like this??


Share this post


Link to post
Share on other sites

Update v0.2

 

Updated to v0.8.3 of ago's ModLauncher.

Included all the extra command-line options the last official update added.  Forgot that Wurm updated before the first release.
Added WurmLoadDumpMod to create a communal server_settings.properties file per database.
Added loadsettings and dumpsettings options to the arguments.
Internationalised the Launcher.
Moved "Gameplay Tweaks" to Server Settings tab.
Added "Online Players" mod.
Added .bat changes.

 

Since most other people seem to be using GitHub I've moved to it as well.  You can download the latest version here.

 

Sorry about the late reply, for some reason I thought it would be a good idea to do all the updates at once.

 

My initial impression is that this would be great and likely do most, if not all, that is needed. Same with the current new command line arguments that CodeClub added in a recent patch. If they could all be set through a configuration file and then autoloaded to the database etc then life would certainly be tons easier.

Share this post


Link to post
Share on other sites

I just tried this and when I launch serverlauncher.bat nothing happens...


 


 


Any help?


 


E:\Steam\SteamApps\common\Wurm Unlimited Dedicated Server>runtime/bin/java "-Dwo

rkdir=E:\Steam\SteamApps\common\Wurm Unlimited Dedicated Server" "-Djava.library

.path=E:\Steam\SteamApps\common\Wurm Unlimited Dedicated Server/nativelibs"  -Xm

n256M -Xms512m -Xmx2048m -XX:+OptimizeStringConcat -XX:+AggressiveOpts -jar serv

erlauncher.jar

'runtime' is not recognized as an internal or external command,

operable program or batch file.

 

This is the error I get when I run from cmd line....

Edited by Overlord

Share this post


Link to post
Share on other sites

 

I just tried this and when I launch serverlauncher.bat nothing happens...

 

 

Any help?

 

E:\Steam\SteamApps\common\Wurm Unlimited Dedicated Server>runtime/bin/java "-Dwo

rkdir=E:\Steam\SteamApps\common\Wurm Unlimited Dedicated Server" "-Djava.library

.path=E:\Steam\SteamApps\common\Wurm Unlimited Dedicated Server/nativelibs"  -Xm

n256M -Xms512m -Xmx2048m -XX:+OptimizeStringConcat -XX:+AggressiveOpts -jar serv

erlauncher.jar

'runtime' is not recognized as an internal or external command,

operable program or batch file.

 

This is the error I get when I run from cmd line....

 

Hmm, I get that but I thought it might just be a problem with my configuration since that's the way it is with ago's mod launcher.

 

Just edit the .bat to take out the "runtime/bin/" bit so you're just left with java.  Or here for easy copy-paste.

if exist logging.properties set LOGGING=-Djava.util.logging.config.file=logging.properties

java "-Dworkdir=%CD%" "-Djava.library.path=%CD%/nativelibs" %LOGGING% -Xmn256M -Xms512m -Xmx2048m -XX:+OptimizeStringConcat -XX:+AggressiveOpts -jar serverlauncher.jar %*

  • Like 1

Share this post


Link to post
Share on other sites
C:\steamapps\common\Wurm Unlimited Dedicated Server>if exist logging.properties set LOGGING=-Djava.util.logging.config.file=logging.properties

C:\steamapps\common\Wurm Unlimited Dedicated Server>java "-Dworkdir=C:\steamapps\common\Wurm Unlimited Dedicated Server" "-Djava.library.path=C:\steam
apps\common\Wurm Unlimited Dedicated Server/nativelibs"  -Xmn256M -Xms512m -Xmx2048m -XX:+OptimizeStringConcat -XX:+AggressiveOpts -jar serverlauncher
.jar
Lis 28, 2015 4:20:10 ODP. mod.wurmonline.serverlauncher.ServerMain main
INFO: ServerMain starting
Lis 28, 2015 4:20:10 ODP. org.gotti.wurmunlimited.modloader.ModLoader lambda$loadModsFromModDir$20
INFO: Loaded mod.wurmonline.serverlauncher.mods.gameplaytweaks.GameplayTweaks as gameplaytweaks
Lis 28, 2015 4:20:10 ODP. org.gotti.wurmunlimited.modloader.ModLoader lambda$loadModsFromModDir$20
INFO: Loaded mod.wurmonline.serverlauncher.mods.playercount.PlayerCount as playercount
Lis 28, 2015 4:20:10 ODP. org.gotti.wurmunlimited.modloader.ModLoader lambda$loadModsFromModDir$20
INFO: Loaded mod.wurmonline.serverlauncher.mods.players.Players as players
Lis 28, 2015 4:20:10 ODP. org.gotti.wurmunlimited.modloader.ModLoader lambda$loadModsFromModDir$20
INFO: Loaded mod.wurmonline.serverlauncher.mods.serversettings.ServerSettings as serversettings
java.util.MissingResourceException: Can't find resource for bundle java.util.PropertyResourceBundle, key number_of_mods.few
        at java.util.ResourceBundle.getObject(Unknown Source)
        at java.util.ResourceBundle.getString(Unknown Source)
        at mod.wurmonline.serverlauncher.ServerMain.main(ServerMain.java:137)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at javassist.Loader.run(Loader.java:288)
        at mod.wurmonline.serverlauncher.DelegatingLauncher.main(DelegatingLauncher.java:22)

Can someone help me?

Share this post


Link to post
Share on other sites
8 hours ago, KubikX said:

Can someone help me?

Oh, sorry about that, I didn't think I had to add those values to the default translation files.

 

I have now added them and it should work fine.  You can download the new version here.

 

Also, I have completed some basic instructions for users, modders and translators, forgot to update the post though.

Share this post


Link to post
Share on other sites

Hi, great tool, I had a couple problems getting this to run but here's what I done to get it working.

 

1: Remove the runtime path and just replace with java

2: Remove -XX:+OptimizeStringConcat - not actually sure what this is ?

3: change -Xmx2048m to -Xmx1028m - not sure why this is a problem, I've 64GIG

Share this post


Link to post
Share on other sites

Hi, great tool, I had a couple problems getting this to run but here's what I done to get it working.

 

1: Remove the runtime path and just replace with java

2: Remove -XX:+OptimizeStringConcat - not actually sure what this is ?

3: change -Xmx2048m to -Xmx1028m - not sure why this is a problem, I've 64GIG

Edited by Reconix
LOL - Sorry, my browser is killing Invasion Power Board for some reason

Share this post


Link to post
Share on other sites

EDIT:  See new update below to hopefully fix this issue.

 

On 10/12/2015 at 9:19 AM, Reconix said:

Hi, great tool, I had a couple problems getting this to run but here's what I done to get it working.

 

1: Remove the runtime path and just replace with java

2: Remove -XX:+OptimizeStringConcat - not actually sure what this is ?

3: change -Xmx2048m to -Xmx1028m - not sure why this is a problem, I've 64GIG

These are options set by the Wurm devs, I don't know much about them but what I've worked out is that with the latest version of Java OptimizeStringConcat no longer works and the other one would stop it from working if you are running the 32bit version of Java rather than 64bit.

 

Looking into this I've also worked out why Overlord and I were having problems a few posts up.  Wurm Unlimited comes with a version of Java bundled, it's in a folder called runtime.  The Dedicated server has it in the top level folder, which is what the settings I used from ago's mod launcher work with, whereas the local version of the server has it one level up (so the client can access it as well I guess).

 

So if you just want to use the version that is bundled with Java and it presumably is best for compatibility, and you are using the local server this should work:

if exist logging.properties set LOGGING=-Djava.util.logging.config.file=logging.properties

"../runtime/bin/java" "-Dworkdir=%CD%" "-Djava.library.path=%CD%/nativelibs" %LOGGING% -Xmn256M -Xms512m -Xmx2048m -XX:+OptimizeStringConcat -XX:+AggressiveOpts -jar serverlauncher.jar %*

Or feel free to delete OptimizeStringConcat, I don't think it would break anything.  The information I got on the memory issue I read about from the wurm devs here.  Hope it helps.

Edited by Mthec
Update v0.2.2

Share this post


Link to post
Share on other sites

Update

Updated in-line with Wurm Unlimited update - 2015/12/03. (New End Game Items option.)
Updated to latest version of ago's ModLoader.
Including Patching. (use serverlauncherpatcher.bat or serverlauncherpatcher.sh instead)
Removed duplication of ModLoader files. Now uses modlauncher.jar (still provided).
Fixed Players mod null pointer error.
.bat and .sh files should now work with both local and dedicated server versions without editing.
Mod panels should resize better now.
Added missing Admin Password option.

 

Download

 

Been busy with other things, so nothing major today.  Hopefully the .bat and .sh update will solve all the problems people have been experiencing (and hopefully not cause more).

Share this post


Link to post
Share on other sites

Hi, when I try to run this with the batch file I get a cmd prompt window that says:

 

C:\Program Files (x86)\Steam\steamapps\common\Wurm Unlimited Dedicated Server>if exist logging.properties set Logging==Djavautil.logging.config.file=logging.properties

\Steam\steamapps\common\Wurm was unexcepted at this time.

C:\Program Files (x86)\Steam\steamapps\common\Wurm Unlimited Dedicated Server\    SET run=C:\Program Files (x86)\Steam\steamapps\common\Wurm Unlimited Dedicated Server\runtime

 

and when I run serverlauncherpatcher.bat I get 

 

\Steam\steamapps\common\Wurm was unexcepted at this time.

C:\Program Files (x86)\Steam\steamapps\common\Wurm Unlimited Dedicated Server

SET run=C:\Program Files (x86)\Steam\steamapps\common\Wurm Unlimited Dedicated Server\runtime

 

I can run Serverlauncher.jar but it won't star the server, just sits there for a very long time with no error messages. Any help would be greatly appreciated.

 

Thanks.

Share this post


Link to post
Share on other sites
19 hours ago, Rudie said:

Hi, when I try to run this with the batch file I get a cmd prompt window that says:

 

*snip*

Sorry about that, haven't used .bat files much and I missed some ", the problem arises when there are spaces in the path to the Wurm folder.  Which mine doesn't have so I missed it.

 

I've made the changes and will add it to the next release, but for now you can just copy and paste the contents from these links into serverlauncher.bat and serverlauncherpatcher.bat (if you need it).

19 hours ago, Rudie said:

I can run Serverlauncher.jar but it won't star the server, just sits there for a very long time with no error messages. Any help would be greatly appreciated.

This I'm not certain on.  Maybe the fixed .bat files will help, but I wouldn't imagine so.  Would you mind opening a command prompt to your Wurm folder, and starting the server launcher from there.

>serverlauncher.bat start=Creative

Any server you want really.  Then copy and paste the output here.  This will bypass the gui which will hopefully eliminate some possibilities.  Thanks.

Share this post


Link to post
Share on other sites

Update

New server console commands.

 

A new console menu will appear after using "start=<server-name>", allowing you to do some of the things you can with the launcher window.  Which will hopefully be useful for those who can't/don't want to use the gui version.

Type:

serverlauncher.bat console

from the command line to start this new menu system before a server is started.

 

The story so far

Sorry for the wait from the last update, what with the holidays, real life stuff and working on two sets of changes at the same time, things have taken long that I'd hoped.  The two main things I've been working on, are 1) this new menu system and 2)  separating the gui from the server controller even further, hopefully paving the way for things like multiple servers.

 

Now I feel (hope) the new console menu system is ready to start gathering feedback.  Some things are still a little awkward, some are missing (e.g. creating new servers) and until the other part I've been working on is done some of the features won't be as full as they should be (e.g. changing settings on a different server to the one that is running), but it seems to work fairly well.  So before I got much further I thought it would be a good idea to, you know, see what people actually want in a console system.

 

How to use

It should be fairly self-explanatory, just type a listed option and press enter.  A few extra commands that work everywhere (except in questions):  "help" will explain what things do, the list of options is printed at every level but typing "list" will bring it up again, "up" will take you back up a menu level and "menu" will get you back to the main menu.  I've created a page on the github wiki explaining a little more about how things work.

 

One little quirk I haven't thought of a better way around is setting a value to blank, so for the moment just type set after the option (e.g. motd set).  If anyone has any suggestions on the matter, please let me know.

 

Feedback on how things are, changes you think would be good, and any extras would be very welcome.

 

 

Edited by Mthec
Formatting.

Share this post


Link to post
Share on other sites

Update

Nothing major, just updating in-line with the 2016-03-01 official update.

Added offline server button.

 

Download

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
Sign in to follow this