CN102436368A - Instruction processing method in online game - Google Patents

Instruction processing method in online game Download PDF

Info

Publication number
CN102436368A
CN102436368A CN201110460596XA CN201110460596A CN102436368A CN 102436368 A CN102436368 A CN 102436368A CN 201110460596X A CN201110460596X A CN 201110460596XA CN 201110460596 A CN201110460596 A CN 201110460596A CN 102436368 A CN102436368 A CN 102436368A
Authority
CN
China
Prior art keywords
instruction
data
atomic instructions
instructions
data change
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.)
Granted
Application number
CN201110460596XA
Other languages
Chinese (zh)
Other versions
CN102436368B (en
Inventor
钟文杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Pixel Software Technology Co Ltd
Original Assignee
Beijing Pixel Software Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Beijing Pixel Software Technology Co Ltd filed Critical Beijing Pixel Software Technology Co Ltd
Priority to CN201110460596.XA priority Critical patent/CN102436368B/en
Publication of CN102436368A publication Critical patent/CN102436368A/en
Application granted granted Critical
Publication of CN102436368B publication Critical patent/CN102436368B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The embodiment of the invention discloses an instruction processing method in an online game. The method comprises the following steps of: splitting an operating instruction sent to a server by a client into multiple original sub instructions according to the logical level from complex to simple, distributing the multiple original sub instructions to multiple threads or multiple processes, and processing the sub instructions; wherein, in the same instruction processing cycle, the original sub instructions of different logical levels are processed at different time; the original sub instructions comprise logical instructions and data change instructions, wherein each logical instruction contains only one operation, and specific data are not modified; and each data change instruction is used for changing only one data once. The method can make full use of multi-thread processing capacity of a server, and has extremely high processing efficiency.

Description

Command processing method in a kind of online game
Technical field
The present invention relates to the instruction process technical field, the command processing method in particularly a kind of online game.
Background technology
MMOG (MMOG), ultra-large type MMOG (RSMMOG) need possess to carry with scene and surpasses thousands of people even higher online number especially in real time, keeps real-time response player operational order and timely feedback processing result's ability simultaneously.All the time, the maximum technological difficulties of MMOG are how to guarantee improving online number simultaneously under the prerequisite that the response operation of player is instructed fast.And along with the increase of player with interior non-player role (NPC) quantity of playing, the computing pressure of server sharply rises with storage pressure, in order to address this problem, two types of ways is arranged generally: upgrade server hardware and raising server process efficient.The former is because the restriction of hardware technology can't accomplish unlimited lifting, and cost is huge; The latter then can improve through software, and cost is low, is the main concern direction of MMOG design.
For improving server process efficient, one or more in several kinds of modes below can adopting are usually realized:
1. the player is divided into groups, and be assigned in the different scenes, each scene has only less player, different scenes is distributed to different threads handle, and the player between the different scenes can not realize mutual fully.
2. allow a large amount of players to accumulate in single scene, but this scene can only be done some specific operation, can not realize mutual fully;
3. adopt the turn-based game mode;
4. reduce the logical complexity of NPC, perhaps reduce the logic of NPC and call frequency, saved processing power focuses on the player and operates response;
5. use landform to cut apart, share through multithreading or multi-process and handle operation of player instruction in the different piecemeals the scene morsel.
Though it is simple that preceding 4 kinds of modes realize, the function of meeting limiting network recreation perhaps reduces player's experience, causes between the player mutual not enough; Or game play is limited; Or NPC intelligence is reduced, and be actually the way of play being compromised because of server performance, the 5th kind then to not loss of play; And having made full use of the server multi-thread mechanism, is a kind of more advanced way.
Specifically, the 5th kind of method is exactly to be divided into a plurality of fritters to the scene of script monoblock, handles the scene of different fritters respectively by different threads or process, thereby makes full use of the multithreading processing power of server.
Though the 5th kind of method can not influence under the prerequisite of game experiencing in assurance, alleviates the pressure of server to a certain extent, the final effect of this mode receives concrete game running situation to influence bigger; Specifically; Receive world subdivision and the player distribution situation influence in scene exactly, when the player relatively disperseed, it was relatively more balanced to handle burden between each process of server; The treatment effeciency of this moment is higher; In a single day accumulate in a certain piecemeal and the idle situation of other piecemeal but player or NPC occur, the treatment effeciency of server will be very low, can't make full use of the multithreading processing power of server.In addition, after world subdivision, handle in adjacent block middle transitional zone is a big difficult point of this method, and the piecemeal too much too small operational efficiency that can make on the contrary sharply reduces.
In addition; Except on thread Distribution Layer face, there being the not high problem of treatment effeciency, also there is a problem in concrete instruction execution aspect, that is exactly data contention (Data Race); Promptly attempt simultaneously writing fashionable when a plurality of threads or a plurality of processes to one or one group of data; Suppose that thread A just writes prior to thread B, then the data that write of thread B can partly or entirely cover thread A and write data, and at this time thread A think data still be it write that; Thereby cause execution error, this phenomenon just is called data contention.Data contention is the most common also the most unmanageable problem during multithreading is handled, can use usually lock, operation synchronously such as semaphore avoids.
It is the generation for fear of data contention that lock or semaphore etc. operated synchronously, makes thread before deal with data, attempts the data shared region is locked, and when locking successfully, then continues data handling procedure, otherwise waits for up to obtaining lock.Can avoid the generation of data contention though lock, may make other thread or process get into waiting status, frequent wait meeting reduces the efficient that multithreading is handled greatly, in some cases can be also slower than single-threaded processing.
So; Generally speaking; Existing online game all exists and can not make full use of the multithreading processing power, the problem that treatment effeciency is not high on the instruction execution aspect that the concrete processing load allocating of user's operational order is concrete to the allocation strategy aspect of a plurality of threads and multithreading.
Summary of the invention
In view of this, the invention provides the command processing method in a kind of online game, can make full use of the multithreading processing power of server, have high treatment effeciency.
For reaching above-mentioned purpose, technical scheme of the present invention specifically is achieved in that
Command processing method in a kind of online game, this method comprises:
The operational order that client is sent to server is assigned to a plurality of threads or a plurality of process parallel processing according to be split as a plurality of atomic instructions from complicacy to simple logic level;
Wherein, in the same instruction process circulation, the atomic instructions of Different Logic level is not handled simultaneously;
Said atomic instructions comprises logical order and data change instruction, and wherein each logical order only comprises an operation, and concrete data is not made amendment; Each data change instruction only to a data change once.
Preferably, said atomic instructions is handled according to said logic level layering, handled the subsequent processing steps of atomic instructions in same instruction process circulation of the follow-up level that atomic instructions produced of preorder level and further handle; The atomic instructions of the preorder level that the atomic instructions of follow-up level produces is not handled in the present instruction cycle of treatment.
Preferably, said once command cycle of treatment comprises logical process and two stages of data change;
The said logical process stage according on once the logical order of instruction process round-robin result and the input of this cycle of treatment generate the final data alteration command;
Adopt atomic operation to carry out said data change instruction in the said data change stage.
Visible by technique scheme; The operational order that command processing method in this online game of the present invention need be handled in the face of server at the instruction execution level is cut apart; The complex operations instruction is split into the various level atomic instructions; Each bar atomic instructions only carries out a single operation, is guaranteeing under the not simultaneously treated prerequisite of various level atomic instructions, and the atomic instructions in the same instruction process circulation can be distributed to different arbitrarily thread parallels arbitrarily and carry out; Make that multi-thread mechanism is able to play one's part to the full, the multithreading treatment effeciency can maximize.
Description of drawings
Fig. 1 is the command processing method synoptic diagram of the embodiment of the invention.
Embodiment
For making the object of the invention, technical scheme and advantage clearer, below with reference to the accompanying drawing embodiment that develops simultaneously, to further explain of the present invention.
The present invention is cut apart at the operational order that the instruction execution level need be handled in the face of server, and the complex operations instruction is split into atomic instructions, and each bar atomic instructions only carries out a single operation.And atomic instructions by complicacy to simple order according to logic level deconsolidation process, the atomic instructions of the follow-up level that the atomic instructions of preorder level produces can supply treatment step at the back further to handle in same cycle of treatment; The atomic instructions that belongs to the preorder level that the atomic instructions of follow-up level produces can not be processed in this cycle of treatment.
The processing stage that single treatment circulation comprising two of logical process and data changes; Corresponding logical order and the data change instruction two big classes of handling in the atomic instructions; The input instruction of logical process stage according to the result of last cycle of treatment and this cycle of treatment generates the final data alteration command, these data changes instructions the data change stage by practical function in internal storage data.The logical order of logical process phase process does not relate to concrete data change, and is all read-only to all data, data contention can not take place.And in the data change stage, a data change instruction is only changed once data, and these data changes instructions all belong to atomic operation, so also the data contention phenomenon can not take place even the instruction of parallel processing data change does not lock.
Therefore; The atomic instructions that splits out from complicated order; Guaranteeing under the not simultaneously treated prerequisite of various level atomic instructions; Atomic instructions in the same instruction process circulation can be distributed to different arbitrarily thread parallels arbitrarily and carry out, and makes that multi-thread mechanism is able to play one's part to the full, and the multithreading treatment effeciency can maximize.
Below give a concrete illustration: user end to server sends an operational order; The content of this operational order is that the player starts a technical ability to target NPC; The concrete effect of this technical ability is to send target NPC to be caused an injury in back one second; Let NPC attach a dizzy state of 3 seconds, state release after three seconds simultaneously.Operational order hereto, whole instruction process process is illustrated in fig. 1 shown below:
After server receives the operational order of the use technical ability that client sends through mixed-media network modules mixed-media; Generate a logical order (technical ability incident); The input logic module; Logic module splits into a logical order of in time queue, inserting incident with this logical order, (injury that after corresponding a second target NPC is caused and subsidiary dizzy state), and a data alteration command (player self gets into the state of excuting a law); The processing stage of completion logic, data processing module is according to data change modifying of order specific data afterwards; Accomplish the data change stage, finish an instruction process circulation (instruction that belongs to this instruction cycle adopts solid arrow to represent) in Fig. 1.When a so-called instruction cycle finished promptly to have produced the final data change, this instruction cycle finished.
After one second; Time queue produces a logical order (timed events according to the incident of inserting before; To tackling injury and the subsidiary dizzy state that target NPC causes) the input logic module; Logic module continues to be split as a logical order (dizzy state release after corresponding three seconds) of in time queue, inserting incident with this logical order, and two data change instructions (target life reduces and target is added dizzy state), the processing stage of completion logic; Afterwards; Data processing module is accomplished the data change stage according to data change modifying of order specific data, finishes an instruction process circulation (instruction that belongs to this instruction cycle adopts short line segment shape dotted arrow to represent in Fig. 1).
After three seconds; Time queue produces a logical order (timed events, corresponding dizzy state release) and input logic module according to the incident of inserting before, and logic module generates a data change instruction (dbjective state removing) according to this logical order; The processing stage of completion logic; Afterwards, data processing module is accomplished the data change stage according to data change modifying of order specific data.Accomplish last instruction process circulation (instruction that belongs to this instruction cycle adopts the point-like dotted arrow to represent) in Fig. 1.
So far, this operational order of player is finished fully.
In the execution of aforesaid operations instruction; A complicated operations instruction splits into the atomic instructions and the execution of function singleness from complicacy to simple order according to the logic level; These atomic instructions adhere to different levels separately according to its function and logical relation, and the atomic instructions of same level does not have logical relation each other; There are contextual two atomic instructions of logic to belong to different levels; For example the technical ability incident in the foregoing description is the logical order of preorder level for time queue insertion incident, and it then is from the technical ability incident, to split the follow-up level logical order of coming out that incident is inserted in time queue.Even synchronization has the operational order of many same levels being processed; Use the instruction of technical ability like what a plurality of clients were sent simultaneously for same NPC; For the instruction of the technical ability of separate sources, owing to do not relate to the change of data, different threads can be distributed to simultaneously or process is handled.As long as in each instruction process circulation, guarantee that the various level atomic instructions can not be processed simultaneously, be not handled simultaneously like technical ability incident and follow-up time queue insertion incident, just can avoid the data contention problem; Simultaneously, in same instruction cycle, the atomic instructions of same level can be distributed to different threads or process parallel processing arbitrarily, therefore can make full use of the multithreading or the multi-process processing power of existing server hardware, improves treatment effeciency.
Visible by the above embodiments; This command processing method of the present invention carries out the stage of logical process in logic module; Because logical order only reads the result data of last cycle of treatment; Generate a series of atomic instructions then, and can be not simultaneously to the data operation of making amendment, so also can not produce the data contention problem even two threads need be used same data.
And carry out stage of data change at data processing module; Owing to each data are changed operation; And can be simultaneously not carry out a plurality of changes operations to data, thus these operations can realize through atomic operation, need not use lock and semaphore etc. technological synchronously; The operation of each thread can not produce the situation of mutual wait, has guaranteed the efficient that multi-threaded parallel is handled.
Because being based on instruction, the entire process process cuts apart realization; And in nearly all processing procedure, can carry out parallel processing to any two atomic instructions of this phase process; Just can atomic instructions be distributed to different threads arbitrarily; Can reach the multithreading executive capability in theory all the time at full capacity; Even occur as situation that the sort of player that the 5th kind of method of background technology mentioned or NPC assemble, also can be assigned to processing simultaneously in each thread by very natural operational order various inputs, reach the maximization of instruction process efficient.
The above is merely preferred embodiment of the present invention, and is in order to restriction the present invention, not all within spirit of the present invention and principle, any modification of being made, is equal to replacement, improvement etc., all should be included within the scope that the present invention protects.

Claims (3)

1. the command processing method in the online game is characterized in that this method comprises:
The operational order that client is sent to server is assigned to a plurality of threads or a plurality of process parallel processing according to be split as a plurality of atomic instructions from complicacy to simple logic level;
Wherein, in the same instruction process circulation, the atomic instructions of Different Logic level is not handled simultaneously;
Said atomic instructions comprises logical order and data change instruction, and wherein each logical order only comprises an operation, and concrete data is not made amendment; Each data change instruction only to a data change once.
2. the method for claim 1; It is characterized in that; Said atomic instructions is handled according to said logic level layering, handled the subsequent processing steps of atomic instructions in same instruction process circulation of the follow-up level that atomic instructions produced of preorder level and further handle; The atomic instructions of the preorder level that the atomic instructions of follow-up level produces is not handled in the present instruction cycle of treatment.
3. method as claimed in claim 2 is characterized in that, said once command cycle of treatment comprises logical process and two stages of data change;
The said logical process stage according on once the logical order of instruction process round-robin result and the input of this cycle of treatment generate the final data alteration command;
Adopt atomic operation to carry out said data change instruction in the said data change stage.
CN201110460596.XA 2011-12-31 2011-12-31 A kind of command processing method in online game Active CN102436368B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201110460596.XA CN102436368B (en) 2011-12-31 2011-12-31 A kind of command processing method in online game

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201110460596.XA CN102436368B (en) 2011-12-31 2011-12-31 A kind of command processing method in online game

Publications (2)

Publication Number Publication Date
CN102436368A true CN102436368A (en) 2012-05-02
CN102436368B CN102436368B (en) 2016-06-01

Family

ID=45984449

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201110460596.XA Active CN102436368B (en) 2011-12-31 2011-12-31 A kind of command processing method in online game

Country Status (1)

Country Link
CN (1) CN102436368B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103631568A (en) * 2013-12-20 2014-03-12 厦门大学 Medical-image-oriented multi-thread parallel computing method
CN108229908A (en) * 2017-12-08 2018-06-29 泰康保险集团股份有限公司 Reward appraisal method and apparatus
CN110523079A (en) * 2012-12-21 2019-12-03 索尼电脑娱乐美国公司 The trivial games for cloud game suggestion are automatically generated based on the game play recorded
WO2021179551A1 (en) * 2020-03-11 2021-09-16 完美世界(北京)软件科技发展有限公司 Method and device for realizing non-branching seamless game world

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5742782A (en) * 1994-04-15 1998-04-21 Hitachi, Ltd. Processing apparatus for executing a plurality of VLIW threads in parallel
CN102171650A (en) * 2008-11-24 2011-08-31 英特尔公司 Systems, methods, and apparatuses to decompose a sequential program into multiple threads, execute said threads, and reconstruct the sequential execution

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5742782A (en) * 1994-04-15 1998-04-21 Hitachi, Ltd. Processing apparatus for executing a plurality of VLIW threads in parallel
CN102171650A (en) * 2008-11-24 2011-08-31 英特尔公司 Systems, methods, and apparatuses to decompose a sequential program into multiple threads, execute said threads, and reconstruct the sequential execution

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
杨义彬等: "面向多目标的指令集模拟技术", 《计算机工程》, vol. 35, no. 23, 5 December 2009 (2009-12-05) *

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110523079A (en) * 2012-12-21 2019-12-03 索尼电脑娱乐美国公司 The trivial games for cloud game suggestion are automatically generated based on the game play recorded
CN103631568A (en) * 2013-12-20 2014-03-12 厦门大学 Medical-image-oriented multi-thread parallel computing method
CN108229908A (en) * 2017-12-08 2018-06-29 泰康保险集团股份有限公司 Reward appraisal method and apparatus
CN108229908B (en) * 2017-12-08 2021-10-08 泰康保险集团股份有限公司 Salary assessment method and device
WO2021179551A1 (en) * 2020-03-11 2021-09-16 完美世界(北京)软件科技发展有限公司 Method and device for realizing non-branching seamless game world

Also Published As

Publication number Publication date
CN102436368B (en) 2016-06-01

Similar Documents

Publication Publication Date Title
CN104750543B (en) Thread creation method, service request processing method and relevant device
Fang et al. Parallel stream processing against workload skewness and variance
CN110898428B (en) Multi-virtual object interaction method, device, server and storage medium
CN1983196B (en) System and method for grouping execution threads
CN104978228B (en) A kind of dispatching method and device of distributed computing system
CN103634379B (en) Management method for distributed storage space and distributed storage system
CN107077390B (en) Task processing method and network card
CN105893126A (en) Task scheduling method and device
CN102436368A (en) Instruction processing method in online game
CN107066612A (en) A kind of self-adapting data oblique regulating method operated based on SparkJoin
CN105573850B (en) Multi-process exchange method, system and server
CN106528065B (en) A kind of thread acquisition methods and equipment
CN111339027A (en) Automatic design method of reconfigurable artificial intelligence core and heterogeneous multi-core chip
CN108319499B (en) Task scheduling method and device
CN104503784A (en) Method and system for controlling micro-client downloading by using script
US11645117B2 (en) System and method for multi-tenant implementation of graphics processing unit
CN104683472A (en) Data transmission method capable of supporting large data volume
WO2021179551A1 (en) Method and device for realizing non-branching seamless game world
CN111352896B (en) Artificial intelligence accelerator, equipment, chip and data processing method
CN109873876B (en) Method for interaction and calculation load balanced distribution of distributed virtual environment
CN107800741B (en) MMORPG server architecture
CN110502337B (en) Optimization system for shuffling stage in Hadoop MapReduce
US11872483B2 (en) Game object control system and method, and computer-readable storage medium
Feitelson et al. Wasted resources in gang scheduling
Cheng et al. Towards Efficient Elastic Parallelism for Deep Learning Processor

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