Java-Gaming.org Java4K winners: [ by our judges | by the community ]         
Featured games (67)
games approved by the League of Dukes
Games in Showcase (∞)
games submitted by our members



News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  Print  
  2D terrain generation - with caves and overhangs  (Read 3462 times)
0 Members and 2 Guests are viewing this topic.
Offline f.l.x

Sr. Member
**

Posts: 305


there is no place like 127.0.0.1


« on: 2006-05-08 18:36:12 »

well, at last i'm having a little free time and with a friend of mine, we are begining a new game, a pure java2d worms clone.

I have used a midpoint displacement algorithm to generate the terrain, with some good results, but as this algorithm outputs only one height for each width point, it won't generate caves nor overhangs, and they are a must in any worms clone Smiley .

Are there other 2d terrain generation algorithm i can use? i have founds losts of papers about 3d terrain generation, but no one covering this topic.

thanks

Litterarum radices amaras, fructus dulces
http://flx.proyectoanonimo.com
figth spam!
Offline woogley

JGO Neuromancer
****

Posts: 1098
Medals: 5



« Reply #1 on: 2006-05-08 18:44:28 »

not to sound stupid.. but couldn't you just generate two landscapes? one for the bottom, one for the top? *shrug*
Offline f.l.x

Sr. Member
**

Posts: 305


there is no place like 127.0.0.1


« Reply #2 on: 2006-05-08 19:20:13 »

that would be fine for a cave-like map, but i'm looking for something like these concave areas

Litterarum radices amaras, fructus dulces
http://flx.proyectoanonimo.com
figth spam!
Games published by our own members! Go get 'em!
Offline woogley

JGO Neuromancer
****

Posts: 1098
Medals: 5



« Reply #3 on: 2006-05-08 19:22:54 »

OHHHH I get it. sorry Tongue
Offline f.l.x

Sr. Member
**

Posts: 305


there is no place like 127.0.0.1


« Reply #4 on: 2006-05-08 19:32:35 »

no problem Grin

Litterarum radices amaras, fructus dulces
http://flx.proyectoanonimo.com
figth spam!
Offline Kova

JGO Ninja
***

Posts: 628



« Reply #5 on: 2006-05-09 08:56:15 »

I don't know nothing about algoritams for terrain creation... so here is an idea.
If you can, how about you additionally generate some round type random irregular shapes on map and then substract them from original terrain. That way you can get caves, wholes in terrain or whatever... only problem is doing substraction.
Offline Orangy Tang

JGO Kernel
*****

Posts: 2959
Medals: 37


Monkey for a head


« Reply #6 on: 2006-05-09 09:08:17 »

Semi-randomly placed metaballs could work well. I've been meaning to try that for quite some time now.

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline f.l.x

Sr. Member
**

Posts: 305


there is no place like 127.0.0.1


« Reply #7 on: 2006-05-09 12:39:34 »

wow, thanks  Grin i have just found a good tutorial on metaballs, i'll give it a try tonight

Litterarum radices amaras, fructus dulces
http://flx.proyectoanonimo.com
figth spam!
Offline Tzan

Full Member
**

Posts: 247



« Reply #8 on: 2006-05-09 19:03:47 »

I think the maps for worms were all created by hand. Obviously they had some elements that got used in chunks like those icecream cones.
Offline Kova

JGO Ninja
***

Posts: 628



« Reply #9 on: 2006-05-09 20:03:41 »

well obviusly not since those ice-creams have horizontal pedestal that sticks out so they are computer generated.
Games published by our own members! Go get 'em!
Offline Jeff

JGO Kernel
*****

Posts: 3535


Got any cats?


« Reply #10 on: 2006-05-10 00:57:36 »

well obviusly not since those ice-creams have horizontal pedestal that sticks out so they are computer generated.

Huh?

The pedestals are clearly part of the artwork for the placables.

There is no reason they could not have been dropped in by hand that I can see...

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline Riven
« League of Dukes »

JGO Kernel
*****

Posts: 5862
Medals: 255


Hand over your head.


« Reply #11 on: 2006-05-10 04:17:42 »

I'm pretty sure the game advertised with "with over 4 billion maps!"

So it must have had a seed-based mapgenerator.

Hi, appreciate more people! Σ ♥ = ¾

Learn how to award medals... and work your way up the social rankings
Offline Kova

JGO Ninja
***

Posts: 628



« Reply #12 on: 2006-05-10 07:39:28 »

well obviusly not since those ice-creams have horizontal pedestal that sticks out so they are computer generated.

Huh?

The pedestals are clearly part of the artwork for the placables.

There is no reason they could not have been dropped in by hand that I can see...

"so they are computer generated."  ... I mean maps are computer generated, not the artwork, my bad formint the sentence. If it were by hand nobody would put an ice-cream with pedestal touching ground with one pixel and the other 50 are above the terrain, in the air (like the most right ice-cream).
Offline Ask_Hjorth_Larsen

Sr. Member
**

Posts: 316


Java games rock!


« Reply #13 on: 2006-05-10 19:30:56 »

One way to do these things would be to define the boundary between ground and non-ground as a contour curve of some function f(x,y), where the values of f could be randomly generated according to - for example - a diamond-square algorithm. Of course this will treat the x and y axes equally, which might not be desirable when doing a sideways-viewed game. This method would require a grid, but one could interpolate to achieve smooth boundaries.

Of course lots of information is lost if you just use a contour. I'm sure there are more elegant ways to do this.
Offline f.l.x

Sr. Member
**

Posts: 305


there is no place like 127.0.0.1


« Reply #14 on: 2006-05-11 08:47:54 »

Worms map are random generated, each map is a set of two 2k files, one for the ground and other for the ubicates, and the image is way too large to be compressed into 2k  Roll Eyes

btw, the metaballs worked fine, here is a test

thanks a lot

Litterarum radices amaras, fructus dulces
http://flx.proyectoanonimo.com
figth spam!
Pages: [1]
  Print  
 
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.105 seconds with 19 queries.