Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Mon Dec 17, 2018 8:56 am

All times are UTC

Post new topic  Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Asynchronous updates
PostPosted: Thu Mar 23, 2006 2:01 pm 
Transport Empire Developer
Transport Empire Developer
User avatar

Joined: Mon Feb 03, 2003 9:30 am
Posts: 699
Location: Back at the office
Clients register for updates at the server. What does this mean? Whenever the player is looking at a piece of the map, the client says "I'm looking at the region from (x, y) to (x', y')." The server will then send updates to that client, whenever something changes in the given region.

If the user scrolls the view, then an update should be sent to the server

  1. Registrations must be uniquely identifyable.
  2. The client must be able to update and delete a registration.
  3. Clients can have more than one registration.
  4. Whenever a piece of the map changes, the updates are sent to all clients that have registered that piece of the map.
  5. Updates are queued and sent in bulk. (this saves bandwith)

If I combine requirements 1, 2 and 3, then it could be wise to let the client create its own ID numbers for registration. Consequences:
  • The server can uniquely identify a registration by the combination of the PlayerID of the client and the registration ID.
  • Clients can assign registration ID's at will. They do not have to request unique ID's at the server. (i.e. it's faster)
  • Clients assign registraion ID's to views and delete them whenever a view is closed.

Feel free to contact me over Email! My current timezone: Europe/Amsterdam (GMT+1 or GMT+2)
| Transport Empire -> |

[ General TE Discussion ] [ TE Development ] [ TE Coding ]
Under construction...

 Post subject: Re: Asynchronous updates
PostPosted: Wed Sep 08, 2010 9:50 pm 
Traffic Manager
Traffic Manager
User avatar

Joined: Tue Dec 21, 2004 5:35 am
Posts: 185
Skype: andrey-zaharov
Location: St. Petersburg, Russia
Yes, this make sense.

A simple RPC service, with following definitions:
package protocol;
/// to really makes clients dunno nothing about server
/// we need to separate this file to server.proto client.proto and common.proto
// <editor-fold defaultstate="collapsed" desc="messages">
message GeneralResponse {
    optional int32   code   = 1 [default = 0];       ///<error code, 0 if no
    optional string   text   = 2;             ///< status text if any
    optional bool   close   = 3 [default = false];       ///< client should close connection

message ClientRequest {
    required string   login       = 1;   ///< some identifier of client.
    optional string   password    = 2;   ///< optional password if game is multiplayer

message ClientResponse {
    required   GeneralResponse   response    = 1;
    optional   ClientID   client       = 2; ///< authorized ticket to use

message ClientID    {// identificator. can be used for fast session validation
    required   fixed32      clientID    = 1; ///< hash of client to use
    optional   string      ticket       = 2; ///< session ticket

/// coordinates in plain map dimensions
message Viewport    {
    required       sfixed64   x   = 1; ///< coordinates of the world
    required       sfixed64   y   = 2; ///< coordinates of the world
    enum    ViewSize   {
   SMALL   = 1;
   MEDIUM   = 2;
   LARGE   = 3;
    } // but I prefer some distance number
    optional ViewSize viewsize      = 3   [default = MEDIUM]; ///< or as integer in coords
    optional sfixed64   iviewsize   = 4;  ///< or in parrots

/// client register viewport which can be several per client
message RegisterViewportRequest   {
    required   ClientID    client   = 1;
    required   Viewport    viewport   = 2;

message   RegisterViewportResponse {
    required   GeneralResponse   response   = 1;
    optional   fixed32      viewportID   = 2; ///< id of viewport. can be individual for client

message ChangeViewportRequest   {
    required   ClientID    client   = 1;
    required   fixed32       viewportID  = 2;
    required   Viewport    viewport   = 3;
} // answer is RegisterViewportResponse

message UnregisterViewportRequest {
    required   ClientID   client      = 1;
    required   fixed32      viewportID   = 2; ///< id of viewport. can be individual for client
} // answer is RegisterViewportResponse

//also current players, map, vehicles and so on packets HERE...
// </editor-fold>

// <editor-fold defaultstate="collapsed" desc="services">
service   clients   {
    rpc   Register    (ClientRequest) returns (ClientResponse);
    rpc Unregister  (ClientRequest) returns (ClientResponse);
    rpc RegistreViewport    (RegisterViewportRequest)   returns (RegisterViewportResponse);
    rpc ChangeViewport       (ChangeViewportRequest)   returns (RegisterViewportResponse);
    rpc UnregisterViewport  (UnregisterViewportRequest)   returns (RegisterViewportResponse);
// </editor-fold>

works for me!
soon i will able to register clients

OpenTTD Hard Game Pack

Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 2 posts ] 

All times are UTC

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000-2018 phpBB Limited

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2018.
Hosted by Zernebok Hosting.