[motherhamster] aligned tiles have gaps

Brian Fisher brian at hamsterrepublic.com
Thu May 10 13:52:32 PDT 2007


On 5/10/07, Bob the Hamster <Bob at hamsterrepublic.com> wrote:
> Check out the latest sidescroller code. Even though the 16x16 dirt tiles
> are aligned neatly, gridlines show up between them. The width of the
> gridlines varies depending on camera alignment.
>
> Even if I edit the display.render line in the DirtTile class in dirty.py
> and add something like scale=1.05 to make the lines go away, they are
> still visible when moving.
>
> I am thinking that this might have something to do with the fact that I
> am using a floating point vector for camera position, but I am really
> not sure what to do about it... Any ideas?
>
The polygons for the squares must be antialised. Floating point camera
position shouldn't be a problem if they weren't. Given that they must
be antialised, it must mean the dirt tiles are not fitting perfectly
on pixel (integer) boundaries. You could try rounding every position
before drawing. If that gets rid of the seams, then the openGL drawing
stuff is good. If it doesn't, then the openGL drawing stuff is off.
Also turning off antialising on the openGL guy should eliminate any
gaps (but you may still have little edge popping if the camera moves
subpixel)

I'm not sure what the best approach is really - Deciding to stick to
perfect pixel boundaries is a proven technique. If you really want
subpixel scrolling or scaling then the best thing for tiles is
probably to overlap tiles somehow.



More information about the Dev mailing list