Progress update 2020-04-15:
Much
earlier in this thread I stated I wanted to expose AI in external config files and allow players to design their own AI to use and to share. So as I develop the AI, I would be doing it via the same external API that anyone else would use, developing the API in parallel with the AI itself.
I've finally gotten around to implementing that vision, and I'm pretty excited to share what I've got so far. The Game Info window has a new Mods button and a red or green message saying whether all mods loaded successfully.
Pressing the Mods button opens up a mod manager:
There is a console log at the top where all mods (and the manager itself) can print text to. Each mod can have multiple scripts for distinct purposes, that each get their own row on the list. The scripting language is
GDScript that is loaded and compiled when the game starts, meaning they have the same capabilities and access as the game itself. A Default mod comes with the game containing two scripts, located in mods/default/library.gd and mods/default/precursors.gd. Each script can report its own name and version number to the mod manager, but the manager also lists the de facto folder and path of the script for clarity. At the bottom left is a single Test button intended only for mod authors to quickly run ad hoc tests on their mods.
The interesting part about the mod manager is that every mod can be configured to be active only when specific criteria are met. The precursors mod can be configured to run for any combination of races, not just Precursors. This is how you would tell each NPR which AI should control it. The options that appear on the menu, and how they function, is controlled by the mod. So other options are possible such as applying AI to NPRs with specific names, or to NPRs at random, to specific games, or even "only on Tuesdays."
Designer Mode is now implemented, but not necessary for developing AI because you can assign the AI mod to Players and watch what it does with your own empire. The Apply To column is only the most basic setting, and typically the only configuration needed, but methods are provided for mods to store more complex configs to the game's database file. This means it is possible to write a mod allowing a player to selectively automate specific tasks.
The mod manager is also available during gameplay via the Quasar4x > Mods menu option. It won't reload mods, but you can change the Apply To settings.
In this build, Precursors are now dynamically generated, including all of their starting tech and ship designs. (In previous builds, precursor tech and designs were just using the same static dump taken from an arbitrary Aurora game.) There is now a chance for wrecks to appear in system generation. There is also a chance for precursors to appear, although they don't move or fire yet. Now that I have tech assignment, ship designs, and the modding framework in place I can start using it to implement precursor moving and shooting.
Edit: Forgot to mention, I added the following options to the SM Random Ruin button, that enable generating some precursors so it's possible to dive right in and mess with an AI race:
Edit #2: Also forgot to mention what the default Precursors mod does right now: It does the same thing Aurora does the subpulse after Precursors are created: Merges battle fleets located in the same location and deletes the empty leftover fleets. Under precisely what criteria? Beats me. But at least it gives a starting example of how exactly AI scripting looks.
I plan to eventually post a tutorial on how to use the modding system for mod authors so I'll try not to go into too much technical detail here. The files included in the mods folder do have a fair amount of documentation already, although don't expect any consistent formatting. Mods that come with the game also include a Godot project file so they can be edited within the Godot IDE which provides syntax highlighting and auto-completion that is even aware of Quasar's own API calls.
Mods can be distributed without the project file and the scene file which are just included for authoring convenience. The .API.gd file is included to get auto-completion to work and to show what methods are available via the api object, and is also not required in a finished mod. A lot can be learned from the 'default' mod folder that comes with the game but there is also an 'example' folder with a mod that can be manually enabled in the included script file. The example mod shows off how the UI can be customized (and my incredible artwork):
The mod demonstrates how to change the image of a button, the background colors for various states of the button, how to resize it, and how to leave certain aspects (the border) intact. The comments in the script contain links to the relevant portions of the Godot documentation to show how a mod author would have learned precisely what functions to call on the button, and thus how they could learn other manipulations not demonstrated by the example mod. The example mod also demonstrates how to list the names of every node in the game so with some effort the author can find the correct UI element they want to modify.
As I mentioned last time, updates will come out much more slowly as I am now in an experimental phase of the project and also have C# to chew on. Version 108 is up on Itch containing the above changes. Hope you enjoyed the read!