Docsity

Model Design Document: Agents, Judge, and SkyNet World - Prof. Stephen B. Wong, Study notes of Software Engineering

Toggle sidebar
bg1
Model Design Document
Description of the primary elements of the Model
Agents - An agent is similar to a virtual client that exists within the server. This agent
has two primary roles in the system : event handling and behavior requests. Several of
the implementation details of the agent are still not very clear at this moment, but we
have a good idea of the features we want this part of the program to have.
Agents will exist in a common process that has clearly defined interfaces between both
itself and the clients, as well as between itself and the SkyNet world. Traveling between
itself and the SkyNet world will be behavior requests, event notifications, and data
returning from query entity behaviors.
An Agent has the ability to request a behavior on the world. In the standard agent, an
agent will simply relay any request that a client has on to the SkyNet world. In a more
advanced client, the agent itself will be able to make decisions, query the world, and run
behaviors under the direction of the user or completely autonomously. If we later wanted
to implement a computer player using AI, all it would need would be to implement the
same Agent interface which allows it to request behaviors on the world and receive
notification when the state of the world changes in different ways. The behaviors are
passed from the Agent to the SkyNet world by handing it off to the Judge. This Judge is
the one to determine if an agent has the permission to run this behavior on the world.
Also an Agent can request a query on the world for a particular entity, a group of entities,
or all entities that have a particular attribute or set of attributes. These requests are
formed via an IQuery object that the agent can generate. This IQuery object has several
methods that can be used to specify search parameters for entities in the world. This again
goes to the Judge which determines if that Agent has the permission to view that entity in
the world, or which attributes of that entity the Agent has the permission to view.
Finally, an agent can register an attribute listener on an attribute field of an entity. This
will add tell the world that this agent would like the Judge to notify the agent when that
attribute field of the particular entity is changed, and the appropriate listener code will be
run in the agent accordingly. This gives the ability to have automatically responding
behaviors and rapid notification of the client if something that it cares about changes
without needing to poll the world for information.
Judge: A stateless class which is responsible for both insuring that any request on an
Entity to perform a behavior is valid and also that when an Entity requests a behavior be
performed on the world, that the behavior is checked by the rule set before it get
executed.
Since the Judge is stateless, either a new Judge instance will be initialized for
each behavior request called from an agent, or all of the methods in the class will be static
allowing numerous threads to call that method without any need for internal state.
Included in the behavior request is enough information is enough information for the
pf3

Partial preview of the text

Download Model Design Document: Agents, Judge, and SkyNet World - Prof. Stephen B. Wong and more Study notes Software Engineering in PDF only on Docsity!

Model Design Document Description of the primary elements of the Model Agents - An agent is similar to a virtual client that exists within the server. This agent has two primary roles in the system : event handling and behavior requests. Several of the implementation details of the agent are still not very clear at this moment, but we have a good idea of the features we want this part of the program to have. Agents will exist in a common process that has clearly defined interfaces between both itself and the clients, as well as between itself and the SkyNet world. Traveling between itself and the SkyNet world will be behavior requests, event notifications, and data returning from query entity behaviors. An Agent has the ability to request a behavior on the world. In the standard agent, an agent will simply relay any request that a client has on to the SkyNet world. In a more advanced client, the agent itself will be able to make decisions, query the world, and run behaviors under the direction of the user or completely autonomously. If we later wanted to implement a computer player using AI, all it would need would be to implement the same Agent interface which allows it to request behaviors on the world and receive notification when the state of the world changes in different ways. The behaviors are passed from the Agent to the SkyNet world by handing it off to the Judge. This Judge is the one to determine if an agent has the permission to run this behavior on the world. Also an Agent can request a query on the world for a particular entity, a group of entities, or all entities that have a particular attribute or set of attributes. These requests are formed via an IQuery object that the agent can generate. This IQuery object has several methods that can be used to specify search parameters for entities in the world. This again goes to the Judge which determines if that Agent has the permission to view that entity in the world, or which attributes of that entity the Agent has the permission to view. Finally, an agent can register an attribute listener on an attribute field of an entity. This will add tell the world that this agent would like the Judge to notify the agent when that attribute field of the particular entity is changed, and the appropriate listener code will be run in the agent accordingly. This gives the ability to have automatically responding behaviors and rapid notification of the client if something that it cares about changes without needing to poll the world for information. Judge: A stateless class which is responsible for both insuring that any request on an Entity to perform a behavior is valid and also that when an Entity requests a behavior be performed on the world, that the behavior is checked by the rule set before it get executed. Since the Judge is stateless, either a new Judge instance will be initialized for each behavior request called from an agent, or all of the methods in the class will be static allowing numerous threads to call that method without any need for internal state. Included in the behavior request is enough information is enough information for the

Judge to query the appropriate permissions and allow or disallow the behavior from being requested on the entity. Similarly, a Judge instance will receive a behavior request from an Entity with the necessary associated data for it to search the Rules database as well as any necessary Entities in the world in order for the Judge to find any rules that will apply to this behavior. After the rules have been applied to the behavior, changing it in some way, the Judge then applies the behavior to the world, changing the world’s state. The Judge interfaces with a back end SQL rules database. These rules will require the Judge to get certain information from the requesting entity and the surrounding world to know if they apply to the behavior. Additionally these rules can have a precedence ordering that will allow them to be chained in a hierarchy and have lower precedence rules not interrupt the action of higher priority rules. SkyNet World: A dataset including entities and rules and a judge. Inside the world there will be entity database, rule database, judge class that will be initialized every time a run behavior request being called. So the whole world is stateless. All entities in the world are database entries and will be managed by the sql database. The stateless attribute of the world will give us the ability that in out future implementation we can extend it to a distributed system. Entities: Database entries that defines what attributes, behavior and permission the entity have. These are database entries that keep track of several things. First, it maintains a list of attributes, which are simply key value pairs. Common attributes will be location, hit points, ammunition, and other such values that it is important for the system to know, but are only defined by what type of game is being played. The use of attributes holding the location allows the server model to remain unchanged even if the gametype is drastically changed, only needing changes on the view side to understand a different gametype. These entities also maintain a list of behaviors that they are allowed to do. For example, a tank might have the behaviors move and fire. Finally, the entities maintain a permission table of which agents have the permission to do a number of things with the entity. The permission table will be roughly similar to the user permissions in Unix, where each attribute and behavior will have flags determining who is allowed to read or change an attribute, and who is allowed to execute a behavior. Additionally, the permissions will support granting or denying permission to a group of users defined by the administrator, and not only the owner of the Entity. Behaviors: A behavior is something that is enacted by an entity on the world. It can change the entity itself, another entity, or even a collection of entities. The basic set of behaviors is to create a new Entity, to destroy an Entity, and to change the attributes of an Entity. These three basic behaviors will define most interactions that an entity could want to do to another entity, since changing attributes equates to doing damage, moving, using ammunition, and any other concrete attribute of the entity. The other options of creating and destroying an entity allow the entity to both build new units, or destroy ones that it has the permission to. For example when a entity execute a behavior which is do damage to another entity, if the judge see that the damage will change the hit point of