Download

Performance Issue Creating Lots of Widgets

I am working an creating a level generator for my game. Its a tile based game so I am generating tiles to be shown on the screen. I put generating code in C++ and sent back minimal information on what is needed to create a tile. Then in BP I created the tile, calculated its location on screen (and other calculations) and added it to the screen. This was slow on the hardest level which has a 30x30 grid of tiles, which is 900 total tiles. This took 3 to 4 seconds to complete

So I moved all the calculations and the actual UI of the game tile to C++ and created the widget, did all the calculations and added the tiles to the screen. This is fast but I am running into a lot of issues doing the UI in C++, which from what I read is hard to get right and can be buggy. I did run into problem after problem so I compromised and tried all calculations and data generating in C++, then sett that data to BP where I loop 900 time and in each loop I create the tile and add it to the viewport and nothing else. This saves a bit of time but on my computer, it still takes 1 to 2 seconds just to loop 900 times and each iteration, create the tile widget and add it to the screen and that’s it.

So I’m wondering what else I can do to add 900 tiles to the screen without taking so much time? I have also tried adjusting the engine scalability settings and that doesn’t have much of an impact to how much time this is taking. Is there a better way to accomplish this? I can proved code if we need to talk specifics about what exactly is going on. But I have a feeling this is going to be more of a design issue than a code issue.

FYI my computer is not a top of the line gaming system but in the lower spectrum. I did that intentionally so I knew if a game ran well on my computer, there shouldn’t be any performance related issues on other computers.