Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Share Your Creations
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Share Your Creations Show your developed application to Basic4ppc community. Please include source code if possible.

Game for two using Remoting

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-05-2009, 07:33 AM
derez's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Posts: 978
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default Game for two using Remoting

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.
Attached Files
File Type: sbp Xmix3_2.sbp (6.9 KB, 37 views)
File Type: sbp Xmix3_3.sbp (7.2 KB, 33 views)
__________________
David Erez
Ramat Hasharon, Israel

Last edited by derez : 10-10-2009 at 12:52 PM.
Reply With Quote
  #2 (permalink)  
Old 10-05-2009, 08:28 PM
derez's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Posts: 978
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default

I have updated the file in the first post to ver 2.1
The flag showing the connection status is now included in the game array, as no 10.
With this there is a way to better control the connection and refrain from error messages.
__________________
David Erez
Ramat Hasharon, Israel
Reply With Quote
  #3 (permalink)  
Old 10-06-2009, 06:52 AM
derez's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Posts: 978
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default

Version 3.1 re-arranged and tested between two computers on LAN and between desktop and device (WM5) through activesync connection (also LAN, see network library help on how to find the host name).

From here to a Chess game is "just" to:
1. increase the board to 8x8 and the array accordingly
2. Tools images
3. MMI to select the tools, place them and move them.
4. define moving rules - what is allowed and what isn't
5. Define game result criteria
6...

So it is still a lot of work , but only on the game itself, the management of connection stays as is

Edit: checked between two devices using Wi-Fi. I added display of the IP after server starts, to help the client find its server.
__________________
David Erez
Ramat Hasharon, Israel

Last edited by derez : 10-09-2009 at 08:16 AM.
Reply With Quote
  #4 (permalink)  
Old 10-10-2009, 12:27 PM
derez's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Posts: 978
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default

Version 3_3 is using two-dimesional array instead of one dimension, to make the adaptation to square board games easier.
The 0 cells in both dimensions can be used for flags.
__________________
David Erez
Ramat Hasharon, Israel
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Inter Process Communication/Remoting library agraham Additional Libraries 16 01-05-2012 09:11 AM
A little game I put together ...... taximania Share Your Creations 0 12-30-2007 07:48 PM
New game maxtillberg Share Your Creations 1 10-29-2007 09:27 PM
[GAME] Merchants legugusse Share Your Creations 4 07-11-2007 08:36 AM
Game jorgerhv Share Your Creations 0 05-20-2007 12:09 AM


All times are GMT. The time now is 12:20 PM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0