Devlog #3 - Placeable Entities and Physics Joints
Join us for a (very) early look at upcoming physics contraption features, and some general improvements to placing objects that aren't really bricks.
Welcome back! This time we'll take a super early look at tools you might use to build physics contraptions in the future. It's very unfinished - but can already be used for some funny moments!
Introducing Placeable Entities
Until now, everything created in Brickadia was strictly made of bricks and only bricks. This worked fine, as we didn't really have many interactive game mechanics yet. We were able to optimize static brick environments very well - letting you have tons of them in multiplayer.
However, it definitely felt like bodges were starting to accumulate. For example, imagine you want to place a bunch of decorative weapons on your wall, like this:
How do you actually do that? Oh, that's easy, just follow the steps for each weapon: decide on a random unique brick somewhere nearby, click on it with the Applicator, attach an Item Spawn component to the brick, maybe set the brick invisible since you only created it to attach the new weapon, edit the Item Spawn component, spend like two minutes messing with totally intuitive rotation and offset sliders to get it where you want it to be, and better remember which brick you spawned it from if you ever want to edit it again.
Wait a minute. Does this sound completely ridiculous to anyone else?
Now, if it was just weapons being slightly weird to use, that would probably be fine, but we're planning to add loads of new interactive objects in the future. For example, those could be physics joints, trigger zones, gravity zones, small moving brick grids, ai controlled players, and much more. We have to improve this design before we build more bodges.
How did we get here?
To understand how we ended up with this in the first place, we only have to look at Unreal Engine. It was originally created specifically for first person shooter games that would have a pre-made, static map, a small number of clients on each server, and almost no interactive objects. It was definitely not created for sandbox games where the entire world is set up at runtime and must be replicated to players.
As a result, multiplayer replication was seemingly never much of a big focus for the engine, because I can only describe the replication system we had available as "almost unusable". Every frame, for every client, it would iterate all relevant objects and compare all properties to see if they had changed. If we spawned 5000 interactive objects and had 5 clients, the game was already unplayable:
There were some attempts made at reducing the impact of this system, such as only iterating a subset of objects each frame, trading significantly increased latency in receiving updates for the server not performing quite so terribly. Or only sending objects that are near the player when the map is huge. Neither of these work well in Brickadia though - in a sandbox game, players and logic may edit random objects at random times. We need the latency of those updates being sent to be low. Objects also don't tend to be spread across such a large area that only sending nearby ones would make sense.
With the engine's own replication system not being usable for our game, we decided to create our own, based on bricks. It is 100% push based, meaning that no work is done at all unless the system is notified of a change to a brick. This system is capable of replicating both millions of bricks and their attachments extremely efficiently, sending hundreds of thousands of updates per second without bogging down the server.
This worked well when it was just bricks in the world, but as we introduce more and more interactive objects that don't fully make sense to be bricks, we are increasingly facing the choice of having the object exist as a bodge-on brick component or having it not exist at all.
Iris Replication to the rescue!
Luckily, with Unreal Engine 5.1, there is light at the end of the tunnel. It has been a long time coming, but Epic finally rewrote the entire replication system in the engine, and the new version is several orders of magnitude faster. For example, here is Iris processing the same 5000 objects from the image above. I had to make some small improvements to Iris to get here, and it could still be faster, but it looks like the problem is finally solved for good.
With Iris running side by side to our brick replication system, we're now able to move things that never felt quite right as brick components out to standalone objects. Item pickups will be one of those, so will physics joints, various types of zones, etc. But enough technical info! Let's jump back to the game and see it in action.
So how do I place these now?
Hopefully, exactly as you'd expect. You first grab them from the catalog:
Then place them in your quickbar, along with normal bricks:
And then just place them in the world:
Note the cube is only used for demonstration purposes here. It is not going to be an actual entity in the game. Or is it?
Introducing Physics Joints
Keen eyes will have spotted the strange circle object above. What does that do? It turns out you can attach it to bricks somewhere in the world:
And then build something else on it! Wait, is this...
Yes, it is! We finally arrived in the future.
I'm sure many of you are curious to see the first ever vehicle created in Brickadia. Behold the latest innovation - square wheels only on one side.
Also whatever this thing is.
We're getting closer.
Flawless helicopter taking flight.
There are so many new possibilities, I really can't wait to see what you guys come up with.
That's it for now! Next time, we'll have even more physics features, and new tools for interacting with them, so stay tuned. Oh, and some better wheels would be nice.