The level editor is in a stable-ish condition. You can create maps, spawn in and run around. I still need to add level win conditions before you can make a fully functional level, but it's about 80% there now.
Despite how broken the editor has been for the last week, some of you guys have been working away on your own maps already.
Tlean has been showing his Pyramid level off:
Fiffe has been showing his castle level off too:
Next week I want to make an example map to show off things like Buttons, Push Triggers, Crushers, Hurt Triggers, Moving Platforms and Collectables.
After that I'll probably explore a way to upload your maps to workshop.
The way the custom maps work in Tub is Asset Bundles. Unity can export these things called asset bundles, which are kind of like zip files full of stuff.
When you export a map, it also exports everything else that you need to run that map. All the textures, animations, sounds, shaders.. everything. Having every map re-ship the same content obviously isn't ideal, so we need a way to deduplicate the assets that we ship with the game.
I had a pretty good idea how I was going to do this but I ran into some problems that created a road block for a day.
In the end I got it all working well. The only downside is that I'm having to build asset bundles to test editor created maps in the main Tub project, which feels archaic, but isn't the end of the world.
To get components working I was copying the MonoBehaviours over to the editor project and stripping out the game logic, leaving only the serialized fields. This worked and confirmed that it was possible and if the guid in the meta file was the same the game would link up with them when a map was exported.
It was kind of hard work and error prone, so I had a bash at doing it semi automatically. I wrote a script that uses reflection to export them now.
This creates these scripts in the Exported folder. It also creates the asmdef folder structure, because as far as I could see, the game won't recorgnise the MonoBehavior if it's not in the same assembly structure.
As well as public fields, it also exports fields marked with [Serializable], interfaces, structs, and some public functions (for hooking up UnityEvent callbacks). There's scope here to add documentation attributes in the future.. since it wasn't possible to copy over comments too.
The end result is that if I want to expose a behaviour to the editor - or if I add/remove a new field, I just add it to this list and run the exporter.
Iteration time is important, so I want to be able to press a button in editor and hav ethe game popup with the level.
To do that I needed to send messages from the editor to the game. Google was suggesting using named pipes, which I looked into and seemed very very complicated. So I decided on using standard TCP sockets.
- User selects "Open In Game"
- Map is bundled
- Editor tries to connect to localhost port 8052
- If it can't connect, it starts the game with command line arguments, which opens the map
- Either way the game recieves the command
- The game loads the map
- The game tries to make itself the upmost focused window
The editor doesn't need to be constantly connected to the editor, so it's pretty simple for us to connect to a socket, send a message, then disconnect. There's probably some cool stuff we could do in the future with the editor connected, like showing player location, but that'd probably just be for fun than anything useful.
The bundle time is a bit worrying for me. Right now it takes ~10 seconds to do a very simple map with no lightmaps, occlusion or compression. If it gets much longer it's going to start to suck in terms of iteration times. We'll have to find solutions to that at the time though.
There's a command line to force the configuration window to show, but not a command line to force it not to show. So I had to disable it and add the command line to show it by default on the Steam launcher.
Unity: Please add a command line for force it not to show.
Launch Through Steam
I originally was launching the game though the steam browser protocol. But when I added command line arguments I got this on every launch.
So not ideal. I get you to find the Tub exe now and launch it directly.
We've been looking to standardise the scale of the world, so we can start creating our own art. So me and Matt made a map that established sizes that felt right in first and third person for things like doorways, ceiling height, window size/position.
So we arrived at these scales, which feel right in first person mode too.
So we formalized the scales in some more specific prototyping materials.
Taylor has got the new Citizen body done, and it's looking great. We've still got a few things to sort out before I can put it in the game, but it's nearly there.
I dunno if I mentioned it last week, but I made the Facepunch.Skeleton system able to automatically retarget. This means you can make all the clothes and shit a prefab, and drag and drop in editor, or just parent in game, and it automatically retargets and becomes part of that skeleton. Which means it animates with the skeleton, and when you make the skeleton a ragdoll, it follow that too.
If you want to follow this project you can sign up to the mailing list.
We'll only update you about this project, we won't spam you about other stuff or sell your email address.