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

Andreas Beckermann kde-games-devel@mail.kde.org
Mon, 17 Feb 2003 04:00:21 +0100


On Monday 10 February 2003 01:51, Neil Stevens wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> My game's Players have several Properties in them.  Is there any way to
> prevent a particular property from being sent to and readable by other
> players?  I don't want someone to be able to modify his client to cheat
> and see everyone's cards.

You can prevent a player to modify the property using KGameProperty::lock(), 
but reading can't be prevented.

For this you need to use the KGameProperty in PolicyLocal mode (meaning: do 
not send out messages when the property changes - it behaves like a normal 
variable except that it gets saved automatically when the game is saved).
Now you can modify this property on every client separately, so that every 
client knows about those variables that the player owns/knows only.

Of course you'd need to use a lot of network messages here...
You can (as Martin pointed out) send a message with a single player as 
receiver. But still every player would receive this message and a hacked 
client could read the message then. So you need a way to send messages to a 
single client only, instead of broadcast messages.
Here you have two options:
1. Tell me that it is important and I'll see if I can do something. 
KGameNetwork::sendSystemMessage() would need to be modified to recognize the 
receiver parameter.
2. Use KGame::messageClient(), which returns a pointer to the internal 
KMessageClient. Burkhard Lehner did an excellent documentation for these 
classes, so you should have a look :)

CU
Andi