[Kde-games-devel] Re: Re: Incomplete Information and KGame

Martin Heni kde-games-devel@mail.kde.org
Sun, 16 Feb 2003 08:41:46 +0100


>But how can the server communicate that to the player and only that player?
>If you can tell me how to do that, then I guess I can make that work.

The KGame message framework allows you to easily send your
own data messages to any receiver in the game (i.e broadcast to all,
any KPlayer or any KGame object). For this the "sendMessage()" functions
are supplied (used exactly for user messages contrary to the sendSystemMessage
for system messages as used by the KGame object and e.g. the KGameProperties).
These functions exists already in a few variations to allow sending 
strings, int,
bytearrays or a general QDataStream.

Check KGameMessage:createPlayerId() to create a qualified
receiver address. You can then get your message back in
a KPlayer or KGame object by reacting to a signal (KPlayer::signalNetworkData)
or in the worst case by overwriting the supplied virtual reception function 
networkTransmission()

Note, that you can check properties and messages very easily with the
debug widgets of the library which give you insight in what the lib does.

However, I do not quite see the difference by manually sending the
data to the player compared to the automatic property update. If
a player really wants to hack his client, why wouldn't he hack your
transmission scheme. If you do not implement some kind of
crypto-layer in the communication you have no chance in the end
if someone really wants to hack it.  We discussed this when setting
up the library but decided that it would be quite hard to prevent
cheating.

However, some extension to crpyto/signed messages would be of interest
for the library also with repect to the highscore system. So if you have
good ideas do not hesitate to discuss them and implement them in the lib.