UQ Students should read the Disclaimer & Warning

Note: This page dates from 2005, and is kept for historical purposes.

COMP2301 – Assignment Five – Basic Network Programming in Visual Basic

This assignment is a pass/fail assignment. I achieved a pass.

The goal of this assignment is to gain experience using Visual Basic by implementing a simple network enabled application.

In this assignment, you should become familiar with:

Specification

Develop a network enabled version of Tick Tack Toe with the following features:

Each player must be able to:

General operation

The applications will communicate over a number of fixed ports via simple text messages to transfer gaming status and commands.

Individual ports are specified for sending and receiving gaming traffic. It is assumed that a small number of games will be active at any one time and that all network requests will be services without delay.

Each game will format and display the content of all gaming traffic it has generated or received in a text window. The gaming commands, auto discovery requests and any other application specific messages will be presented at the bottom of the screen in a scrolling window. The last 100 gaming command and control messages should be buffered and accessible. At the top of the screen all status information must be displayed with buttons for all the gaming functions.

After launching the application the user will select Auto Discovery to generate a listing of all the active workstations.

The user may click on any one of the listed active gaming work stations and invite them to play. On the remote gaming work station a dialog box containing a detailed invitation will be displayed. The remote user may now accept or reject the invitation. If the remote user accepts the invitation the inviting system will randomly assign a player to go first. The first player must select Naught (green) or Cross (red) and click to indicate where to place their selection. The other system will automatically assign the remaining token. After this each player will make a selection in turn until the game is over. (out of turn plays are illegal)

Each end will maintain error checking and highlight any remote illegal moves in blue on the local system. If an illegal move is made the originator must display the move (O=green, X=red) and send the move to the remote player. The remote player must detect the invalid move, display the move in blue and send an illegal move message back. The originator of the illegal move must respond to the illegal move information and automatically change the colour of the illegal item on their local system. If the originator of an illegal move clicks that item (now blue) it will be removed from the game. Only after all illegal items are removed can the game proceed.

When a winning token is placed the remote system must detect the condition and notify the originator of the win. After this the winning line of X/O will be identified as a local event by colour change on both systems. The game is now over. The players will be shown a dialogue box congratulating the winner. At any time either player may Abort / Reset or Manually change the games network status. Connected players should react to all events logically.

Port definitions

Commands & Messages

(examples: Local system John Smith IP 130.102.73.53. Remote system Fred Nirk IP 130.102.73.33)

Gaming Commands

Port 6020 & Port 6021

<Invitation, From:IP Players Name: Inviting player’s name> Invite a remote player to play the game.
<Acceptance, From:IP Players Name: Accepting player’s name> Accept an invitation to play the game.
<Assign First Player, From:IP First Players Name: First players name> Inviting system must select and assign the first player status.
<Select, Token: x From:IP Players Name: name> Each player selects X or O which is displayed on the remote screen. Token: [X|O]
<Place , Token: x Colour: x Position: xx From:IP Players Name: name > Player places a token on the grid A1 to C3 with Colour [R|G|B]
<Delete, Token: x Colour: x Position: xx From:IP Players Name: name > Reports the removal of an illegal token from a system.
<Illegal, Token: x Colour: x Position: xx From:IP Players Name: name > Identifies an illegal token to the remote system.
<Winner, From:IP Winners Name: winner’s name> Notifies the remote system of game completion.

Example

Text from Network Gaming traffic window on the local system

General

No IP traffic should be generated outside of the specified IP / Port range.

Note: This application was coded as fast as possible, and as such does not conform exactly to the specification, and may not be stable or fit for use. The IP range is hard-coded, so without modification this application will only work in environments with a similar IP range.

Compiled (WIN32) binary (64 KB)

frmTicTacToe.frm

Code © Copyright 2004 Ned Martin

04-Jun-2004