1. How are the routines and memory usage divided between the user and the game server?
I will use my favorite online game to help you. Tanarus
You have 4 teams. 5 tanks on each. (Red, Blue, Gray, Green)
Then you have different types of tanks (Mag, Van, Cham, Lite, Dev)
Different Weapons (too many to list)
Each tank (player sitting at home) simply store only their information.
team, weapons, armor/crits, and location.
They also store the needed information about other tanks.(what team, tank, and location.)
When you are hit it goes something like this.
1.They fire and hit.
2.Packet is sent to the server then routed to you.
3.Your computer handles it from here on.
2. Using packets, how are the locations of other players kept track of and displayed on the users screen in the proper location?
(this is the one that keeps me up nights)
Ok. Online gaming means data stream.
Each player (meaning their computer) sends its information to the server. Lets say armor/crits, location/direction/speed.
The server simply routes the information to other players.
Code:
Lets say this is our data stream.
----player id, location/direction/speed, armor/crits, other stuffs---
string int x,y,z angle, int int int string
player id = Who the player is.
location = Just that. Note the three int. Remember we are in a 3D world.
direction = which way you are traveling. I think its two int which tell the horizontal and vertical angles, but I don't recall
speed = you already know.
armor/crits = nm
other stuffs = here is the fun part. This is the core of the data stream.
Any thing that you do that other players can see is here.
i.e. fire weapons, missiles, mine sweeps, etc.
3. Back to question one, assuming it would be impossible for one user to store information for 3000 users in memory (not to mention NPC's) how does the code determine which information to keep, and which to destroy.
Sorry but thats the programmers job.
4. This one may be a bit more general, but how much memory would take to host three thousand users playing such a game, how much of the information gets written to hard disk compared to how much actually resides in memory, and how how are the packets sent between users so seamlessly?
It just deponds on how powerful the server is.
owwww. After all that here is some design.
Code:
class cArena
{
array<cTeam> team;
someType battleField;
int timeOfDay; //just to add effects
}
class cTeam
{
array<cPlayer> members
color thisTeamsColor
}
class cPlayer
{
string name;
long bounty; //how much you get for killing them
long score; //How many point you have collected
int[3] location;
int[2] direction;
int speed;
cTank playersTank; //Configs on the players tank
}
class cTank
{
int bays; //Spots to store weapons
int maxSpeed;
int armor;
int crits;
array<cWeapon> weapons; //list of weapons
cTankType myTank;
}
class cTankType
{
void draw(); //your draw method
void specialWeapons(); //places whatever weapons that
//come with the tank in the
//cTank.weapons
}
the rest just depends on what you want to be able to do inside the game.
mostly methods. there is alot more but its 4:20 a.m. and I have to go.
Hopefully you will have more questions. So just post them.
I will hit you back.
BTW
All that, I just came up with.
I love programming off the top of my head.
But thats how I would design it.