Cities: Skylines - Parklife Dev Diary #5: Modding and menu filtering

Cities: Skylines - Parklife Dev Diary #5: Modding and menu filtering

  • We will be taking the forums down for scheduled maintenance on 12 August 2020 at approximately 3PM CDT (8PM UTC / 10PM CEST), this downtime is currently estimated to last around 1 hour.
  • Pre order now!

    Paradox Development Studio brings you the sequel to one of the most popular strategy games ever made! Crusader Kings III is soon upon us and you can pre order it today!


    Releasing September 1st 2020

co_emmi

Captain
1 Badges
Sep 22, 2014
487
263
  • Colossal Order Staff
Hello everyone! We are again happy to announce some new modding features coming up alongside with Park Life expansion, all of which will be part of the free update.

Asset editor
Sub-meshes
Certain built-in buildings and vehicles have already made use of something called sub-meshes to change their look during the game. Sub-meshes are additional 3D-models with some simple conditions on when to switch them on and off. To give a few examples, you might have seen your friendly neighborhood Landfill Site switching between multiple trash pile models as the building fills up, and many service vehicles using a mirrored model in left-hand traffic. We have now exposed the sub-mesh system in asset editor.

The editor panel now contains a new collapsible menu for sub-meshes when editing buildings and vehicles. Simply click the “Add New” button, select your custom model from the importer menu, tweak its position and rotation, set up any conditions on when to show or hide the sub-mesh in the “Required Conditions” and “Forbidden Conditions” drop-down menus, and you’re ready to go. You can switch the sub-mesh on and off in editor with “Toggle Preview”-button to get some idea on how your asset acts when you finally let it loose in your city.

To give you some idea about how the conditions work let’s take a look at how the Landfill Site is set up. First we’ll import the asset with “Load existing props & decorations” switched on so as not to discard the sub-meshes. Now for clarity let’s switch off all sub-mesh previews.

previewoff.png

The main mesh of the Landfill Site only consists of the surrounding fences. There are in total three sub-meshes with trash piles of varying heights, making use of the “First Half Filled” and “Second Half Filled” conditions only available to certain building types such as Landfill Site and Cemetery. The first sub-mesh has both of these conditions set as “forbidden conditions”, meaning that if any of these conditions is met, the sub-mesh will be toggled off. The second sub-mesh has “First Half Filled” set as required, and “Second Half Filled” as a forbidden condition, and the third one requires both conditions to be met. In the end exactly one of these sub-meshes will always be rendered.

preview and dropdown.png

There are multitude of conditions available, some of them only for some building types such as “Abandoned” condition for zoned buildings. Some general conditions such as “Active” are available for all building types, which you can for example set as forbidden to only have the sub-mesh rendered when the building is turned off. Vehicles have their own set of conditions, and also let you specify conditions on when to hide the main mesh.

Scripting API
We have also added two new scripting interfaces to ICities.dll. These are mainly targeted to more experienced modders, but Cinematic Camera API might be interesting to those wanting to experiment with scripting. The API reference and documentation will become available later in community wiki once Parklife is released.

Asset Data API
The new Asset Data API will enable more advanced asset creators and modders to save custom data straight into their custom asset packages and receive a callback with that data when the asset is loaded. This feature has been requested to ease up custom setup of more complex assets, and should mitigate some needs for external xml-dumps and detour/harmony -hooks on asset loading.

The custom data is saved as byte-arrays into a dictionary using string keys to organize the data. When saving an asset, the game will call OnAssetSaved method in your IAssetDataExtension implementation. The parameters contain the name of the saved asset, the actual asset prefab as a boxed object (which you can cast to game’s internal type in case you need to handle some additional magic), and the data-dictionary as an out-parameter. Similarly OnAssetLoaded will be called for all custom assets when they are loaded. Note that these are called only for the main asset, so for example road elevations or prop variations that get packed in the same package don’t receive additional calls.

Cinematic Camera API
The Cinematic Camera API provides a reliable and convenient way to script beautiful camera sequences of your city, maybe for a showcase video or just to marvel at your creation. A new button has been added next to the existing Free Camera button to activate any custom cinematic camera scripts, along with a built-in cinematic camera to randomly showcase citizens, traffic or buildings in your city.

The API offers some low level controls such as rotating and moving the camera, fading to/from black and changing the camera aperture to control the depth of field, as well as helpers to find citizens, buildings, vehicles etc. with certain parameters in your city. The camera system utilizes Unity coroutine -style scripting which is especially suitable for this kind of frame-to-frame work and lets you easily break your camera script into multiple sequences, start those sequences from others and halt some sequences while waiting for others to finish.

When a player selects the cinematic camera from the in-game menu and activates it, the game will start the OnStart coroutine in your ICameraExtension implementation. The ICamera handle passed to OnStart will contains all the camera control methods, and ICameraExtensionBase also wraps these methods in the base class for some added convenience. When the script has finished controlling the camera for a frame, just use a yield instruction to wait for next frame and the script will keep then take on from where you left.

Cinematic cameras are created much like any other mods, but implementing the ICameraExtension or ICameraExtensionBase will cause the mod to be listed under Cinematic camera scripts tab in content manager and Steam workshop. Due to being scripted assemblies, same security precautions apply to cinematic camera scripts as with any other mods, and enabling any camera scripts will disable achievements.

Menu Filtering

We have a real treat for all players, regardless whether you buy or don't Parklife we have included the Menu Filtering feature for everyone to enjoy. As some may have noticed that with all the additional content from the previously published expansions, some of the in-game and editor menus have become somewhat crowded. Instead of just leaving it be, we made Menu Filtering so the browsing of the menus isn't as slow as it used to be. Menu Filtering is a new feature that will help players to filter down the objects in the menus and make menu browsing easier.

So, lets go over the basic functionality real quick:

  • Each of the in-game and editor menus that has filters available will have the filters as small buttons next to the menu.
    • If a menu has multiple tabs, the filters are determined per tab.
  • By clicking (primary mouse button) the filter button the player activates the filter and the menu will show only items that fulfill the conditions specified by the filter.
  • When multiple filters are chosen, all of the filters' conditions must be met, thus narrowing down the range of available menu objects.
  • The filters can be deactivated by clicking them again.
There are plenty of different kind of filters, some menus can have more and some can have less filters to choose from. Couple of the menu filters that players will find are "Small Buildings", "Large Buildings" and "Net Structures". Net Structure filter shows you all roads, paths, water pipers and power lines.

The Asset Editor is a special case, there will be a search box instead of filter buttons and will function similarly to Content Managers search feature, I welcome this change with big open arms, finding those assets just got so much easier.

MenuFiltering_Diary.PNG
Let's take a look at all the Small Buildings in City Park menu.

Cheers,
Cities: Skylines developers
 

Beer Fiend

Better to have a keg than a six-pack
23 Badges
Apr 28, 2017
717
53
  • Cities in Motion 2
  • Cities: Skylines
  • Cities: Skylines Deluxe Edition
  • Cities: Skylines - After Dark
  • Cities: Skylines - Snowfall
  • Cities: Skylines - Natural Disasters
  • Cities: Skylines - Mass Transit
  • Cities: Skylines - Green Cities
  • Cities: Skylines - Parklife Pre-Order
  • Cities: Skylines - Parklife
  • Cities: Skylines Industries
  • Cities: Skylines - Campus
  • Stellaris
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Humanoids Species Pack
  • Stellaris: Distant Stars
  • Stellaris - Path to Destruction bundle
  • Stellaris: Leviathans Story Pack
  • Stellaris: Apocalypse
  • Stellaris: Synthetic Dawn
  • Stellaris: Megacorp
  • Stellaris: Ancient Relics
  • Stellaris: Lithoids
Two dev diaries in a week? You do spoil us.

So can I finally fix the issue with the XD60 biofuel bus that renders it unable to spawn as a Left lane driving vehicle with this?
 

Audacious_vile

Private
26 Badges
Apr 1, 2018
12
0
  • Pillars of Eternity
  • Cities: Skylines - Campus
  • Prison Architect
  • Cities: Skylines Industries
  • Cities: Skylines - Parklife
  • Cities: Skylines - Parklife Pre-Order
  • Cities: Skylines - Green Cities
  • Cities: Skylines - Mass Transit
  • Cities: Skylines - Natural Disasters
  • Tyranny: Archon Edition
  • Cities: Skylines - Snowfall
  • Cities: Skylines - After Dark
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Way of Life
  • Europa Universalis IV: Pre-order
  • Cities: Skylines
  • Europa Universalis IV: Res Publica
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Art of War
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II: The Republic
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II
  • Cities: Skylines Deluxe Edition
Can we have option to hide or turn off that new filter menu? Especially if this is a free feature and it's making me really uncomfortable while watching this buttons covering buildings is the menu.
 

Maludir

Recruit
19 Badges
Jan 28, 2018
2
0
  • Surviving Mars
  • Surviving Mars: First Colony Edition
  • Surviving Mars: First Colony Edition
  • Stellaris: Distant Stars
  • Stellaris: Distant Stars Pre-Order
  • Cities: Skylines - Parklife
  • Cities: Skylines - Parklife Pre-Order
  • Surviving Mars: Digital Deluxe Edition
  • Cities: Skylines - Green Cities
  • Cities: Skylines - Mass Transit
  • Stellaris - Path to Destruction bundle
  • Cities: Skylines - Natural Disasters
  • Cities: Skylines - Snowfall
  • Cities: Skylines - After Dark
  • Pillars of Eternity
  • Cities: Skylines
  • Cities in Motion
  • Age of Wonders III
  • Stellaris
I can now start my Cities with costom made Buildings, that will grow as continuos as my city does
Or one could mod a growing Train-Hub dependent on the traveller's count...
Thanks for the heads up
 

Timmysoboy

Second Lieutenant
17 Badges
Nov 27, 2017
194
17
  • Hearts of Iron IV: Death or Dishonor
  • Hearts of Iron IV: La Resistance
  • Cities: Skylines - Campus
  • Hearts of Iron IV: Expansion Pass
  • Cities: Skylines Industries
  • Cities: Skylines - Parklife
  • Cities: Skylines - Parklife Pre-Order
  • Hearts of Iron IV: Expansion Pass
  • Cities: Skylines - Green Cities
  • Cities: Skylines
  • Cities: Skylines - Mass Transit
  • Hearts of Iron IV: Together for Victory
  • Cities: Skylines - Natural Disasters
  • Hearts of Iron IV: Colonel
  • Hearts of Iron IV: Cadet
  • Cities: Skylines - Snowfall
  • Cities: Skylines - After Dark
Didn't read any of the mod stuff, but SO hyped for filters. Would be cool if we could costomize our filters too.
 

Beer Fiend

Better to have a keg than a six-pack
23 Badges
Apr 28, 2017
717
53
  • Cities in Motion 2
  • Cities: Skylines
  • Cities: Skylines Deluxe Edition
  • Cities: Skylines - After Dark
  • Cities: Skylines - Snowfall
  • Cities: Skylines - Natural Disasters
  • Cities: Skylines - Mass Transit
  • Cities: Skylines - Green Cities
  • Cities: Skylines - Parklife Pre-Order
  • Cities: Skylines - Parklife
  • Cities: Skylines Industries
  • Cities: Skylines - Campus
  • Stellaris
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Humanoids Species Pack
  • Stellaris: Distant Stars
  • Stellaris - Path to Destruction bundle
  • Stellaris: Leviathans Story Pack
  • Stellaris: Apocalypse
  • Stellaris: Synthetic Dawn
  • Stellaris: Megacorp
  • Stellaris: Ancient Relics
  • Stellaris: Lithoids
Can we have option to hide or turn off that new filter menu? Especially if this is a free feature and it's making me really uncomfortable while watching this buttons covering buildings is the menu.
It's not covering the buildings though.
 

metatoaster

Reticulator of Splines
112 Badges
Jan 8, 2012
179
81
  • Cities: Skylines
  • Warlock 2: The Exiled
  • Warlock 2: Wrath of the Nagas
  • Sword of the Stars
  • Hearts of Iron III
  • Crusader Kings II
  • Cities in Motion
  • Cities in Motion 2
  • Arsenal of Democracy
  • Steel Division: Normandy 44
  • Rome: Vae Victis
  • Crusader Kings II: Monks and Mystics
  • Crusader Kings II: Reapers Due
  • 500k Club
  • Cities: Skylines - Mass Transit
  • Europa Universalis IV: El Dorado
  • Magicka: Wizard Wars Founder Wizard
  • Mount & Blade: With Fire and Sword
  • Crusader Kings II: Way of Life
  • Pillars of Eternity
  • Cities: Skylines - Natural Disasters
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Horse Lords
  • Crusader Kings II: Conclave
  • Tyranny: Archon Edition
  • Achtung Panzer
  • Hearts of Iron IV Sign-up
  • Hearts of Iron IV: Cadet
  • Age of Wonders: Planetfall Season pass
  • Cities: Skylines - Parklife
  • Europa Universalis IV: Rights of Man
  • Age of Wonders: Planetfall
  • Prison Architect
  • Europa Universalis IV: Golden Century
  • Crusader Kings II: Holy Fury
  • Surviving Mars: First Colony Edition
  • Shadowrun: Dragonfall
  • Shadowrun Returns
  • Europa Universalis IV: Dharma
  • Europa Universalis IV: Mandate of Heaven
  • Cities: Skylines - Parklife Pre-Order
  • Europa Universalis IV: Rule Britannia
  • Cities: Skylines - Green Cities
  • Steel Division: Normand 44 Sign-up
  • Surviving Mars
  • BATTLETECH
  • Crusader Kings Complete
  • Magicka
  • Majesty 2
The custom saving for modders sounds like great news, it's gonna remove some maintenance burden from their shoulders at every update. Which means quicker mod updates for players.

Sub-buildings means workshop assets are gonna look way more dynamic, can't wait to see what people come up with.

For the search box, it would be nice if it was globally available in-game with a hotkey (like the current Find It! mod's ctrl+F). I can't count the number of times I've watched YouTubers get lost in the menus looking for an asset they had just downloaded, or for a monument's or unique building's dependency.

Actually here's an idea for you: deep linking. Click a hyperlink in a monument's description and it takes you straight to the building you're supposed to build first. But click the same skylines://asset/my_asset link in a web page, and it focuses the game and navigates to the proper asset in the panel.
 

[Delta ²k5]

Sergeant
11 Badges
Aug 29, 2015
82
128
  • Cities in Motion 2
  • Cities: Skylines
  • Cities: Skylines - After Dark
  • Cities: Skylines - Snowfall
  • Cities: Skylines - Natural Disasters
  • Cities: Skylines - Mass Transit
  • Cities: Skylines - Green Cities
  • Cities: Skylines - Parklife Pre-Order
  • Cities: Skylines - Parklife
  • Cities: Skylines Industries
  • Cities: Skylines - Campus
These are great news :)

Well - I got a question: Is submesh usage only available for buildings after the update or will the vehicle asset editor benefit from this feature too? (as we've got submeshs on helicopters and blimps for their rotors ;) )?

We vehicle modders could do fancy stuff using these like trucks with and without loads, new fancy helicopters, propeller driven planes, hovercraft type vessels (also prop driven), container ships which get unloaded visually...