Translating Perlin noise into a world

 
Post new topic   Reply to topic    mudlab.org Forum Index -> Coding
View previous topic :: View next topic  
Author Message
nihraguk



Joined: 16 Apr 2007
Posts: 4

PostPosted: Tue Apr 17, 2007 2:27 pm    Post subject: Translating Perlin noise into a world Reply with quote

Hi everyone,

I've been trying to implement the oft-discussed idea of using a Perlin noise algorithm to generate a world on the fly for a MUD I've been working on. There are several threads that cover this topic in Mudconnector (and here as well I believe) so I won't rehash it, and will go straight to my problem:

Perlin noise function generates coherent randomness, taking (x,y) coordinate pairs as input. When I use this randomness to colour pixels in a greyscale image, I get the typical, beautiful swirly Perlin textures.

However, seeing that MUDs are text-based, I'm wondering how best to 'colour' the 'pixels' of the MUD world using the output from this function. A few methods I've tried (and am still experimenting with) are:

1. Using the value as an indication of height-above-sealevel, or just as an index value to a list of terrain descriptions. The problem I'm having with this approach is that it becomes boring to describe the terrain between, say, 50 and 100 as "gently sloping hills", "slightly steeper but still gently sloping hills overall", "a little more than slightly..." and so on.

2. Using the value to determine monster seeding. This has been semi-effective, creating natural clusters of monsters here and there, with stragglers hanging around on the fringes.

3. Using the value to determine weather (same issues as 1.).

I know I'm not at a real dead end here, and I could always tweak the function to constrain the range of values it returns (and hence the range of 'slightly slightly steeper hills' descriptions I need to write), but I was wondering if you guys have come across any other meaningful ways of translating the noise values into something MUD-ish.

I'd also like to add that I'm not attempting to use Perlin noise as a replacement for hand-built/written areas/descriptions in my MUD. Hand-build/written areas will be overlaid on top of the generated world, like islands in a sea of noise-generated descriptions.
Back to top
View user's profile Send private message MSN Messenger
Author Message
Kjartan



Joined: 13 May 2005
Posts: 110

PostPosted: Tue Apr 17, 2007 5:30 pm    Post subject: Reply with quote

I have had luck using three separate perlin noise maps, one for height above sea level, one for roughness, and one for precipitation. Different combinations generate different terrain types.
Back to top
View user's profile Send private message Visit poster's website
Author Message
nihraguk



Joined: 16 Apr 2007
Posts: 4

PostPosted: Tue Apr 17, 2007 8:46 pm    Post subject: Reply with quote

Hrm, okay, and you write a list of descriptions corresponding to values from each map and squish them together when you want to generate a room description?
Back to top
View user's profile Send private message MSN Messenger
Author Message
Kjartan



Joined: 13 May 2005
Posts: 110

PostPosted: Tue Apr 17, 2007 11:38 pm    Post subject: Reply with quote

Actually, I was using them to select bitmaps for something graphical. If you want room descriptions, I would suggest selecting on multiple dimensions at once. Like, say you had A (altitude) and P (precipitation), and each goes from 0 to 1, then maybe:

A < 0.3 => water
0.3 <= A < 0.4 => beach
0.4 <= A < 0.5 and P >= 0.5 => jungle
0.4 <= A < 0.8 and 0.1 < P <= 0.5 => plains
0.4 <= A < 0.8 and P < 0.1 => desert
0.5 <= A < 0.8 and P >= 0.5 => forest
A >= 0.8 => mountains

And as far as the actual room descriptions, you have to still go from "mountains" to writing some mountainous sentences from which to make up the room descriptions. As you get further into a range, e.g. as A gets more and more above 0.8, you can add denser mountainous descriptions.

Note that I don't say this is going to look good, but it will probably work as well as any other automated scheme for randomly generating room descriptions. They'll flow globally smoothly. They'll still be pretty boring unless you make a zillion "mountain things" and a zillion "jungle things" and so on.
Back to top
View user's profile Send private message Visit poster's website
Author Message
Vopisk



Joined: 22 Aug 2005
Posts: 99
Location: Golden Valley, Arizona, USA

PostPosted: Wed Apr 18, 2007 12:57 am    Post subject: Reply with quote

The problem with randomly generating your game world, such as with Perlin noise, is lack of concurrency.

Fields and mountains and streams and so on are broken and disjunct (although their is slight preference towards grouping) but you don't get distinct ridges and valleys and so on. I think Kjartan has something on his personal website where he solved this problem...

Anyway, how do you differentiate between "this mountain range" and "that mountain range"? If you simply use perlin noise, all of your mountains are the same, that is to say, every time you are in the vicinity of said mountain range, you will see the same thing, with no way of landmarking.

So you don't have the "Rang'Shada Mountains" or the "Dragonsteeth Mountains" or "The Spine of the World". You have, mountains.

This could be solved if you randomly generated ridges, that were then fleshed out with perlin noise to make them fuzzy, and while you generated the ridges you also generated things like a name and attributes for that same mountain range.

I can say from pretty wide experience, being an avid outdoorsman, that there are many different types of mountains.

Out here in the desert, we have very rocky, craggy projectile mountains with steep slopes and not much in the way of vegetation and none of them high enough to maintain snowfall for very long, while if you move just a bit to the east you'll hit the rocky mountains, which are similar but have a much greater abundance of pine tree slopes, are almost year-round (and in some places are) snow-capped and feature a lot of steep, granite bluffs.

While yet again, head even further east and you'll hit the Appalachian mountains, which are mountains (not hills) but are gently sloping and once again have abundant vegetation covering their slopes.

How do you make the distinction with perlin noise? How do you know that area X is a desert and area Y is tropical while area Z is sub-arctic? How do you keep these particular things from being random?

I suppose you could solve this issue by using "bands" such that line B at a certain Y coordinate for the entire X length of your world represents the equator, while other lines may represent poles and such so that you can define fitting terrain types depending upon the amount of sunlight that this area would naturally be exposed to.

Going with the same flow as earlier, fields, valleys and mountains all take on a new dimension if you head up north to Alaska. Your "field" might actually be a giant glacier with pitfalls and other unseen hazards while your mountains might be more ice than stone and your valley has a frozen river "running" down its center.

Kjartan's suggestion works, but I think you need the "sunlight" exposure factor in order to keep a desert from appearing right next door to a tundra. But that's just me, maybe I'm crazy. Smile

-Vopisk

Edit:
Another caveat... trees in different areas can also vary widely and wildly. A forest might be a forest sure, but it might consist of oak trees, or pine trees, or spruce or aspen or ash or whathaveyou. This is another thing to think of when just randomly generating a world, at least assuming that a "forest" represents something more than just a difference in action points used to move through said terrain type.

Also as Kjartan mentioned, a granularity map might also be a good idea, to determine if the forest is sparse, dense or average, likewise with mountains, sand dunes and other terrain features which may vary greatly dependent upon their number.
Back to top
View user's profile Send private message AIM Address MSN Messenger
Author Message
nihraguk



Joined: 16 Apr 2007
Posts: 4

PostPosted: Wed Apr 18, 2007 5:55 pm    Post subject: Reply with quote

Quote:
Anyway, how do you differentiate between "this mountain range" and "that mountain range"? If you simply use perlin noise, all of your mountains are the same, that is to say, every time you are in the vicinity of said mountain range, you will see the same thing, with no way of landmarking.


The landmarks will be provided by the hand-built areas/locations scattered across the gameworld (though the further out you go the less of them you'll presumably see, since builders can only work so quickly). So certain mountain ranges of significance would have already been altered/named by builders/some human agency.

Your suggestion to also assign random generic names to the unnamed mountains and ridges is a good one though, and I might take that into consideration.

Also, I'm currently thinking of basing the MUD on White Wolf's Wraith: the Oblivion, with the randomly generated world we're discussing being the Tempest in that game. The Tempest is supposed to be difficult to navigate in, in terms of getting one's bearings, getting to a destination, estimating distances, etc etc. So I'm (currently) not too bothered about making the world easy to navigate via landmarks or dead reckoning.

Quote:
How do you make the distinction with perlin noise? How do you know that area X is a desert and area Y is tropical while area Z is sub-arctic? How do you keep these particular things from being random?


Also because of the fact that I'm not modelling the gameworld on planet Earth per se, I'm not really interested in ensuring that there's an equatorial line and that colder regions are nearer the poles, etc. The game world probably won't even be spherical. What I need is for deserts and tropics and sub-artic locations to be grouped together (so you don't have a coordinate pair with extremely low temperatures in the middle of a desert, for example), and to transition smoothly from one to the other (so that deserts don't sit right next to snowy ridges). Perlin noise inherently provides both of these things.

I take your points regarding the sunlight, vegetation and granularity factors... these are definitely things that I'll be thinking of implementing in one way or another. Thanks. Smile
Back to top
View user's profile Send private message MSN Messenger
Author Message
Vopisk



Joined: 22 Aug 2005
Posts: 99
Location: Golden Valley, Arizona, USA

PostPosted: Wed Apr 18, 2007 8:56 pm    Post subject: Reply with quote

nihraguk wrote:
Also, I'm currently thinking of basing the MUD on White Wolf's Wraith: the Oblivion, with the randomly generated world we're discussing being the Tempest in that game. The Tempest is supposed to be difficult to navigate in, in terms of getting one's bearings, getting to a destination, estimating distances, etc etc. So I'm (currently) not too bothered about making the world easy to navigate via landmarks or dead reckoning.


This is something I admittedly hadn't thought about... Either the Tempest from Wraith or the Wyld from Exalted, Perlin Noise would be a good way to do the "chaoticness" of either of these, or any other fantasy setting that might involve some similar setup.

It's a good idea and it would work, especially if you recreate the Tempest/Wyld when there are no players there. So the next time someone pops in there, it might all be different Smile Or on the other hand you can have just a static chaotic void area, keeping patches of sub-arctic from being in the middle of the desert is easy enough with some simple logic.

Anyways, good luck,

Vopisk
Back to top
View user's profile Send private message AIM Address MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    mudlab.org Forum Index -> Coding All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Powered by phpBB © 2001, 2002 phpBB Group
BBTech Template by © 2003-04 MDesign