Hi everyone,
TheJesser on Discord gave me an idea of "addon missions" for existing terrains, a kind of new mod type which would add scenarios to existing terrains: https://discord.com/channels/136544456244461568/189904947649708032/1071847722128244916. After a quick chat, we made a rough design:
What do you think?
TheJesser on Discord gave me an idea of "addon missions" for existing terrains, a kind of new mod type which would add scenarios to existing terrains: https://discord.com/channels/136544456244461568/189904947649708032/1071847722128244916. After a quick chat, we made a rough design:
- Introduce a new mod type, 'missionzip' - works the same as 'skinzip' (download from repository, regen cache, load using selector UI) except it would add a scenario to terrain.
- Each missionzip would contain one or more '*.mission' files - these would be similar to TOBJ in syntax and could be also bundled directly in the terrain ZIP (same as .skin files can be directly in the vehicle ZIP)
- To load a mission, load a terrain and go to Top Menubar, Simulation menu -> 'Load mission' which opens Selector UI with list of missions for that terrain.
- To see list of loaded missions with progress info, Top Menubar will contain new menu 'Missions', similar to actor list.
- Integration with our races system - a race is definitely a type of mission. The race script is pretty flexible so I can build on top of it.
- No scripting knowledge required - you should only need scripting if you want it, but the simple scenarios should be just data-driven.
- Extensibility via scripting - Everything possible via the mission system must also be possible via scripting, so that modders can create scenarios beyond what the .mission fileformat offers at any time. Ideally, the whole mission execution should be driven by a built-in script, with the possibility of modder overriding it.
- Possibility to edit scenarios in-game using a script, similar to the road editor - This was requested on GitHub https://github.com/RigsOfRods/rigs-of-rods/issues/3011 and also makes complete sense. Given the "no scripting" requirement above, this means even the races need to get some definition file, because currently you need to define them directly in code (see the generator page CuriousMike kindly ported and documented: https://docs.rigsofrods.org/terrain-creation/race-generator/). Even if an editor script could read them from code, it couldn't save them back to code.
- User places the .missionzip to mods directory, either by RepoUI download or by download from browser.
- Modcache updates and enlists the missions.
- When player wants to load mission, the SelectorUI will open in 'LT_Mission' mode using the 'guid:<the terrain GUID>' search method, listing only missions for current terrain. Like skinzips, missions won't work if terrain has no GUID.
- Once mission is selected, game will execute a script to prepare it - either a script attached to the mission, or built-in script 'mission_default.as' if there is none. This is inspired by terrain scripts - if there are none defined in .terrn2 [Scripts] section, game executes 'default.as'.
- The 'mission_default.as' script will use the `GenericDocument` API to load and read the .mission file, and then existing scripting (including the race system) to prepare the scenario.
- From this point it's scripting as usual.
What do you think?