[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[pygame] Smooth Scaling for Terrain Generation
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.