Topic: PHP/GD terrian generator (Page 1 of 1) Pages that link to <a href="http://ozoneasylum.com/backlink?for=29703" title="Pages that link to Topic: PHP/GD terrian generator (Page 1 of 1)" rel="nofollow" >Topic: PHP/GD terrian generator <span class="small">(Page 1 of 1)</span>\

 
zavaboy
Paranoid (IV) Inmate

From: f(x)
Insane since: Jun 2004

IP logged posted posted 11-20-2007 23:37 Edit Quote

I made this primarily for a MMORPG flash game that I'm developing. There's no edge of the map, so I needed the map to grow as the players explore. This is the best I could come up with for a terrain generator, powered purely by PHP and the GD library.

It's a basic fractal terrain, consisting of 4 separate fractals, since I needed them to seed off each other if the map is to grow without seams. I made and used this gradient for it.


http://zavaboy.com/phpbox/map_gen2.php

Additional things? Yes, maybe.
I'm going to see if I can make rivers, flowing based on the slopes, along with erosion if possible. It would be cool if I can get the rivers to develop deltas from the eroded land.

Suho1004
Maniac (V) Mad Librarian

From: Seoul, Korea
Insane since: Apr 2002

IP logged posted posted 11-21-2007 01:19 Edit Quote

Pretty cool! Do you have color-coding for the terrain? Like the red/brown is mountains/highlands, white would be snow caps, etc.?


___________________________
Suho: www.liminality.org | Cell 270 | Sig Rotator | the Fellowship of Sup

zavaboy
Paranoid (IV) Inmate

From: f(x)
Insane since: Jun 2004

IP logged posted posted 11-21-2007 01:41 Edit Quote

Sort of... As I mentioned above, I used a gradient (linked above), to translate the grayscale altitude map produced by the fractal. I still don't know how I'm going to implement this into the game engine, but I'll do it somehow. I might just have the game engine do the terrain generation if it doesn't tax processing power too much. My game engine right now avarages around 35 - 40 FPS on my machine, though I have no 3D transformations yet.

poi
Paranoid (IV) Inmate

From: Norway
Insane since: Jun 2002

IP logged posted posted 11-21-2007 01:55 Edit Quote

Nice start.
Alas it looks way too "mid-point fractal"-ish. I suggest you to have a look at:



To make the map "infinite", you could use some kind of predictive noise like Perlin or even a simple method with a known seed.


HTH



(Edited by poi on 11-21-2007 01:57)

zavaboy
Paranoid (IV) Inmate

From: f(x)
Insane since: Jun 2004

IP logged posted posted 11-21-2007 02:13 Edit Quote

Thanks poi!
I used a variation of the method explained here: http://gameprogrammer.com/fractal.html

aobjects
Neurotic (0) Inmate
Newly admitted

From:
Insane since: Nov 2011

IP logged posted posted 11-22-2011 09:05 Edit Quote

Are you sharing the PHP code that generated this. Would love to see how it works.



Post Reply
 
Your User Name:
Your Password:
Login Options: Remember Me On This Computer
 
Your Text:
Loading...
Options: Show Signature
Enable Slimies
Enable Linkwords

« BackwardsOnwards »

Show Forum Drop Down Menu