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; https://streamable.com/820d
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?