home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / sys / amiga / datacomm / 5801 < prev    next >
Encoding:
Internet Message Format  |  1992-08-19  |  4.4 KB

  1. Path: sparky!uunet!portal!lll-winken!decwrl!access.usask.ca!kakwa.ucs.ualberta.ca!ami-cg!cg
  2. From: cg@ami-cg.UUCP (Chris Gray)
  3. Newsgroups: comp.sys.amiga.datacomm
  4. Subject: Re: multiuser environment (via modem)
  5. Message-ID: <cg.0cu9@ami-cg.UUCP>
  6. Date: 20 Aug 92 03:22:46 GMT
  7. References: <1992Aug19.030112.16145@msuinfo.cl.msu.edu>
  8. Organization: Not an Organization
  9. Lines: 75
  10.  
  11. In article <1992Aug19.030112.16145@msuinfo.cl.msu.edu> coup@crs.cl.msu.edu
  12. (Chris Klaus) writes:
  13.  
  14. >Hello. I am looking for source code or information pertaining to a multi-
  15. >player or user environment inwhich there is a graphical representation.
  16. >
  17. >    I'd like to see something like a MUD but based on ASCII characters
  18. >moving around on the client.  I'd like to see how the src code deals with
  19. >handling each person's input and updating the information on each person's
  20. >client.
  21.  
  22. I can't send you sources, but I can provide some information. What I do in
  23. AmigaMUD is have a single server process and multiple client processes,
  24. which communicate over Amiga Exec message ports. The server is responsible
  25. for maintaining a consistent idea of what the world looks like, where
  26. players are, etc. The clients are responsible for details of how to talk
  27. to the player. It is the clients that would, in your case, know what kind
  28. of control sequences to use to get the player's terminal or computer to do
  29. the right things on the screen.
  30.  
  31. Exec message ports allow any number of messages to be queued up on them, and
  32. it is easy to pull them off one at a time. Normally, each such message
  33. contains a 'return address' message port, to which the server should send
  34. any reply to this message.
  35.  
  36. So, let's imagine that you have 5 players in your game, all of them visible
  37. in the same area of the world (so they all show up on all player's screens).
  38. Two of the players try to move into the same place at roughly the same time.
  39. Their client programs send a message to the server requesting the move.
  40. Because the Amiga locks such accesses to messages, one of the requests will
  41. 'win' and get to the server before the other one. That one is allowed to
  42. do the move, and the server will tell all clients to update their screens
  43. to show that move. The server then processes the next request, and will
  44. have to tell that player (and perhaps the others too) that the move failed.
  45. If the system is fast enough (shouldn't be a problem with a reasonable
  46. game programmed in a compiled language), then the failing player won't see
  47. any significant pause (unless he's connecting at 300 baud!) between his
  48. screen showing the first player moving in, and his message saying he can't
  49. move in.
  50.  
  51. The messages themselves should be fairly simple, e.g. a byte telling what
  52. kind of action is requested or what kind of thing to do on the player's
  53. machine, followed by a binary form of the needed parameters. Inside the
  54. host machine, messages will be completely reliable, but that will not be
  55. the case over modems, so you would want the client programs to keep a record
  56. of what their player's screen should look like, so the player can request
  57. a redraw if the screen gets garbled. The server shouldn't be involved at all
  58. in such an operation.
  59.  
  60. In a bit more detail (I don't know how much of this kind of thing you've
  61. done, so I'm being verbose!), the situation described might go like this:
  62.  
  63.     - player 1 hits the 7 key on his keypad to move up-left.
  64.     - his terminal transmits the appropriate escape sequence for that hit
  65.     - sequence arrives on the host machine in the client for that player
  66.     - client program decodes the escape sequence into the command to move
  67.     up-left, and sends a couple of bytes saying that in a message to
  68.     the server process.
  69.     - player 2 does something similar, with similar results (the escape
  70.     sequence may be different if the terminal/computer differs)
  71.     - player 2's request is sent to the server
  72.     - server is woken up from it's Wait call by the arriving message, gets
  73.     the message and processes it.
  74.     - server updates it's view of what the world looks like, and sends out
  75.     messages to each client program, requesting that they send sequences
  76.     to their remote terminals/computers to update the display to show
  77.     the move.
  78.     - server processes next request on its message port, that from player 2
  79.     - server sends failure message to player 2's client program, which then
  80.     flashes a message on that player's screen
  81.  
  82. Whew! I AM verbose. Lemme know if you want MORE!
  83.  
  84. --
  85. Chris Gray   ualberta!ami-cg!cg   or   cg%ami-cg@kakwa.UCS.UAlberta.CA
  86.