[plt-scheme] Re: Writing a game and have questions

From: Neil Van Dyke (neil at neilvandyke.org)
Date: Sat Sep 20 15:35:13 EDT 2008

I don't know the answer to the offscreen buffer question.

If you decide not to go that route, and these objects like monsters are 
not all bound to particular hex tiles or do not fill the tiles 
completely for purposes of picking (so you can't just find the hex tile 
and then check a data structure to see whether there's a monster 
associated with the hex tile), you might consider implementing this kind 
of object picking as a two-step algorithm.  The first step would be to 
determine which if any of the monster-like objects is clicked  (by, 
e.g., scanning linearly through lists of them and checking for point 
inside polygons, or by using a fancy computational geometry method).  
The second step would be, if no monster-like thing was clicked, to use 
the simple arithmetic means of determining which hex tile was clicked.  
I think that would be more of the CAD way of doing things, and it is not 
subject to some of the limitations and potential headaches of the 
off-screen pixel-peeping method.

Probably for your game, either approach would be fine, but just thought 
I'd mention it, in case you have trouble with pixel-peeping or you later 
need to implement something that scale better.  (You did ask originally 
for other approach suggestions. :)

Deep wrote at 09/20/2008 01:54 PM:
> The reason for the offscreen buffer scheme was that its a bit more
> general. In the sense that if tomm I was using some ill defined shapes
> (like say a Monster which would be an image with alpha) I could still
> render their outlines to the offscreen click map and get the results.


Posted on the users mailing list.