This is still a work in progress and may not be good or totally working. I'm working on testing still so backup your saves, your mileage may vary.
There does appear to be some stuttering with the default Starsector config. I was able to resolve it on my install by increasing the fps setting to 70 or higher in \Starsector\starsector-core\data\config\settings.json. Disabling vsync and cranking the frames currently lets me get 250-500 fps so that's cool.
- Unzip release into /Starsector
- Download JDK21 https://jdk.java.net/21/
- Rename the /Starsector/jre folder (or delete it)
- Create a new /Starsector/jre folder
- Unpack JDK21 into that folder so that you have /Starsector/jre/bin
- Enjoy the new JDK21
##Linux coming soon
##Mac coming soon
*** Tested for Starsector 0.96 and 0.97, obviously this can be very sensitive to changes on the starsector side.
I wanted to do some modding but was irritated by having to write code for ancient java.
Maybe people can test it and see if it is better or worse? New garbage collectors are available as well:
https://docs.oracle.com/en/java/javase/21/gctuning/available-collectors.html
https://openjdk.org/jeps/377
https://openjdk.org/jeps/439
- byte-buddy-1.14.11.jar - This is for the java agent described below.
- jaxb-api.jar / txw2.jar - This is an older version of jaxb, 2.3.1 that still has the old javax classpaths. In Java 9 they hid and then later removed EE components https://openjdk.org/jeps/320 so these add needed functionality back.
- DirectBuffer's Cleaner type has changed from sun.misc.Cleaner to jdk.internal.ref.Cleaner so that class has been remapped.
- Thread.stop() now throws an exception. This call was ALREADY deprecated in Java7 and should not have been used. More recently it was updated to just throw an exception. The agent makes the call to this method do nothing. Seems fine.
- Starsector code was using IndentingXMLStreamWriter from EE code to write out the save file. Previously this class was inside the Java core library and located at com.sun.xml.internal.txw2.output.IndentingXMLStreamWriter. Now it is in txw2.jar and located at com.sun.xml.txw2.output.IndentingXMLStreamWriter. Since the class has moved packages the agent remaps the reference in the inner class of com.fs.starfarer.campaign.save.CampaignGameManager$5 that is responsible for creating the XStream instance that writes out the save file.
- Disables verification -Xverify:none -- This is needed because the obfuscator starsector uses is terrible and uses illegal names for things like return/for/class/etc.
- Add exports and opens. Since Java 9 https://openjdk.org/jeps/261 we have modules, kind of cool but mostly a pain. These make it so Starsector can access code in other modules that are by default closed.
- Add new libs to classpath.
- Add the agent: -javaagent:agent.jar
- Does enable the new ZGC, -XX:+UseZGC -XX:+ZGenerational
- Add -Djava.util.Arrays.useLegacyMergeSort=true since there appear to be a few of Starsector's comparators are not appropriately transitive (a > b, b > c, therefore a > c) this breaks the newer TimSort in java.
- Min/Max memory set to 4G. This was fine for me but will greatly vary for people depending on mods used.