Presentation is loading. Please wait.

Presentation is loading. Please wait.

The Generic Gaming Engine Andrew Burke Advisor: Prof. Aaron Cass Abstract Games have long been a source of fascination. Their inherent complexity has challenged.

Similar presentations


Presentation on theme: "The Generic Gaming Engine Andrew Burke Advisor: Prof. Aaron Cass Abstract Games have long been a source of fascination. Their inherent complexity has challenged."— Presentation transcript:

1 The Generic Gaming Engine Andrew Burke Advisor: Prof. Aaron Cass Abstract Games have long been a source of fascination. Their inherent complexity has challenged the limits of both computing power and human creativity. Similarly, games are also an excellent teaching tool for the exploration of artificial intelligences. The Generic Gaming Engine is a single computer program capable of playing many different two-player board games. With the engine as a framework, students are able to develop and play games of their own design. Game behavior is described using a small programming language and a finite state machine. The generality of the game rules and the utility’s ease of use simplify the game design process, freeing the user from many of the details involved in writing game-playing programs from scratch. Implementation Details Games are described using a finite state machine and a rule set. The finite state machine specifies game progression and terminal conditions. The rule set contains information about pieces, board dimensions, starting conditions, and piece movement rules. This file is actually a small program, written using a small custom programming language. Movement rules and state machine transitions and their resulting actions are written using included primitive functions. These include a wide variety of tests regarding the game state, as well as actions that modify the game state. The program is composed of one main game logic class, several data management classes, and several game data classes. All classes are contained in the genericgamingengine package. The program is written using Sun Java 1.4.2. Finite State Machines Finite State Machines are used to describe game progression, note occurrences of unusual game behavior, and denote endgame conditions. State machines are written using the State Machine Compiler, a freeware state machine compilation utility that converts a state machine description file into executable code. A compilation into Java code generates a method for each transition. The SMC language allows state machines to be defined as a listing of states and their associated transitions. Consider the example below: Normal { StandardMove [gameEnded() == false] Normal { display(); getInput(); } } This code fragment creates a state called “Normal” with a transition named “StandardMove.” In order for StandardMove to occur, the boolean function gameEnded() must return false. If this condition is true, the transition’s next state is Normal, with the resulting action of calling the display() and getInput() functions. After each move is made and verified to be legal given the current game state and movement rules, the state machine processes the input and calls the appropriate transition method. This method in turn calls any specified action methods. A state machine must contain at least two states: a “normal” state which gives the actions to be taken after a successful move, and an “ending” state that specifies the game’s concluding conditions. Programming Language Rules are written using a small programming language. A rule program contains the following elements: A game declaration, giving the name of the game. An environment declaration, giving the board dimensions. One or more piece type declarations, detailing the piece’s size, maximum and minimum move distance, and the Boolean functions describing the conditions for this piece’s legal move. A list of board configurations. One configuration is the keyword ‘piece’ followed by an ordered triplet of an initial location, a piece type, and the player to whom the piece will belong. Any functions defined by the user. These are written as compositions of supplied primitives. The programming language was written using the freeware programs JJTree and JavaCC. JavaCC generates a compiler given properly formatted lexical and syntactical grammars. JJTree inserts parse tree generating code into a JavaCC grammar. Data Classes Data is stored in five Java objects. An OrderedPair object stores an ordered pair of the form (x,y). It is used for storing piece size and starting locations. PieceType objects store the information defining a type of piece, e.g. “Bishop” in Chess or “King” in Checkers. This object stores the piece’s name, its minimum and maximum move distance, its size information, and a tree containing the movement function information. A Piece object is a single occurrence of a PieceType. While a PieceType object defines a class of pieces, Piece objects denote who owns particular piece, and assign it a unique identifier value. Multiple Piece objects that reference a single PieceType object may exist. CfgObj objects store the initial board configuration. A CfgObj object is created for each piece on the board at the beginning of the game. Each object contains a string representing the piece’s owner, an OrderedPair object storing the piece’s location, and a PieceType pointer for the piece’s type. GameState objects store the game’s state. This includes an array of the pieces on the board. Engine Classes Core functionality and file processing is handled by five Java classes. Logic and progression are handled by the Game class, which initiates rule set parsing and state machine compilation and contains publicly accessed methods for data access and program control. The ParseExplorer class is responsible for instantiating the programming language compiler and initiating the compilation of the game program. This class also contains depth-first search methods for traversing the parse tree generated from the game program. The GameInstantiator class uses the ParseExplorer class to glean details from the game program and organize them into a usable format. The SMManager class compiles a finite state machine and generates the necessary Java code for its transitions. The GGEMethods abstract class contains the definitions of the engine’s primitive functions. Future WorkDistributability The engine itself will run on a computer acting as a server, to which clients will be able to connect and play, thus allowing an easier medium for competitive play. Simultaneity A corollary to distributability, the engine will be able to handle more than one game at a time, permitting tournament style competitions. User interfaces Since the engine contains methods for obtaining information about the current game state, a more intuitive, adaptive, and pleasing user interface would increase the program’s usability. Primitive list expansion Since much of the game specification is accomplished through the implementation of supplied primitives, the variety of games supported is directly proportional to the variety of primitive functions included in the system. Resources The State Machine Compiler: http://smc.sourceforge.nethttp://smc.sourceforge.net JJTree and JavaCC: https://javacc.dev.java.net/https://javacc.dev.java.net/ Fig. 2: Finite State Machine for Checkers Fig. 3: Screenshot from a game of Checkers using default output. Fig. 1: Generic Gaming Engine UML Diagram


Download ppt "The Generic Gaming Engine Andrew Burke Advisor: Prof. Aaron Cass Abstract Games have long been a source of fascination. Their inherent complexity has challenged."

Similar presentations


Ads by Google