-
Content Count
51 -
Joined
-
Last Visited
Community Reputation
11 FavourableAbout aubergine18
-
Rank
Area
-
Incompatible Mods Checker (WIP)
aubergine18 replied to aubergine18's topic in Cities: Skylines Modding - Open Discussion
Stage 3: User interface This stage will be added in a few days, we're currently hunting down some bugs. The TM:PE implementation can be viewed online: IncompatibleModsPanel.cs todo -
Incompatible Mods Checker (WIP)
aubergine18 replied to aubergine18's topic in Cities: Skylines Modding - Open Discussion
Stage 2: Scan for incompatible mods In stage 1, you will see we instantiate a ModsCompatibilityChecker instance, and then PerformModCheck() - here's the code that does that... The TM:PE implementation can be viewed online: ModsCompatibilityChecker.cs namespace YourNamespace { public class ModsCompatibilityChecker { private readonly Dictionary<ulong, string> knownIncompatibleMods; public ModsCompatibilityChecker() { knownIncompatibleMods = LoadListOfIncompatibleMods(); } // In TM:PE, we actually load these from an embedded text file resource, // but to keep this guide simple we'll just manually define them in code. private Dictionary<ulong, string> LoadListOfIncompatibleMods() { // You don't really need the string, tbh, so you could use a much simpler data structure here Dictionary<ulong, string> results = new Dictionary<ulong, string>(); results.Add(409184143u, "Traffic++"); results.Add(626024868u, "Traffic++ V2"); return results; } // continued below... Now, before we continue, it's important to set yourself some rules about adding mods to the list. If your mod is popular, you're potentially going to nerf the subscriber count of the mods on the list. As an example, you can view the rules we defined for TM:PE in our wiki. Furthermore, you should also post a page somewhere explaining why the mods are incompatible, and, where possible, list alternate mods (particularly if the incompatible mods are obsolete) to help users retain functionality they would otherwise lose. As an example, see this post we made in the Steam workshop. // continued from above... // Scan for incompatibilities, and if any are found show a dialog public void PerformModCheck() { Dictionary<PluginInfo, string> detected = ScanForIncompatibleMods(); if (detected.Count > 0) { IncompatibleModsPanel panel = UIView.GetAView().AddUIComponent(typeof(IncompatibleModsPanel)) as IncompatibleModsPanel; panel.IncompatibleMods = detected; panel.Initialize(); UIView.PushModal(panel); UIView.SetFocus(panel); } } // Iterate installed mods looking for any on the knownIncompatibleMods list, or other // versions of our mod. public Dictionary<PluginInfo, string> ScanForIncompatibleMods() { // This gives a unique id for our mod so we can avoid adding it to the results Guid selfGuid = Assembly.GetExecutingAssembly().ManifestModule.ModuleVersionId; Dictionary<PluginInfo, string> results = new Dictionary<PluginInfo, string>(); // You'd pull this from your mod settings, but to keep things simple we'll just define inline bool filterToEnabled = false; foreach (PluginInfo mod in Singleton<PluginManager>.instance.GetPluginsInfo()) { // Skip bundled mods, camera scripts, and, if filtered, non-enabled mods if (!mod.isBuiltin && !mod.isCameraScript && (!filterToEnabled || mod.isEnabled)) { string modName = GetModName(mod); ulong workshopID = mod.publishedFileID.AsUInt64; if (knownIncompatibleMods.ContainsKey(workshopID)) { results.Add(mod, modName); } else if (modName.Contains("YourModName")) { Guid currentGuid = GetModGuid(mod); if (currentGuid != selfGuid) { results.Add(mod, $"{modName} in /{Path.GetFileName(mod.modPath)}"); } } } } return results; } public string GetModName(PluginInfo mod) { return ((IUserMod)mod.userModInstance).Name; } public Guid GetModGuid(PluginInfo plugin) { return plugin.userModInstance.GetType().Assembly.ManifestModule.ModuleVersionId; } } } Phew! So, that's stage 2 done. We've built up a list of identified incompatible mods and, assuming we found some, it's now time to do the dreaded UI stage... -
Incompatible Mods Checker (WIP)
aubergine18 replied to aubergine18's topic in Cities: Skylines Modding - Open Discussion
Stage 1: Determine when the mod checker should run This is the easy bit For sake of brevity, I've left out the using clauses, I'm sure your IDE will help you fill in the gaps. The TM:PE implementation can be viewed online: TrafficManagerMod.cs namespace YourNamespace { public class YourMod : IUserMod { public string Name => "YourModName"; public string Description => "Your mod description"; public void OnEnabled() { if (UIView.GetAView() != null) { // The user just enabled mod via Content Manager > Mods // So we can run the checker right now CheckForIncompatibleMods(); } else { // The mod was already enabled when Cities.exe launched // We need to wait for plugin manager to be ready, so use this event: LoadingManager.instance.m_introLoaded += CheckForIncompatibleMods; } } public void OnDisabled() { // Remove the event listener LoadingManager.instance.m_introLoaded -= CheckForIncompatibleMods; } private static void CheckForIncompatibleMods() { // You'd pull this from your mod settings, but we'll just define inline for now bool ScanOnStartup = true; if (ScanOnStartup) { // This performs the next stage - checking for incompatible mods ModsCompatibilityChecker mcc = new ModsCompatibilityChecker(); mcc.PerformModCheck(); } } } } You'll notice we're using the LoadingManager.instance.m_introLoaded event in the code above; that occurs after the game has finished downloading any new or updated subscriptions and initialised the PluginManager. -
Incompatible Mods Checker (WIP)
aubergine18 posted a topic in Cities: Skylines Modding - Open Discussion
In this guide I'm going to explain how part of the mod incompatibility detection used in TM:PE works, specifically: Detecting known-incompatible mods Detecting other versions of your own mod It does not cover: Detecting "currently unknown" incompatibilities You'll need a redirection framework (eg. Harmony) to do stuff like that Persisting settings such as "Run on startup" or "Ignore disabled mods" Implementation is specific to how you choose to store settings I've tried to keep the guide as simple and generic as possible. When to use? First, an incompatible mod checker can be somewhat contentious so only implement it if you really need it. For example, these are valid reasons to implement a checker: Another mod conflicts with your mod, breaking it's functionality or causing weird bugs Some users have obsolete versions of your mod You keep forgetting to remove other builds of your mod during development & testing The first two items on that list should be obvious, but the third might seem a little strange. While developing and testing TM:PE, we realised that the game (well, Mono, actually) is really bad at coping with multiple versions of the same mod - you can, and should, read more about it in our issue tracker. The tl;dr is: If there are multiple versions of your mod installed, such as a local dev version and a workshop version, the game struggles to differentiate them. The more complex your mod, particularly if it uses lots of static classes, etc., the more nightmarish this issue becomes. With over a million subscribers (probably only about 300k active), 46 known incompatible mods, ~10 older versions of TM:PE, and 2 live versions (LABS and STABLE), we really needed this infrastructure to help tame support workload! If you spot any errors in the guide below, please let us know as you could potentially make hundreds of thousands of people a bit happier! Top-level overview The checker has three main stages: Determine when the mod checker should run: If the mod is already enabled when cities.exe is launched, wait until the plugin manager is ready Or run when the mod is enabled by the user via Main Menu > Content Manager > Mods Scan for known incompatible mods, including other versions of your mod Display a pop-up dialog allowing the user to unsubscribe/delete problematic mods See comments below for each stage in turn. Credits Krzychu124 developed the initial version of the mod checker. LinuxFan identified the issue with Mono not dealing with multiple instances of the same mod, and Dymanoid later elaborated on why that happens. Dymanoid also came up with the neat way to use a Guid to identify the current instance of the mod when scanning through other mods. FireController helped with testing. The UI code is largely based on the games' own code by Colossal Order. I've just helped out a bit on the fringes. -
Cities Skylines: Campus Mods
aubergine18 replied to ghosty20's topic in Cities: Skylines General Discussion
TM:PE has an internal game version check, and if the game version changes (new version of game) then it shows a warning to let users know there might be issues. So far we've not had any Campus-specific issues; looks like the pathfinder and vehicle AIs have not been altered in any way as part of Campus patch. We updated the internal game version check to the new game version number and released a new version, along with some other updates, to both STABLE and LABS versions of TM:PE. If you are aware of any issues with TM:PE, please let us know. We are currently doing code review on the next release, version 10.21 (not yet released), which includes the following changes: -
Network Skins 2
aubergine18 replied to boformer's topic in Cities: Skylines Modding - Open Discussion
Is there a difference between the light props bundled with the mod and the original "Modern Lighting Pack" they came from? Also, catenary options don't seem to be showing for rail tracks from the Railway collection - I assume that it's because those assets have their catenary set by a dedicated "Railway Replacer" mod, but just flagging it up just in case.- 81 Replies
-
- mod
- development
-
(and 1 more)
Tagged with:
-
Network Skins 2
aubergine18 replied to boformer's topic in Cities: Skylines Modding - Open Discussion
On UK Roads Revived roads, changing street lights sometimes results in lights facing wrong way like so: Not sure if it's asset or prop problem. The light facing wrong way is "LPS Street Light" which I think comes with base game. The road is a 1-lane slip road from the UK Roads Revived Motorways pack (it has some dependencies, I think the lights it uses are in the 'essentials' pack listed on asset 'required items' list).- 81 Replies
-
- 1
-
-
- mod
- development
-
(and 1 more)
Tagged with:
-
Network Skins 2
aubergine18 replied to boformer's topic in Cities: Skylines Modding - Open Discussion
Just noticed comment on R69 discord that NS2 should be ready next week... Would it be possible to change the way the road color thing works? Currently the palette updates every time I select new road or change color, which is somewhat annoying. Would it be possible to require manual intervention to put a color on the palette? Like clicking the larger color preview swatch or something? That way it keeps me in control over my color palette, rather than just random stuff appearing in there without me noticing. To reiterate an earlier comment:- 81 Replies
-
- 1
-
-
- mod
- development
-
(and 1 more)
Tagged with:
-
Network Skins 2
aubergine18 replied to boformer's topic in Cities: Skylines Modding - Open Discussion
I'm not sure if this is a bug or a feature, but thought I'd flag it up as potentially unexpected mod behaviour - here's what I did: Placed some elevated City Park ped path - ugh, don't like those lights... Open "lights" panel in NS2 and choose a fancy "old french lamp" (note: Keep lights panel open during next steps) Try upgrading path - game won't let me upgrade ped path to path of same type (ugh, can this be changed?) Ok, I'll upgrade to some other path first and then upgrade that back to city path later... * upgrades to amusement park path * Selects city path again and upgrades, expecting it to now have old french lamps It gets the lights of the amusement park ped path ... wait, what?! Based on my workflow at the time, I was like "Why have you switched to a different street lamp?" It's like when I switched to amusement path, the lights select panel thought I'd selected a different light (amusement park light) for the city park ped path...?- 81 Replies
-
- 1
-
-
- mod
- development
-
(and 1 more)
Tagged with:
-
Network Skins 2
aubergine18 replied to boformer's topic in Cities: Skylines Modding - Open Discussion
Applying traffic lights to Parking Lot Roads results in lights facing away from the road rather than in to the road.- 81 Replies
-
- mod
- development
-
(and 1 more)
Tagged with:
-
Vanilla asphalt & pavement textures (for TM:PE color palette)
aubergine18 replied to aubergine18's topic in Cities: Skylines Modding - Open Discussion
It can now apply visualisations of different types of color blindness Once complete I'll be uploading the tool to TM:PE issue tracker (which contains additional information about the color research): https://github.com/krzychu124/Cities-Skylines-Traffic-Manager-President-Edition/issues/287 -
Vanilla asphalt & pavement textures (for TM:PE color palette)
aubergine18 replied to aubergine18's topic in Cities: Skylines Modding - Open Discussion
Thanks Here is progress so far, with vanilla pavement texture selected: As for in-game lighting conditions, we'll be using an unlit shader to do the lane routing overlays so the colors won't be affected An added bonus is 8 - 12 fps improvement when extensive routing is applied, based on this rudimentary test map. -
Vanilla asphalt & pavement textures (for TM:PE color palette)
aubergine18 replied to aubergine18's topic in Cities: Skylines Modding - Open Discussion
What's the crp extractor? -
Vanilla asphalt & pavement textures (for TM:PE color palette)
aubergine18 posted a topic in Cities: Skylines Modding - Open Discussion
Hi, Does anyone have the seamless tiling textures for vanilla pavement, asphalt, bus lane and bike lane? I'm working on new color palette for TM:PE lane connector (it will also be used for revised UI for traffic lights and bunch of other stuff) and decided to test colors in HTML for faster iterations - to do that properly it would really benefit from being able to set the page background to some common textures a mentioned above. Any help (and images!) greatly appreciated -
Network Skins 2
aubergine18 replied to boformer's topic in Cities: Skylines Modding - Open Discussion
Unable to change trees or lights on P & B Pavement ped path Unable to change trees and lights on several of the UK Rural and UK Small roads- 81 Replies
-
- mod
- development
-
(and 1 more)
Tagged with:
