[crossfire] map2 & animations

Mark Wedel mwedel at sonic.net
Tue Mar 14 02:18:30 CST 2006


Brendan Lally wrote:

> This would therefore suggest that a better approach would be to have 1
> byte at the start of the map2 packet to act as a control byte,
> something like
> 
> CDDDNSEW
> 
> where C corresponds to the newmap packet, and tells the client to
> clear the fog of war data.
> 
> D is the distance to scroll in any direction, (from 0 to 7 squares)
> 
> NSEW are north, south, east, west, the bit being 1 if the map is
> scrolling in that direction.
> 
> so, on entering a new map, 0x80 would be sent.
> 
> on scrolling one square to the north west, 0x19 would be sent, etc.

  That's a good idea - I'd probably do it a little different - rather than 
including the direction to scroll, I'd just do offsets.

  As things stand now, I have the coordinates for each space defined as 6 bits 
(0-63) with 4 bits in reserve.

  objects can be in position from 0 to 33 (33 is the head of a big object with 
an 8 space offset).

  I'm thinking that some form of negative coordinates is needed, so that perhaps 
the range goes from -20 to 43.  The reason I think negative coordinates are 
needed is if/when we send the location of light sources to the client - if you 
have a light source at -1, 10 that is bright, that light is having some effect 
on the map spaces that is visible to the client, so we need to be able to convey 
the fact that there is a light source at -1,10.

  Where all this is leading is here - of those 4 reserved bits, we could hijack 
a couple for the purpose you describe.  If 1 bit is set, take this not as the 
coordinate of a space, but rather the offset to scroll the map.

  OTOH, it could just be easier to say something like 'the first 2 bytes of the 
map2 packet are special - they describe scrolling or newmap behaviour'.  The 
only problem here is that if there is not a newmap or scroll, we just wasted 2 
bytes.

  Or for that matter, we could just 'hold' the newmap and scroll commands until 
we are ready to send a new map to the client.  For newmap, it probably doesn't 
happen all that often, so keeping it as its own command is reasonable.  Scrolls 
do happen fairly often, so perhaps more to gain putting that in with the map2 
command.




More information about the crossfire mailing list