Re: [pygame] Smooth Scaling for Terrain Generation

2007-06-16 Thread Marius Gedminas
On Sat, Jun 16, 2007 at 12:33:10AM -, [EMAIL PROTECTED] wrote:
 I fiddled with a different terrain generation algorithm, this one based on
 using Pygame to do something like Conway's Game of Life. That is, I draw
 some random shapes of grass on water on a 100x100 image, then iterate
 each pixel through a Life-like process to build a grass/sand/water map.
 The results look OK, and I was thinking it was reasonably simple and
 fast... but it assumes a 100x100 image. My program uses 1000x1000 zones.
...
 I'd also be open to different ways to generate terrain entirely.

Check out http://freespace.virgin.net/hugo.elias/models/m_perlin.htm

Marius Gedminas
-- 
Si fractum non sit, noli id reficere.


signature.asc
Description: Digital signature


[pygame] Smooth Scaling for Terrain Generation

2007-06-15 Thread kschnee
I fiddled with a different terrain generation algorithm, this one based on
using Pygame to do something like Conway's Game of Life. That is, I draw
some random shapes of grass on water on a 100x100 image, then iterate
each pixel through a Life-like process to build a grass/sand/water map.
The results look OK, and I was thinking it was reasonably simple and
fast... but it assumes a 100x100 image. My program uses 1000x1000 zones.

I tried scaling the finished image up using pygame.transform.scale, but I
get pixels big as hams, which would translate into weirdly jagged
landscapes. Smoothing it out even slightly using the existing functions
is, not surprisingly, about 100 times as slow as with a smaller image. Is
there a way to get a smoothly scaled-up image? That is, if s is sand and
w water:

www
wss
sss

I don't want the above data to turn into 10x10 blocks of sand and water,
but some kind of smooth diagonal.

I'd also be open to different ways to generate terrain entirely. I've
gotten good-looking island landscapes through ad-hoc drawing and smoothing
(better than with standard algorithms), but haven't gotten to the point of
placing actual objects at random.



Re: [pygame] Smooth Scaling for Terrain Generation

2007-06-15 Thread Alex Holkner

[EMAIL PROTECTED] wrote:

 Is
there a way to get a smoothly scaled-up image? That is, if s is sand and
w water:

www
wss
sss

I don't want the above data to turn into 10x10 blocks of sand and water,
but some kind of smooth diagonal.

  
You want the scale2x algorithm and its friends: 
http://scale2x.sourceforge.net/
If you can save your map in a palettized image format, you can use 
pygame's built-in scale2x function to do the hard work.


Alex.