CN1278223C - Scropt executing method for computer game - Google Patents
Scropt executing method for computer game Download PDFInfo
- Publication number
- CN1278223C CN1278223C CN 03119251 CN03119251A CN1278223C CN 1278223 C CN1278223 C CN 1278223C CN 03119251 CN03119251 CN 03119251 CN 03119251 A CN03119251 A CN 03119251A CN 1278223 C CN1278223 C CN 1278223C
- Authority
- CN
- China
- Prior art keywords
- order code
- script
- file
- code file
- instruction
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Lifetime
Links
Landscapes
- Devices For Executing Special Programs (AREA)
- Stored Programmes (AREA)
Abstract
The present invention provides a script executing method applied in computer games, which comprises the following steps: scrip sentences are compiled so as to form a script file; the scrip sentences in the script file are compiled into an instruction code, and are stored into an instruction code file; the instruction code file is loaded by a computer game engine, and the instruction code file is transmitted to a script executing machine; an instruction in the instruction code file is operated by the script executing machine, and a task system and a scenario interlude of the computer game are driven. Efficiency can be more rapidly realized, and the method can be more conveniently realized.
Description
Technical field
The present invention particularly is applied in the computer game relevant for the script executing method, can realize driving the task system of computer game and the script executing method of story of a play or opera interlude performance.
Background technology
At present, a lot of computer games are task system and the story of a play or opera interlude performances that drive computer game by adopting script system to reach.And computer game becomes increasingly complex, computer game networking has simultaneously also become the trend of computer game, so the requirement to the game scripts system is more and more higher, require flow control method faster, can realize complicated flow process control and complicated various functions fast.
And present game scripts system only provides simple and crude flow control method, owing to generally be to carry out by script sentence is one by one explained, it is very low to carry out efficient, script flow process control instruction is simpler and cruder, it is convenient inadequately to make to the support that realizes the complicated story of a play or opera flow process of recreation, the practice difficulty, efficient is low and make mistakes easily.And, the technical solution price general charged costliness of foreign same type.
Summary of the invention
The object of the present invention is to provide a kind of script executing method that is applied to computer game, the script file that writes has been compiled and be stored as the order code file, reduced error rate, improved the efficient of carrying out.
A further object of the present invention has been to provide a kind of script executing method that is applied to computer game, in script executing machine, moved the flow control method of exploitation certainly, simplified the operational scheme of script executing machine, improve the script travelling speed, the task system of quick realization driving computer game and story of a play or opera interlude performance.
An also purpose of the present invention has been to provide a kind of script executing method that is applied to computer game, will be stored as the order code file of set form through the script file of compiling, makes its standardization.
In order to realize the above object, the invention provides a kind of script executing method that is applied to computer game, (1) compile script statement forms script file;
(2) the compilation script statement becomes order code, is stored as the order code file;
(3) loading computer game engine order code file, and give script executing machine the order code file transfers;
(4) script executing machine is carried out described order code after obtaining order code in the described order code file, drives the task system and the story of a play or opera interlude of computer game.
Described order code is obtained and moved to script executing machine as follows in the step (4):
(a) script executing machine is loaded into the order code file in the order code file sequence of waiting for operation;
(b) described execution machine checks always whether described order code file sequence has the order code file, if having, then carries out step (c), otherwise end step (4);
(c) whether this order code file of script executing machine check has order code, if having, carries out step (d), otherwise returns step (b);
(d) be written into this order code, move this order code;
(f) after the order code operation finishes, return step (c).
According to above method, following remarkable result can be arranged:
(1) the present invention has improved the operational efficiency of script greatly by in advance script sentence being compiled into order code; Realized the functions such as judgement, branch, circulation and function call of script sentence, supported that more the multilayer between these functions is mutually nested, made script very convenient the control of complicated flow process; To the compiling of script sentence the time, script sentence is detected, can find in advance that most script writes mistake.
(2) utilize script executing method of the present invention, simplify the operational scheme of script executing machine, improve the efficient of carrying out, the traditional computer game script system of function ratio of convenient various complexity is more suitable for the complicated and networked development of computer game simultaneously.
(3) compiled order code is stored as the order code file of set form, makes standard, the standard more of operating more.
Description of drawings
Fig. 1 is the structured flowchart that is applied to the script system of computer game of the present invention.
Fig. 2 is the workflow diagram that is applied to the script system of computer game of the present invention.
Fig. 3 is the workflow diagram of the script executing machine of the script system that is applied to computer game of the present invention.
Embodiment
Consult Fig. 1, the invention provides a kind of script system 100 that is applied to computer game, comprising: script module 110, be used for the compile script file, this script file is made up of script sentence; Script compile device 120 is used for the script sentence of script file is compiled into order code, is stored as the order code file, and script executing machine 130, is used for the operating instruction sign indicating number and drives computer game task system and the performance of story of a play or opera process.
Script module 110, this script module 110 provides the environment of compile script statement.This script module 110 comprises the basic instruction set of being made up of self-defining elementary instruction 112, and logic determines, redirect statement, loop statement, comparison statement or the like are wherein arranged.Script file is made up of a rule script sentence, and script sentence can be called basic instruction set 112.When design, writing of script adopted the grammer of similar Pascal language for convenience, makes writing of script safer.
Script compile device 120 is used for script sentence is compiled into order code, is stored as the order code file.Because script executing machine 130 operations is order code, so need script compile device 120 that the script file of text mode is changed into the order code that script executing machine 130 can be carried out.This step can make the script of actual use save storage space simultaneously, improved operational efficiency, multilayer between judgement, branch, circulation and the function call etc. of support script sentence is mutually nested, can check the grammer problem of script simultaneously, script is write can in time be found mistake.
Compiled script file is stored by defined fixing order code file layout.The file layout of this order code file is divided into three parts at least by sequencing on the storage space: 1, file header module; 2, function name and location tables module; 3, order code module.
1, file header module: the length of this module is 40 bytes, wherein writes down function numbers and order code data length in some essential informations of this order code file and this order code file.At least include function numbers part and order code data length part.Particular content is referring to table 1 (table 1);
Part | The position | Explanation | Content |
Part 1 | The 1st byte to the 31 bytes | copyright | Character string KingSoft Script |
Part 2 | The 32nd byte | Version number | Version number |
The 3rd part | The 33rd byte to the 36 bytes | The function numbers part | The order code that indicates this order code file partly has what functions (function is special order code) |
The 4th part | The 37th byte to the 40 bytes | Order code data length part | One 32 figure place indicates presents order code partial data length |
2, function name and location tables module: this module records the title of all functions of this order code file and the position of each function in the order code file, this part is made up of a lot of unit, the function numbers of file header module has illustrated the quantity of unit, the length of each unit is fixed as 36 bytes, and the structure content of each unit is referring to table 2.
Table 2
Part | The position | Explanation | Content |
Part 1 | The 1st byte to the 32 bytes of unit | The function name part | A character string indicates function name |
Part 2 | The 33rd byte to the 36 bytes of unit | Function order code position part | One 32 figure place indicates the position of this function order code at the order code file |
3, order code module: this part has been preserved all order codes of this order code file.Form by instruction in the order code file, and order code is the coding form of instruction.The form of every order code is referring to table 3 (table 3);
Part | The position | Explanation | Content |
Part 1 | The 1st byte to the 4 bytes | The order number part | One 32 figure place, the numbering of minute book instruction |
Part 2 | The 5th byte to the 8 bytes | Parameter region length part | One 32 figure place indicates the length of all subsidiary supplemental characteristics of this instruction; If length is 0, then there is not the 3rd part |
The 3rd part | Be positioned at after the part 2, length is indicated by part 2 | The parameter region part | All supplemental characteristics of this instruction, parameter by some is formed, the quantity and the type of every concrete incidental parameter of instruction determine that the structure of each parameter is referring to table 4 |
Table four
Part | The position | Explanation | Content |
Part 1 | The 1st byte to the 4 bytes | The parameter length part | One 32 figure place, the length of minute book parameter |
Part 2 | Be positioned at after the part 1, length is indicated by part 1 | The content of parameter part | Content of parameter has multiple different type, and every concrete instruction has determined the type of these parameters |
Instruction can be the instruction of system definition, also can add user-defined directive script.The script compile device mainly is to have utilized Fundamentals of Compiling, and each character in the script file is resolved, and generates corresponding order code, then is stored as the order code file of said fixing form.
Script executing machine 130, this script executing machine 130 provide the api function (ApplicationProgram Interface application programming interfaces) 134 of script.This self-defining script api function 134 can be finished the sophisticated functions relevant with game engine, for example changes the Mission Objective state, and game replaying story of a play or opera interlude etc. have comprised a series of api functions that various objects in the computer game are carried out various operations.By the basic instruction set 112 of invoke script api function 134 and script module 110, can finish writing of script sentence; The script of a computer game comprises many script files of being made up of a series of script sentence.Script executing machine 130 operations drive the task system and the story of a play or opera interlude of computer game through the instruction in the order code file of compiling.
Fig. 2 is the process flow diagram that is applied to the script executing method of computer game of the present invention.
200: computer game is made the actual demand according to recreation, utilizes basic instruction set 112 and script api function 134, and the compile script statement forms script file in the script module;
210: script sentence becomes order code in script compile device 120 these script files of compiling, when occurring the grammar mistake of script sentence in the script, point out and require to correct, have only do not have grammar mistake after, these script sentence could be compiled into corresponding order code, and these order codes be preserved to become be the order code file of above-mentioned set form;
220: by the compiled order code file of loading computer game engine, and give script executing machine 130, prepare operation with the order code file transfers;
230: script executing machine 130 by each bar directive script of script executing machine 132 actual motions, drives the task system and the story of a play or opera interlude performance of computer game after obtaining compiled order code file.
Fig. 3 is the workflow diagram of execution machine that is applied to the script system of computer game.At first, must move initialization function 138, the order code file that moves is carried out a series of initial work, just can carry out the actual motion of execution machine as shown in Figure 3 then, finish the workflow of script executing at last by the anti-initialization function 140 of operation.
300: at first, script executing machine 130 is waited for it adding in the order code file sequence of operation after obtaining compiled order code file; Order code file sequence can be to open up a storage space at internal memory, can be continuous, is used to deposit the order code fileinfo of waiting for operation;
310: script executing machine 130 can quantitative check wait to move the order code the file whether operation waited for is arranged in the order code file sequence, if do not have, then enters 360; If finding has the order code file that needs operation, then move this document, enter 320;
320: script execution module 132 is finished the execution of order code file by the instruction in the operating instruction sign indicating number file one by one, each check earlier current just in operating instruction sign indicating number file, whether also having need the instruction carried out; If no, then return 310; Otherwise enter 330;
330: script executing machine 130 has detected instruction to be needed to carry out, and is written into the order code of this instruction, prepares operation, enters 340, does not need the instruction carried out if detect, and then returns 320;
340: script executing machine 130 obtains order code that need to carry out, this instruction that brings into operation, and regularly detect this instruction and whether move and finish, enter 350;
350: 130 pairs of instructions that moving of script executing machine detect; If finding also not move finishes, then continue this instruction of operation, get back to 340; If finding that this instruction has moved finishes, see that then the instruction that whether also has other needs to carry out, and gets back to 320.Have only when all are waited to move order code file in the order code file sequence and all are finished, just can finish this flow process
360: process ends.
The above is one embodiment of the present of invention, but the present invention is not limited only to this, and about any change of the present invention, protection domain is as the criterion with claims.
Claims (7)
1, a kind of script executing method that is applied to computer game is characterized in that this method may further comprise the steps:
(1) the compile script statement forms script file;
(2) script sentence in the script file is compiled into order code, is stored as the order code file;
(3) loading computer game engine order code file, and give script executing machine the order code file transfers;
(4) instruction in the script executing machine operating instruction sign indicating number file drives the task system and the story of a play or opera interlude of computer game:
(a) script executing machine is loaded into the order code file in the order code file sequence of waiting for operation;
(b) whether the described order code file of described script executing machine quantitative check sequence has the order code file of the operation waited for, if having, then carries out step (c), otherwise end step (4);
(c) whether this order code file of script executing machine check has the instruction that needs execution, if having, carries out step (d), otherwise returns step (b);
(d) be written into the order code of this instruction, move this instruction;
(f) after instruction operation finishes, return step (c).
2, the script executing method that is applied to computer game as claimed in claim 1 is characterized in that: call basic instruction set in the step (1) and api function comes the compile script statement.
3, the script executing method that is applied to computer game as claimed in claim 1 is characterized in that: step (4) before, script executing machine operation initialization earlier function carries out initialization with the order code file of operation.
4, the script executing method that is applied to computer game as claimed in claim 1 is characterized in that: described order code file is stored with fixing order code file layout, and this order code file layout is divided into three big modules sequentially on storage space:
File header module: write down the quantity of function in the described order code file and the data length of order code;
Function name and location tables module: the title and the position of each function in the order code file of having write down described all functions of order code file;
Order code module: the information of having preserved all order codes except that function in this order code file.
5, the script executing method that is applied to computer game as claimed in claim 4 is characterized in that: comprise at least in the file header module with the lower part:
Function numbers part: the function number that is used for recording instruction sign indicating number file;
Order code data length part: the data length that is used to write down described order code document order sign indicating number.
6, the script executing method that is applied to computer game as claimed in claim 4, it is characterized in that: function name and location tables module include at least with the lower part:
Function name part: each function name that indicates the order code file;
Function order code position part: indicate this function at the order code document location.
7, the script executing method that is applied to computer game as claimed in claim 4, it is characterized in that: the order code module comprises at least with the lower part:
Order number part: the numbering of minute book instruction;
Parameter region part: the quantity of all parameters of this instruction, type and structure.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN 03119251 CN1278223C (en) | 2003-03-07 | 2003-03-07 | Scropt executing method for computer game |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN 03119251 CN1278223C (en) | 2003-03-07 | 2003-03-07 | Scropt executing method for computer game |
Publications (2)
Publication Number | Publication Date |
---|---|
CN1527195A CN1527195A (en) | 2004-09-08 |
CN1278223C true CN1278223C (en) | 2006-10-04 |
Family
ID=34285034
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN 03119251 Expired - Lifetime CN1278223C (en) | 2003-03-07 | 2003-03-07 | Scropt executing method for computer game |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN1278223C (en) |
Families Citing this family (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN100357888C (en) * | 2005-01-05 | 2007-12-26 | 英业达股份有限公司 | Game developing system and method |
CN101634940B (en) * | 2008-07-25 | 2012-07-04 | 苏州蜗牛数字科技股份有限公司 | Method for developing computer games through scripts |
KR101264615B1 (en) * | 2011-06-17 | 2013-05-27 | (주)네오위즈게임즈 | Device and method for executing and managing job file of game server |
CN103530087B (en) * | 2012-07-04 | 2015-02-18 | 腾讯科技(深圳)有限公司 | Plot command executing method and device |
CN104679489A (en) * | 2013-12-02 | 2015-06-03 | 厦门极致互动网络技术有限公司 | System and method for internally setting web browser in online game client side |
CN105786465A (en) * | 2014-12-23 | 2016-07-20 | 远光软件股份有限公司 | Scripting language execution method and device |
CN107450930A (en) * | 2017-08-14 | 2017-12-08 | 上海迅显信息科技有限公司 | A kind of development approach based on HMI system script |
-
2003
- 2003-03-07 CN CN 03119251 patent/CN1278223C/en not_active Expired - Lifetime
Also Published As
Publication number | Publication date |
---|---|
CN1527195A (en) | 2004-09-08 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Cardelli | The functional abstract machine | |
US5732234A (en) | System for obtaining parallel execution of existing instructions in a particulr data processing configuration by compounding rules based on instruction categories | |
CN1119756C (en) | Method and system for performing static initialization | |
CN1577268A (en) | Shared library system and method of building the system | |
US20070076010A1 (en) | Memory layout for re-ordering instructions using pointers | |
CN1848088A (en) | Method and apparatus for transforming java native interface function calls into simpler operations during just-in-time compilation | |
CN1540517A (en) | Just-My-Code modulation tech | |
JPH0778741B2 (en) | Object Module Generation Method | |
CN1516003A (en) | Readable medium for machine | |
US8438468B2 (en) | Annotation management | |
CN1838088A (en) | Method of instrumenting code having restrictive calling conventions | |
CN1977241A (en) | Method and apparatus to vectorize multiple input instructions | |
CN1271892A (en) | Automatic continued software/adaptor generator | |
CN1922574A (en) | Method and system for performing link-time code optimization without additional code analysis | |
CN1273390A (en) | Method and equipment for effective calling Java method from local code | |
CN1862495A (en) | Method and apparatus for maintaining context while executing translated instructions | |
CN1278223C (en) | Scropt executing method for computer game | |
CN1801093A (en) | Class loading implementation method in Java operation system | |
CN1853164A (en) | Combinational method for developing building blocks of DSP compiler | |
CN1945531A (en) | Design method of inter-operation system | |
CN1650266A (en) | Time-multiplexed speculative multi-threading to support single-threaded applications | |
CN101051269A (en) | Intelligent platform management interface firmware architecture and method of building the same | |
CN1525317A (en) | System and method for defining and using subclasses declaratively within markup | |
US8869109B2 (en) | Disassembling an executable binary | |
CN1266592C (en) | Dynamic VLIW command dispatching method according to determination delay |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
CX01 | Expiry of patent term | ||
CX01 | Expiry of patent term |
Granted publication date: 20061004 |