Well, I have gotten things stabilized with the last demo at least. Anyways, I am now looking into the network code.
Network code, I think, has to be next. Because to build too much gameplay without thinking how it will work in terms of group play, would mean that ultimately group play will seem like an afterthought. Instead, I want the game to really focus on group play.
There will be three network layers:
First is a "group server". This is like a global server, running on some system. It must be up in order for vex to be played online. It is very simple, and only communicates with clients for login/logout purposes, and periodicially with the "game server".
The second is "game server". This one moves around, it is part of the vex engine and can be hosted on anybodies machine. It communicates database updates with the group server, and with the other players. When a player logs on, they connect first to the group server which tells them who is currently playing in the game world, who is online, as well as who has the game server. If nobody else is online, or the current game server is lesser priority than they are, then they become the game server. Otherwise they connect to it remotely. If the game isn't a group game at all, i.e., it's totally off-line, then the player doens't need to connect to the group server at all, the game server just operates on it's own.
Finally there is the game network layer. Basically, the game communicates with the game server, remotely or locally depending. So when you enter a house or something, you talk to the game server and request a mutex lock or whatnot, so nobody else can enter the house. Then, say, game state is changed while you are in the house, and that data is sent to the game server which updates.
As well, the game network layer knows how to communicate with other players directly. When you are flying around, the coordinates etc. are transmitted to the other players, not the game server.
The whole idea here is that, make the main load on the game server, so the group server stays very simple.
However. There are just a few problems that mean I may not do this. Basically, what advantage do we have if the game server has to constantly be updating with the group server? Well, a couple things. First, we *could* make so the game server only updates the group server periodically, and/or at logout of the game server. Second, the game server doesn't need to keep coordinates of everything.
Well, I'm still not sure. Really the biggest problem is, what happens when the network connection is lost to the game server, i.e., person X's computer crashes. So the group server has to be kept somewhat up-to-date.
Hmmm......................................................... Let me think!