CN102436368B - A kind of command processing method in online game - Google Patents

A kind of command processing method in online game Download PDF

Info

Publication number
CN102436368B
CN102436368B CN201110460596.XA CN201110460596A CN102436368B CN 102436368 B CN102436368 B CN 102436368B CN 201110460596 A CN201110460596 A CN 201110460596A CN 102436368 B CN102436368 B CN 102436368B
Authority
CN
China
Prior art keywords
data
atomic instructions
logical
atomic
level
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.)
Active
Application number
CN201110460596.XA
Other languages
Chinese (zh)
Other versions
CN102436368A (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

Abstract

The embodiment of the invention discloses the command processing method in a kind of online game, the method includes: the operational order that client is sent to server is assigned to multiple thread or the process of multiple task parallelism according to being split as multiple atomic instructions from complexity to simple logical hierarchy; Wherein, in same instruction processing loops, process during the atomic instructions difference of Different Logic level; Described atomic instructions includes logical order and data alteration command, and each of which logical order only comprises an operation, and concrete data is not modified; One data is only changed once by each data alteration command. The method can make full use of the multiple threads ability of server, has high treatment effeciency.

Description

A kind of command processing method in online game
Technical field
The present invention relates to instruction processing technique field, particularly to the command processing method in a kind of online game.
Background technology
MMOG (MMOG), especially real-time ultra-large type MMOG (RSMMOG) needs possess same scene and is loaded beyond the even higher online number of thousands, is maintained with real-time response player exercises instruction and the ability of timely feedback processing result. All the time, technological difficulties maximum for MMOG are in that how under ensureing the premise quickly responding the operational order of player, improve online number simultaneously. And along with the increase of player and interior non-player role (NPC) quantity of playing, the computing pressure of server and storage pressure steeply rise, in order to solve this problem, generally have two class ways: upgrade server hardware and raising server process efficiency. The former is due to the restriction of hardware technology, it is impossible to accomplish unlimited lifting, and cost is huge; The latter then can be improved by software, and cost is low, be MMOG design be primarily upon direction.
For improving server process efficiency, it will usually adopt one or more in following several ways to realize:
1. player being grouped, and be assigned in different scene, each scene only has less player, difference scene is distributed to different threads and processes, and the player between different scenes can not realize completely mutual.
2. allow substantial amounts of player to be gathered in single scene, but this scene can only do some operation specific, it is impossible to realize completely mutual;
3. turn-based game mode is adopted;
4. reducing the logical complexity of NPC, or the logic reducing NPC calls frequency, saved disposal ability focuses on player exercises response;
5. use Terrain segmentation that scene is divided into fritter, shared by multithreading or multi-process and process the operational order of player in different piecemeal.
Although front 4 kinds of modes realize simple, but the experience of the function of meeting limiting network game or reduction player, cause between player mutual not enough, or game play is limited, or make NPC intelligence reduce, and it being actually way game compromised because of server performance, game is not then lost by the 5th kind, and take full advantage of server multi-thread mechanism, it is a kind of more advanced way.
Specifically, the 5th kind of method is exactly be multiple fritter the scene cut of script monoblock, different threads or process process the scene of different fritter respectively, thus making full use of the multiple threads ability of server.
Although fifth method can under ensureing the premise not affecting game experiencing, alleviate the pressure of server to a certain extent, but the final effect of this mode is affected bigger by concrete game running situation, specifically, just it is affected by world subdivision and player's distribution situation impact in the scene, player's ratio is time relatively decentralized, between each process of server, processing load is more balanced, treatment effeciency now is higher, but the situation that other piecemeal is idle once occur player or NPC to be gathered in a certain piecemeal, the treatment effeciency of server will be very low, the multiple threads ability of server cannot be made full use of. additionally, after world subdivision, the transitional region process in the middle of adjacent block is a big difficult point of this method, and piecemeal is too much too small can make operational efficiency dramatic drop-off on the contrary.
Additionally, except there is, on thread Distribution Layer face, the problem that treatment effeciency is not high, a problem is there is also in specific instruction execution aspect, that is exactly data contention (DataRace), namely when multiple threads or multiple process attempt one or one group of data are read simultaneously, assume that thread A writes just prior to thread B, then the data of thread B write can partly or entirely cover thread A write data, and at this time thread A thinks that data are still that that it writes, thus causing performing mistake, this phenomenon is known as data contention. Data contention is the most common also the most intractable problem in multiple threads, it will usually use the simultaneously operatings such as locking, semaphore to avoid.
The simultaneously operatings such as locking or semaphore are the generations in order to avoid data contention, make thread before processing data, attempt data shared region is locked, when locking successfully, then continue data handling procedure, otherwise wait for until obtaining and locking. Although locking the generation being avoided that data contention, but other thread or process may being made to enter waiting state, wait can reduce the efficiency of multiple threads greatly frequently, in some cases can be also slower than single-threaded process.
So, generally speaking, existing online game, the concrete process load of user operation instruction being assigned on allocation strategy aspect and the instruction execution level face that multithreading is concrete of multiple thread, all also exists and can not make full use of multiple threads ability, the problem that treatment effeciency is not high.
Summary of the invention
In view of this, the invention provides the command processing method in a kind of online game, it is possible to make full use of the multiple threads ability of server, there is high treatment effeciency.
For reaching above-mentioned purpose, technical scheme is specifically achieved in that
A kind of command processing method in online game, the method includes:
The operational order that client is sent to server is assigned to multiple thread or the process of multiple task parallelism according to being split as multiple atomic instructions from complexity to simple logical hierarchy;
Wherein, in same instruction processing loops, process during the atomic instructions difference of Different Logic level;
Described atomic instructions includes logical order and data alteration command, and each of which logical order only comprises an operation, and concrete data is not modified; One data is only changed once by each data alteration command.
It is preferred that to described atomic instructions according to described logical hierarchy layered shaping, process the atomic instructions of follow-up level subsequent processing steps in same instruction processing loops produced by the atomic instructions of preamble level and be further processed; The atomic instructions of the preamble level that the atomic instructions of follow-up level produces does not process in present instruction and follows in-loop processing.
It is preferred that described once command processes circulation includes logical process and two stages of data change;
The described logical process stage according on once the result of instruction processing loops and this logical order processing circulation input generate final data alteration command;
Change stage employing atomic operation in described data and perform described data alteration command.
As seen from the above technical solution, command processing method in this online game of present invention server faced by instruction execution level needs operational order to be processed to split, complex operations instruction is split into various level atomic instructions, each atomic instructions only carries out a single operation, under the premise processed when ensureing various level atomic instructions difference, atomic instructions in same instruction processing loops can be arbitrarily assigned to arbitrarily different thread parallels and perform, multi-thread mechanism is played one's part to the full, multiple threads efficiency can maximize.
Accompanying drawing explanation
Fig. 1 is the command processing method schematic diagram of the embodiment of the present invention.
Detailed description of the invention
For making the purpose of the present invention, technical scheme and advantage clearly understand, developing simultaneously embodiment referring to accompanying drawing, the present invention is described in more detail.
The present invention mainly server faced by instruction execution level needs operational order to be processed to split, and complex operations instruction is split into atomic instructions, and each atomic instructions only carries out a single operation. And atomic instructions is by complexity to simple order logically level deconsolidation process, the atomic instructions of the follow-up level that the atomic instructions of preamble level produces can be further processed for process step below in circulation same process; The atomic instructions belonging to preamble level that the atomic instructions of follow-up level produces can not process in circulation processed at this.
The processing stage that single treatment circulation including logical process and data change two, logical order in alignment processing atomic instructions and the big class of data alteration command two, the logical process stage processes the result of circulation according to the last time and this input instruction processing circulation generates final data alteration command, these data alteration commands in the data change stage by practical function to internal storage data. The logical order of logical process phase process is not related to concrete data change, and all data are all read-only, and data contention will not occur. And changing the stage in data, data are only changed once by a data alteration command, and these data alteration commands belong to atomic operation, even if so parallel data processing alteration command does not lock without data contention phenomenon occurs.
Therefore, from the atomic instructions that complicated order splits out, under the premise processed when ensureing various level atomic instructions difference, atomic instructions in same instruction processing loops can be arbitrarily assigned to arbitrarily different thread parallels and perform, multi-thread mechanism is played one's part to the full, and multiple threads efficiency can maximize.
Hereinafter give a concrete illustration: user end to server sends an operational order, the content of this operational order is that target NPC is started a technical ability by player, the concrete effect of this technical ability is to send latter one second target NPC causes an injury, allow NPC attach the dizziness state of 3 seconds, status releasing after three seconds simultaneously. For this operational order, whole instruction processing procedure is illustrated in fig. 1 shown below:
After server receives the operational order of the use technical ability that client sends by mixed-media network modules mixed-media, generate a logical order (technical ability event), input logic module, this logical order is split into a logical order inserting event in time queue by logic module, (injury after corresponding a second, target NPC caused subsidiary dizziness state), and a data alteration command (player self enters state of excuting a law), the processing stage of completion logic, data processing module specifies data according to the amendment of data alteration command afterwards; Complete data and change the stage, terminate an instruction processing loops (instruction belonging to this instruction cycles adopts solid arrow to represent in FIG). When a so-called instruction cycles terminates namely to create final data change, this instruction cycles terminates.
After one second, time queue produces a logical order (timed events according to previously inserted event, to the reply target NPC injury caused subsidiary dizziness state) input logic module, this logical order is continued to be split as a logical order (after corresponding three seconds dizziness status releasing) inserting event in time queue by logic module, and two data alteration command (targeted vital reduces and target adds dizziness state), the processing stage of completion logic, afterwards, data processing module specifies data according to the amendment of data alteration command, complete data and change the stage, terminate an instruction processing loops (instruction belonging to this instruction cycles adopts short-term section shape dotted arrow to represent in FIG).
After three seconds, time queue produces a logical order (timed events according to previously inserted event, corresponding dizziness status releasing) and input logic module, logic module generates a data alteration command (dbjective state removing) according to this logical order, the processing stage of completion logic, afterwards, data processing module specifies data according to the amendment of data alteration command, completes data and changes the stage. Complete last instruction processing loops (instruction belonging to this instruction cycles adopts dotted line arrow to represent in FIG).
So far, this operational order of player is fully implemented complete.
In the execution of aforesaid operations instruction, one complicated operational order logically level splits into the atomic instructions of function singleness from complexity to simple order and performs, these atomic instructions according to its functionally and logically relation adhere to different levels separately, the atomic instructions of same level does not have logical relation each other; Contextual two atomic instructions of logic are had to belong to different level, such as, technical ability event in above-described embodiment inserts, for time queue, the logical order that event is preamble level, and it is then the follow-up level logical order splitting out from technical ability event that event is inserted in time queue. Even if synchronization has the operational order of a plurality of same level processed, such as the instruction same NPC being used to technical ability that multiple clients are simultaneously emitted by, for the technical ability instruction of separate sources, owing to being not related to the change of data, it is possible to be simultaneously allocated to different threads or process processes. As long as in each instruction processing loops, it is ensured that various level atomic instructions will not be processed simultaneously, insert event such as technical ability event and follow-up time queue and be not handled simultaneously, it is possible to avoid data contention problem; Meanwhile, in same instruction cycles, the atomic instructions of same level can be arbitrarily assigned to different threads or task parallelism processes, and therefore can make full use of multithreading or the Multiprocessing ability of existing server hardware, improves treatment effeciency.
From the above embodiments, this command processing method of the present invention carries out the stage of logical process in logic module, the last result data processing circulation is only read due to logical order, then a series of atomic instructions is generated, without operation of data being modified simultaneously, even if so two threads need to use same data without producing data contention problem.
And the stage of data change is carried out at data processing module, owing to only data being modified operation every time, and will not data be carried out multiple change operation simultaneously, so these operations realize such as through atomic operation, the simultaneous techniquess such as lock and semaphore need not be used, the operation of each thread will not produce the situation of wait mutually, it is ensured that the efficiency of multi-threading parallel process.
Realize owing to whole processing procedure is based on instruction segmentation, and any two atomic instructions of this phase process can be carried out parallel processing in nearly all processing procedure, namely atomic instructions can be arbitrarily assigned to different threads, multithreading executive capability can be reached in theory all the time at full capacity, even if the situation that player mentioned such as the 5th kind of method of background technology or NPC assemble occurs, can also be assigned in each thread and process simultaneously by the operational order various inputs naturally, reach the maximization of instruction processing efficiency.
The foregoing is only presently preferred embodiments of the present invention, not in order to limit the present invention, all within the spirit and principles in the present invention, any amendment of making, equivalent replacement, improvement etc., should be included within the scope of protection of the invention.

Claims (3)

1. the command processing method in an online game, it is characterised in that the method includes:
The operational order that client is sent to server is assigned to multiple thread or the process of multiple task parallelism according to being split as multiple atomic instructions from complexity to simple logical hierarchy; These atomic instructions according to its functionally and logically relation adhere to different logical hierarchy separately, the atomic instructions of same logical hierarchy does not have logical relation each other; Contextual two atomic instructions of logic are had to belong to Different Logic level;
Wherein, in same instruction processing loops, process during the atomic instructions difference of Different Logic level;
Described atomic instructions includes logical order and data alteration command two types, and each atomic instructions only carries out a single operation; Each of which logical order only comprises an operation, and concrete data is not modified; One data is only changed once by each data alteration command.
2. the method for claim 1, it is characterized in that, to described atomic instructions according to described logical hierarchy layered shaping, process the atomic instructions of follow-up level subsequent processing steps in same instruction processing loops produced by the atomic instructions of preamble level and be further processed; The atomic instructions of the preamble level that the atomic instructions of follow-up level produces does not process in present instruction and follows in-loop processing.
3. method as claimed in claim 2, it is characterised in that once command processes circulation and includes logical process and data two stages of change;
The described logical process stage according on once the result of instruction processing loops and this logical order processing circulation input generate final data alteration command;
Change stage employing atomic operation in described data and perform described data alteration command.
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 CN102436368A (en) 2012-05-02
CN102436368B true 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)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2745893B1 (en) * 2012-12-21 2019-03-20 Sony Computer Entertainment America LLC Automatic generation of suggested mini-games for cloud-gaming based on recorded gameplay
CN103631568A (en) * 2013-12-20 2014-03-12 厦门大学 Medical-image-oriented multi-thread parallel computing method
CN108229908B (en) * 2017-12-08 2021-10-08 泰康保险集团股份有限公司 Salary assessment method and device
CN111459626B (en) * 2020-03-11 2021-06-01 完美世界(北京)软件科技发展有限公司 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
面向多目标的指令集模拟技术;杨义彬等;《计算机工程》;20091205;第35卷(第23期);第285页左栏倒数第3-4段 *

Also Published As

Publication number Publication date
CN102436368A (en) 2012-05-02

Similar Documents

Publication Publication Date Title
CN102436368B (en) A kind of command processing method in online game
CN110898428B (en) Multi-virtual object interaction method, device, server and storage medium
US9898700B2 (en) Method, apparatus, and artificial intelligence server for determining artificial intelligence behavior
CN103634379B (en) Management method for distributed storage space and distributed storage system
CN107066612A (en) A kind of self-adapting data oblique regulating method operated based on SparkJoin
CN103795782A (en) Cross server method and system of network game
CN104503784A (en) Method and system for controlling micro-client downloading by using script
CN106528065B (en) A kind of thread acquisition methods and equipment
WO2021179551A1 (en) Method and device for realizing non-branching seamless game world
CN104601562A (en) Interactive method and system of game server and database
CN1803237A (en) Game system automatic generation method and its device
CN109873876B (en) Method for interaction and calculation load balanced distribution of distributed virtual environment
CN107038260B (en) Efficient parallel loading method capable of keeping titan real-time data consistency
CN104036141B (en) Open computing language (OpenCL)-based red-black tree acceleration method
CN107169138B (en) Data distribution method for distributed memory database query engine
CN107800741B (en) MMORPG server architecture
CN111159631B (en) Hardware SAT solver based on programmable logic
CN112527450A (en) Super-fusion self-adaption method, terminal and system based on different resources
Tithi et al. Prune the unnecessary: Parallel pull-push louvain algorithms with automatic edge pruning
CN109448092B (en) Load balancing cluster rendering method based on dynamic task granularity
US11872483B2 (en) Game object control system and method, and computer-readable storage medium
CN115564374A (en) Collaborative multitask redistribution method, device, equipment and readable storage medium
EP2350852A1 (en) Use of dynamic bounded regions to improve the scalability of decentralised online environments
CN111552458A (en) Game system architecture construction method, realization method, device and system
CN112799808B (en) Idle resource scheduling method in hybrid key-level system

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