read

This week life was pretty busy but I made some good progress on Builderment. Early in the week I added some life to the world by animating the water tiles. This was done by randomly rotating tiles every few seconds. I think the results are pretty good for how little effort was involved. 👏

Your browser does not support playing this Video

for tile in visibleWaterTiles { // Target fps is 60 so on average each tile will rotate every 2 seconds if Int . random ( in : 0 ..< 120 ) == 0 { // Select random rotation in 90 degree increments let rotation = Float ( Int . random ( in : 0 ..< 4 )) * Float . pi / 2 tile . node ? . eulerAngles . y = rotation } }

Multi-tile Buildings

The next couple of days were spent on refactoring the code to support buildings larger than 1x1 tile. It’s not quite working yet but I’m glad to start this sooner rather than later since it’s changing a lot of early assumptions that were made. Many parts of the code expect buildings to only occupy one tile 🤯. While redoing some of the building logic I also want to have fixed input & output locations on a building. Currently belts can input items into a building from any direction, which is maybe a bit confusing. This would also make it more visibly appealing by allowing doors or loading docks on the models that line up with belts in a predictable way.

Turrets

I took a break from multi-tile buildings to add basic turrets. They don’t do much now, just kind of rotate randomly 😂. It was good practice to get the code and modeling to rotate independent parts of a model programmatically. The next step is to add enemies they can fire at! But first so many questions to answer, what is the enemy? Where do they spawn? What do they target to attack? How do they move? Can they swim *cough* factorio? How do turrets decide what to shoot first? How much health do buildings have? The list goes on! Anyway here they are being totally useless currently:

Your browser does not support playing this Video

Testing Level

Performance is always on my mind and an important part in ensuring this game is as good as it can be. So to make testing easier I created a very basic level that has a single belt and filled with copper. I let that run for a while and check to make sure it stays at 60fps. It looks a little something like this:

Word Wrapping

This website design is pretty basic and adapted from a free template. Slowly I’m putting work into improving it, the first improvement is word-wrapping. For whatever reason the template css hyphens value was set to auto which caused words like “seconds” to break into “sec-onds” if it was at the end of a line. Changing the value to manual prevents that and makes the blog a little easier to read.

This journey is just beginning. If you like what you read I’ll be posting more of it, hopefully weekly. Currently on twitter and instagram sharing images and videos from development. Reach out via email or come join discord!

Twitter @builderment

Instagram @builderment

Discord https://discord.gg/VkH4Nq3

Email contact ‘at’ builderment ‘dot’ com