I recently started playing Cities: Skylines, Colossus’ recent city builder game. I was really impressed to how well it simply “just worked” – especially given how fresh it was. What also intrigued me was it’s reported good support for user modding.
Creating assets from existing game items is a really nice feature. The concept feels very familiar to the components system in SketchUp where you can create reusable items.
However, I wanted to create new content. The wiki page gives a brief overview over the asset requirements:
- Must be exported to FBX.
- Must have a flat hierarchy.
- Must fit into the game’s 8x8m cells.
- Must use meters for units.
Good news for SketchUp Pro users – it includes a FBX exporter. Bad news for Make users – no FBX exporter for you. :(
Unfortunately there is bad news for the Pro users as well: even if you have no hierarchy in the SketchUp model an extra node is injected upon export and the game fails to load the mesh.
This sounded like a challenge! With good help from other modders I found out that SketchUp export FBX using the ASCII variant, which allowed me to easily see the model hierarchy.
By manually patching the FBX file the model would load. But I wanted to automate the process, so I wrote a small SketchUp extension: https://github.com/thomthom/cities-skylines-sketchup-tools
It’s currently a beta tool, supporting only SketchUp Pro 2014 and newer.
When you use the Export Asset functionality it will verify your SketchUp model first, such that you have a flat model hierarchy and only one material applied to all the faces. Backside materials are ignored – so make sure you keep track of the front and back side of your faces when you model. Once the model has been verified the FBX file is exported and the extension will attempt to patch it.
At the moment it doesn’t extract the diffuse texture, so you must do that yourself until I add the option for this.
The extension also takes care of configuring the FBX exporter correctly for the game:
The two bottom ones are probably the most notable, making sure the axes are swapped and the units. The axis swap is described in the wiki, so no surprise there. But the units deviate from what I described earlier. In my testing I found that if I exported the model in meters the asset would be 100 times too small in the game. As it turned out, this is a Unity quirk where it’s default import scale is 0.01 because some modelling applications have a default up-scale of 100.
In order to avoid having to adjust the scaling in the game’s asset editor every time the export units from SketchUp needs to be in centimetres.
I made a little test using an old model of a building in Trondheim where I live. Previously I worked at an architectural office so have a nice collection of local builds. The only thing I had to adjust was converting the multi-map model into a single-map. Since the model was so simple I did this by hand using PhotoShop and remapped the model manually.
If you are working on more complex models you might want to install Dale Marten’s SketchUV extension which allows you to use third party UV mapping tools such as RoadKill. Check out his excellent tutorial videos on YouTube.
Clearly the texture needs improvement and I need to add the other maps. But this was just a simple proof of concept.
One thing I haven’t figured out yet is what the arrow in the Asset Editor signify. Is it the side of the asset where the roads will appear? What happens if you add roads outside of the assets building area?
Requirements:
- SketchUp Pro 2014 or newer
Download:
- GitHub
- Extension Warehouse
- SketchUcation Plugin Store (Coming)
Thanks for posting back the solution.