The request for the clickable interface constructed by InSim programs has got me thinking now, the current UDP based insim system and guaranteed delivery system is too clumsy and starting to result in too many packets flying around, and has a major drawback that the guaranteed delivery does not guarantee order. Also there is a well known problem that connections must be identified by user name comparisons, instead of a unique connection identifier assigned when the user connects - that is ok for licensed hosts but doesn't work on demo hosts where changing player name must be used instead, and doesn't help our insim programmers testing on a local network. So I'm thinking that a major overhaul is required, including a change to TCP instead of UDP, and using connection ID, not user name in packets that refer to a user.
All InSim packets would start with a consistent three bytes, specifying the size, the packet type and an optional request id (useful for individual clients making a request through an insim relay). Then a minimum of one data byte. For example :
struct IS_NCN // new connection
{
byte size; // 56
byte id; // packet identifier, from an enum (e.g. 28)
byte request_id; // zero unless this was sent in response to a request
byte conn_id; // unique identifier of new connection
char UName [24]; // username
char PName [24]; // nickname
byte Admin; // user is admin
byte TotalConns; // number of connections on host, including host
byte Sp2;
byte Sp3;
};
struct IS_CNL // conn leave
{
byte size; // 4
byte id; // packet identifier, from an enum (e.g. 29)
byte request_id; // not used for this packet - zero
byte conn_id; // unique identifier of leaving connection
};
So what do you think? I might leave some packets UDP based - the time based ones that report car positions, just like in LFS, if you miss one of those, you just want the next one, you don't want TCP tripping over itself trying to correct that kind of data.