Hello!
While I am working on an open-world survival, I find myself aware of something that I don’t like about open-world survivals. The issue which I am talking about is spawning far away from a friend whenever I die in an open world survival, which after too many times will cause me to get mad and decide to quit the game. So, my solution is as follows:
- The game will have 4 factions, and you’ll be able to pick the faction you’d like to associate with
- As there’s no official spawn for a faction since it’s open world survival, the spawn coordinates will be based around the density of a faction within the map.
For instance, if the majority of faction is in a city in the open-world map, then I will spawn around the city. I have the spawn button as a function that activates a function that determines the appropriate location to spawn. All I need is coordinates of just one person that is part of the bulk of a faction, and it’ll be put into the function I’ve built to determine a good location to spawn from.
To simplify:
You click the spawn button → It runs the function to detemine the most densely packed area of your faction → My algorithm I built to figure out the right area to spawn around the coordinates
I need step 2, but I’m too braindead to figure it out. To detemine a person as being in the same faction, use the function isInFaction(yourPlayer, otherPlayer)
and it will return whether or not a player is in your faction as true or false. Anything is helpful. You don’t need to paste code, I just need at least some sort of pseudocode to help me.
Thank you so much for your time