Prefab Prototyping

Hey Folks! I'm happy to report that today was more productive, and was mostly spent coding an alternative ship-building system. Namely, prefabs instead of tiles.

Prefabs, as mentioned yesterday, are basically items like the bed and fridge I showed in previous builds. The difference is that these are meant to be used to layout the ship itself, not just decorate it. For example, there might be a series of structural prefabs for things like struts and beams, others for straight and corner walls, and still more for floor panels.

Each of these prefabs may be larger than a tile, and like the earlier decorative items, they have a certain grid pattern they need below them to be placed. So things like a wall piece may require that a structural beam be below it, and that the beam's sockets line up with the wall. Essentially, it's like hanging walls on a frame of a house, then adding flooring, etc.

Here's a quick and dirty shot of it in action:

IMAGE( Don't mind the programmer art!

So what we see above is a series of beams, the brown lines that criss-cross behind everything else, which frame the ship's outline. Floor grates sit atop those beams, and white wall/cladding panels attach to the beams to form a perimeter. The green dots are just reference points for me to measure/debug, so they can be ignored.

Walls and floors can only be placed in areas where the underlying structure fits a certain pattern. And the structure itself must be contiguous, so each beam must connect to a previous one.

In this example, everything is laid out on a 32x32 grid. This is the same grid the tilemap would've used if we could see it. But the difference here is that the grid is hidden, and is only used to track things like where different sockets are available to install items. Later, I'm thinking I can have the game review the placed items and structures, figure out which tiles in the grid can be walked on, and use them for other things like air pressure, maybe even lighting? Basically, keep the functionality the grid offered, while using arbitrary prefabs to define the visuals.

It's still pretty crude. Just a few part types and really basic programmer art. But I think the idea has legs. For one thing, it already allows for angular walls and more interesting shapes. I can also probably leverage draw-order to make each type of item render on a separate layer, so we can drill-down from ceiling to wall to floor to substructure, like one does with floors in Sims.

The real question is: will it work in practice? Can I get the crew walking around this type of layout as they did on the tilemap one? And can I get it to look better?

So far, I'm optimistic. But we'll need to see next week. For now, have a good weekend!