Sandbox Logo
31 January 2022

January 2022

Editor mode, addon uploads, controller support, post processing improvements, and a bunch more this month.
I spent a lot of time fleshing out the editor over the last couple of months. I don't think everyone was convinced that it was a good thing to be focusing on, so I wanted to show more of my vision for it.

Using Valve's build of qt was limiting in a few ways so I forked it and made some changes. I mainly wanted to fix how the DockWidget stuff worked, because by default it adds a title bar with a close button to the docks. The modern way is to just have a tab bar.. so I changed that.

Then because all of the other tools were using the old windows style, I went through the tools and updated them to use the new frameless window to offer some consistency. I also went through all the tools to make them work properly with the new tab system.
They're not all perfect, but there's at least a consist look between the tools and the editor window now.

Then I added Unity like controls to the game view. Allowing full screen, resolution restrictions, display modes and performance information.

I did some work on the editor's inspector. The inspector is meant to function kind of the same as Unity's object inspector.  It has a few differences though.

You can inspect any c# object. It doesn't need to be a special type.. as long as it has properties you can inspect it.

It has a history. It works like a webpage. That means if you select an object, then select another object, you can press the previous button (or the back button on your mouse) to go back to the previous object.

Here's a clip of me inspecting the inspector..
Like unity, It's pretty easy to make your own property editors in c# for specific types.. and because of hotloading it's fun to quickly iterate to make them as awesome as possible.
I improved controller support by integrating Steam Input - this lets us support any new or weird controller types in the future without any effort.

There's official Xbox and PS4 configs, these will map over to anything really.
We'll add more configs as we go, the community have already uploaded some.

Creators don't need to make any changes to their games, they'll work even better by default now. But there are new APIs available to enhance controller experience.
It's nice for players to start a game and know how to play right away.

So I've added a new API for getting input glyphs to show players.
It's smart enough to know if you're using a controller or not, and there's a variety of style combinations you can use them with.

Whilst working on input I quickly added key binds in the menu too.

The tilemap system was hardcoded to use a cell size of 256 and a step height of 256. These are now all changeable. This has been very useful for minigolf maps.

Some parts of the styling we have for the UI had some feature additions and improvements done this time around. Improvements have been made on text rendering, new features, gradients, and much more!

Improvements have been made to VRAD and now allow emissive textures to get baked as light sources. This works for any static object with any geometry which has an emission texture applied to it and works out of the box
A new post-processing feature was added to the standard post-processing shader which lets you adjust how strong any post-processing effect is based on its distance from the camera.
I spent more time this month iterating on the depth of field to make it look better and perform better. A few changes to post-processing were done to allow for this to happen, you now can run post-processing before & after tone mapping allowing you to use a full HDR buffer or an 8-bit buffer. A lot of the DOF options were trimmed down to improve its ease of use, it's now running on the HDR buffer, has bokeh filling & is a lot softer.
We've bumped up the size of light cookies to 1024x1024 so they look even crisper than ever
We started to introduce a new foliage shader to help improve the performance by frustum culling per triangle, removing unneeded shading of the trees & improving how culling happens on shadows/depth. We're working hard to add new features to this new shader so stay tuned!
You now have the ability to tag assets and organize them to your heart's content 
The entity list moved to tools and the in game one was removed.
You can see when entities are dormant now (this means they're out of your client's PVS). Entities can define which icon is shown next to them using the Icon attribute.

The colours here show which realm they're in. Yellow means clientside only, blue means serverside only, green means both your client and server has the entity.

The entity's owner is shown on the right.
One of the big things on my list was making creating addons easier. There should really be a create new addon option and you're done. 

So the addon manager was born. This operates a lot like Github Desktop in terms of switching between and creating new stuff.

As you see above, you can do everything you would expect to be able to do here. 

Creating a new addon brings up this dialog.
When creating a new game or map it'll give you a minimal template that is enough to get you started doing what you're doing.

All this stuff is just at the stage where it's functional enough to be cleaned up and expanded on, so I'd expect things to get a bit friendlier, and template choices etc.
Addon uploads have changed. Previously you had two options. Either fill in a github url and download your addon from that, or upload a zip.

In the new system you upload each file individually, crc'd, and each addon has a manifest which contains the url and crc of the files.

This has obvious benefits.. like only uploading and downloading changed files., and being able to upload much bigger addons. But beyond that it makes us a lot more agile around what we can do. We no longer have a bunch of assets in zip files, we have a huge single accessible filesystem with multiple variants of each file.

This is interesting to me. It's what we had in gmod with toybox before workshop came out. It enables a bunch of cool stuff with asset sharing, and versioning. But beyond that there are interesting things we could do by post processing all the uploaded files to create lower res versions, etc.

Broken Maps


Something it immediately fixed already. We had a recurring problem that maps were using our base materials and models, and we'd change one of them. So then the map would either have missing material errors or we'd block a door because the model got rotated or resized etc. 

That's not an issue now, because when uploading the map the creator also uploads the version of our assets that they're using (if they haven't already been uploaded). So when you download their map it's using all those assets locked in time.

If we never change that asset then end users don't download the historical version because they already have it on disk. If we change it then they can download the historical version and everything works.

Broken Games


Uploaded games also upload the base addon and all of its content (stylesheets etc). This means we can't break your addon by changing any of the underlying base addon code. It's all time locked in.

This cuts both ways. If we make a fix in the base addon, your game won't get that fix because it'll still be using the older base. Right now I think this is fine though - because your addon might be relying on the base operating in the wrong way, so by fixing it we'd be breaking it.
The in game UI inspector has moved to tools. It's pretty much the same functionality, allowing you to see a tree of panels and where they are. You can select them and play with their values.

In the future it'd be nice to be able to use this to runtime change styles and stuff, but right now I was just concentrating on moving the functionality to the editor.
I have been continuing to add more props for use on construct. Including more wall mounted items like a cash machine, CCTV and aircon, with seperate mounts so they can be repurposed for other uses. The iron fences have also all been made more ornate with more detailed Victorian wrought ironwork tops to the poles and fences.
I Added some door prefabs with exposed parameters so I wouldn't have to reconfigure it each time I needed a door
In the same way, several house prefabs were added to build the street background.

Background 

Pass on the background to finally get rid of the grey box there

Assets

Added a road barrier and a gutter set
The gutter set exist with several material variation (metal, painted, PVC)

Water bed

Added texture and materials to add details to the canal/water bed
(shot in the editor with the water removed for clarity)
In the same way some functional ladders were added

Less noticeably some tweak were made all over the map, adding props and detail; layout and blend pass on the tree and water platform area etc...
We’ve added an API to listen for speech and translate it into a string. 

You can now listen for any speech or from a set of pre-defined choices and have the underlying speech recognition engine return what it thinks you said. This can only be done client-side, of course.

In the future we could expand this API with more advanced stuff, but this initial version should let people experiment with using speech as an input method for their games.
I've refactored how high quality reflections work, it's running on its own pass now and it should be 4-6x faster while looking much better.

Rendering artefacts are also gone and it still has the nice roughness granularity you'd expect.
You can modify the reflection shader and even specify your own if you want to experiment with new ways to render reflections or to composite over it, it's exposed as a parameter in MODES
This paradigm could be expanded in the future for players to expand their own render passes in the render pipeline without dealing with much fluff, let's see..
With help from Layla, we reimplemented func precipitation in c#. We found out the way it was done before was super overengineered and realised a bloat load of the work can now be done inside the particle so that is what we did.

We also added a bunch of extra new features, we can now change the colour of the precipitation, Freeze and Unfreeze the particles in place, change the speed at which it falls and also change the density. This allows for a much more dynamic system.

Using models made by the team I created a bunch of useful tilesets for mappers to use to create details fast and quick. Tilesets are an incredibly powerful mapping tool, if you ever made maps for Half Life Alyx you will know how much time they save placing certain props like pipes, rails ect. So now we have a bunch of them in s&box speeding up that process.
I had some fun with Layla's dynamic mesh creation API, seeing how much I could do in C#. Here I'm using marching cubes to turn a grid of voxels into a mesh in real-time.
You can play around with it in "Voxel Test" in-game, or take a look at the source code.

When you press F2 you get the developer camera, where you can fly around and inspect things. We use it to take screenshots a lot so added the option to adjust field of view and some other effects. To open the menu you just hold down tab.

Check this out nerds:
Now you can click on that shit in the console to inspect those objects
If like me you do your debugging via console logging instead of a debugger - you're gonna love this.
This month I made a few additions to the leaderboard system.  A game's setup has a new toggle for per-map ranking.  When enabled, every map in this gamemode will get its own uniquely scored leaderboard.

I've also added two new modes for submitting player scores: Best and Increment.

Best is useful for games where we only want to keep a player's score if it's an improvement over their previous score.  Ascending leaderboards will make sure only lower scores are accepted, Descending will make sure only higher scores are accepted.

Increment is useful for games that want to adjust a player's score with a custom ranking model.  A simple example might be increment 1 per kill, -1 per death, -2 per suicide.  Adjust a player's score as you wish.
Creators can now set a game's map selection mode to Official and have a curated list of maps to display for their gamemode so players can quickly and easily find compatible maps.
We really should have done this editor stuff a year ago. We'd be living on the moon with robot butlers right now. I know to a lot of people it probably feels like we're just rearranging the furniture but it's filling in a lot of gaps in the development cycle.

I stopped the access queue last month. We have enough devs on board right now to be doing what we need to do. I feel like it'll be apparent to us when it's ready to have more people with access - and at that point we'll have to decide how we do that, whether it's a soft launch or just dev access.

Getting the dedicated server downloadable via Steam is next on my agenda, along with making them accessible in the games. I'll also be making the addon system more integrated with the backend and look at adding different types of addons.  I'd love to get some high level performance monitoring in too.

See you next month 🥰