I am making a 2d top-down tile based game, which is randomly generated each new world.

What I want to do is create a Polygon (or other more appropriate shape I don't know of) for each landmass not disrupted by land, basically each unseparated landmass/island, I want to do this for where my player is to spawn in the world, I want to have it so it has a higher chance of spawning on the biggest landmass in the world, rather than spawning on a tiny several tile island. So, all I need to know is how would I create some sort of shape system to recognise different islands.

The reason I suggest a Polygon is because the player would randomly spawn in that area so it has to be accurate to the land, it can't start of by spawning in water nearby.

If a Polygon is obsolete for this idea, and another system would be better let me know.

  • \$\begingroup\$ This sounds like a simple connected component search problem, which we've answered here before. Where have you run into difficulty implementing it? \$\endgroup\$ – DMGregory Sep 17 at 19:13
  • \$\begingroup\$ @DMGregory I haven't tried anything yet, but I don't actually know where to start, my quesion was asking for ideas to my problem \$\endgroup\$ – Tyler Harrison Sep 18 at 15:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.