This wiki is archived from 2021-09-05

Planetary Annihilation Community Mods Implementation: Difference between revisions

From Planetary Annihilation: TITANS and Classic PA Wiki
Jump to navigation Jump to search
(Created page with "Category:Modding = 50px Planetary Annihilation Titans & Classic Community Mods Manager Implementation = Community Mods is loaded remotely during...")
 
mNo edit summary
 
(30 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[Category:Modding]]
[[Category:Modding]]
= [[File:Titans-icon.png|50px]] Planetary Annihilation Titans & Classic Community Mods Manager Implementation =
= Planetary Annihilation Community Mods Implementation =


Community Mods is loaded remotely during startup.
[[Planetary Annihilation Community Mods Release Notes]]


Files are downloaded and cached for offline use or if the community mods server is temporarily offline.
== Implementation Overview ==


== [[File:platinum-rank-icon.png|50px]] Main Scene ==
Highlights of the implementation are:
 
* community mods menu item is added to start menu to load the community mods scene and in game mod manager
* initial community mods code is loaded remotely during startup in the main scene
* downloaded files are cached for offline use or if the community mods server is temporarily offline
* community mods code is auto updated
* community mods scene has been added to default code and loads from download cache
* community mods hooks have been added to default scenes (see below) which load from downloaded files cache
* mods are mounted from compressed zip archives
* zip mod are hashed using md5 on server and when downloaded
* zip mods auto update based on md5 hashes
* server zip mod mounting is deferred until creating a game that supports server mods
* companion mods are mounted if missing when starting or connecting to a game
* server mods are reset in transit back to start only when needed
* all scenes that load server mods return to start via transit
* client mods are only remounted when necessary
* community mods server does all the heavy lifting to process, validate, summarise, repackage and hash mod zips
 
The following are saved in Indexed DB:
* installed mods
* available mods
* default unit info for current build
 
Mods are currently auto updated during:
* startup in main
* return to start from a game in transit
* return to start from community mods
* activating a mod in community mods
 
== Main Scene ==


The main scene is the parent of the game and uberbar scenes.
The main scene is the parent of the game and uberbar scenes.
Line 12: Line 41:
Community Mods injects into the main scene using hooks in the default code.
Community Mods injects into the main scene using hooks in the default code.


Once loaded remotely or from the download cache the following is started:
Once loaded remotely or from the download cache the following occur:


* delay loading of game and uberbar scenes by clearing panel src
* loading of the game and uberbar scenes is delayed by clearing panel src
* start downloading latest community mods files
* latest community mods files are downloaded (auto update)
* scan for file system mods
* file system is scanned for client and server mods
* merge into installed mods
* file system mods are merged into existing installed mods
* load available mods from community mods server (failing back to local storage if unavailable)
* available mods data is loaded from the community mods server (falling back to local storage if unavailable)
* update active zip mods
* installed file system mods are linked to available mods
* mount client mods
* active zip mods are updated if md5 has changed (auto update)
* load game and uberbar scenes by restoring panel src (or after a 45 second timeout)
* community mods client and server zip mods are downloaded via data url
* active client mods are mounted
* game and uberbar scenes are loaded by restoring their panel src (or after a 45 second timeout)


== [[File:platinum-rank-icon.png|50px]] Start Scene ==
== Start Scene ==


The start scene is the home page for the game panel in the main scene.
The start scene is the home page for the game panel in the main scene.
Line 29: Line 60:
Community Mods injects into the start scene using hooks in the default code.
Community Mods injects into the start scene using hooks in the default code.


Once loaded from the download cache the following is started:
Once loaded from the download cache the following occur:


* hook api.file.unmountAllMemoryFiles to prevent unmounting of memory files
* community mods menu item is added to load community mods scene
* api.file.unmountAllMemoryFiles to hooked to prevent unmounting of memory files
* if return to start and mods not already reset in transit:
* if return to start and mods not already reset in transit:
** hold ready
** hold ready
** reset server mods
** server mods are reset
** mount client mods
** active client mods are remounted
** release ready
** ready is released
 
== Connect to Game Scene ==
 
The connect to game scene manages starting and joining games.
 
Community Mods injects into the connect to game scene using hooks in the default code.
 
Once loaded from the download cache the following occur:
 
* server mods reset required is flagged if joining, hosting or replaying a game that can mount server mods ie not Galactic War or ranked
* api.net.startGame is hooked to mount transient companion mods and server mods for non Galactic War or ranked games
* api.net.connect is hooked to mount transient companion mods and server mods when joining a waiting custom server
* navToDestination is replaced to wait for server mods to mount
 
== Transit Scene ==
 
The transit scene display messages when returning to the start and other scenes.
 
Community Mods injects into the transit scene using hooks in the default code.
 
Once loaded from the download cache the following occur:
 
* ff returning to start:
* latest community mods files are downloaded (auto update)
* and if server mods need reset:
** server mods are reset
** active zip mods are updated if md5 has changed (auto update)
** community mods client and server zip mods are downloaded via data url
** client mods are remounted
** navigation continues to start
 
== Galactic War Play Scene and Referee ==
 
The play scene and referee manage memory mounting of the unit specs for various loadouts and technology discovered.
 
Community Mods injects into the Galactic War play scene and referee using hooks in the default code.
 
Once loaded from the download cache the following occur:
 
* api.file.unmountAllMemoryFiles to hooked to remount client mods
 
== Community Mods Scene ==
 
The community mods scene is the new in game mod manager.
 
Once loaded from the download cache the following occur:
 
* community mods html is injected into the default community mods scene
* latest community mods files are downloaded (auto update)
* available mods data is loaded from the community mods server (falling back to local storage if unavailable)
 
On returning back to previous scene:
 
* active zip mods are updated if md5 has changed (auto update)
* community mods client and server zip mods are downloaded via data url
* client mods are remounted
* uberbar is reloaded if required
 
== Community Mods Manager ==
 
The community mods manager provides core functionality to manage mounting, resetting and updating mods in the various scenes.
 
* resetServerMods
* mountServerMods
* remountClientMods
* updateActiveZipMods( remountClientMods:boolean, downloadServerModZip:boolean )
 
In the community mods scene the manager provide functionality to install, enable, activate (install + enable), disable and uninstall mods with dependency tracking.

Latest revision as of 11:12, 9 September 2021

Planetary Annihilation Community Mods Implementation

Planetary Annihilation Community Mods Release Notes

Implementation Overview

Highlights of the implementation are:

  • community mods menu item is added to start menu to load the community mods scene and in game mod manager
  • initial community mods code is loaded remotely during startup in the main scene
  • downloaded files are cached for offline use or if the community mods server is temporarily offline
  • community mods code is auto updated
  • community mods scene has been added to default code and loads from download cache
  • community mods hooks have been added to default scenes (see below) which load from downloaded files cache
  • mods are mounted from compressed zip archives
  • zip mod are hashed using md5 on server and when downloaded
  • zip mods auto update based on md5 hashes
  • server zip mod mounting is deferred until creating a game that supports server mods
  • companion mods are mounted if missing when starting or connecting to a game
  • server mods are reset in transit back to start only when needed
  • all scenes that load server mods return to start via transit
  • client mods are only remounted when necessary
  • community mods server does all the heavy lifting to process, validate, summarise, repackage and hash mod zips

The following are saved in Indexed DB:

  • installed mods
  • available mods
  • default unit info for current build

Mods are currently auto updated during:

  • startup in main
  • return to start from a game in transit
  • return to start from community mods
  • activating a mod in community mods

Main Scene

The main scene is the parent of the game and uberbar scenes.

Community Mods injects into the main scene using hooks in the default code.

Once loaded remotely or from the download cache the following occur:

  • loading of the game and uberbar scenes is delayed by clearing panel src
  • latest community mods files are downloaded (auto update)
  • file system is scanned for client and server mods
  • file system mods are merged into existing installed mods
  • available mods data is loaded from the community mods server (falling back to local storage if unavailable)
  • installed file system mods are linked to available mods
  • active zip mods are updated if md5 has changed (auto update)
  • community mods client and server zip mods are downloaded via data url
  • active client mods are mounted
  • game and uberbar scenes are loaded by restoring their panel src (or after a 45 second timeout)

Start Scene

The start scene is the home page for the game panel in the main scene.

Community Mods injects into the start scene using hooks in the default code.

Once loaded from the download cache the following occur:

  • community mods menu item is added to load community mods scene
  • api.file.unmountAllMemoryFiles to hooked to prevent unmounting of memory files
  • if return to start and mods not already reset in transit:
    • hold ready
    • server mods are reset
    • active client mods are remounted
    • ready is released

Connect to Game Scene

The connect to game scene manages starting and joining games.

Community Mods injects into the connect to game scene using hooks in the default code.

Once loaded from the download cache the following occur:

  • server mods reset required is flagged if joining, hosting or replaying a game that can mount server mods ie not Galactic War or ranked
  • api.net.startGame is hooked to mount transient companion mods and server mods for non Galactic War or ranked games
  • api.net.connect is hooked to mount transient companion mods and server mods when joining a waiting custom server
  • navToDestination is replaced to wait for server mods to mount

Transit Scene

The transit scene display messages when returning to the start and other scenes.

Community Mods injects into the transit scene using hooks in the default code.

Once loaded from the download cache the following occur:

  • ff returning to start:
  • latest community mods files are downloaded (auto update)
  • and if server mods need reset:
    • server mods are reset
    • active zip mods are updated if md5 has changed (auto update)
    • community mods client and server zip mods are downloaded via data url
    • client mods are remounted
    • navigation continues to start

Galactic War Play Scene and Referee

The play scene and referee manage memory mounting of the unit specs for various loadouts and technology discovered.

Community Mods injects into the Galactic War play scene and referee using hooks in the default code.

Once loaded from the download cache the following occur:

  • api.file.unmountAllMemoryFiles to hooked to remount client mods

Community Mods Scene

The community mods scene is the new in game mod manager.

Once loaded from the download cache the following occur:

  • community mods html is injected into the default community mods scene
  • latest community mods files are downloaded (auto update)
  • available mods data is loaded from the community mods server (falling back to local storage if unavailable)

On returning back to previous scene:

  • active zip mods are updated if md5 has changed (auto update)
  • community mods client and server zip mods are downloaded via data url
  • client mods are remounted
  • uberbar is reloaded if required

Community Mods Manager

The community mods manager provides core functionality to manage mounting, resetting and updating mods in the various scenes.

  • resetServerMods
  • mountServerMods
  • remountClientMods
  • updateActiveZipMods( remountClientMods:boolean, downloadServerModZip:boolean )

In the community mods scene the manager provide functionality to install, enable, activate (install + enable), disable and uninstall mods with dependency tracking.