Download

How to check if tile on a grid is available while spawning

Hey Guys, I’m working on a tile based strategy mobile game. I’ve created my entire grid with tiles as instanced static meshes. These are square tiles. I’m stuck at a point while spawning or creating new structures. I want the spawned actor to find a n empty set of grid tiles as a spawn location.

I want something as shown in the video video @0.34

In this video you can see how everytime we spawn a building it finds an empty location. How can I achieve this?

Games like Clash of Clans have the same feature.

Any idea is much appreciated.

Thanks.

I’m doing the same genre. What I do is use the constructor to create the grid as instanced static mesh, I know all their positions. Then at begin play I will spawn equal amount of empty actors (with a sphere collision roughly the size of the unit that will be on it) and use that for collision detection, spawning etc. It’s important that these actors don’t have anything physical in them, only collision objects, or the game will become slow.

Spawning is not the issue…the issue I’m facing is the location where the object is spawned. And there are different units with different size. How can I place sphere colliders for these?