It currently works on JavaFx and web page. Using canvas on both platforms. See Scala Docs and See Scala Docs for JavaScript target.")
The Strategy games was the original motivation for the project, but the geometry and graphics library have far wider applicability. The geometry and graphics are far more developed, while the tiling and strategy games are still in a far more experimental stage. This is in accordance with the original vision, part of which was to explore the possibilities of an Algebra of Tiling.
I would welcome input from developers with greater experience and knowledge than my own. One of the goals of the project is to explore, where it is best to compose with trait / class inheritance and where to use functions. When to use mutation and when to use immutability. When to use smart, garbage collected heap based objects and when to use dumb data values. Balancing the competing priorities of elegance, succinctness, readability, run-time performance, compile time performance and accessibility for inexperienced programmers. I feel Scala is, and in particular Scala 3 will be the ideal language to explore these questions.
Scala currently set to 3.4.2. Jdk 11+, 21 preferred. Scala.Js set to 1.16.0. Scala native set to 0.4.16. Sbt currently set to 1.10.1 (uses the openstrat.sbt file). Note(probably due to the JavaFx dependency). Sbt will not work running on Windows in Git Bash. Update your Mill to 0.11.6.
sbt
in bash from project's root folder.~ DevFx/reStart
To launch a ScalaFx window. The most useful command for development.
~ DicelessJs/fastOptJS
To rebuild a fast optimised JavaScript file. Use with Dev/DevPages/DicelessSbtFast.html
DicelessJs/fullOptJS
To build a full optimised JavaScript file. Use with Dev/DevPages/DicelessSbtFull.html
~ Util/test
Rerun tests on Util module.
~ Tiling/test
Rerun tests on Tiling module.
~ Dev/test
Rerun tests on, Dev module.
~ Util/test; Tiling/test; Dev/test
Rerun tests on Util module.
DocMain/doc
Will produce docs for all the main code in all the modules for the Jvm platform. They can be found in Dev/SbtDir/DocMain/target/scala-3.4.0/api/
DocJs/doc
Will produce docs for all the main code in all the modules for the Javascript platform. They can be found in Dev/SbtDir/DocJs/target/DocMain/target/scala-3.4.0/api/
bothDoc
Will perform both the above tasks.
The tilde ~
tells sbt to rerun the command every time you modify and save a source file. The first command will build and launch a
ScalaFx window. It will rebuild and relaunch so you can immediately see the effects of your changes.Copy the Dev/Misc/DevSettings.rson
file to the Dev/User
folder. Creating the directory and its parents if
not already existing. Change the appStr setting in Dev/User/DevSettings.rson
to change the application. All the
examples on the richstrat.com website are available plus others.The second command will also rebuild on source changes in similar manner. However
unlike with the reStart command, when you make a source file edit and save it, you will have to manually refresh the browser window after the
fastOptJS command has finished the rebuild.
project AppsJs
set Compile/unmanagedSourceDirectories += (ThisBuild/baseDirectory).value / "EGrid/JsAppsSrc/EG1300App";
set Compile/mainClass:= Some("ostrat.pSJs.EG1300AppJs")
set Compile/unmanagedSourceDirectories += (ThisBuild/baseDirectory).value / "EGrid/JsAppsSrc/EG1000App";
set Compile/mainClass:= Some("ostrat.pSJs.EG1000AppJs")
set Compile/unmanagedSourceDirectories += (ThisBuild/baseDirectory).value / "EGrid/JsAppsSrc/EG640App";
set Compile/mainClass:= Some("ostrat.pSJs.EG640AppJs")
set Compile/unmanagedSourceDirectories += (ThisBuild/baseDirectory).value / "EGrid/JsAppsSrc/EG460App";
set Compile/mainClass:= Some("ostrat.pSJs.EG460AppJs")
set Compile/unmanagedSourceDirectories += (ThisBuild/baseDirectory).value / "EGrid/JsAppsSrc/EG320App";
set Compile/mainClass:= Some("ostrat.pSJs.EG320AppJs")
set Compile/unmanagedSourceDirectories += (ThisBuild/baseDirectory).value / "EGrid/JsAppsSrc/EG220Europe";
set Compile/mainClass:= Some("ostrat.pSJs.EG220EuropeJs")
set Compile/unmanagedSourceDirectories += (ThisBuild/baseDirectory).value / "EGrid/JsAppsSrc/EG220EuropeWide";
set Compile/mainClass:= Some("ostrat.pSJs.EG220EuropeWideJs")
set Compile/unmanagedSourceDirectories += (ThisBuild/baseDirectory).value / "EGrid/JsAppsSrc/EG220NAmerica";
set Compile/mainClass:= Some("ostrat.pSJs.EG220NAmericaJs")
set Compile/unmanagedSourceDirectories += (ThisBuild/baseDirectory).value / "EGrid/JsAppsSrc/EG160Europe";
set Compile/mainClass:= Some("ostrat.pSJs.EG160EuropeJs")
set Compile/unmanagedSourceDirectories += (ThisBuild/baseDirectory).value / "EGrid/JsAppsSrc/EG160Europe";
set Compile/mainClass:= Some("ostrat.pSJs.EG160EuropeJs")
set Compile/unmanagedSourceDirectories += (ThisBuild/baseDirectory).value / "EGrid/JsAppsSrc/EG120Europe";
set Compile/mainClass:= Some("ostrat.pSJs.EG120EuropeJs")
set Compile/unmanagedSourceDirectories += (ThisBuild/baseDirectory).value / "EGrid/JsAppsSrc/EG80Europe";
set Compile/mainClass:= Some("ostrat.pSJs.EG80EuropeJs")
set Compile/unmanagedSourceDirectories += (ThisBuild/baseDirectory).value / "EGrid/JsAppsSrc/EarthApp";
set Compile/mainClass:= Some("ostrat.pSJs.EarthAppJs")
set Compile/unmanagedSourceDirectories += (ThisBuild/baseDirectory).value / "Apps/JsAppsSrc/DicelessApp";
set Compile/mainClass:= Some("ostrat.pSJs.DicelessAppJs")
set Compile/unmanagedSourceDirectories += (ThisBuild/baseDirectory).value / "Apps/JsAppsSrc/UnitLocApp";
set Compile/mainClass:= Some("ostrat.pSJs.UnitLocAppJs")
set Compile/unmanagedSourceDirectories += (ThisBuild/baseDirectory).value / "Apps/JsAppsSrc/BC305App";
set Compile/mainClass:= Some("ostrat.pSJs.BC305AppJs")
set Compile/unmanagedSourceDirectories += (ThisBuild/baseDirectory).value / "Apps/JsAppsSrc/GlApp"
set Compile/unmanagedSourceDirectories += (ThisBuild/baseDirectory).value / "Apps/JsAppsSrc/ZugApp";
set Compile/mainClass:= Some("ostrat.pSJs.ZugAppJs")
set Compile/unmanagedSourceDirectories += (ThisBuild/baseDirectory).value / "Apps/JsAppsSrc/WW1App";
set Compile/mainClass:= Some("ostrat.pSJs.WW1AppJs")
set Compile/unmanagedSourceDirectories += (ThisBuild/baseDirectory).value / "Apps/JsAppsSrc/WW2App";
set Compile/mainClass:= Some("ostrat.pSJs.WW2AppJs")
set Compile/unmanagedSourceDirectories += (ThisBuild/baseDirectory).value / "Apps/JsAppsSrc/IndRevApp";
set Compile/mainClass:= Some("ostrat.pSJs.IndRevAppJs")
set Compile/unmanagedSourceDirectories += (ThisBuild/baseDirectory).value / "Apps/JsAppsSrc/DungeonApp";
set Compile/mainClass:= Some("ostrat.pSJs.DungeonAppJs")
set Compile/unmanagedSourceDirectories += (ThisBuild/baseDirectory).value / "Apps/JsAppsSrc/SorsApp";
set Compile/mainClass:= Some("ostrat.pSJs.SorsAppJs")
set Compile/unmanagedSourceDirectories += (ThisBuild/baseDirectory).value / "Apps/JsAppsSrc/PericuloApp";
set Compile/mainClass:= Some("ostrat.pSJs.PericuloAppJs")
set Compile/unmanagedSourceDirectories += (ThisBuild/baseDirectory).value / "Apps/JsAppsSrc/Peri2App"
set Compile/unmanagedSourceDirectories += (ThisBuild/baseDirectory).value / "Apps/JsAppsSrc/DiscovApp";
set Compile/mainClass:= Some("ostrat.pSJs.DiscovAppJs")
set Compile/unmanagedSourceDirectories += (ThisBuild/baseDirectory).value / "Apps/JsAppsSrc/PlanetsApp";
set Compile/mainClass:= Some("ostrat.pSJs.PlanetsAppJs")
set Compile/unmanagedSourceDirectories += (ThisBuild/baseDirectory).value / "Apps/JsAppsSrc/FlagsApp";
set Compile/mainClass:= Some("ostrat.pSJs.FlagsAppJs")
set Compile/unmanagedSourceDirectories += (ThisBuild/baseDirectory).value / "Apps/JsAppsSrc/CivRiseApp";
set Compile/mainClass:= Some("ostrat.pSJs.CivRiseAppJs")
set Compile/unmanagedSourceDirectories += (ThisBuild/baseDirectory).value / "Apps/JsAppsSrc/ChessApp";
set Compile/mainClass:= Some("ostrat.pSJs.ChessApp")
So at least recent versions of Kubuntu the java command on the path, is at /usr/bin/java
. It is a link to /etc/alternatives/java
. This is also a link. To install a different java, install the JDK root folder in usr/lib/jvm
. It doesn't have to be here, but it makes it easier to go with convention. Run
sudo
update-alternatives --config java
In my example this gives
Selection | Path | Priority | Status |
---|---|---|---|
0 | /usr/lib/jvm/java-11-openjdk-amd64/bin/java | 1111 | auto mode |
1 | /usr/lib/jvm/java-11-openjdk-amd64/bin/java | 1111 | manual mode |
2 | /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java | 1081 | manual mode |
So leave the number as it is, then add to alternatives. I put the number 3 at then end because in my case slots 0 to 2 are already taken.
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.8.0_212/bin/java 3
then repeat
sudo update-alternatives --config java