codecodeon github< text x="62" y="14">on github   chatchat on gitteron gitter
This project has 2 main focuses:

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 expermiental stage. This is in accordance with the original vision, part of which was to explore the possiblites of an Algebra of Tiling. Out of the needs of these 2 primary focuses, 2 secondary focuses have developed. If you are new to programming then just ignore these for the time being.

It currently works on JavaFx and web page. Using canvas on both platforms. See Scala Docs and See Scala Docs for JavaScript target.

This project is intended to be accessible and welcoming to programmers of all levels. Indeed it is intended as a vehicle for complete beginners to learn programming in a fun environment. To be able to begin by what for most games would be described as modding and then move down into programming as deep as they wish to go, at the pace they wish to. I want to break down the wall between modding and coding. So if you're new to programming and want to get involved, drop into the gitter channel and say hi. If you are not experienced with Scala, you have found this site and want to experiment, you will need to install Java JDK8 and sbt. more complete documentation for getting started on Linux / Windows / Mac will come later. The basic build has been tested on Linux and Windows 7. Jdk 11 preferred.

However at the other end, 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.1.0. Jdk 11+, 11 prefered. Scala.Js set to 1.8.0. Sbt currently set to 1.6.1 (uses the build.sbt file). Note (probably due to the JavaFx dependency). Sbt will not work running on Windows in Git Bash. Update your Mill to 0.9.11.

Run sbt in bash from project's root folder

From within the sbt console run:

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 DevSettings.rson file from the Dev/Misc folder to the Dev/User folder. Creating the directory and its parents if not already existing. Change the appStr setting in DevSettings.rson to change the application. All the examples on the 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.

So I'm experimenting with Mill from the project root folder run: mill run To launch a ScalaFx window.
mill -w run As above but mill will rebuild and relaunch the ScalaFx window when ever you save changes to source code. The most useful command for development.
mill test To run tests.
mill -w test To recompile and rerun the tests on source code changes.
mill -w Dev.runMain ostrat.pFx.App3D Temp command
mill -w jsfast To rebuild the fast optimised Js file. Use with WebPages/MillFastDev.html
mill jsfull To build the fully optimised Js file. Use with WebPages/MillFullDev.html
mill mill.scalalib.GenIdea/idea To create an IntelliJ IDEA project.

The Code is currently organised into 4 modules. Each module can be build artifacts for Jvm and JavaFx and for the JavaScript platform and the Web. Modules can be built for Scala-Native, but code, notably hanging commas may break the Scala-Native build as ScalaNative is still on Scala 2.11.

  1. Util Module organised into the following packages: Organised into the following folders and packages:
    • ostrat The root package. All other packages depend on this.
      • 32 bit Int based Colours.
      • A persistence framework. Succinct readable object notation. Save files in Dev/mine folder.
      • A functional Either based Errors framework.
      • Immutable Array based collection system inlcuding flat Array[Int] and Array[double] based compound value collections of same length elements, to overcome the performance deficencies of the Java and JavaScript platforms, with a view to maximising common code for future Scala Native and Scala Web assembly platforms.
      • 3 simple macros, that print the source code location to help with debugging and development, in the srcMacros folder. They are a separate unit of compilation for sbt /mill. It is a sub module of the this module inr Mill, but for Sbt it is a sub-project on the same level as Util.
      • Other general utilities.
    • ostrat.parse The code for parsing RSON, Rich Succinct Object Notation.
    • ostrat.pWeb Code for the generation and manipulation of
      • HTML
      • Other XML
      • CSS
      • Simple JavaScript
  2. Geom Module Depends on Util, organised into the following packages Organised into the following folders and packages:
    • ostrat.geom A pure or near pure functional package.
      • Basic geometry.
      • A number of implementation Value classes of the Int and Double product classes defined in ostrat.
      • 2d graphical objects for generalised use. They are of particular use for the generic canvas based classes defined in pCanv but can be used in any display framework and for printing.
    • ostrat.pCanv depends on geom. This could be made into a separate module, but I don't see any great advantage.
      • Abstract canvas and classes for placing objects on that abstract canvas.
      • classes for the manipulation and display of maps.
      • Mouse and other abstract controls.
      • An implementation of Canvas for Jvm using JavaFx.
      • An implementation of Canvas for Html Canvas using JavaScript.
      • There is no implementation for Native yet. I'm waiting for Scala-native to get up on 2.12 before experimenting. Running a game server in native should pose no problems. However there is no easily accessible canvas for native on Windows or Linux. The abstract canvas api could be implemented on DirectX or OpenGL, but this would require significantly more work than for the ScalaFx canvas or the Html Canvas.
    • ostrat.p3d Currently just a stub. I have included it because 3d is the preferred GUI. I have started with 2d, just because 3d development is highly time consuming and I want to focus on game play and what might might be described as the algebra of tiling. There is no "physics engine", although there is time and distance and other basic mechanics maths will probably be included later. I prefer 3d graphics, but as we are dealing with animations not a "physics engine", 2d and 3d are completely interchangeable. There will also be a command line interface. This will be the canonical interface, although it obviously won't be the normal user interface.
  3. Tiling Module Depends on UtilMacros Util and Graphic, just has the ostrat.pGrid package depends on geom and pCanv.
    • Abstract regular tile geometry.
    • Square and hex tile grid geometry.
    • OfTile classes for the display of tiles.
  4. Earth Module This package and module is for Earth maps. In particular the tiling of the whole world in Hex grids, defining the changes over the course of history. This will be a data orientated module. It will also include terrain types to model terrain, both real and imagined for local maps and higher scales right up to 0.5 metres per tile However it won't generally include the data for these. The data for the real world will be organised according to a number of levels, which are likely to change over increasingly shorter historical time frames.
    • ostrat.pEarth depends on geom, pCanv and pGrid
      • Earth and sphere geometry.
      • Grids of Earth terrain.
    • ostrat.pEarth.pPts large irregular Earth terrain areas. This is mainly a development aid.
  5. Dev Module The Module as a whole Depends on all the other modules, although its constiurent parts may not. This module is for the use of developer tools and settings and for end-user applications, that may eventually end up in their own repositaries. Unlike the other modules this module has no examples sub modules. The eaxmples in the other modules, should be just that example codes to explain, illustrate provide tutorials, and to some extent test the modules core code. The examples should not include apps that have nay use in and of themsleves. Those apps belong in the Dev module.
    • User folder contains developer settings
    • Developer html pages, linked to sbt target and Mill out folder artifacts.
    • Documentation web pages.
    • Collates the lessons in the examples folders from Util, Graphic, World and Strat. This is a number of series of lessons for beginners to Scala, complete beginners to programming and beginners in geometry, using the graphical API. These lessons are published separately as the LearnScala project.
    • A number of rudimentary games and applications depending on some or all of the above packages. The intention is to factor out common functionality and classes.
      • ostrat.pWW2 A grand strategy world War 2 game, using the hex tiled world terrain map.
      • ostrat.p1783 A grand strategy game, also using the world map starting in 1783.
      • ostrat.p305 A grand strategy game set in 305BC, using part of the world map.
      • ostrat.pZug A 20th century squad based strategy game using hex tiles.
      • ostrat.pGames.pCiv A human history 4x development game using hex tiles.
      • ostrat.pGames.pDung A Square tile based dungeon game.
    • ostrat.pStrat depends on geom, pCanv and pGrid and pEarth.
      • Flags
      • DemoCanvas for graphics elements.
      • Odds and ends.
    • ostrat.pCloseOrder. Pre modern close order formation based battles, not using tiles.
    • ostrat.pSpace A solar system app.
    • ostratpChess. A search for an elegant implementation of Draughts and Chess.

The code is organised so if it gains significant traction with other developers, then it can be broken up into separate repositories.

Road Map So currently we now have a 3 month maximum time frame for Github issues, for non urgent issues left as eaily accessible for beginners. Everything will go in the road map, unitl we have time and focus to start implementing.