Create account / Log in

Allow custom VM arguments for Player, Editor

Discussion area for the development team.

Moderators: uckelman, Tim M

Allow custom VM arguments for Player, Editor

Postby Flint1b » July 10th, 2020, 1:20 am

It is possible now to start the ModuleManager with custom VM arguments e.g. the selection and configuration of a garbage collector. The idea is to allow the same for the Player and the Editor.

We would provide a text file with default settings, but the users could override this with custom settings.

This is customary in Java applications:
- Eclipse has the eclipse.ini: https://wiki.eclipse.org/Eclipse.ini
- IntelliJ has idea.exe.vmoptions (and even an editor for it inside the IDE itself): https://www.jetbrains.com/help/idea/tun ... vm-options
- Minecraft has a text field in its launcher where the arguments can be entered and prefills it with a default set which configures the GC

Advantages:
- power users would get a way to tune the GC and other VM features to their needs
- we could introduce -D arguments and if needed tell users to change them to a different value in case of problems, e.g. "-Dorg.vassalengine.useLegacyFeatureX=true"
- we could put some awt/jdk arguments there e.g. "-Dawt.useSystemAAFontSettings=lcd" or "-Dsun.java2d.opengl=true"

The implementation would simply read the file line by line and in VASSAL.launch.AbstractLaunchAction.LaunchTask#doInBackground append the lines to the jvm arguments.


Sounds good?
User avatar
Flint1b
 
Posts: 461
Joined: May 19th, 2020, 12:27 am
Location: Colonia Agrippina

Re: Allow custom VM arguments for Player, Editor

Postby Cattlesquat » July 10th, 2020, 3:47 am

Would you be able to make it so that dude could use the Windows LAF with the bundled JVM?
User avatar
Cattlesquat
 
Posts: 890
Joined: December 2nd, 2019, 4:57 pm
Location: Baltimore, Maryland, USA

Re: Allow custom VM arguments for Player, Editor

Postby Flint1b » July 10th, 2020, 11:05 am

Cattlesquat wrote:Would you be able to make it so that dude could use the Windows LAF with the bundled JVM?


Yes, this could be solved by a parameter in this file. If the bundled "castrated" JVM is not good enough we can just bundle a regular JVM.

The jlink'ed half-JVM is no good for Vassal anyways, we can never know which parts of Java the modules are going to use. If we already bring a JVM we should be bundling a full JVM to support all kinds of custom module code.
User avatar
Flint1b
 
Posts: 461
Joined: May 19th, 2020, 12:27 am
Location: Colonia Agrippina

Re: Allow custom VM arguments for Player, Editor

Postby pixelpshr » July 13th, 2020, 4:46 pm

I am also looking at the custom arguments to pass in an alternate server URL and port. (My implementation cannot reach out to vassalengine.org) It's turning out to be a lot more tricky than it sounds.
My first thought was to use Apache Commons Configuration library. But, that was even worse.
User avatar
pixelpshr
 
Posts: 23
Joined: March 23rd, 2020, 1:40 pm
Location: Yorktown, VA, US, Earth, Sol, Milky Way

Re: Allow custom VM arguments for Player, Editor

Postby Flint1b » July 13th, 2020, 5:51 pm

pixelpshr wrote:I am also looking at the custom arguments to pass in an alternate server URL and port.


Solution to this would be slightly different but still very similar, a .properties file where all the URLs are. We would need to extract them from the code and have the code read them from the properties file, then the users could change the properties without having to recompile anything. Something like
Code: Select all
# vassal properties
vassal.jabber.url=www.vassalengine.org/foo/bar
vassal.jabber.port=12345
User avatar
Flint1b
 
Posts: 461
Joined: May 19th, 2020, 12:27 am
Location: Colonia Agrippina

Re: Allow custom VM arguments for Player, Editor

Postby uckelman » August 3rd, 2020, 8:04 pm

Go for it if you think it's worth the effort. It would make troubleshooting where we're asking people to try different JVM flags a bit simpler.
User avatar
uckelman
Site Admin
 
Posts: 8847
Joined: December 10th, 2007, 9:48 am
Location: Durham, England

Re: Allow custom VM arguments for Player, Editor

Postby Flint1b » August 3rd, 2020, 11:55 pm

Have a look at #149. I guess the user's conf dir is the best place to write that file into, and I also came up with a way of cleaning up a possible mess that a user could create there.
User avatar
Flint1b
 
Posts: 461
Joined: May 19th, 2020, 12:27 am
Location: Colonia Agrippina

Re: Allow custom VM arguments for Player, Editor

Postby uckelman » August 22nd, 2020, 4:33 pm

This is merged and will be in 3.3.4.
User avatar
uckelman
Site Admin
 
Posts: 8847
Joined: December 10th, 2007, 9:48 am
Location: Durham, England


Return to Developers

Who is online

Users browsing this forum: No registered users and 3 guests