SuperClient Overview

From PSwiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

PlaneShift will one day support many thousands of players and many thousands of npcs running on the same instance, in the same “world”. However, to do this will take a relatively large number of game servers talking together and maintaining consistent world state among them. This has a high requirement for donations and puts a heavy burden on the developers to maintain and administer many boxes.

Until that long-term vision is achieved, though, it is desirable to run for as long as possible on one server, then scale to two nicely and so forth. But the top priority is to get as many people onto one server as we possibly can. Another high priority is to make sure that the NPC AI system achieves the following goals:

  • Allows for multiple versions of AI to be implemented, or to evolve over time.
  • Has maximum independence from the core game server code. To the game server, a Player Character with a human being at a computer and a Non-Player Character which is automated should be as similar as possible.
  • Takes into account the key objectives for the Game Servers, which are to maximize number of players allowed to play on a single box and to not assume unlimited server power, or even local access to multiple servers. If servers are donated to the team to help the cluster, it is not reasonable to assume they will all be at the same data center, or even in the same country.

For these reasons, the PS team has developed a ‘superclient’ architecture for NPC management. A ‘superclient’ is a process which connects to the Game Server using the same basic protocols and account structures as a player client. However, the superclient is managing multiple entities in the game instead of just the single player entity managed by a normal 3d client. The superclient has a special message protocol oriented around controlling multiple things at once which packs messages more tightly and makes networking more efficient. On the Game Server, though, there is almost no difference between a PC and an NPC outside the NPCManager which handles and unwraps these special network messages for the rest of the server.

The first superclient written is the one in CVS called ‘npcclient’, which the remainder of this document will focus on. Its focus is on stupid, but numerous monsters that are efficient on CPU to manage so a single instance of npcclient can possibly manage 500-1000 npcs concurrently.

Another document will be produced to explain the exact network protocol used by psserver and npcclient so that new superclients with their own AI and own scripting abilities/languages can be implemented. Such is the design of psserver that we can accommodate not only multiple superclients attached concurrently, but multiple different AI implementations with different levels of sophistication and scalability as long as both comply with the npc network protocol.

The best example of this is that npcclient is designed to have the bare minimum intelligence for attackable monsters, but to be able to support as many as 1000 of them concurrently at any one time. This takes a lot of sophiscation on the scripting side, managing 1000 multitasking eventdriven scripts for 1000 monsters, but each one cannot be very smart because our CPU budget for each monster is 1msec/sec.

An alternative superclient might be for very smart, very rare dragons and require 100% CPU on a separate box just to run the AI for 2 dragons, instead of 1000 orcs.