Using Agraham's new Remoting library, I wrote a simple game as an example of how this library can be used for two players games.
I tried to keep it as simple as possible. Here is a description of the code:
The game is called "X Mix Drix" (at least where I live) and you must know it.
There is only one application, each player selects his number, but no. 1 must press first since he is the server.
The game status is kept in the game() array and the program updates it in both players application using setdata and getdata .
The program connection is for running on the same computer as I believe it still needs a lot of development as a baseline for more advanced games. To convert it for LAN or WAN - look at Agraham's examples.
I'll be happy to see an addition to the library, for connection status report, instead of errors...in the program I keep a flag to hold the status.
I wish for and expect comments and corrections, to help me and others advance with this library.
Thanks again,Agraham
Edit: updated to version 2, enabling selection of local host or LAN, eliminating cheating and ending game when there is no winner. New game is launched by pressing again on player1 and player2 respectively.
Edit: upgraded to ver 3 , using remoting 1.1 lib. The code is commented for clarity.
3_2 use one dimension array, 3_3 - two-dimension.
I tried to keep it as simple as possible. Here is a description of the code:
The game is called "X Mix Drix" (at least where I live) and you must know it.
There is only one application, each player selects his number, but no. 1 must press first since he is the server.
The game status is kept in the game() array and the program updates it in both players application using setdata and getdata .
The program connection is for running on the same computer as I believe it still needs a lot of development as a baseline for more advanced games. To convert it for LAN or WAN - look at Agraham's examples.
I'll be happy to see an addition to the library, for connection status report, instead of errors...in the program I keep a flag to hold the status.
I wish for and expect comments and corrections, to help me and others advance with this library.
Thanks again,Agraham
Edit: updated to version 2, enabling selection of local host or LAN, eliminating cheating and ending game when there is no winner. New game is launched by pressing again on player1 and player2 respectively.
Edit: upgraded to ver 3 , using remoting 1.1 lib. The code is commented for clarity.
3_2 use one dimension array, 3_3 - two-dimension.
Attachments
Last edited: