- Home /
Infinite/procedural multiplayer world in Unity possible?
So, a project where the terrain/environments are procedurally generated. Players and other entities are Unity gameobjects, with physics/collision. Players can go off on their own, explore, etc. Or interact with each other, if they choose.
How is this possible with networking? If you have a single authoritative server, that means the server has to have a collision mesh for the terrain where -each- player is at. I -need- the terrain to have a collision mesh, so physics and default collision will work.
The problem: Player one is at the "origin". Player two is a pazillion miles away. Ok, maybe not that far...but WAAAAY away. Unity has a limited range that it can place gameobjects at. How does the server manage multiple collision mesh/gameobjects for each player's zone?
I could spawn a server for each player...but then, I might as well just use non-authoritative networking, and have each player handle their own zone, and inform the other players/clients of changes if necessary. I don't like that this makes it easier for people to cheat, but I don't know of a way to handle this with a single server.
I'm trying to do much of the same, although it would be on an ocean so would that require less power? or more due to the amount of movement...idk
Answer by Jason B · Mar 30, 2011 at 07:18 PM
I should think the amount of raw power required by the authoritative server would be legendary. I mean, just to constantly be procedurally generating things for EVERY player as each player wanders into new things. Especially when you apply the "infinite" scope to it. So how many tens of thousands of players need content generated for them on the fly now? :) Only way it would be feasible is to use each player's processing power to do it, but now you've made it exponentially more complex.
As you said, each player needs to handle their own zone, but also as you said, now players can cheat by running pretty simple memory hacks.
Personally, I think you should try instead to make a finite area of play, and make the features of that finite area be what is procedural. Spore comes to mind here. Each planet is a finite body, but how you populate each planet and what effects your actions have on the general ecosystem is totally dynamic.
Just because it's finite doesn't mean it has to be small, though. A good handful of MMORPGs have worlds so big that it's literally boring to travel across them on foot, so accommodations such as horses, air vehicles, and even loading screen transitions exist.
I'm kind of just shooting the breeze here, I guess. This topic might be better suited for the forum, not sure.
Thanks for your response! The procedurally generated terrain isn't so heavy on processing power that it would cripple the server. The terrain is pretty simple. "Infinite" terrain is a big feature, but you do have a good point. Let's say 7 players max. I can honestly say that limiting it to one zone's worth of terrain would be severely limiting. As far as $$anonymous$$$$anonymous$$O's having static zones...the issue here is, a zone should be not only large...but the terrain data is 3 dimensional, not 2. And, it's procedurally generated...so it's not like each player can load static zone mesh data from the disk.