[Kde-games-devel] New problem converting KsirK to KGame
Kleag
kleag at free.fr
Sun Jul 17 19:10:47 CEST 2005
Hello,
I have a new problem in my conversion of KsirK to KGame. In the current state,
I'm trying to start a network game. I think that all necessary virtual
functions are reimplemented, the inherited one being called when necessary.
Policy is Clean. Here is the problem: My server game is started OK and next
local players are created. But when the client connects, local players are
saved on the server side and then it seems that the server have to reload
them. The problem is that loaded data are incoherent. See the trace part
below (I join the full trace.):
libkdegames (KGame): [void KMessageServer::addClient(KMessageIO*)] : 2
libkdegames (KGame): ===========================[virtual void
KGame::negotiateNetworkGame(Q_UINT32)] : clientID=2
===========================
libkdegames (KGame): [void KGameNetwork::receiveNetworkTransmission(const
QByteArray&, Q_UINT32)] Message not meant for us 1!=2 rawid=0
libkdegames (KGame): =====>(Master) [virtual void
KGame::networkTransmission(QDataStream&, int, Q_UINT32, Q_UINT32, Q_UINT32)]
- IdSetupGameContinue
libkdegames (KGame): Master calculates how many players to activate client
has cnt=0
libkdegames (KGame): The game has 1 active players
libkdegames (KGame): The user deactivated 0 player already
libkdegames (KGame): MaxPlayers for this game is 2
libkdegames (KGame): havePlayers 1
libkdegames (KGame): Alltogether deactivated 0 players
libkdegames (KGame): [virtual bool KGamePropertyHandler::save(QDataStream&)] :
6 KGameProperty objects
libkdegames (KGame): KGamePropertyList save 28674
libkdegames (KGame): Saving KGame 1 KPlayer objects
libkdegames (KGame): [void KGame::savePlayer(QDataStream&, KPlayer*)] rtti=1,
id=1025, io=4
ksirk: Player::save
libkdegames (KGame): [virtual bool KGamePropertyHandler::save(QDataStream&)] :
9 KGameProperty objects
libkdegames (KGame): [void KGameNetwork::receiveNetworkTransmission(const
QByteArray&, Q_UINT32)] Message not meant for us 1!=2 rawid=0
libkdegames (KGame): [void KGameNetwork::receiveNetworkTransmission(const
QByteArray&, Q_UINT32)] Message not meant for us 1!=2 rawid=0
ksirk: slotPropertyChanged 28672
libkdegames (KGame): ====> (ALL) [virtual void
KGame::networkTransmission(QDataStream&, int, Q_UINT32, Q_UINT32,
Q_UINT32)] : Got IdGameConnected for client 2 we are =1
libkdegames (KGame): [virtual void KGame::networkTransmission(QDataStream&,
int, Q_UINT32, Q_UINT32, Q_UINT32)] : Got IdAddPlayer
libkdegames (KGame): [KPlayer* KGame::loadPlayer(QDataStream&, bool)] Player
2050(rtti=0,io=0) not found...asking user to create one
ksirk: GameAutomaton::createPlayer(0, 0, true)
ksirk: ERROR: No rtti given... creating a Player
libkdegames (KGame): [void KPlayer::init()] : this=0x82308f0, sizeof(this)=144
You can see that a player with id 1025, rtti 1 is saved but a player with id
2050 (so with an extra 0 low bit) and rtti 0 is loaded. I don't know were
thie extra bit come from... Any idea ?
Also, when a player object is created from the GameAutomaton (KGame)
createPlayer method, should the KPlayer constructor with the KGame argument
be used to cause addPlayer be called are should one use the empty constructor
instead ? I tried both version but saw no change...
Thanks in advance.
Kleag
--
KsirK - a turn-based strategy game for KDE
http://gna.org/projects/ksirk
KGraphViewer - a GraphViz dot graphs viewer
http://gna.org/projects/kgraphviewer
-------------- next part --------------
kdecore (KIconLoader): Theme tree: (Enfants)
libkdegames (KGame): CREATE(KMessageServer=0x819bc38) cookie=42 sizeof(this)=44
libkdegames (KGame): [void KMessageServer::addClient(KMessageIO*)] : 1
libkdegames (KGame): [KGameNetwork::KGameNetwork(int, QObject*)] this=0x819bba8, cookie=42 sizeof(this)=44
libkdegames (KGame): [KGame::KGame(int, QObject*)] - 0x819bba8, sizeof(KGame)=48
libkdegames (KGame): [void KGamePropertyHandler::init()] : this=0x8198b58
libkdegames (KGame): Connecting SLOT 1sendProperty(int, QDataStream&, bool* )
libkdegames (KGame): Connecting SLOT 1emitSignal(KGamePropertyBase *)
ksirk: WARNING: KXMLGUIClient::setXMLFile: cannot find .rc file ksirkui.rc
kdeui (KMainWindow): KMainWindow::applyMainWindowSettings
ksirk: addAButton: Images/quitter.png
ksirk: Trying to load button image file: /Images/quitter.png
ksirk: Button added Quitter
ksirk: addAButton: Images/nouveauJeu.png
ksirk: Trying to load button image file: /Images/nouveauJeu.png
ksirk: Button added Nouveau jeu
ksirk: addAButton: Images/newNetGame.png
ksirk: Trying to load button image file: /Images/newNetGame.png
ksirk: Button added Join network game
ksirk: addAButton: Images/aide.png
ksirk: Trying to load button image file: /Images/aide.png
ksirk: Button added ?? propos
ksirk: addAButton: Images/ouvrirJeu.png
ksirk: Trying to load button image file: /Images/ouvrirJeu.png
ksirk: Button added Open game
ksirk: KGameWindow::enterEvent()
ksirk: slotPropertyChanged 28672
ksirk: slotPropertyChanged 28673
ksirk: skin changed to: skins/default
ksirk: Got ONU definition file name: /home/gael/kde3.4.1/share/apps/ksirk/skins/default/Data/onu.xml
ksirk: ONU XML format version: 1.2
ksirk: Map path: Images/map.png
ksirk: Map file name: /home/gael/kde3.4.1/share/apps/ksirk/skins/default/Images/map.png
ksirk: Map mask file name: /home/gael/kde3.4.1/share/apps/ksirk/skins/default/Images/map-mask.png
ksirk: Loaded int item flag-width = 20
ksirk: Loaded int item flag-frames = 4
ksirk: Loaded int item flag-versions = 1
ksirk: Loaded str item infantry-file = infantry.png
ksirk: Loaded int item infantry-frames = 1
ksirk: Loaded int item infantry-versions = 3
ksirk: Loaded str item cavalry-file = cavalry.png
ksirk: Loaded int item cavalry-frames = 1
ksirk: Loaded int item cavalry-versions = 3
ksirk: Loaded str item cannon-file = cannon.png
ksirk: Loaded int item cannon-width = 32
ksirk: Loaded int item cannon-frames = 2
ksirk: Loaded int item cannon-versions = 3
ksirk: Loaded str item firing-file = firing.png
ksirk: Loaded int item firing-width = 64
ksirk: Loaded int item firing-frames = 4
ksirk: Loaded int item firing-versions = 2
ksirk: Loaded str item exploding-file = exploding.png
ksirk: Loaded int item exploding-frames = 4
ksirk: Loaded int item exploding-versions = 2
ksirk: Loaded int item fighters-flag-y-diff = -12
ksirk: Loaded int item width-between-flag-and-fighter = 32
ksirk: Loaded int item cannon-width = 32
ksirk: Creating nationality France
ksirk: Creating nationality United Kingdom
ksirk: Creating nationality United States
ksirk: Creating nationality Belgium
ksirk: Creating nationality Japan
ksirk: Creating nationality Italy
ksirk: Creating continent North America
ksirk: Creating continent South America
ksirk: Creating continent Europe
ksirk: Creating continent Africa
ksirk: Creating continent Asia
ksirk: Creating continent Pacific
ksirk: ONU::mapFileName() /home/gael/kde3.4.1/share/apps/ksirk/skins/default/Images/map.png
ksirk: ONU backgnd file name: /home/gael/kde3.4.1/share/apps/ksirk/skins/default/Images/map.png
ksirk: Before initView
kdeui (KMainWindow): KMainWindow::applyMainWindowSettings
ksirk: Before m_backGnd
ksirk: ONU::mapFileName() /home/gael/kde3.4.1/share/apps/ksirk/skins/default/Images/map.png
ksirk: BackGnd image file name is /home/gael/kde3.4.1/share/apps/ksirk/skins/default/Images/map.png
ksirk: Before paint
ksirk: End new game
ksirk: slotPropertyChanged 28672
ksirk: GameAutomaton::run
ksirk: Handling INIT ; ; 0,0
kdeui (KMainWindow): KMainWindow::saveMainWindowSettings MainWindow
ksirk: GameAutomaton::run
ksirk: Handling INIT ; ; 0,0
ksirk: GameAutomaton::run
ksirk: Handling INIT ; ; 0,0
ksirk: GameAutomaton::run
ksirk: Handling INIT ; ; 0,0
ksirk: GameAutomaton::run
ksirk: Handling INIT ; ; 0,0
ksirk: GameAutomaton::run
ksirk: Handling INIT ; ; 0,0
ksirk: GameAutomaton::run
ksirk: Handling INIT ; ; 0,0
ksirk: GameAutomaton::run
ksirk: Handling INIT ; ; 0,0
ksirk: Slot new game: posting event actionNewGame
ksirk: EventsListProperty::push_back actionNewGame / (0, 0)
libkdegames (KGame): ---> LIST id=28674 got command (62) !!!
ksirk: slotPropertyChanged 28674
ksirk: GameAutomaton::run
ksirk: EventsListProperty::pop_front
ksirk: Handling INIT ; actionNewGame ; 0,0
ksirk: KGameWindow::actionNewGame()
ksirk: KGameWindow::setupPlayers
ksirk: There is 6 nations
ksirk: Nation = 0x8212750
ksirk: Nation = 0x82127c0
ksirk: Nation = 0x82127d0
ksirk: Nation = 0x82103f0
ksirk: Nation = 0x8210788
ksirk: Nation = 0x8212960
ksirk: Filling skins combo
ksirk: Got skins dir name: /home/gael/kde3.4.1/share/apps/ksirk/skins/
ksirk: Got skin dir name: bubble
ksirk: Got skin dir: bubble
ksirk: Got skin dir name: default
ksirk: Got skin dir: default
libkdegames (KGame): ---> LIST id=28674 got command (63) !!!
libkdegames (KGame): CmdRemove:id=28674 i=0
ksirk: slotPropertyChanged 28674
ksirk: KPlayerSetupDialog slotOk
ksirk: Got true ; 2 ; skins/default
ksirk: slotPropertyChanged 8
ksirk: slotPropertyChanged 7
ksirk: min and max players number set to 2
ksirk: Got skin name: skins/default
libkdegames (KGame): WARNING: No player has been set!
ksirk: slotPropertyChanged 8
ksirk: slotPropertyChanged 7
libkdegames (KGame): [void KGameDialogNetworkConfig::slotInitConnection()]
ksirk: [void KGameNetwork::setDiscoveryInfo(const QString&, const QString&)] :
libkdegames (KGame): [bool KGameNetwork::offerConnections(Q_UINT16)] on port 20000
libkdegames (KGame): [bool KGameNetwork::offerConnections(Q_UINT16)] before Server->initNetwork
libkdegames (KGame): [bool KMessageServer::initNetwork(Q_UINT16)]
libkdegames (KGame): [bool KMessageServer::initNetwork(Q_UINT16)] : Now listening to port 20000
libkdegames (KGame): [bool KGameNetwork::offerConnections(Q_UINT16)] after Server->initNetwork
libkdegames (KGame): ERROR: [virtual void KGameDialog::submitToKGame()] : no player has been set
ksirk: There will be 1 network players.
libkdegames (KGame): [virtual KGameDialogNetworkConfig::~KGameDialogNetworkConfig()]
libkdegames (KGame): [virtual KGameDialogConfig::~KGameDialogConfig()]
ksirk: There is 6 nations
ksirk: Nation = 0x8212750
ksirk: Nation = 0x82127c0
ksirk: Nation = 0x82127d0
ksirk: Nation = 0x82103f0
ksirk: Nation = 0x8210788
ksirk: Nation = 0x8212960
ksirk: KGameWindow::setupPlayers: before switch; newPlayersNumber = 2
ksirk: KGameWindow::setupPlayers: nbAvailArmies = 52 ; nb countries = 42
ksirk: Filling nations combo
ksirk: Adding nation Belgium / belgium.png
ksirk: Adding nation France / france.png
ksirk: Adding nation Italy / italy.png
ksirk: Adding nation Japan / japan.png
ksirk: Adding nation United Kingdom / uk.png
ksirk: Adding nation United States / us.png
ksirk: slotOk
ksirk: Got name azer
ksirk: computer? : false
ksirk: After KPlayerSetupDialog. name: azer
ksirk: Creating player azer(computer: false): Belgium
ksirk: Adding player (AI: false)
libkdegames (KGame): [void KPlayer::init()] : this=0x8222b40, sizeof(this)=144
libkdegames (KGame): sizeof(m_Group)=20
libkdegames (KGame): [void KGamePropertyHandler::init()] : this=0x821c8c8
libkdegames (KGame): Connecting SLOT 1sendProperty(int, QDataStream&, bool*)
libkdegames (KGame): Connecting SLOT 1emitSignal(KGamePropertyBase *)
libkdegames (KGame): [void KGame::addPlayer(KPlayer*)] : ; maxPlayers=2 playerCount=0
libkdegames (KGame): [void KGame::addPlayer(KPlayer*)] NEW!!! player 0x8222b40 now has id 1025
libkdegames (KGame): [void KGame::savePlayer(QDataStream&, KPlayer*)] rtti=0, id=1025, io=0
libkdegames (KGame): [virtual bool KGamePropertyHandler::save(QDataStream&)] : 5 KGameProperty objects
ksirk: Creating player with flag file name: belgium.png
ksirk: Sprite file name: skins/default/Images/sprites/belgium.png
ksirk: imgName= /home/gael/kde3.4.1/share/apps/ksirk/skins/default/Images/sprites/belgium.png
ksirk: Done creating player
ksirk: Created player azer
ksirk: Calling player createIO
ksirk: createIO for azer
libkdegames (KGame): [KGameIO::KGameIO()] : this=0x8202f90, sizeof(this)44
libkdegames (KGame): Mouse Event filter installed tracking=false
libkdegames (KGame): [virtual void KGame::networkTransmission(QDataStream&, int, Q_UINT32, Q_UINT32, Q_UINT32)] : Got IdAddPlayer
libkdegames (KGame): dequeue previously added player
libkdegames (KGame): Trying to add player 0x8222b40 maxPlayers=2 playerCount=0
libkdegames (KGame): Player: isVirtual=false
libkdegames (KGame): id=1025 #Players=1 added 0x8222b40 (virtual=false)
ksirk: slotPlayerJoinedGame
ksirk: KGameWindow::enterEvent()
ksirk: GameAutomaton::run
ksirk: Handling INIT ; ; 0,0
ksirk: GameAutomaton::run
ksirk: Handling INIT ; ; 0,0
ksirk: GameAutomaton::run
ksirk: Handling INIT ; ; 0,0
ksirk: GameAutomaton::run
ksirk: Handling INIT ; ; 0,0
ksirk: GameAutomaton::run
ksirk: Handling INIT ; ; 0,0
ksirk: GameAutomaton::run
ksirk: Handling INIT ; ; 0,0
ksirk: GameAutomaton::run
ksirk: Handling INIT ; ; 0,0
ksirk: GameAutomaton::run
ksirk: Handling INIT ; ; 0,0
ksirk: GameAutomaton::run
ksirk: Handling INIT ; ; 0,0
ksirk: GameAutomaton::run
ksirk: Handling INIT ; ; 0,0
libkdegames (KGame): [void KMessageServer::addClient(KMessageIO*)] : 2
libkdegames (KGame): ===========================[virtual void KGame::negotiateNetworkGame(Q_UINT32)] : clientID=2 ===========================
libkdegames (KGame): [void KGameNetwork::receiveNetworkTransmission(const QByteArray&, Q_UINT32)] Message not meant for us 1!=2 rawid=0
libkdegames (KGame): =====>(Master) [virtual void KGame::networkTransmission(QDataStream&, int, Q_UINT32, Q_UINT32, Q_UINT32)] - IdSetupGameContinue
libkdegames (KGame): Master calculates how many players to activate client has cnt=0
libkdegames (KGame): The game has 1 active players
libkdegames (KGame): The user deactivated 0 player already
libkdegames (KGame): MaxPlayers for this game is 2
libkdegames (KGame): havePlayers 1
libkdegames (KGame): Alltogether deactivated 0 players
libkdegames (KGame): [virtual bool KGamePropertyHandler::save(QDataStream&)] : 6 KGameProperty objects
libkdegames (KGame): KGamePropertyList save 28674
libkdegames (KGame): Saving KGame 1 KPlayer objects
libkdegames (KGame): [void KGame::savePlayer(QDataStream&, KPlayer*)] rtti=1, id=1025, io=4
ksirk: Player::save
libkdegames (KGame): [virtual bool KGamePropertyHandler::save(QDataStream&)] : 9 KGameProperty objects
libkdegames (KGame): [void KGameNetwork::receiveNetworkTransmission(const QByteArray&, Q_UINT32)] Message not meant for us 1!=2 rawid=0
libkdegames (KGame): [void KGameNetwork::receiveNetworkTransmission(const QByteArray&, Q_UINT32)] Message not meant for us 1!=2 rawid=0
ksirk: slotPropertyChanged 28672
libkdegames (KGame): ====> (ALL) [virtual void KGame::networkTransmission(QDataStream&, int, Q_UINT32, Q_UINT32, Q_UINT32)] : Got IdGameConnected for client 2 we are =1
libkdegames (KGame): [virtual void KGame::networkTransmission(QDataStream&, int, Q_UINT32, Q_UINT32, Q_UINT32)] : Got IdAddPlayer
libkdegames (KGame): [KPlayer* KGame::loadPlayer(QDataStream&, bool)] Player 2050(rtti=0,io=0) not found...asking user to create one
ksirk: GameAutomaton::createPlayer(0, 0, true)
ksirk: ERROR: No rtti given... creating a Player
libkdegames (KGame): [void KPlayer::init()] : this=0x82308f0, sizeof(this)=144
libkdegames (KGame): sizeof(m_Group)=20
libkdegames (KGame): [void KGamePropertyHandler::init()] : this=0x822dcc8
libkdegames (KGame): Connecting SLOT 1sendProperty(int, QDataStream&, bool*)
libkdegames (KGame): Connecting SLOT 1emitSignal(KGamePropertyBase *)
ksirk: Done creating player
ksirk: Player::load
libkdegames (KGame): [virtual bool KGamePropertyHandler::load(QDataStream&)] : 5 KGameProperty objects
libkdegames (KGame): KGamePropertyHandler loaded propertly
libkdegames (KGame): Player loaded propertly
More information about the kde-games-devel
mailing list