Edit:
So it looks like the short of it is that UE4 does not deal too well with getting and setting location for instanced meshes as well as I was hoping. This is something I can bypass by applying my placement logic before a tile is placed instead of trying to update it. Makes it a bit harder to iterate through the logic with a single loop but compile times are down to a few seconds. This however is a bit of a limitation as I was hoping to make updates to tile locations during run time on a large scale, however I am thinking I can still get this to work if I can break up the tiles within designation arrays at world gen so I mitigate the amount of tiles I would need to iterate through instead of going through the entire list during runtime.
Hey everyone,
I’m experiencing issues with long compile times on logic that creates a basic world when ran.
I don’t believe my hardware is the issue. Im running I5 with 16GB of ram and all my project files, assets, and the UE4 install are all on a SDD. I have also edited the config file to use multiple cores. The only thing I notice hardware wise is that my system is only using 4GB of RAM and only 25% of my CPU when compiling and not more.
Since I don’t think its my hardware I think it may be the logic I’m using and was hoping I could get some input on how to improve my it.
When the program is ran it will create a flat world composing of only of 400000 tiles in a 200X200 Grid. The tiles are an instance static mesh root of an actor I have that is running the logic. They 200X200 in size as well and they do have a bit of depth and collision enabled to allow for physics with high velocity objects.
This only takes 10 seconds to compile and is what I would expect. However I then perform logic to elevate tiles to create a pyramid shape landscape. After that I then replace some of the tiles with instances off “instance static mesh component” within the same actor that contains the tile instanced static mesh. When I try to compile with this logic enabled it then takes well over 2 hours to compile.
To get the pyramid shape I have some logic that randomly generates several coordinates in descending width and height. I use these coordinates to create logical squares that box in tiles located within the bounds. Now to check to see if a tile is within the bounds of one of the squares I have to iterate through every tile, get it’s location and then compare it to the coordinates to check to see if it is within the bounds. Since this is an instance static mesh the only way I can seem to do this is just get the count of my instances and then iterate through every tile based off the index created by the count. If a tile is identified within one of the logical squares it then goes up in height equal to its width (200). At this same time a random number of tiles that were moved are replaced with instances of another “instanced static mesh” to change the tile to something physically different. The tile replacement requires the removal of the old tile and creation of the new instanced static mesh component. This happens for every layer of squares until the tip of the pyramid is created. There is also some logic that randomizes the tip of the pyramid, giving it a randomly curvature as it reached the tip.
Does this sound like something that would normally take a long time to compile? Is my logic faulty and are there much easier ways to do this? Does it sound like I am using Instanced Static Meshes correctly?
I would greatly appreciate any input you may have.