In the last post I mentioned the “Nanobots” that we’re using for construction.
Nanobots teleport around the station, so they offered a practical solution for expanding the station and building in areas that are inaccessible to colonists.
Teleporting
Right now, the little Nanobot thing teleports around the station. This is partly because it’s faster, but primarily because it was quicker to implement than an object that can physically fly around the station.
Here’s a Nanobot teleporting around and building some floors:
Construction Animations
We’ve also significantly improved the visuals of objects under construction.
Objects currently turn blue when first placed. Once construction starts, they “rise” from the ground. We also added a progress bar to show the state of construction.
The implementation of the visuals is slightly interesting.
Back Faces
First, we don’t render any pixels above a certain y position. This y position increases as construction progresses. This is what causes the refinery to “grow”.
The immediate issue with this is that our models don’t have anything on the inside. These are called “back faces”.
Imagine that you’re looking at a cube.
(Do you know how hard it is to find a drawing of a cube that doesn’t use black lines?)
The sides of the cube that you can see are the “front faces”. There are 6 front faces.
There are, of course, 6 inside faces that you you can’t see. These are the “back faces”, and we don’t bother to draw textures for them or render them.
Here is what the Ore Refinery looks like when you discard all pixels above a certain height. Again, we’re not rendering the back faces, so you can’t see anything.
To solve this, we perform a second rendering pass on the Ore Refinery and render the back faces black.
Texture Roof
The black color isn’t ideal though, so we place a “construction” looking texture on top of the refinery. This second texture is actually a separate GameObject, and we move it at the same rate as the y position cutoff.
We use the stencil buffer to render the “construction” texture only where the ore refinery back faces are present. This allows us to use the exact same texture for all objects.
Growth
The object “growth” is achieved by increasing a y cutoff value. Any pixels above the y value are discarded in the shader.
Here’s the entire process again:
You’ll notice that you can see the “black” back faces in a few spots. This is probably because the geometry of the model doesn’t play well in all cases.
Overall, though, this visual implementation can be used on any object, and requires no additional development time. So it scales quite well.
Required Resources
I’m running out of time, but one last thing.
Objects require resources to be constructed. These resources have to be added to the Nanobot docking station. Without a Nanobot builder, you can’t build anything. So we placed the docking station directly on the Starmancer Core, because if the core is destroyed, you lose.
So Long
That’s mostly everything for the Nanobot builder. We’ll probably do some more visual tweaking and polishing before Alpha.
Speaking of Alpha, it’s coming eventually.
-Tyler