I’m going to start working on a grid based construction system much like you would see in a game like The Sims. There will be tiles and walls that go on the borders between tiles. Building will be animated (as in when you draw the line for a wall the wall slowly comes up out of the ground or something like that).
I’ve thought of a few different ways to do this and I was wondering if anyone could point me in the right direction of which would be best.
-
Make each part of the building a instanced static mesh. Have a building animation and then spawn the static mesh in it’s place at the end of the animation. Corners could be handled by another mesh that is placed when a corner is formed. The advantage of this method to me seems like simplicity (would be very easy to allow the player to build and destroy in this way). The disadvantage being possibly performance.
-
Procedurally generate a mesh when the player builds. Use this mesh for the building animation (in this case it would have to be a simple animation like scaling up or moving up). When the animation completes, combine the new mesh with any existing adjacent meshes, eliminating any overlapping vertices. The disadvantage to this method I think would be that it would be much harder to tell exactly which part of the mesh is being hit and then remove that segment when the player decides to remove it. It might be done by storing the triangles that make up each segment in a dictionary or something to correspond with that segment’s coordinate in the world. The program could then remove those triangles and then check the affected vertices to ensure that they are still being used, if not delete them and adjust the triangles for the rest of the mesh accordingly.
I would much appreciate some input from people more experienced with unreal.