Advertisement

Server Side Procedural Terrain Generation

Started by January 27, 2010 08:04 PM
11 comments, last by EmpireProductions 15 years ago
Ok so we designing a server and client. The Client is just a dumb rendering terminal and the server does all the work. Now I had an idea that I wanted to see if it is possible or not. The terrain I would like to have generated in like 10,000 to 25,000 square mile chunks. As players move out away from the starting area new chunks are created on the fly procedurally. These terrain chunks would have mountains, rivers, oceans, ect as well as foliage and even buildings all done procedurally as well. When people leave the area the information for recreating that chunk would be saved to a database and the chunk would be unloaded from server memory. When some one goes to enter the area again the server would pull the information from the database and recreate the chunk. Would something like that be possible or not?
In Development:Rise of Heros: MORPG - http:www.riseofheroesmmo.com
Anything is possible. There's tons of procedural city algorithms out there online. You'd be doing a lot of research and algorithm tweaking though. You could generate your full terrain using 1 seed since perlin noise is reproducible for rectangles in a large height map. You can do vegetation based on slope and another perlin map or other algorithms. Very possible. A city and buildings could be done as regions at certain locations such that it flattens the terrain and adds roads. How it does that is up to you. If you view youtube videos like this
">one
you'll see possible methods and might be able to reverse engineer it by thinking hard.
Advertisement
It actually sounds moderately simple. For generating the content, you can get away with just a single "seed" value, which can just be a 32-bit integer you feed to your random number generator to ensure all "random" numbers that are generated are the same each time the content is constructed. This is done in quite a lot of games with procedurally generated content.

Putting this in a multiplayer environment really doesn't require much more than having the server tell the client about the world instead of having the client load it from file.

Only problem I see is generating "fair" content (meaning depends on the game in question), and generating interesting enough content fast enough. Sending the data to the clients could be made very easy by letting them generate the content from the seed value(s), too, but you can also just serialize the data into a highly compressed format the first time it is generated and always send that (since its not like the terrain is changing).
NetGore - Open source multiplayer RPG engine
Like others have said, what you are wanting to do is possible, and that you don't need to store the generated world, you just need to store the seed that generated it so you can re-generate it.

In this case, the server could just send the seed to the client and the client could generate everything. That should be less work for the server (well depends if the server needs to generate the world anyways or not... although this can still save transfer bandwidth).

Offloading work to the clients is always a good idea whenever possible in a multiplayer game. However, you should take the stance that you can't trust a damn thing a client tells you, so that limits the amount of work it can do to stuff that generally doesn't really matter too much hehe.

HTH
This should live in the arts forum, not the networking forum.
There have been many, many approaches to procedural modeling, including several PhD dissertations and even commercial programs.
Almost all of them have the problem that, very quickly, everything seems too similar.
You might want to check out "rocket club," an indie multiplayer game that uses procedurally generated planets and cities. It doesn't look all that great (I know the guy, so I can say that :-) but still he's worked on it on and off for a long time. If you think you want something a lot better than that, but roll it on your own, prepare to be disappointed.
enum Bool { True, False, FileNotFound };
Quote:
Original post by hplus0603
This should live in the arts forum, not the networking forum.
There have been many, many approaches to procedural modeling, including several PhD dissertations and even commercial programs.
Almost all of them have the problem that, very quickly, everything seems too similar.
You might want to check out "rocket club," an indie multiplayer game that uses procedurally generated planets and cities. It doesn't look all that great (I know the guy, so I can say that :-) but still he's worked on it on and off for a long time. If you think you want something a lot better than that, but roll it on your own, prepare to be disappointed.


Thanks every one for answering. I am not so much concerned with generating buildings and cities as I am just generating the land. There are 2 reasons I am interested in generating the terrain procedurally. The First is that I personally have always been a fan of exploration in MMOs. That is what I tend to do the most of in MMOs so I want plenty of places to explore including areas that as the developer I have no idea they even exist so I can just stumble upon them as I am helping a player out or taking my lunch or dinner break. The 2nd reason is one of the big features of the game is the ability for guilds to create cities and even kingdoms and then for guilds and alliances to wage war against each other. Generating the terrain procedurally means there will be plenty of places for guilds to build on and capture land.

I also love the idea of having the server send the seed and whatever other data is needed and having the client generate the terrain. That most likely will be the way I go.

As for generating buildings I would like some procedurally generated buildings spread out on the terrain so it isn't so barren when a area is first found. That way you could be exploring the area and stumble upon a ghost town or something. However having the buildings procedurally done may not be completely what I am looking for. What I am looking for more is having us create modular building models that can then be randomly put together creating a whole bunch of different buildings. That is the basic idea of how the Guild city creation will work and I think that is a pretty good way to go with the buildings that the server spreads out around the new terrain when a new terrain chunk is made. I will have to play around with doing this and see what we get for results.

If you guys have any more suggestions, tips, or advice please let me know! Thanks!

In Development:Rise of Heros: MORPG - http:www.riseofheroesmmo.com
Advertisement
Ok sorry for posting again so soon but I have a million different ideas running through my mind right now on how this could be done and I want to so what other people think of it.

Ok so when the game first launches it includes 16 predesigned regions which would equal about 160,000 square miles of terrain. Those 16 regions are mainly your low-level areas for each of the races. As players branch out from their race's starting area they will at some point move into completely new regions that area created procedurally. The first client to find a new region will give the information from the server. The server will send back the ID of the new region which will end up being the name of the heightmap, the seed to use, and the location of the new region. The client will then create the heightmap for the region and upon completion will send the heightmap to the server. Every other client to get with in sight of the region will then request the heightmap from the server at which point the server will send the heightmap to the client.

Now for mobs in these new regions. We could either place the mobs our selves as the new regions are created. Or each region could contain a couple properties such as a region level which would determine the level of the mobs and a type property such as mountains, swamp, dessert, Ice lands, bad lands, ect. Then based on the properties of the region the server would place random mobs that match the properties of the region. We could then go in our selves and setup points of interest which would go hand in hand with the story of the game.

For cities and buildings in the new regions they would be the sparsely populated buildings here and there until guilds got in and settled the region.

For resources they would be generated through out the world based on some rules. Such as some types of resources only are found around water, some only found around caves, some found just in dry dessert areas, ect.

I think that just about covers everything. This idea still needs to be worked out more planned more so if you have anything to add please feel free to do so. Any feedback either negative or positive is highly encouraged so this idea can be fully detailed taking into account everything so it will work the best it can when implemented! Thanks!
In Development:Rise of Heros: MORPG - http:www.riseofheroesmmo.com
Well after working for a little while on the terrain engine it is finally starting to pay off! Also using Ogre3D's new terrain plugin is really making the terrain look nicer then what I had before.

So far I am making the heightmaps using libnoise out side of the client. Haven't yet integrated it into the client.

Here are some screenshots:







In Development:Rise of Heros: MORPG - http:www.riseofheroesmmo.com
Hmm, those images make me think again of using Ogre for picogen's real time preview :)

Which of those are you using? (I lightly remember something like "paging terrain manager", but it is not listed there)

edit: Ah, I guess it's Sinbad's one: clicky.
None of those. Ogre 1.7 comes with a new Terrain plugin which is alot more flexable then the old one that came standard with Ogre. This new one you can have the terrain in chunks instead of 1 piece. Theres also alot more options with it. My terrain that is in those screenshots is made up of 5 regions or chunks each one having its own heightmap.
In Development:Rise of Heros: MORPG - http:www.riseofheroesmmo.com

This topic is closed to new replies.

Advertisement