home *** CD-ROM | disk | FTP | other *** search
/ The Net: Ultimate Internet Guide / WWLCD1.ISO / pc / java / enxle1f6 / html / casual / old_docs / commspecs.txt next >
Encoding:
Text File  |  1996-08-14  |  2.1 KB  |  59 lines

  1. * Assume maximum transfer rate of 1024 bytes / second.
  2.  
  3. * The entire board is transmitted to the client at once.
  4.  
  5. * The board is 16 x 16 (total of 256 cells)
  6.  
  7. * Assume the terrain does not change
  8.  
  9. * Assume cities can not be created or destroyed
  10.  
  11. * Information required by a single cell during transmission:
  12.     - Visibility                1 bit
  13.     - Occupied player           3 bits
  14.     - Number of troops          6 bits
  15.     - Vector configuration      4 bits
  16.     = total of                  14 bits
  17.  
  18.     We can place this information in two bytes, like:
  19.  
  20.     . . . . . . . . . . . . . . . .
  21.  
  22.     ^ |---| |---------| |-----|
  23.     |   |        |         |
  24.     |   |        |         +-- Vector configuration
  25.     |   |        +------------ Number of troops
  26.     |   +--------------------- Occupied player
  27.     +------------------------- Visibility
  28.  
  29. * If a cell is invisible, all bits in the 2 bytes
  30.   are set to 0. Early in the game when large parts
  31.   of the board are invisible, there will be huge
  32.   chains of zeros, making run-length encoding
  33.   very useful.
  34.  
  35. * 3 bits for a player gives us 8 occupancy configurations:
  36.   one configuration for unoccupied, and then 7 configurations
  37.   for different players (seven different players). If a cell
  38.   is unoccupued, then the unocupied configuration is all
  39.   zeros--and the troop number and vector configuration can
  40.   also all be zeros, making run-length encoding more useful.
  41.  
  42. * 6 bits for number of troops give us a maximum of 64 troops
  43.   per square. In reality, the server's game can have any
  44.   number of troops per square that it likes, and just scale
  45.   that value in 1-64 when it sends to the client.
  46.  
  47. * 4 bits for vector configuration give us the on/off state
  48.   for each of the n/s/e/w vectors.
  49.  
  50. * We have two extra bits as insurance in case we come across
  51.   something we've missed. Also, the 6 bits for number of 
  52.   troops can probably be fiddled with in an emergency.
  53.  
  54. * 16 bits = 2 bytes
  55.   2 bytes * 16 rows * 16 columns = 512 bytes
  56.   Since we have maximum 1024 bytes per second transfer
  57.   rate, this allows us to update the board twice every
  58.   second.
  59.