Christian: Optimize and Do it Again

This week was about building collision meshes and making some structural choices on how the levels are going to be stored. The collision meshes were relatively easy to sort out, once I was able to find a nice way to mark edges. What I ended up doing was marking each edge when a block was added, and then tagging those edges with whatever axis they were aligned to. Then, when another block was added, it would check first to see if any of the edges that it was attempting to add were already present. If they were, then those two cubes were sharing an edge, and the edge that they were both sharing could be removed (since it is an internal face). Thus, after looping through all the cubes, we have a list of edge positions and orientations with no internal edges. After that, it is a simple matter of making a quad at each location and combining them into a single mesh. as for the structural choice, I decided to go with the simplest route, and have the level be stored as a prefab. Right now, I don’t plan on having to have deformed levels (like the player taking out a wall or something) so the level storage doesn’t need to support runtime updates and saving. However, should that eventually be wanted, it can be added without much fuss.