[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Old pygame tutorial not working



On Sun, Aug 3, 2008 at 8:24 AM, Ian Mallett <geometrian@xxxxxxxxx> wrote:
> Hello,
>
> For a 3D game I'm making, I need to load a grey heightmap*.  Obviously, only
> 256 heights are possible.  In game, this translates to a landscape having
> "steps".
>
> -My current method, loading the data pixel by pixel with Surface.get_at()
> seems inefficient.  There is a faster way through Numeric.  What?  (Note
> that I only want one component of the color, as it is grey.  Not alpha
> though).
>
> -The array must be blurred, i.e. made so that the "steps" no longer exist.
> The only unique example I could find originates here:
> http://www.pygame.org/docs/tut/surfarray/SurfarrayIntro.html
> ...andt gives me an error:
> soften[1:,  0:  ] += Data[0:-1,0:  ]*8
> TypeError: list indices must be integers
> Plus, as the height at the edges of the landscape is not necessarily the
> same, the edges must be specially handled so that they don't average heights
> with stuff on the other side of the map.
>
> Thanks,
> Ian
>
> *Heightmaps are greyscale images containing height data--with the intensity
> of the grey corresponding to the height.
>

Sure you can do all that with pygame but why not use gimp? Do you need
to make it on the fly?
For the tiling look at the gimp filter that makes tiles work together.
filter-map-make seamless and before that blur as much as you like.

I will let someone else tackle the error.

-- 
Douglas E Knapp

http://sf-journey-creations.wikispot.org/Front_Page