CHAPTER 2 FRAMEWORK DESIGN
2.1 MMOG DEVELOPMENT SYSTEM
In the general MMOG development flow, the first step is to define the game contents like game roles, environment, events, game objects, NPCs and game playing scenario.
After decide the game contents, the next step is to develop the server side and client side code. In order to develop these code by using the platform’s API, the programmers must precede the developer’s teaching course to learning how to development. That is developers must know the programming language and the functionality of the APIs which the platform assignment and provide, and then they will start to develop the code according to the definition of the game contents. And the game content designers must define a content script document thyself which tells the programmers what should they do, and the developers must understand that what the document mean is.
Under this development flow, we find some parts that can be replaced by other way and will increase the development speed and reduce the development complexity.
First, the game content description document format should be provided by the platform that uses a popular language to define. Therefore, the game content designers
could write the description document by using the language and the programmers could understand the document’s content more easy and it also reduce the communication time between content designers and programmers which wasted on talk about the content’s definition.
The second, we find that the programmer will write a lot of the duplicate code during the development process. Because the development of the MMOG component’s program will follow an architecture which assigned by the platform and these programs may have the some methods or attributes are the same. Under this condition, the same MMOG component’s programs will have a part of codes are similarity and the differentiations between them are the method operation logic and other attributes which are defined by themselves. Therefore, we draw out the similarity part of the programs and use the XML description document to describe the different parts like methods and attributes. Then we design a code generation engine according to the document’s format and the regular of the programs. The code generation engine will generate the code according to the distribution of the document. Therefore, we can load the document into the code generation engine, and then the programs will be generated automatically. At last, the programmers must insert the code into the programs which can’t be generated by the engine, and then the development work will be finished. According to the method, the whole development flow will be simplified and the development speed will be more fest.
Therefore, the design of the MMOG development system can be partition into some parts. First, we must analyze all of the programs which must be development at the game server. After we get the relationship and programming rule between these programs, we define the description data structure and also choice a description
language to describe these programs. At last, we design a code generation engine according to the relationship between the programs and the description language.
2.1.1 DESCRIBE THE MMOG CONTENT BY XML
A MMOG content description language should have some futures like be suitable for describe and process the data, easy to be edited, support multi language code and with the verify mechanism. Therefore, we choice the XML (eXtensible Markup Language) to describe the MMOG contents, because XML is specially design for data description and exchange, and it is self-describing (the markup describes the structure and type names of the data, although not the semantics) and the XML file is a text file which could be edit by any text edit software, and it also support multi language code, and by using a XML schema file we could verify the XML document whether it is valid or not.
The MMOG contents description could be partition into some parts like messages;
NPCs, MAPs, Game objects, Game logic, server configure files and others. Each kind of the data will have their own data structure, and all of these data structure can be representing by the data structure tree. Therefore, we defined the data tags at first, and then build the data structure tree according to the relationship between these data.
Then the content designer can write the description document follow this data structure. In order to verify the document if it is valid, we will design a XML schema file to implement this work.
Figure 2-1 is a XML file which describes the MMOG messages includes the version, package name, class path, and each message’s contents. Each message represents a kind of player’s action; according to different player actions we need a kind of
message to handle this action. Therefore, we define some messages in this XML document, and use a MMOG message xml schema document to verify it in the Figure 2-2. According to the method, the content designer could define data follow a standard structure, and will be more convenient to search or edit the document.
Figure 2-1 MMOG message script document
Figure 2-2 MMOG message xml schema document
2.1.2 CODE GENERATION
After defined the game contents document, the programmers must development the programs according to the definition of contents. The programmers must development all components’ programs of the MMOG, the whole work is very complexity and complicated. In order to reduce the programmers’ load, we load the document into the code generation engine and make a part of the programs be generated automatically.
The programs we generated still need to be edit by programmer, because the code generation engine only generate the code which can be described, and others like method operation logic which could not be described in the description document must be write into the program by them self. The code generation engine use a XML parser to parser the XML description document, and send the data which were got in the parser process to the corresponding generator, then the generator will be
responsible to generate the codes.
Figure 2-3 MMOG Code generation flow
Figure 2-3 show the MMOG Code generation flow. Each generator handle a kind of code, it will store this kind of program’s architecture and the part of the same code and will have some method to generate the part of the different code according to received data.