Slow Rush Studios logo,
    depicting an apprehensive-looking snail rushing forward

Slow Rush Studios

◂  Ability Subroutines
News index

Loot Chests

Contents

Okay, look, I know loot boxes get a bad name from the (many) publishers that use lootboxes to encourage microtransactions that milk their players for every last cent.

But I don't do microtransactions! So here we just have certified evil-free loot chests, filled with yummy yummy perks you can pick up in a game.

Also, we now have a way to edit abilities which doesn't blatantly break the game, which is always nice.

Perk Pickups

So we had these perks that you could assign to abilities to effectively "program" what bullet you're going to shoot (or whatever1), but there was no way to actually gain these abilities or perks in-game.

That changes now!

You can pick up abilities and perks that are scattered throughout the level. Ability and perk icons are placeholders, of course.

But, in a falling sand world where all pixels are individually simulated (like in this game), these "pickups" come with an interesting design question: what happens if they get buried?

Do players just miss out on buried pickups? Or can players still pick up perks that are really far below them?

Block Bodies

To fix that, I introduced "block bodies", which is possibly the world's dumbest physics engine:

Block bodies always stay on top of sand when you try to cover them, or if you squeeze them, they'll escape by travelling through terrain.

Unlike the regular "rigid body" physics we have had so far, block bodies are allowed to break the laws of physics a little: the block body checks each of the integer-grid positions that it occupies to see if there's an atom there, and if any atoms are in the way, the block body looks around itself to find a new place to move to - even if that means moving through terrain. 2

That means that perk pickups will never be fully buried under sand.

Loot Chests

Just running around picking up perks was a little mundane, so I put them inside chests (which are also block bodies under the hood):

Find and open loot chests to get a perk, like this Legendary Multi Shot perk. Chest graphic is a placeholder too.

The more powerful Epic and Legendary perks (blue and orange) appear less often, which adds a bit of excitement when you see a rare perk appear, and makes it okay to have overpowered perks.

The chest locations in each level are lightly randomized: I place the possible chest locations manually in the LDTK editor and a number of them are selected based on the level size. 3

Ability Editing v2

You could now run around collecting abilities and perks, but each perk would automatically get assigned into the first ability you had - which can be less than ideal:

Picking up an explosion perk and trying to shoot your revolver means that every second shot creates an explosion at your position - which flings you sky high.

And there wasn't a way - other than using the cheat-y loadout editor - to reassign those perks.

So I upgraded the HUD so that you can press Tab to enter an ability editing mode:

The new ability editor is opened automatically when you pick up a perk, or you can open it at will to move perks around. Moving a perk causes affected abilities to enter a cooldown state to avoid obvious exploits.

There's a lot of hidden complexity in that interface:

Splitting Perks

In the original cheat-y loadout editor, once you had acquired a perk of a certain level, you could use it as many times as you like in as many abilities as you wanted.

That's obviously broken if you get a super powerful legendary perk, so now perks can't be 'duplicated' like that.

Instead, if you have a perk that's been leveled up, you can 'split' it by right clicking:

Splitting the Level 2 Large Clip perk into two Level 1 Large Clip perks, so that both abilities can have larger clips.

So I guess perks now behave more like stacks of items than acquired traits - hmm, maybe I should rename them?

Playable web build‎

I've also rolled in a few other minor changes:

Press F1 for help, including to see keyboard/mouse controls. Mobile devices probably won't work! By playing you agree to our Privacy Policy and Terms of Service.

1

Okay, sure, right now pretty much all abilities can do is shoot bullets which get modified by the assigned perks.

I'd like there to be a bit more variety but haven't got around to trying prototyping that yet.

2

This isn't how collision resolution normally works in physics engines! Normally you have two polygonal shapes and use an algorithm to find how much the two shapes intersect, and what displacement is required to stop them intersecting - then move them according to that.

I do have a way to calculate polygons from terrain atoms - which is used for the rigid body physics engine integration - but calculating those polygons is computationally expensive. So I use this hack job approach instead to avoid having to compute more terrain polygons than necessary.

3

That does mean that you can get unlucky and have a whole area of the map that doesn't have any chests, but I can rework that later.

4

Which meant I rewrote my over-engineered (and apparently poorly-designed) control mapping and input handling code yet again. Now any player can have 1-N input devices assigned, each player can use multiple input devices, and the most recently assigned device is the preferred device for any player.

I still need to dynamically update the preferred device based on player inputs, so the singleplayer case where someone swaps from keyboard to controller works seamlessly - but this'll do for now.

5

You can't directly modify the game state from within the UI because that would cause the game clients to get out of sync. And I didn't want to move the 'editing state' (like mouse cursor position) inside the networked game simulation too, because then the raw mouse cursor position would need to be sent to all players, which would cause a lot of rollbacks and ruin performance while any mouse-using player had the HUD open.

So instead each edit operation needs to be sent as a standalone command, like 'swap ability A perk at position X with ability A perk at position Y', and the UI code needs to accept that the game state might be rug-pulled out from under it at any point.

◂  Ability Subroutines
News index