This wiki is archived from 2021-09-05

Planetary Annihilation Community Mods Implementation

From Planetary Annihilation: TITANS and Classic PA Wiki
Revision as of 11:12, 9 September 2021 by Admin (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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.