Website powered by

Home Domes - Flooring, Walls, and Painting

The painting, wall placement, and floor placement systems appear incredibly simple, but I spent a lot of time improving, iterating, and rafactoring each of these systems so that they would feel intuitive and simple for players. The click-and-drag functionality of both walls and floors was added pretty late in the project based on player feedback, but vastly improved the feel of building so players didn't have to place every single wall segment and floor tile individually.

The Wall building system went through the most changes on the entire project. Initially I simply placed a rectangular wall looking object, and on diagonals multiplied the scale to make it the correct length. I started applying random materials to the walls when they were placed, because the white was looking pretty boring, and upon doing this I discovered that the overlap of the walls was causing some z-fighting where walls overlapped each other(similar games all have this problem from my research, but it bothered me too much). I tried some tricks like offsetting overlapping walls just slightly, but it ended up just looking bad so I endeavored on a long journey to build a better system. The GivenKittens Superior Walls Building System(TM). This system went through many iterations, but in the end there are 18 different wall models(9 for walls placed on cardinal directions and 9 for diagonal walls) that get swapped in so that it fits correctly with neighboring walls. This happens seamlessly so that players will not even notice that the wall model has been replaced, and I worked on many iterations to improve performance, reliability(sometimes walls didn't update), and accuracy(sometimes an incorrect wall model was chosen). There are 'wall-door' models that replace the walls for when a door is placed in a wall segment, which has the 18 different iterations so that they fit together nicely too.

Painting walls was relatively simple to implement, but I decided to add the ability to paint an entire room as well. The most difficult part for me was figuring out how to define what was a room conceptually, and convey that somehow in a computer function. My solution ended up being anything that was a chain of walls when you followed one side of those walls until the current link was the same face of the same wall as where the chain was started(where the player had clicked). This solution had the added benefit of painting the entire outside with a single click, which was a lower priority task automatically completed once the functionality was working correctly.

Initially the floor of the dome was made of a ton of individual models, and placing a different kind of flooring would replace the model with a new model with the matching material. While this solution was simple it became difficult to manage when I added the half floor tiles as I was trying to determine which models needed to be replaced with a half tile, and then make sure that the complementary half floor was created with the previous material inside of that one grid tile. At some point I discovered(or realized I was being silly) that I could just swap out the material on the tiles, and implementing the system became fairly straightforward, and required a little testing to make sure I was changing the material on the correct material indexes.

The flooring and walls are easily placed by players. The wall building system automatically chooses the correct wall model at intersections so that the corners fit together smoothly, which prevents Z-Fighting of textures on neighboring wall pieces.

Wall painting can be done for each individual wall face, and also entire rooms at once.