Damaged Walls, Scrap, and Scattering Items

Hey Folks! Work continues on item stacking, and expanding various loot systems to use it.

The big change today is getting mode switching to support lists of new items instead of a single new item. E.g. having a wall convert into a damaged wall plus a list of scrap parts when it receives a "damaged" interaction, whereas before it could only change from "wall" to "damaged wall."

A lot of this depended on some fixes and enhancements to the stacking code, and in particular, the code to scatter items in an area. A bunch of the code that I wrote specifically for loot spawners was cannibalized to make more generic utility functions that other game code could use. Now AI and other objects can use it to drop loot in nearby spaces, the interaction system can use it, and so can the trading UI.

There were a few bugs from the stacking work that needed fixing, too. The stacking code wasn't correctly accounting for the incoming item's stack, and I changed all the hid/unhide code for items within a stack to also affect collision meshes. The latter change ensured that game code like tooltips and selection raycasts ignore items within a stack.

Finally, I made some data changes to support this new loot scattering. The wall modeswitch into damaged state now produces the damaged wall plus scrap, as you can see in today's image. Piles of junk around broken walls!

Furthermore, I did some recalculating of wall mass, as the amount of loot it generates should correlate to the amount of material in the original object. For this, I used the Falcon 9's fairings as a guiding number, with its aluminum honeycomb structure covered in carbon fiber facing panels/sheets. The result is that damaging a wall roughly halves its mass, and 66% of that lost mass becomes scattered scrap. And I'll likely make the subsequent breakdown from damaged to completely gone produce the same results. So basically, destroying a wall through damage or salvage loses about 33% of the mass, overall.

There is still one error I can see while testing this new code and data. When an item breaks down into stacked scrap items, some of them get added to the root of the scene, which shouldn't happen. Every item should either be added to a ship directly, added to an existing item's stack, or destroyed and removed from the game. So I'll need to figure out what's happening here.

So far, my hunch is that adding an item to an existing item's stack is relocating that whole stack to 0,0, which is probably due to not adjusting the incoming item's position after it becomes the new stack head.

Once that's done, though, I think it's time to throw a few more interactions into the data. A laser torch salvaging interaction for walls, floors. Maybe a nav station, pump, or something more complex, too? And some high-level component loot from those?

Tags: Ostranauts


ra1's picture

Will it be possible for a single stacked tile to contain multiple resource types? If so, this may be very confusing to the player. If not, how do you handle a single object breaking down into multiple resources? I can imagine a small room still filling up with junk very quickly.

dcfedor's picture

It depends on how each item is setup in the data. The tile placement info for everything is defined there.

Right now, only one loose item (including stacks) can occupy any given tile at a time. But that could be changed later.

And a lot of the last week or two of work has been dealing with the "lots of items from one item" problem. So it'll try to place in the surrounding area, and stack when it can.

But yeah, too much in one place can run into trouble.

Dan Fedor - Founder, Blue Bottle Games