Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

procedural terrain generating

Name: übermench 2011-12-26 2:30

any good tutorials about procedural terrain generating /prog/? I am currently particularly interested how rivers can be generating, how do the affect the terrain.

Name: Anonymous 2011-12-26 2:53

>>1

you can think about the processes that occur when they are created in nature, and then simulate the process really really fast.

Name: Anonymous 2011-12-26 3:00

>>2

it actually might be difficult to do this dynamically as more terrain is explored though, as it would be hard to get the new terrain to match up with the preexisting terrain next to it. What do you need it for? I was actually going to do something similar myself for a massively multi-player game where the whole world is procedurally generated from a seed shared among all the players, and each player would generate what they needed within a certain radius of their location.

Name: Anonymous 2011-12-26 6:37

I'd say just look for more efficient ways of getting the information you want to be created.

You can look at procedural vs pseudorandom vs random, usually there's not a clear distinction with the first two in terms of dynamic content.

Completely unrelated (but I'm thinking of it for some reason), the way Valve does their lettering and spray/label/sign texturing is actually very inventive, like they use two 32x32 images to come up with sharp high-resolution vector images.

Also maxes are an interesting bit to look at if you're into that stuff, as well as cellular automata.

Name: Anonymous 2011-12-26 6:44

>>4
mazes*

Name: Anonymous 2011-12-26 7:08

>>5

like procedurally generated mazes?

Name: Anonymous 2011-12-26 15:06

>>6
like this?
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

#define _(i,j) d[(i)+(w+2)*(j)]
#define __(i) for(int i=0;i<w;i++)

int main(){
  int w, arr[]={620757024, 621552898, 620766464, 623650064,
                622077186, 622601474, 624174360, 624698660};
  scanf("%d",&w);
  short *dat=(short*)malloc((w+2)*(w+2)*2), *d = dat+w+1;
  srand(time(0));
  __(i)__(j)_(i,j) = (j&&j+1-w?0:5) | (i&&i+1-w?0:10) |  rand()%4&(w-1-j?w-1-i?15:14:13)
                   | (j?i?15:11:7)  & (_(i-1,j)&1 | _(i,j-1)&2)<<2;
  __(i)__(j)_(i,j) = *(((short*)arr)+_(i,j)),*(int*)(d+i*(w+2)-2) = 655373;
  fwrite(&(d[-1]=-257),2,w*(w+2)-1,fopen("o.txt", "wb"));
  return 0;
}

Name: Anonymous 2011-12-26 15:38

>>7
mygoodness

Name: Anonymous 2011-12-26 17:59

>>7
__
take your shit else where

Name: Anonymous 2011-12-26 17:59

I created something like this using Perlin noise (what most people use for procedural generation). I basically had one Perlin noise function generate the terrain bumpmap, and another to generate sparse, connected lines that were rivers. Then I interpolated between the two to create riverbanks.
Of course they didn't look or act like real rivers, but it's a start. I guess you'd have to read up on how rivers work in the real world.

Name: Anonymous 2011-12-26 18:25

<---- DUBS CHECK EM .. LISP IS GAY

Name: ^^^^^^^^^^^^ 2011-12-26 18:28


^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
||||||||||||||||||||||||||||||||||||

Name: Anonymous 2011-12-26 18:32

1. Create random terrain map.
2. For 600000 years:
3.   Rain.erode(ground); Rain.accumulateWater(ground); Wind.erode(ground); Volcano.erupt();
4. For 40000 years:
5.   Wind.carry(TreeSeeds, ground); TreeSeeds.attemptToGrow(); Trees.grow(); Rain.errode(ground); Rain.water(Trees);

Name: Anonymous 2011-12-26 21:26

>>10
yeah, I can create a map with perlin noise however creating rivers is still a mystery. I used a simple algorithm to find seeds for liver and then use elevation to expand river but without erosion it looks like shit.
http://img835.imageshack.us/img835/8057/testo2011122609150901.jpg

Name: Anonymous 2011-12-26 21:56

>>14

Hey that looks pretty good! You could try sinking the ground near the rivers, after you assigned their positions.

Name: Anonymous 2011-12-26 22:01

>>14

when generating the river, you could also try to make it always go directly down hill. To get that direction, you can calculate the gradient of the height map. If H(x,y) is the height at grid point x,y, then you can calculate:

G(x,y) = (H(x + 1, y) - H(x - 1, y), H(x, y + 1) - H(x, y - 1))

And this will give you a 2D vector that'll point up hill. So you can motivate the river to flow in the direction -G(x,y) when it is at (x,y), and then have it stop as soon as it gets stuck, or hits an ocean.

Name: Anonymous 2011-12-26 23:17

>>14
Simulate weather.

Name: Anonymous 2011-12-27 3:09

Might be easier to think inversely, as in, create like a 3d vector map with all the vectors pointing the middle.

Name: Anonymous 2011-12-27 4:42

This thread is not shit. Interesting.

Name: Anonymous 2011-12-27 5:02

>>19
An actual programming related thread on /prog/? Weird isn't it.

Name: Anonymous 2011-12-27 5:08

>>20
Nevermind. I just expanded the thread. Same shit/info ratio as any other thread.

/prog/ IS VICTORIOUS!

Name: Anonymous 2011-12-27 6:03

>>7
Every identifier that starts with two underscores are reserved, your code is not C.

Name: Anonymous 2011-12-27 6:21

Which Touhou would generate terrain?

Name: Anonymous 2011-12-27 6:38

>>22
your puny rules does not bother me.

Name: Anonymous 2011-12-27 10:01

>>24
Inconsequential, you're still not writing valid C code.

Name: Anonymous 2011-12-27 14:08

>>23

cinro

Name: Anonymous 2011-12-27 14:23

>>25
Yeah, I am above that.

Name: Anonymous 2011-12-27 22:52

>>27

why so defensive chistopher?

Don't change these.
Name: Email:
Entire Thread Thread List