I am trying to do a stardew valley grid like.

I’m trying to make a game inspired by Stardew Valley, but in 3D and with a square aesthetic. I created cubes to represent the ground—things like dirt, stone, sand, etc. I set up a struct and a data table with properties for these cubes such as:

  • Can be plowed?
  • Can be watered?
  • Can trees grow?
  • Is plowed?
  • Is watered?
  • Has a tree?
  • Can build on?
    …and similar attributes.

The only way I see to build the ground as a grid is by placing multiple instances of the same actor side by side. However, this approach causes major performance issues since it would require roughly a 250x250 block area per map segment.

I even tried using Instanced Static Meshes (ISM), but then the blocks don’t have individual data table variables—they all act as a single block. I’ve looked into how farming games like Stardew Valley, Coral Island, and even Harvest Moon handle this, but I haven’t found any answers yet.

1 Like

ISM instances have an index, and that’s all you need. The data is kept in an int (index) | struct Map and retrieved as needed. It would not reside in the tile itself.

In short:

  • have a single actor with many ISM components, acting as a manager
  • tiles can be moved between ISMs if needed
  • have a struct representing the tile’s data
  • the manager actor holds onto tMaps keeping track of tiles’ state

It takes a while to get one’s head around it but it is quite performant. There are obviously quirks and gotchyas you’ll discover along the way. You will need to understand how instance indexing works, too.

Once you feel comfortable with ISM, you could tackle HISM which can provide further performance boosts under right circumstances.


At this point, you may also want to start looking into:

Here’s a very crude example: