Randomized Grid Spawning Advice

I’ve made a grid generator which I use to randomly generate levels for our bomberman inspired game. We’ve now gotten to such a stage where we need to start working on multiplayer, so as of lately I’ve been doing so. Though, I’m left scratching my head as to how I would go about managing the spawning of players.

This becomes kind of an issue due to how I randomly fill the grid with destructible boxes. The way this works, is that it will try and fill a minimum of 50% and a maximum of 90% of the grids with destructible boxes. The layout is entirely random and can be changed using different seeds.

So I’m afraid this could potentially result in not all players being able to spawn*(should be able to minimize this by tweaking the min-max of boxes to make)*. To make things a bit clearer, here’s a video I recorded a few days ago showcasing what a generated grid looks like;

I’m assuming the best way of doing this would be to work with offsets and check for certain patterns. Since I know the offsets, I can easily get a grid’s vector and check it’s neighboring grids and whether they’re empty or a box via accessing the BP_GridLogic component.

Here’s a quick picture example I made to visualize what I’m thinking of;

The green grids would be a viable spawn, whereas the red ones would not be - as the only outcome would either be suicide or having to wait for other players to clear the boxes around you. The brown boxes are destructible ones.

Would this be the most optimal way of doing it?

The easiest way to do this would be to manually clear a path for your bombermen upon spawn. Determine where to place them, say around the 4 corners, and then determine what shape to cut out of their surrounding terrain to ensure they fit.

You could of course make this all manner of complicated, including using pathfinding to help determine ideal spawn points.

Aye, I’ve been working on it a bit now and I managed to get it to work via finding patterns - however, this also resulted in the bomb breaking as I had to use BreakTransform. It would seem that BreakTransform completely breaks my stuff for no apparent reason. If I re-work my blueprints a bit so I don’t have to use BreakTransform - checking if the two vectors are the same will work as intended. But as soon as I use BreakTransform it stops working - always returning false*(which is necessary since I am using instanced meshes)*.

So I’ve decided to go with your first suggestion, it’s easy and gets the job done. :slight_smile: