~kubuntu-members/libkdegames/4.11

« back to all changes in this revision

Viewing changes to libkdegamesprivate/kgame/messages.txt

  • Committer: Stefan Majewsky
  • Date: 2012-05-01 15:34:35 UTC
  • Revision ID: git-v1:82376fb5ca6f29f862641b6ca68603cb76258831
Begin to move stuff into libkdegamesprivate.

The build is now broken because I'm moving stuff without adjusting the
CMake files. But I figured it's cleaner to have the move in one commit
and the various edits in CMake and source files in the next commits.

svn path=/trunk/KDE/kdegames/libkdegames/; revision=1292461

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Message formats of libkdegames:
 
2
-------------------------------
 
3
 
 
4
There are two different communication layers, using their own protocols:
 
5
 
 
6
 - the message layer (KMessageIO, KMessageServer, KMessageClient)
 
7
 
 
8
     This is used to send messages from one client (i.e. KGame object)
 
9
     to an other one, to a group of other clients, or to all the clients
 
10
     connected to the KMessageServer. The messages are arbitrary blocks
 
11
     of data, of an arbitrary length.
 
12
     This layer is an underlying protocol that isn't game specific at all.
 
13
     You shouldn't need to know the message format of the packets. If you
 
14
     want to extend the protocol, have a look into KMessageServer API
 
15
     reference for a complete list of message types.
 
16
 
 
17
 - the game layer (KGame, KGameIO, KPlayer)
 
18
 
 
19
     This layer uses the message layer to send its specific message packets
 
20
     between the objects of the game.
 
21
     This layer contains the game specific messages (e.g. addPlayer, setupGame).
 
22
     The rest of this file describes this layer.
 
23
 
 
24
 
 
25
Game Layer Messages:
 
26
--------------------
 
27
 
 
28
     Application Cookie   16 Bit
 
29
     Version               8 Bit
 
30
     MsgId                16 Bit
 
31
     SenderId             16 Bit
 
32
     ReceiverId           16 Bit
 
33
     Userdata
 
34
 
 
35
The format of the messages is used internally and there is usually no reason why
 
36
you have to know what it is used for. But as usually != always here are some
 
37
comments on the format. Note that KGame is under development and the content of
 
38
this file could be obsolete. Please result the sourcecode for up-to-date
 
39
information.
 
40
Application Cookie is used to identify the application. This prevents a
 
41
chess game from talking to a poker game.
 
42
Version is the version of KNetworkGame, sender and receiver must be of the same
 
43
version.
 
44
  library note: this could be a limitation, as KGame should be backward
 
45
  compatible. Maybe change to version must be >= KNETWORKGAME or something less
 
46
  restrictive
 
47
MsgId specifies the kind of the message data (see below).
 
48
SenderId is the id of the KGame/KPlayer object which sent the message, it is
 
49
coded like this: the lower 10 bits specify a player and the upper bit
 
50
represent the game id shifted by 10 bits. So we get
 
51
Id=playerId | (gameId<<10);
 
52
ReceiverId is the id of the receiver of the message. It can be either
 
53
a player, a game or a broadcast. For a broadcast the Id is set to 0
 
54
in the other cases the coding is as with the senderId
 
55
Userdata is the data of the user (wow ;-))
 
56
 
 
57
 
 
58
MsgId           UserData
 
59
---------------------------------------------------------
 
60
IdMessage        user defined
 
61
 
 
62
IdSetupGame      qint32  isServer
 
63
                 qint32  maxPlayers
 
64
                 qint32  newid (id for the new game)
 
65
                 qint32  cntR (virtual player nunmber)
 
66
                 qint32  cntT (tagged player number)
 
67
                 TODO: Changed
 
68
 
 
69
IdContinueSetup: TODO
 
70
 
 
71
IdSendPlayer     qint32  omit how many tagged players for replacement
 
72
                 TODO: Changed
 
73
 
 
74
IdGameSave       Save(msg)->Load(msg)
 
75
 
 
76
IdAddPlayer      rtti
 
77
                 gameid() of the owner
 
78
                 player->Save(msg) -> player->Load(msg)
 
79
 
 
80
IdRemovePlayer   qint16  playerid
 
81
 
 
82
IdError          qint32  errorcode
 
83
                 QString  errortext
 
84
 
 
85
IdGameStatus     qint32  status
 
86
 
 
87
IdPlayerProperty qint16  propertyId
 
88
                 user defined -> the property
 
89
 
 
90
IdGameProperty   qint16  propertyId
 
91
                 user defined -> the property
 
92
 
 
93
IdPlayerInput    user defined