Giter Club home page Giter Club logo

pulsar-mod-loader's Introduction

Build Status Download Wiki Discord

Injects a basic mod loader into PULSAR: Lost Colony.

Installation

Before running ensure your Pulsar installation is a Mono build. On Steam you can change this by right clicking Pulsar: lost colony in your steam library and selecting [properties > betas > mono].

image

On Excecution PulsarModLoaderInstaller.exe will attempt to patch the Steam version of the game in after detecting Steam from it's default install location. To patch a PULSAR installation in another location (non-Steam version, copy of client, etc), simply specify the path to Assembly-CSharp.dll as shown below.

.\PulsarModLoaderInstaller.exe [Path\To\Pulsar\PULSAR_LostColony_Data\Managed\Assembly-CSharp.dll]

Additionally, if the steam installation is not selected/viable an OpenFileDialogue will pop up for windows users asking for the installation location.

Afterwards, add mods to the PULSARLostColony\Mods directory and run PULSAR normally. PulsarModLoaderInstaller.exe is not needed after this.

Removal

Use Steam's Verify Integrity of Game Files option to restore any modified files with minimal download.

Non-Steam users can attempt to rename Assembly-CSharp.dll.bak to Assembly-CSharp.dll, assuming no official patches were released since it was last generated. Otherwise, restore a clean copy from the official non-Steam download.

Optionally remove PulsarModLoader.dll and Assembly-CSharp.dll.bak from PULSARLostColony\PULSAR_LostColony_Data\Managed, and the Mods directory from PULSARLostColony

Creating Mods

Check out the wiki for basic instructions on creating mods.

pulsar-mod-loader's People

Contributors

18107 avatar andrianoturner avatar badryuner avatar dragonfire47 avatar flpydsk avatar pokegustavor avatar tomrichter avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

pulsar-mod-loader's Issues

PPL breaks region switching

PPL breaks switching Photon regions, requiring a switch and restart to see the new game list. This is likely due to modifications to the version string. Changing how version strings are handled should fix both issues.

F5 ModManager improvements

ModManager has a number of UI issues.
-Users are able click buttons behind GUI, which means the user has to move the manager around to avoid unintentional button clicking.
-Users must manually unlock the mouse when interacting with the GUI. Should have an option for toggling so users can keep the menu up while playing.
-deselecting text input fields is unintuitive, right click seems to be the best method.

Handle Failed Plugin Loading

Plugins that fail to load currently soft crash the game. This isn't too graceful, although it's been necessary to leave it this way since we haven't had a way to display broken plugins in game.

When a plugin fails to load, it should be handled such that other plugins and the game can still continue. The exception should still be displayed in the log. Additionally, an in game message should appear that states which plugins have failed in total.

Cannot seem to join a game when the host is running PML

I have just taken the time to delete every mod I'm running one by one and hosted a server with the same mods as the joining client each time, and yet still cannot join. Now if I'm running PML but the host is not, I can join. I am getting some sort of error which I think may be the cause of this. Started happening after the latest Pulsar update.

Full logs:
Joining-Side log

Host-Side log

Debug Readout throws exceptions in Main Menu

The debug readout throws exceptions while in the main menu after quitting a game, although they won't be visible until joining a new game.

Steps:

  1. Join a game and enable debug readout.
  2. Exit game to main menu.
  3. Join another game without closing the actual program.
  4. Note the exception spam fading out on the left.

Improve Content API and etc.

Some features are not implemented correctly:

  • CaptainChar: implemented as ComponentModBase, so you can't change the appearance of the chair. (Suggestion: implement how TurretMod is implemented)
  • For some components, not all method overloads work due to missing patches.

Suggestions for new content features:

  • QuestAPI or MissionsAPI.
  • ShopAPI (for exampel: IShopItem interface; implements a method similar to "OnNewShopCreated(Shop shop, Sector sector)" that allows you to manually add items to the shop. Or add a spawn chance property and store type to the interface.)
  • DialogAPI for ships
  • DialogAPI for pawns
  • CreaturesAPI (maybe, if possible)
  • Pawn Appearance API
  • Translation API

Other Suggestions:

  • Fix-patch for one bool method in SteamVR api (Creates boolean (false) many times if you don't have VR. For 1 hour of play, it creates them for 1 gigabyte +_+) (Solution: prefix override patch with "return false")
  • Move the start PML method to Awake and add an attribute to it that will tell Unity that this Awake should be called first.

Remove build number on PML Version.

0.11.0.24
0.11.1.25

Generally when referring to PML versions, we use the first 3 numbers to differentiate the version. I am not aware of any case where we use the build number, so we should consider not including it in the PML version.

Wiki refers to Plugins, predating the rename to Mods

Wiki pages appear to be written against old versions of pulsar-mod-loader

For example, this page refers to PulsarPlugin instead of PulsarMod
https://github.com/PULSAR-Modders/pulsar-mod-loader/wiki/Creating-Plugins

This page talks about copying mods into <game dir>/PULSAR_LostColony_Data/Managed/Plugins, but they should go into <game dir>/Mods
https://github.com/PULSAR-Modders/pulsar-mod-loader/wiki/Visual-Studio-Tips

Some of the wiki's information is replicated in the README. so one of the two duplicates could be removed. The page about configuring .csproj, however, is not duplicated in the README. I found it useful, so I think it should be preserved somewhere, whether in the wiki or README or elsewhere.

Improve Clean Backup Logic

PPL tries to store a clean backup of assemblies it modifies and restores them before patching to avoid repeated file verification + downloading. But as @18107 points out, this will fail subtlely and miserably in scenarios like official patches or plugin developers accidentally contaminating their DLLs before running PPL (thus contaminating the backup).

The backup logic needs to be improved to automatically delete the backup and start fresh after an official patch. See below for implementation strategy.

PPL Logging Writes to Folder Without Permissions

PPL's own log file path is resolving to folders that may not be writable due to OS permissions (e.g., Program Files subfolders). Find a way to redirect it to a writable folder (AppData?) that makes sense.

IOException: Sharing violation on path C:\Program Files (x86)\Steam\steamapps\common\PULSARLostColony\PULSAR_LostColony_Data\Managed\Log.txt
  at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) [0x00000] in <filename unknown>:0 
  at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share) [0x00000] in <filename unknown>:0 
  at System.IO.StreamWriter..ctor (System.String path, Boolean append, System.Text.Encoding encoding, Int32 bufferSize) [0x00000] in <filename unknown>:0 
  at System.IO.StreamWriter..ctor (System.String path, Boolean append) [0x00000] in <filename unknown>:0 
  at PulsarPluginLoader.Utils.Logger..cctor () [0x00000] in <filename unknown>:0 
Rethrow as TypeInitializationException: An exception was thrown by the type initializer for PulsarPluginLoader.Utils.Logger
at PulsarPluginLoader.PluginManager..ctor () <IL 0x00033, 0x000ed>
at PulsarPluginLoader.PluginManager.get_Instance () <IL 0x0000e, 0x0008f>
at PulsarPluginLoader.Patches.LoadPlugins.Prefix () <IL 0x00028, 0x000d4>
at (wrapper dynamic-method) PLGlobal.Start_Patch1 (object) <IL 0x00000, 0x0001c>

List Plugins In-Game

The list of active plugins should be displayed in game, alongside all the plugin metadata. Place a button for this list on the main menu and possibly escape menu. Make sure the URLs are clickable.

The README file does not mention the mono branch

The most common issue with new players installing mods is forgetting or not knowing about switching to the mono branch of Pulsar. It could be helpful to include information about this in the README file.

Log Bootstrapper output to disk

PPL Bootstrapper has sufficient logging, but it doesn't write to disk. This is a pain when the program crashes and wasn't run from the command line, since all the logs disappear forever and it may appear to have run correctly.

dnSpy vs dnSpyEx

dnSpy is archived and unmaintained.
https://github.com/dnSpy/dnSpy/

I see that there is another project, dnSpyEx, that aims to continue maintenance and release new versions.
https://github.com/dnSpyEx/dnSpy

Do Pulsar modders use one or the other? Are there any reasons to prefer one or the other, perhaps because dnSpyEx removed an important feature, or because dnSpy already does everything you need and so there is no reason to upgrade?

Mark Modded Games in Lobby

Modded games announce themselves through Photon Properties as isModded. The game lobby should use this property to identify modded games, similar to the Discord game list bot. Look at how the lock icon is added for inspiration.

Add notification to switch to Mono during installation

New PML users miss outside installation instructions to switch the game branch, and fill up support channels with questions on this one topic. Providing a notification that this is their issue should reduce such questions.

Move lib assemblies to NuGet Feed

References to PULSAR assemblies are required to build PPL and subsequent plugins, but manually including them in the repository is error prone and wasteful. Instead, create a private NuGet feed containing all PULSAR assemblies for easy reference and restoration by other developers and auto build systems.

Display Debug Info

Create a display for extra debug info, such as position or map ID. Make it toggleable to avoid clutter. Check PPL version string append for an example of adding to the in game UI.

Display Exception Notification in game

The game captures all exceptions for logging, but often continues as if nothing happened even after catastrophic failures. Display notifications of an exception in game to better alert plugin developers that something broke and roughly what gameplay caused it. Instead of showing the full exception, show an ID that can be used to search the logs for the exact event.

Installer crashes on Linux

The installer crashes immediately on Linux without a crash log.

Steps to reproduce:

  1. Download PulsarModLoaderInstaller-0.11.1.25-6159078.zip
  2. Extract all contents to an empty folder
  3. Open a terminal in that location and run mono PulsarModLoaderInstaller.exe

Result:

$ mono PulsarModLoaderInstaller.exe

Unhandled Exception:
System.TypeInitializationException: The type initializer for 'PulsarModLoader.PMLConfig' threw an exception. ---> System.TypeInitializationException: The type initializer for 'Valve.Newtonsoft.Json.JsonWriter' threw an exception. ---> System.BadImageFormatException: Could not resolve field token 0x04000358, due to: Could not load type of field 'Valve.Newtonsoft.Json.Utilities.EnumUtils+<>c:<>9__1_0' (1) due to: Could not load file or assembly 'System.Runtime.Serialization, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. assembly:/home/18107/Downloads/PML/Valve.Newtonsoft.Json.dll type:<>c member:(null)
  at Valve.Newtonsoft.Json.JsonWriter.BuildStateArray () [0x0001b] in <2c5310964c4c487abfe73911114a8b49>:0 
  at Valve.Newtonsoft.Json.JsonWriter..cctor () [0x001bc] in <2c5310964c4c487abfe73911114a8b49>:0 
   --- End of inner exception stack trace ---
  at Valve.Newtonsoft.Json.Linq.JTokenWriter..ctor () [0x00000] in <2c5310964c4c487abfe73911114a8b49>:0 
  at Valve.Newtonsoft.Json.Linq.JToken.FromObjectInternal (System.Object o, Valve.Newtonsoft.Json.JsonSerializer jsonSerializer) [0x00016] in <2c5310964c4c487abfe73911114a8b49>:0 
  at Valve.Newtonsoft.Json.Linq.JToken.FromObject (System.Object o) [0x00006] in <2c5310964c4c487abfe73911114a8b49>:0 
  at PulsarModLoader.SaveValueManager.GetValueFor[T] (PulsarModLoader.SaveValue`1[T] saveValue, T default) [0x00067] in <53a71800fe3846058dfd108f34594256>:0 
  at PulsarModLoader.SaveValue`1[T]..ctor (System.String id, UnityEngine.TextAnchor default) [0x00018] in <53a71800fe3846058dfd108f34594256>:0 
  at PulsarModLoader.PMLConfig..cctor () [0x00000] in <53a71800fe3846058dfd108f34594256>:0 
   --- End of inner exception stack trace ---
  at PulsarInjector.Injector.Main (System.String[] args) [0x00026] in <5135491733384d65bb5de5588ed9bde3>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: The type initializer for 'PulsarModLoader.PMLConfig' threw an exception. ---> System.TypeInitializationException: The type initializer for 'Valve.Newtonsoft.Json.JsonWriter' threw an exception. ---> System.BadImageFormatException: Could not resolve field token 0x04000358, due to: Could not load type of field 'Valve.Newtonsoft.Json.Utilities.EnumUtils+<>c:<>9__1_0' (1) due to: Could not load file or assembly 'System.Runtime.Serialization, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. assembly:/home/18107/Downloads/PML/Valve.Newtonsoft.Json.dll type:<>c member:(null)
  at Valve.Newtonsoft.Json.JsonWriter.BuildStateArray () [0x0001b] in <2c5310964c4c487abfe73911114a8b49>:0 
  at Valve.Newtonsoft.Json.JsonWriter..cctor () [0x001bc] in <2c5310964c4c487abfe73911114a8b49>:0 
   --- End of inner exception stack trace ---
  at Valve.Newtonsoft.Json.Linq.JTokenWriter..ctor () [0x00000] in <2c5310964c4c487abfe73911114a8b49>:0 
  at Valve.Newtonsoft.Json.Linq.JToken.FromObjectInternal (System.Object o, Valve.Newtonsoft.Json.JsonSerializer jsonSerializer) [0x00016] in <2c5310964c4c487abfe73911114a8b49>:0 
  at Valve.Newtonsoft.Json.Linq.JToken.FromObject (System.Object o) [0x00006] in <2c5310964c4c487abfe73911114a8b49>:0 
  at PulsarModLoader.SaveValueManager.GetValueFor[T] (PulsarModLoader.SaveValue`1[T] saveValue, T default) [0x00067] in <53a71800fe3846058dfd108f34594256>:0 
  at PulsarModLoader.SaveValue`1[T]..ctor (System.String id, UnityEngine.TextAnchor default) [0x00018] in <53a71800fe3846058dfd108f34594256>:0 
  at PulsarModLoader.PMLConfig..cctor () [0x00000] in <53a71800fe3846058dfd108f34594256>:0 
   --- End of inner exception stack trace ---
  at PulsarInjector.Injector.Main (System.String[] args) [0x00026] in <5135491733384d65bb5de5588ed9bde3>:0

Mark game as modded in PUN metadata

When creating a game with Photon, it's possible to set extra properties for use by the client. PPL should add an isModded flag or similar metadata to help with future management of modded games.

Add Discord link to Main Menu

To make it easier to find us, a Discord link should be added to the main menu. A simple Discord icon styled to look like a button should suffice.

More generally, this should be implemented as a collection of icons/buttons that we can add to in the future. Have it appear in the bottom left corner since that space is dark/contrasting and unused.

Thrusters

I am getting an NRE in logs regarding thrusters (all 3 types) coming from PML, see the errors below. I've also attached a full log if that's needed. NOTE: it appears thrusters added from PML are still functioning, however.

FULL LOG

[PML] Exception ID: C64BDDA
NullReferenceException: Object reference not set to an instance of an object
  at PulsarModLoader.Content.Components.InertiaThruster.InertiaThrusterMod.GetStatLineRight (PLShipComponent InComp) [0x00019] in <f32009a277c84971bdfbcdf2877c3db4>:0 
  at PulsarModLoader.Content.Components.InertiaThruster.RightDescFix.Postfix (PLInertiaThruster __instance, System.String& __result) [0x00041] in <f32009a277c84971bdfbcdf2877c3db4>:0 
  at (wrapper dynamic-method) PLInertiaThruster.PLInertiaThruster.GetStatLineRight_Patch1(PLInertiaThruster)
  at PLTooltipRequest.Draw () [0x0035a] in <54e26eb28c19438f9c2ae141dc7fe68b>:0 
  at PLTooltip.OnGUI () [0x0001f] in <54e26eb28c19438f9c2ae141dc7fe68b>:0 

Uploading Crash Report
[PML] Exception ID: C64D6C1
NullReferenceException: Object reference not set to an instance of an object
  at PulsarModLoader.Content.Components.ManeuverThruster.ManeuverThrusterMod.GetStatLineRight (PLShipComponent InComp) [0x00019] in <f32009a277c84971bdfbcdf2877c3db4>:0 
  at PulsarModLoader.Content.Components.ManeuverThruster.RightDescFix.Postfix (PLManeuverThruster __instance, System.String& __result) [0x00041] in <f32009a277c84971bdfbcdf2877c3db4>:0 
  at (wrapper dynamic-method) PLManeuverThruster.PLManeuverThruster.GetStatLineRight_Patch1(PLManeuverThruster)
  at PLTooltipRequest.Draw () [0x0035a] in <54e26eb28c19438f9c2ae141dc7fe68b>:0 
  at PLTooltip.OnGUI () [0x0001f] in <54e26eb28c19438f9c2ae141dc7fe68b>:0 

Uploading Crash Report
[PML] Exception ID: C640A00
NullReferenceException: Object reference not set to an instance of an object
  at PulsarModLoader.Content.Components.Thruster.ThrusterMod.GetStatLineRight (PLShipComponent InComp) [0x00019] in <f32009a277c84971bdfbcdf2877c3db4>:0 
  at PulsarModLoader.Content.Components.Thruster.RightDescFix.Postfix (PLThruster __instance, System.String& __result) [0x00041] in <f32009a277c84971bdfbcdf2877c3db4>:0 
  at (wrapper dynamic-method) PLThruster.PLThruster.GetStatLineRight_Patch1(PLThruster)
  at PLTooltipRequest.Draw () [0x0035a] in <54e26eb28c19438f9c2ae141dc7fe68b>:0 
  at PLTooltip.OnGUI () [0x0001f] in <54e26eb28c19438f9c2ae141dc7fe68b>:0 

Document Existing Code

Most of PPL is lacking docstrings, making intellisense tooltips useless. Write docstrings for at least every public function to reduce wasted plugin developer time and keep us sane in the future.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.