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

Re: [pygame] Isometric Math



Chris Ashurst wrote:

If you progress with this isometric stuff, and get around any of the
following issues, I'd love to hear how you got around them:

1) I had a mechanism that allowed you to "pick up" the entire iso grid and
move it around on screen. Whilst this worked fine without any actors on the
grid, when I did eventually populate the area with them, picking the grid
and moving it around caused the actors to *almost* stick to their original
locations, but eventually they would "forget" the constraints of the grid
and start rolling off it, etc.


No idea. Round off errors maybe? I keep my "grid" and "actors" firmly in the same coordinate system, so this isn't possible. It helps that I never actually move the grid, but move the viewpoint instead.

2) Sort of associated with above. I wanted to have an effect that moving the
grid in any direction would cause the background image to move
proportionally slower in the same direction of the grid movement (to give
more pseudo-parallax effect). I got it working, but encountered problems
with the fact that the grid would never escape the bounds of the camera, but
the background image *would* escape the bounds and would start gradually
edging out of the camera, leaving nasty trails. I was using an image that
was approximately double the size and width of the grid (and had its center
underneath the center of the grid) to give me plenty of "play", but I just
couldn't keep the background from escaping.


Use Opengl, and just tile the texture infinitely, and use a perspective view matrix. ;-)

More seriously, this too sounds like you might be accumulating round off errors. Rather than moving the background in parallax when moving the foreground, perhaps calculate where the background should be and place it directly.

3) If you *do* have actors strolling across the grid in their correct
isometric directions, I found a problem with the fact that an actor placed
before (or was it after?) another actor, but further "North" would mean if
the two actors crossed paths at some point, the actor placed further north
would blit *through* the actor to the south, whereas it should really blit
*behind*.



Sort your "actors" by their depth into the screen, and draw them in that order, rather than just drawing them in the order placed.


-Jasper