Hi again,


As for the object hierarchy, I'm not sure if this is what you are looking for, but here goes.

I was thinking of having a new instance (or thread) of the server running for each game.

Within each instance we have a class called tanks.

Because each tank knows which player it belongs to we can put all of these into a 1 dimensional array.

So for 10 players with 10 tanks we need a 100 element array.

Thus:

Code:
Dim Tanks(100) as new tank
So player 1 joins and we assign him

Tanks(1-10)

Player 2 gets

Tanks(11-20) etc.

Each tank class also has a string property called .Instruction

As we read in the instructions from each instruction file we drop this into the relevant tanks .instruction property.

When the round is ready to be processed (either all the players have submitted instructions or a certain amount of time has elapsed), we randomly work our way through the array following the instructions of that tank.

Therefore we randomly pick tank 56.

We process it, and empty it's .instruction property.

We pick another tank 32 and do the same for it.

We pick another random number .. say we get 56 again, we look in it's .instruction and see that it's already been processed so we go to 57 (add 1), it has already moved so we go to 58, it hasn't done anything yet so we process it.

When all 100 have been processed we generate the output reports for each player and send them off.

The reason for this approach is that we don't want to give an unfair advantage to the players lower down the array. If two players are trying to move their tanks onto the same square, only one will succeed (and it will be decided randomly).

So we have a tank class with the following properties
.Energy
.Ammo
.Direction
.X
.Y
.PlayerId
.TeamId
.Instruction
.Dead

It also has the following methods
.LeftTurn
.RightTurn
.Recharge
.DepleteAmmo
.DepleteEnergy

This should suffice to record each of the tanks attributes.

To speed up processing, I would create an array of the playing field based on it's height and width

Dim arrayField (100,100) as integer

Then loop through the tanks array, and for each tank that is alive put their array index into the arrayField for their location.

i.e. If tank(32) is at 12,16 then we set
arrayField(12,16)=32

This way when we want to check if a shot has hit etc, we just need to look into that array.

Of course the array will have to be cleared at the beginning of each turn or after each tank has moved.

The basic playing parameters (size of field, etc) should be stored at the beginning of the match and never changed. The list of who is on which team only matters to the AI, if they want to take pot shots at ttheir own team mates then let them. It only becomes usefull for the server when we are checking to see if either side has won.

I hope this answers your questions, if not fire them back and I'll try again.

As for the name, Obliteration it is then! Cool.

Thanks again,

SD