Sandbox Logo
10 February 2024

Hackweek Feb 2024

Here's a bunch of stuff that we did with s&box during our hack week
Every few months at Facepunch we have a hackweek. This is a time for people to experiment, to chase the ideas and whims that they have felt are too much of a distraction during the normal working time.

Programmers become artists, artists become programmers, some people just stay who they are but work on something else for a week.
When I was making the particle sprite shader that used a geometry shader, it got me interested in being able to draw lines that way too. Would it be possible to draw lines in a shader by passing just position vertices.
It broke my brain for a long while. I was trying to do it in screen space for some reason, so my maths was all fucked. But eventually, it clicked.
I managed to detect the ends and add nice end caps.
I got the shader creating extra geometry to add curves too. This feels great, but I didn't have the time or brains to stitch the areas together, so it has gaps.

It’s been over a year since I made Socceteo in s&box and I’ve been itching to prototype another game mode since. S&box has had so many changes since then and I wanted to get up to speed with the changes!

The basic idea is - what if multiple people controlled a single character? Hopefully a rage-inducing, yet fun cooperative puzzle game!

The mechanics of the game are fairly simple:
  • Each player gets a cursor, but there’s a team crosshair which is the direction the character faces and moves
  • Everyone can contribute movement inputs, but you will only move if the majority of the team agree (represented by ⛔ changing to a☝️)
  • Everyone can jump a little bit, but to make the big jumps you’ll have to combine jumps into one powerful one.
I didn't have enough time to really explore any of the fun puzzle elements, but I do feel there's a lot of potential for some really interesting mechanics in the future! As always working in s&box was a treat, the new scene system is really something.
Internally, there's a sound mixing system called VMix and I've been trying to find a way to tame it for a year. Ideally, I want people to define their own mixers in the editor, and while vmix is doing that, it's huge, complicated and unwieldy.

So for a couple of days of the hackweek I decided to come at it from the other side. Instead of trying to tame vmix, I'll rip it all out and leave us with only the lowest level shit. We just want to read bytes from a sound and push them to a speaker.

This actually went amazingly well, and within a few hours I'd got the framework of our own audio system where we have 100% control from c#. 

In total I spent about 2 days on it, and really, 1.5 days of that has been trying to figure out how to make Steam Audio do what I wanted it to do.
All in all, this has been a huge win for me. Now we can make the audio system more customizable, just like we've been waiting to.
Our goal is to eventually replace SFM, the core of that is just animating properties with keyframes. So that was my goal this week, click on an object and edit curves for any property it has.
Instead of a seperate tool, it's handled directly in the scene editor, this makes the most sense to me because you could either use it for in game cutscenes or record it out like you would in SFM.

Because it's a component, the keyframed curves can easily be saved and loaded and playback controlled from in game.
It has been a little over a year since I've touched any code and this hackweek was a good excuse to see what I still remembered, familiarize myself with s&box's new scene system, and play around with an idea for a game mode I designed a while ago. 

To summarize the game briefly, Septic Sprawl is a co-op shooter where players are tasked with cleaning up a map covered in toxic sewage and giant bacterial monsters. Think of it like a mix between Left 4 Dead, Powerwash Simulator, and Splatoon.

A week is not a lot of time but I'm pretty happy with how far I got, happy to say I didn't forget everything I knew about coding and I have a much better grasp on the scene system now.

Here are a few recordings of me playing:
Action Graph was missing a big feature: you could only store stuff in properties defined in C#. That's no good if you don't know C# yet, or are making an addon type that doesn't support code.

Before Hackweek I mocked up a quick solution where each GameObject has a Dictionary<string, object>, but I really wasn't a fan. I know that people are going to stubbornly make whole games without any C#, so imagining them only using Dictionaries to store everything makes me cry.

Instead, imagine designing whole Component types without touching C#. That's what I did this week.
After selecting the "New Action Graph Component" template and choosing where to save it, you'll be able to define properties for your custom component type.
This is using System.Reflection.Emit to build a real System.Type, and our existing Hotload tech to handle it changing. Generating Types like this means it fully integrates with our TypeLibrary stuff, with no ugly hacks or special cases everywhere. Your properties will show up in the inspector, and you can access them in Action Graph of course.
So that was Monday. The next big idea is to let you define methods too.
Methods are implemented as Action Graphs, and inside them you can easily access any properties or other methods on the same component type.
As well as creating custom methods to do whatever job you want, you can override all the virtual methods in Sandbox.Component like OnStart and OnUpdate.

To make everything as fun to use as possible, I've added a bunch of interactions to help you add or modify these properties and methods. It only takes a couple of clicks to refactor a bunch of nodes into a method, or create a new property with the right type to supply an input.

One last thing I'll show off from this week: you can mouse over wires while the game is running to see the value they last transmitted.

To wrap up, I'm super happy with how much I got done. This idea has been stuck in my head for a few weeks, so it's great to see that it can actually work. Bear in mind that this is all on a branch at the moment, and it'll need some review and polish before we can think about releasing it.
We are likely to expand our platform support in the future, just isn't a priority now.

I recently got a M3 Max Macbook and it's so fast compared to what everyone else is offering.
I wanted to take the opportunity of a hackweek to try to get S&box on it and be able to take advantage of how fast this thing is for development.

I don't think on the current tide there's enough to justify officially supporting the platform - the users just aren't there, if any of this ever goes public I'd put a big fat sign to never report bugs on it since it's an unsupported platform.

This work lays good foundation for making the game more malleable to be targeted on other things, I think Linux server (x86-64 and ARM64) support might be more valuable for users in general, and 90% of the work for that is done now.

There's still some work to be done to have it booting but I'm very happy with how smooth it is compared to previous attempts I have done with Source 1.

Opium is a PSX-style love letter to the gritty melee-focused brawlers of the 2000's, namely the Condemned series. It combines a first-person rock-paper-scissors combat system with light puzzle elements and a weapon scavenging loop, forcing the player to pull pipes from walls and re-use damaged equipment dropped by enemies. We’re setting it in a run-down apartment building, occupied by violent crackheads with occult undertones.

Some of us banded together to try to make a small game using the scene system within the span of a couple of weeks, the main goal being to show how easy it is to make games now.
This is our first real hack week since the inception of the Scene System, so it's been interested to see it getting used. It's amazing to see that Taylor and Howie can quite intuitively put a prototype together now as non-programmers. It's even more impressive that they managed to make them multiplayer, too.

But the winners here have got to be Team Opium, who I think stunned everyone with their reveal yesterday. They've done an amazing job showing us that the scene system can be used to make stuff that isn't a skybox with floating solid blocks. It has been impressive to see them make this in such a relatively short amount of time, and I'm excited to see what they do next.

Cya next Hack Week 💖