I'm an ex-long time "AAA" game programmer, now solo indie developer making GearBlocks, a game all about creative building, interactive machines, and gears - lots of gears!

Report RSS Text decals, data links, and electronics

Posted by on

I've been wiped out with a nasty bug over the last couple of weeks which slowed productivity somewhat, still got quite a few things done though!

Text decals

I implemented a decal shader that can modify material properties in the g-buffer independently of normals. This allows for rendering over the top of objects already rendered in the scene, modifying albedo, smoothness, etc. while leaving the underlying normals as they are, which gives a "painted over" look. I wrote this shader specifically to work with rendering font text from the Unity UI.

Then, I added a Canvas in World Space mode and a UI Text component to the resizable plate part, and implemented a new text label part behaviour to configure the text string to be shown.

With a “painterly” font, it's quite a nice effect, here's an example of what it looks like:-

And here's the part behaviour UI the player can use to configure the text string:-

This will be handy for labelling things on constructions, and I’m thinking I might make use of it in future challenge game mode scenarios / tutorials.

Data links

I refactored the part behaviour linking code using various interfaces to better decouple the code and make it easier to add new link types. I also made some minor fixes and improvements to the linker tool.

I then implemented a new data link type, which allows part behaviours to expose "data channels" that can be accessed by other linked part behaviours. Where appropriate, I added data channels to all the part behaviours already in the game, for example the electric motor now exposes its current RPM, torque, and power values.

Electronics

Now the dawn of a whole new category of parts, electronics! I hope to expand on this a lot more in the future but here’s what I’ve done so far.

Putting the text decal shader and the data links together, along with a LCD display font, I implemented some text display screen parts that show the data channels of the part they’re linked to.

Here you can see the new data link type being used as we link a display to a motor:-

The display screen showing the motor’s data channel values while it runs:-

These displays have a part behaviour that lets the player assign a data channel to each text line on the display. Here's the UI for this, it needs some improvement but is functional for now at least:-

I also added some "sensor" parts which are little modules that calculate their own speed, acceleration, or attitude (i.e. orientation in the world) and report these values via data channels. These can then be linked to from the LCD displays to show their current values.

The speed sensor in action, as well as speed it also reports its altitude and rate of climb (RoC):-

The accelerometer sensor, reporting longitudinal, lateral, and vertical acceleration separately, as well as overall acceleration:-

Finally, the attitude sensor, which reports heading, pitch, and roll in degrees:-

I have loads of ideas for more sensor modules I could add in the future, e.g. for reporting angle, angular velocity, proximity (think radar / lidar) and so on. Let me know if you have any ideas too! Combining these with the control links I have planned will really open things up to some very cool possibilities I think.

Anyway, for now I’ve just been enjoying messing around with these parts, like adding some sensors and LCD screens to the Mosquito flyer for flight instruments!

Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: