![]() |
|
Alphaball was written by Robert Parker in 2005 to explore the abilities of wxWindows and wxSockets.
The game itself is a rewrite of an earlier DOS version called Alfaball written about 2000 (note the spelling to keep within the 8 letter DOS name size). That game had been intended to help an eight year old learn the QWERTY keyboard in a two person game environment. However two people fighting over one keyboard was not very successful.
Pick your quickest computer to run the game server [g_server.exe]. From all the computers on the network, run alphaball.exe. From one computer select the desired game from the Options menu; say soccer. The first computer to connect will set the game for all. From each computer select Open_Session from the Socket menu. When the address of the gamer server is requested, enter the network name of the computer running the game server. Typically it is best to maximise the screen of the alpaball window. As each computer is connected, it is allocated a colour for the 52 men representing the upper and lower case of the alphabet.
To move a man on your team of 52, make sure that the alphaball window is selected and then type the appropriate character. If necessary, the viewing area will move to include the required key and a series of 6 numbers will be shown around that man to indicate the possible moves. A man can move anywhere within the limits of the field and if necessary can push other players or balls out of the way. If space bar is pressed a number of times before the move, then a kick will occur instead of a move. The number of times the space bar is pressed will set the distance of the kick.
There are two options in particular which the user may wish to experiment with.
SMOOTH MOTION is found under the socket menu and makes player motion look slightly more natural.
The TAKE TURNS option is found under the game menu and makes multipul players take turns. Only when it is a player's turn are the motion hints displayed.
For soccer (quite sensibly called football except down-under and some other British colony) the object is obviously to get the ball into your goal, indicated by your team colour (or colours). There can be a maxmimum of four players for the two teams. Each team has 11 players on the field but, if you want to cheat, there are additional players watching from just below the field. The passing off-side rule has not been implemented. When a goal is scored, the next move will cause the ball and players to reset to their original position. If a ball is pushed or kicked off the field, the offending team will not be able to move the ball. In this circumstance the TAKING TURNS rule will be disregarded until the ball is back in play.
The hexagon tiles now have the occassional red wall. These cannot be passed through. The object of the game is to push the ball to your side of the field with the full set of 52 man a size.
Getting the socket connection to work on windows XP and 98 was easy but getting the protocol to work without blocking proved harder. To diagnose these problems the server (g_sever.exe) and client (alphaball.exe) have different levels of log displays. Select from "Silent", "Normal", "Informative" and "Verbose". "Verbose" mode can be a little overwelming, particularly if the timer or the idle update modes are active. The server has "Terse" instead of "Silent" mode.
The client application needs to poll the server regularly to see if one of the other player has moved. This can be done either using a periodic timer (5 times a second) or whenever the windows OS is idle. Under Windows98 the server response seems a little slow, possibly a little better using the IDLE_UPDATE mode. Windows XP seems to find the IDLE_UPDATE mode a little congestive, so I have left the TIMER_UPDATE mode as the default.
The server normally logs everything (unless the log is disabled in options), so all games can be recovered. You will find a unique gameXXXX.txt for each game. Sorry if this clogs up your directory. Alternatively a game can be saved with a name of your choice. A game can be loaded into a server. This will then be issued to the client application when it connects or next updates. Games are saved not as a state but rather as a complete record of all actions.
Playing on computer with different speeds can cause the game to be a bit one sided. The wxSocket system seems a bit slow, which I think is probably due to fault of my protcol.
If the players are changing games or starting a new game, disconnect and restart the server, otherwise it almost always locks up while trying to replay the previous game.
I intend to work on these problems sometime, but I have other interests just at the moment.
To compile this code, you'll need wxWidgets (also known by it's previous name of wxWindows) which is a multiplatform library which includes wxSocket functions I wished to tryout. I used wxWidgets under MSWindows (98 and XP) with the DevC++ IDE which I uses a gcc compiler. Look for the DevC++ package with wxWidgets amalgamated version which has both wxWidgets and DevC in one unified package. My last attempt to get wxWidgets working on Debian Linux ran into cross dependancy troubles.