[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

2 Player mode



Hi,

as you know, I'm a bit busy as my girlfriend gave birth to my second child (a boy) 5 weeks ago. The week before I've promised to look into the 2 Player mode and actually I did. I have something which works one, two rounds between 2 Palm devices over Bluetooth, then it crashes. I don't know the reason yet and to find a crash is quite difficult, as you don't have a real way to debug it, except print out a lot of log-info. But maybe someone else will try it on the desktop version and see if it is a problem in the way it works, or rather a memory problem of the Palm port.
I've made a diff to the 0.4.9:


what I did:

added a new game flag: GI_2PLAY
added a flag to the player: local or not
added functions to send and receive data over a given transport

In game.cpp StartTurn I'll record a history if the other player is human but not local. After I record the history in EndTurn I'll add an header and send it to the other site. After it's sent and acknowledge it goes into a wait loop for the answer.
The other site is waiting in StartTurn for this header and receives the history. The history is then played back, but this time for real. Then it starts to do it's own turn. In EndTurn it will again send it's own history to the other site.
Then it starts all over again.


The decision how starts is done by asking the user if he is server or client.

Please check the diff and ask me in the list. Sending the history was a better thing as the player can see what the other site did, if he like.

I would like to know what happens when you implement it for 2 desktop players over TCP/IP.


Regards Henk


-- ------------------------------------------------------------------------- Henk Jonas Palm OS ® certified developer

  metaview@xxxxxx                                   www.metaviewsoft.de
-------------------------------------------------------------------------

Attachment: diff.zip
Description: Zip archive