Download

Is it a bad idea to create lots and lots of StaticMesh instances?

Thanks, Epic, for making this engine available at such an affordable price. Looks like a great package so far!

Let’s say I want to make something like a chessboard, with the white squares one material and the black squares another. I would also like to be able to change the size of the board (at the start of the game). What’s the easiest approach which will have good performance on mobile?

I can fairly easily use a blueprint constructor script to place StaticMesh Cube objects in a grid, and assign one or the other material to each. Is it going to be a problem for me later on that I have all these individual StaticMesh instances?

If it would be noticeably more efficient for me to combine everything of one material into a single StaticMesh, can I do that from Blueprint or do I have to import a model (from Blender for example)?

Honestly i am not entirely sure.

You might have one issue off the top of my head which is that lighting will not be able to be baked, simply because the board would not be there at compile time.

It also depends on what you intend to do with them later on.

I mean having the individual cubes could be very useful for player or ai movement, or doing effects and things to the spaces when events take place.
Especially since you intend to be able to resize the board at run time.

You can have baked lighting on meshes created from a construction script. The CS does not re-run in-game for placed actors.

A chess board with 64 meshes should probably be fine, unless you are very concerned about draw count (are you targeting mobile?). You could also try using an InstancedStaticMeshComponent. You add one and then call Add Instance multiple times to populate it with multiple instances of the same mesh. All will be drawn as one call (at least on PC/Mac).

Thanks, I’ll have a look at InstancedStaticMeshComponent.
The board is probably going to be about 10x10, and yes I’m probably expecting mobile (or at least, iPad) to be among the target platforms.

My procedurally generated 20x10 hex board is fine, but when I make boards with 40x20 or 100x50 I have a rather large amount of lag in the editor. Using bare bones static meshes, though they are 462x400(13x12ft) so I am wondering if that may be what is bogging down my computer.

Still, should even 5000 12ft wide blank hexes be enough to bog down the computer? Wondering if there is another factor at work…