Hex Servers and Agent Programming :: Possibilities for an Ecology and Reducing Server Lag


Pathfinder Online

Goblin Squad Member

2 people marked this as a favorite.

Not sure if you even want feedback of this type, but I figured you could delete it or move it if not.

Goblinworks :: Introducing the Crusader Road :: Ryan Dancey on Wednesday, December 21, 2011 wrote:
We'll divide this area into 256 hexes—the fundamental territorial unit of Pathfinder Online. The game's underlying technical architecture will likely encapsulate each hex in its own process similar to the way EVE Online manages systems. (This is extremely preliminary thinking; our final choice of middleware may dictate a different underlying architecture, but the logical division of the territory into hexes from the player perspective is the intended design.)

There has been quite a bit of work recently in academia which illustrated the usefulness of programming with agents. Specifically, work that I have participated in tracked targets in RL across numerous camera networks. This was accomplished by assigning each target a mobile agent that autonomously moved from server to server within the network as its associated target moved from the visual field of one camera to another.

Reference

While the application seems fairly different on the surface, the foundation could be used to efficiently allow cross hex server movement and the more radical idea of viable ecosystems.

What is of particular interest concerning this idea is that each object within game that exists interactively in the virtual world would be assigned its own agent within the server (items in inventory would not but if dropped...would, large rock faces would not but a piece chiseled off...would, etc). These agents could not only actively monitor position, but also statuses and even interactions. They could be created and destroyed on the fly and if treated like data-types could even be made to "hibernate", using zero resources until "triggered". Since every mutable object will have one of these agents, each agents behavior could be directly linked to an AI rule-set. This means the animals and mobs (and plants?) could be made to act and move regardless of the hex server boundaries (because they can seamlessly "jump" servers). Likewise, they could be made to interact with other agents autonomously. This would help lay a foundation for an ecosystem as suggested here.

As was mentioned in that thread, it would enable behaviors unseen in past MMOs such as true cooperative behavior among mobs, mobs that actually build structures, mobs that settle in abandoned shelters, intelligent migration routes and more importantly self balancing networks. It even allows control of mob "respawn" rates by allowing agents to duplicate themselves (or use a genetic algorithm and allow two agents to average their features into a new agent with random mutation) at given rates (and of course, based on their rule-set, they would be driven to do so when possible).

There is of course, the question of overhead. Ideally you would be able to change "sizes" of your hex servers to limit them to x number of agents. For example, if each hex server was limited to 1000 agents, a gathering of 3000 agents (for whatever reason, assume a battle between two factions) the hex servers would automatically re-size themselves to distribute that load. So the server at the core of the battle may limit itself to 100m diameter...and 900 agents. The servers on either side then extend their edges to fill that void and each runs at 1.3 km diameter and 600 agents on average. I am not sure of the math behind doing this with hexes. Having this agent based model actually allows you to do this easily because the respective agents keep all of their data intact and just jump to the new server when they cross the geographic boundaries (it makes no actual difference to them if they cross the boundary or if the boundary moves from underneath them, they would be bound by their "absolute geographic position", not server ID).

Since each agent contains all of its relevant data and is an active process, there is already a body of research and application that take advantage of the distribution of processes across clusters. This is opposed to storing data in a central location and using processes to retrieve and manipulate that data, there will always be bottlenecks. I am not an MMO developer and so I am not sure what systems are currently used. However, I don't believe traditional MMOs allow this sort of server dynamics, as evident by the lag we see in cities.

Anyways, this was just an idea I hinted at several times in other threads and never expanded upon. If this type of system could be made to work, the addition of addition hex servers as you expand the world would also have the effect of increasing the efficiency of your whole world (including what you already have)...something that I bet is pretty counter intuitive to most programmers.

It also brings up an interesting point...since this system would effectively allow you to cross the hex barrier in any direction, I assume if pushed you intend to make the world "stacks" of hexes. You could give the hexes a static height and stack them up or dawn as needed. So the next level down could be hexes that are .98 km in diameter at default (vs. the 1 km diameter at ground, one stack up would be 1.1 or 1.2 km in diameter), but also able to re-size themselves horizontally to distribute the population...of course, there is no reason why relatively unpopulated areas such as underground could not be made with larger hexes, perhaps 1:7 underground to ground, since the demands should be less.

Anyways, this has already got longer (and bounced across more topics) than intended. Feel free to ask for clarification if I am unclear about how something would work. If I can answer I will.


This sounds like a fascinating idea! If I'm understanding you correctly, this would allow for things such as roving bands of outlaws, or tribes of orcs reproducing and building settlements? That sounds incredibly cool. As you said, I imagine the setup of the servers would come into play here, but I would like to think that this idea would be considered!

Goblin Squad Member

Check out the big brain on KitNyx!

Seriously, though, this is exactly what I would love to see, although I've always seen it implemented using clients that would drive individual NPCs. These clients could even be taken over by GMs at times, if necessary.

Can you go into a little more detail about why it's better to have the agents actually running on the server where the NPC (or mutable object) is situated?

I really, really like the idea of groups of NPCs autonomously acting to modify their environment. I would imagine the greatest thing in the world for a game developer would be to be surprised at what happened in his game.

Goblin Squad Member

This sounds awesome. I've done a little 2D game programming, and this is reminding me of a Pool... basically, a group of already-created objects that can be pulled out of the pool into the game, and then called back to the pool when they're no longer needed in the game at that time. It saves a lot of work if they're objects that are added and removed a lot from the game.

Anyway, interesting idea! And however it's implemented, I'd love to see NPC's interacting with each other, not just waiting for a PC to come in and brighten up their lives. It would be interesting to see what the NPC's come up with if allowed to do something on their own.

Goblin Squad Member

1 person marked this as a favorite.

My favorite pet implementation would be to have NPCs spawn at logical locations and then push out to control territory.

It is one of my biggest pet peeves to clear a hallway, post guards at both ends, and still have mobs spawn in the middle.

Goblinworks Executive Founder

How would an agent running on one server interact with agents running on a different server? Would players have to connect to all servers within a radius, or would each server communicate seamlessly with all adjacent servers, and pass the relevant information to the clients?

Would each active mutable object run its own thread? How does this idea differ from the standard model, where static objects don't do anything, and dynamic objects are 'pushed' by the server?

Goblin Squad Member

Daniel Powell 318 wrote:
How would an agent running on one server interact with agents running on a different server?

Good point, that is not something we had to worry about with our application. I suppose, like all interactions, through the creation of agents and/or the passing of messages between existing agents. Agents and messages should be able to cross server boundaries, replicating itself on the one it is moving to and deleting itself from the one it is moving from.

Daniel Powell 318 wrote:
Would players have to connect to all servers within a radius, or would each server communicate seamlessly with all adjacent servers, and pass the relevant information to the clients?

The latter. Everything is either an agent or a message (which could also be seen as a simple agent). Agents use message passing to communicate...so the servers need to pass messages appropriately.

Daniel Powell 318 wrote:
Would each active mutable object run its own thread?

It's own process...ideally.

Daniel Powell 318 wrote:
How does this idea differ from the standard model, where static objects don't do anything, and dynamic objects are 'pushed' by the server?

It would be similar to programming in Erlang, everything is actor model with message passing. I am not advocating Erlang, only the power, utility, and robustness of it. Actually, I suppose I am not even doing that...only pushing the actor model, the philosophy of it.

I have never been part of the implementation of an MMO, but I imagine NPCs and other dynamic objects are simply serial programming responding not to its "environment" but instead to a simple rule set based on "player clicks"...no independent agency. Using the Actor model, everything has independent agency, meaning the world can be fluid, cities can be razed and/or raised and the NPCs will "find" their place within it.

Let me know if I failed to answer something you asked.

Community / Forums / Paizo / Licensed Products / Digital Games / Pathfinder Online / Hex Servers and Agent Programming :: Possibilities for an Ecology and Reducing Server Lag All Messageboards

Want to post a reply? Sign in.
Recent threads in Pathfinder Online