I woke up 3 am tonight and laid awake, restless and unable to fall asleep, because I was thinking about how
the client/server model should work. I come back online at 8 am and lo, behold, Mickey asks which
client/server model we should use.
I got just the thing for you:
I envisioned an unified client/server executable, like you, but it does not quite work as you imagined it.
Current online 3D games make the server calculate some or all parts of the physics and other data,
so the player could not noclip through walls, wallhack and perform live injection or replay with
packet editors to go into godmode or give themselves millions of dollars.
Currently, the servers are being the slave workhorses, while the clients are the consumers and
only render and calculate what the main server tells them to. This causes linear increase in server
costs with every additional player.
But we can't allow clients to calculate their physics and data, because someone will sooner or later
hack it and fair multiplay would become impossible.
So I thought... what if... clients would calculate physics, BUT, someone ELSEs' physics.
Imagine this:
Client connects to central server and beings playing.
After some time, when the server has performed as a traditional server and integrated the user
into the game and verified that the client is doing correct physics calculation,
the server randomly chooses 3 (or more) clients and tells them about the newly joined client.
The server forwards all physics and environment related data to the 3 clients and then tells the newly
joined client the IP addresses of the 3 other clients. At this point, when the newly joined client does
something in the game which requires physics, it first tells the other 3 clients what it is going to do, then
it calculates the effect on its own computer. By now, the info has reached the 3 clients, who separately
calculate, based on the new players position, environment, and his actions, (as received from the main server)
what the result will be. After the new player has calculated the result of its actions, he sends the result to
the 3 clients and the main server, at which point the 3 clients verify that the new client performed the calculation truthfully.
Then, the 3 clients (who don't know about eachother) send the results of their calculations to the central computer,
who decides by majority vote the correct result of the action done by the new player.
Note: all other calculation, such as login/off, inventory content, who is visible to whom
(to prevent wallhack), etc. is performed by the main server.
This is an amazing system, since it relieves the central server from performing direct physics calculation for some players,
shifting the burden to the clients, while still verifying all the physics and being continuously informed of all the
actions taking place in the game.
This should, in theory, allow amazing scalability to massive scales while keeping the server costs as low
as possible AND eliminating any possible noclip packet injection hack.
The server should be able to detect players using modified clients, who try to hack physics, and ban them.
Since all connections begin with the main server, there is no way to hack the game even if all the players
use malicious modified clients, since any discrepancy will (and should) result in an immediate permaban.
EDIT: ...since any discrepancy with the physics algorithms harÐcoded in the server code will...
EDIT:
The server should begin shifting physics calculation to other clients, when the amount of connected players
reaches over a certain threshold.
Also, the server should continue to exclusively calculate the physics of randomly chosen players to detect malicious clients.
If a malicious client does physics while a server-controlled client is in the same room with the malicious user,
they both have to send the resulting state of physics object X to the server.
If the discrepancy is insignificant, the server tells the non-controlled client the correct location of the object
as it calculated it for the controlled client. If the discrepancy is huge, the server bans the non-controlled client AND
any or all of the 3 verifying clients whose result matched with the malicious user result.
Since all non server-controlled client physics are calculated by other clients, meaning that everyone is connected one
way or the other with everyone else, this should cause a chain banning for all malicious users, since,
when the server begins to doubt the calculations of a player and at some point it decided the actions done by that player
to be correct based on the results calculated by the verifying clients, the server beings to also doubt the verifiers and
the verifiers of verifiers. This leads to taking command of physics calculations for the suspicious clients one-by-one and banning
all the clients participating in the hack.
Also, since all the clients basically contain the server code, any client can set up a personal server and act as a main host,
which overviews all data and forwards it between participants. Note: all players joining the official servers should always run in
"client" mode. If they were allowed to run in server mode, you could as well hand over all other users personal data on a silver platter.
EDIT 2:
When I played Face of Mankind and 10 players turned simultaneously their flashlights on while in the same room,
massive lag was caused, because their client/server model makes each player calculate all other player lightray
physics (or they have just poop coding) who are in the vicinity.
The model I proposed should eliminate this issue, since the main server knows all object and lightmap data and just
forwards the rendering info to relevant clients, who are in each others proximity, while allowing the physics calculations
to spread out to clients who might be idling or in a complete different place is the game, reducing overall load and lag.
EDIT 3:
Also, all lightmap calculations should be simple additive algorithms. I'll create a separate topic about it if Mickey approves,
since i'd like to throw in other physics engine ideas and it might be a long post.
This one has already exceeded any limit above which people are capable of retaining any interest in reading it.
Congratulations if you made it to this end!
Until I append EDIT 4 here...
EDIT 4:
This was all said assuming that you plan to make RPGWO in 3D...
If 2D, then commercial success will become more questionable and the action verification
done by clients becomes a lot more simplified and less resource hungry.
(I prefer 3D, its all the rage the past 10 years or so...)
EDIT 5:
ALTHOUGH, Angry Birds is a huge success, but that is a short-term entertainment side-scroller.