CN112604284B - Game task execution method, device, equipment and computer readable storage medium - Google Patents
Game task execution method, device, equipment and computer readable storage medium Download PDFInfo
- Publication number
- CN112604284B CN112604284B CN202011594399.2A CN202011594399A CN112604284B CN 112604284 B CN112604284 B CN 112604284B CN 202011594399 A CN202011594399 A CN 202011594399A CN 112604284 B CN112604284 B CN 112604284B
- Authority
- CN
- China
- Prior art keywords
- map
- task queue
- target
- task
- game
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 65
- 238000012545 processing Methods 0.000 claims description 14
- 230000009467 reduction Effects 0.000 claims description 10
- 238000004590 computer program Methods 0.000 claims description 9
- 238000000605 extraction Methods 0.000 claims description 4
- 238000013461 design Methods 0.000 abstract description 3
- 230000008569 process Effects 0.000 description 19
- 238000011161 development Methods 0.000 description 10
- 239000000284 extract Substances 0.000 description 8
- 239000000463 material Substances 0.000 description 7
- 230000008901 benefit Effects 0.000 description 4
- 238000001514 detection method Methods 0.000 description 4
- 238000010586 diagram Methods 0.000 description 4
- 239000007787 solid Substances 0.000 description 3
- 238000004891 communication Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 238000004880 explosion Methods 0.000 description 2
- 230000007246 mechanism Effects 0.000 description 2
- 238000004364 calculation method Methods 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
Classifications
-
- A—HUMAN NECESSITIES
- A63—SPORTS; GAMES; AMUSEMENTS
- A63F—CARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
- A63F13/00—Video games, i.e. games using an electronically generated display having two or more dimensions
- A63F13/50—Controlling the output signals based on the game progress
- A63F13/53—Controlling the output signals based on the game progress involving additional visual information provided to the game scene, e.g. by overlay to simulate a head-up display [HUD] or displaying a laser sight in a shooting game
- A63F13/537—Controlling the output signals based on the game progress involving additional visual information provided to the game scene, e.g. by overlay to simulate a head-up display [HUD] or displaying a laser sight in a shooting game using indicators, e.g. showing the condition of a game character on screen
- A63F13/5378—Controlling the output signals based on the game progress involving additional visual information provided to the game scene, e.g. by overlay to simulate a head-up display [HUD] or displaying a laser sight in a shooting game using indicators, e.g. showing the condition of a game character on screen for displaying an additional top view, e.g. radar screens or maps
-
- A—HUMAN NECESSITIES
- A63—SPORTS; GAMES; AMUSEMENTS
- A63F—CARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
- A63F13/00—Video games, i.e. games using an electronically generated display having two or more dimensions
- A63F13/55—Controlling game characters or game objects based on the game progress
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/48—Program initiating; Program switching, e.g. by interrupt
- G06F9/4806—Task transfer initiation or dispatching
- G06F9/4843—Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
- G06F9/4881—Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5027—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
- G06F9/5038—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the execution order of a plurality of tasks, e.g. taking priority or time dependency constraints into consideration
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/546—Message passing systems or structures, e.g. queues
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2209/00—Indexing scheme relating to G06F9/00
- G06F2209/48—Indexing scheme relating to G06F9/48
- G06F2209/484—Precedence
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2209/00—Indexing scheme relating to G06F9/00
- G06F2209/50—Indexing scheme relating to G06F9/50
- G06F2209/5021—Priority
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2209/00—Indexing scheme relating to G06F9/00
- G06F2209/54—Indexing scheme relating to G06F9/54
- G06F2209/548—Queue
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Multimedia (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Radar, Positioning & Navigation (AREA)
- Optics & Photonics (AREA)
- Human Computer Interaction (AREA)
- Debugging And Monitoring (AREA)
Abstract
The application discloses a game task execution method, a game task execution device, a game task execution equipment and a game task execution computer readable storage medium, and relates to the technical field of game design. The method comprises the following steps: when the game program is detected to be in the running state, acquiring a global task queue of the game program; selecting a map task queue to be processed from the global task queue, and extracting a preset number of first map tasks from the map task queue to be processed; executing a preset number of first map tasks based on the target working thread; and if the second map task exists in the map task queue to be processed, re-adding the map task queue to be processed to the global task queue.
Description
Technical Field
The present invention relates to the field of game design technologies, and in particular, to a method, an apparatus, a device, and a computer readable storage medium for executing a game task.
Background
In recent years, game design technology has been rapidly developed, and many games are made in a world scene and collision detection, so that the performance requirements of the server are higher and higher. In order to better game experience, game developers usually adopt a multithreading mechanism, the tasks of one map are executed by a plurality of threads, the multi-core calculation is fully processed by a computer, and the performance is effectively improved.
In the related art, tasks of the game map are client tasks, heartbeat tasks, timing tasks and the like, and the server organizes the tasks into task queues and controls a plurality of threads to execute the tasks in the task queues.
In carrying out the present application, the applicant has found that the related art has at least the following problems:
because the multi-thread execution task is realized, program locks are required to be added on a plurality of operation objects to ensure the correctness of logic and data in the game development stage, a great number of callback modes are used in the development process, and the same business logic can be scattered in different code files, so that the development process of the game is complicated, the business logic is complicated to write and is easy to make mistakes, and the cost of manpower and material resources is increased.
Disclosure of Invention
In view of this, the present application provides a method, apparatus, device and computer readable storage medium for executing a game task, which mainly aims to solve the problems that a great number of callback modes are involved in the current development process, the same business logic is scattered in different code files, so that the development process of the game is complicated, the business logic is complex to write and is easy to make mistakes, and the cost of manpower and material resources is increased.
According to a first aspect of the present application, there is provided a method for executing a task of a game, the method comprising:
when the game program is detected to be in a running state, acquiring a global task queue of the game program, wherein the global task queue comprises a plurality of map task queues corresponding to a plurality of game maps of the game program, and each map task queue in the plurality of map task queues comprises a map task corresponding to the game map;
selecting a map task queue to be processed from the global task queue, and extracting a preset number of first map tasks from the map task queue to be processed;
executing the first map tasks with the preset number based on a target working thread, wherein the target working thread is a working thread in an idle state in a plurality of working threads;
And if a second map task exists in the map task queue to be processed, re-adding the map task queue to be processed to the global task queue, wherein the second map task is other map tasks except the first map tasks with the preset number in the map task queue to be processed.
In another embodiment, when detecting that a game program is in a running state, before acquiring the global task queue of the game program, the method further includes:
receiving protocol information generated by the game program, and determining a created map and a target map task queue of the created map based on the protocol information;
adding the target map task indicated by the protocol information into the target map task queue;
detecting whether the target map task queue is registered in the global task queue;
if the target map task queue is detected not to be registered in the global task queue, registering the target map task queue in the global task queue, and adding the target map task queue to the global task queue;
if the target map task queue is detected to be registered in the global task queue, continuing to acquire other map task queues with built maps and detecting whether the target map task queue is registered in the global task queue.
In another embodiment, the receiving the protocol information generated by the game program, determining a created map and a target map task queue of the created map based on the protocol information, includes:
receiving the protocol information, determining a map identifier indicated by the protocol information, and acquiring the created map indicated by the map identifier;
and inquiring a target map object corresponding to the map identifier in an object pool, and extracting the target map task queue from the target map object.
In another embodiment, after receiving the protocol information generated by the game program and determining the created map and the target map task queue of the created map based on the protocol information, the method further comprises:
reading a release mark of the created map;
when the release mark indicates that the target map object of the created map is released, deleting the protocol information, ending the task adding operation of this time, and continuously receiving other protocol information;
and when the release mark indicates that the target map object of the created map is not released, continuing to add the target map task to the target map task queue.
In another embodiment, the selecting a map task queue to be processed from the global task queues includes:
respectively determining the adding time points of each map task queue in the plurality of map task queues to the global task queue to obtain a plurality of adding time points;
counting time intervals between the plurality of adding time points and a current time point, and determining a target adding time point in the plurality of adding time points, wherein the time interval between the target adding time point and the current time point is larger than other adding time points except the target adding time point in the plurality of adding time points;
and taking the map task queue corresponding to the target adding time point as the map task queue to be processed.
In another embodiment, the method further comprises:
and if the second map task does not exist in the to-be-processed map task queue, re-selecting a new to-be-processed map task queue, and executing the to-be-processed task in the new to-be-processed map task queue.
In another embodiment, the method further comprises:
counting the total amount of tasks of each map task queue comprising map tasks in the plurality of map task queues, and taking the map task queue with the total amount of tasks being larger than a task amount threshold as a map task queue to be adjusted;
And determining a game map to be adjusted corresponding to the map task queue to be adjusted, and adjusting the task execution mode of the map task queue to be adjusted or the running mode of the game map to be adjusted.
In another embodiment, the adjusting the task execution mode of the map task queue to be adjusted includes:
calculating a difference value between the total target task amount of the map task queue to be adjusted and the task amount threshold value, determining an adjustment number corresponding to the difference value, extracting the map tasks with the adjustment number from the map task queue to be adjusted when the map tasks in the map task queue to be adjusted are executed, and executing the map tasks with the adjustment number based on a target working thread; or alternatively, the first and second heat exchangers may be,
and determining a preset reduction value corresponding to the difference value, determining an adjustable map task in the map task queue to be adjusted, and reducing the number of the adjustable map tasks in the map task queue to be adjusted to the preset reduction value.
In another embodiment, the adjusting the running mode of the game map to be adjusted includes:
determining a player quantity threshold, setting a preset player quantity threshold in the game map to be adjusted, and controlling the quantity of players entering the game map to be adjusted according to the player quantity threshold; or alternatively, the first and second heat exchangers may be,
Obtaining a plurality of entity models arranged in the game map to be adjusted, determining a target entity model in the entity models, suspending model operation logic of the target entity model in the game map to be adjusted, wherein the target entity model does not detect any player in a map area where the game map to be adjusted is located, and the map area is built by taking the target entity model as a center and taking a preset distance as a radius.
According to a second aspect of the present application, there is provided a game task execution apparatus, the apparatus comprising:
the system comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring a global task queue of a game program when the game program is detected to be in a running state, the global task queue comprises a plurality of map task queues corresponding to a plurality of game maps of the game program, and each map task queue in the plurality of map task queues comprises map tasks corresponding to the game map;
the extraction module is used for selecting a map task queue to be processed from the global task queue, and extracting a preset number of first map tasks from the map task queue to be processed;
the execution module is used for executing the first map tasks with the preset number based on a target working thread, wherein the target working thread is a working thread in an idle state in a plurality of working threads;
And the adding module is used for re-adding the map task queue to be processed to the global task queue if a second map task exists in the map task queue to be processed, wherein the second map task is other map tasks except the first map tasks with the preset number in the map task queue to be processed.
In another embodiment, the apparatus further comprises:
the determining module is used for receiving protocol information generated by the game program and determining a created map and a target map task queue of the created map based on the protocol information;
the adding module is further configured to add a target map task indicated by the protocol information to the target map task queue;
the detection module is used for detecting whether the target map task queue is registered in the global task queue or not;
the registration module is used for registering the target map task queue in the global task queue and adding the target map task queue to the global task queue if the target map task queue is detected not to be registered in the global task queue;
and the extraction module is used for continuously acquiring other map task queues with built maps and detecting whether the target map task queue is registered in the global task queue if the target map task queue is detected to be registered in the global task queue.
In another embodiment, the determining module is configured to receive the protocol information, determine a map identifier indicated by the protocol information, and obtain the created map indicated by the map identifier; and inquiring a target map object corresponding to the map identifier in an object pool, and extracting the target map task queue from the target map object.
In another embodiment, the determining module is further configured to read a release mark of the created map; when the release mark indicates that the target map object of the created map is released, deleting the protocol information, ending the task adding operation of this time, and continuously receiving other protocol information; and when the release mark indicates that the target map object of the created map is not released, continuing to add the target map task to the target map task queue.
In another embodiment, the extracting module is configured to determine an adding time point when each of the plurality of map task queues is added to the global task queue, so as to obtain a plurality of adding time points; counting time intervals between the plurality of adding time points and a current time point, and determining a target adding time point in the plurality of adding time points, wherein the time interval between the target adding time point and the current time point is larger than other adding time points except the target adding time point in the plurality of adding time points; and taking the map task queue corresponding to the target adding time point as the map task queue to be processed.
In another embodiment, the extracting module is further configured to, if the second map task does not exist in the to-be-processed map task queue, reselect a new to-be-processed map task queue, and execute the to-be-processed task in the new to-be-processed map task queue.
In another embodiment, the apparatus further comprises:
the statistics module is used for counting the total task amount of the map tasks included in each map task queue in the plurality of map task queues, and taking the map task queue with the total task amount larger than a task amount threshold value as a map task queue to be adjusted;
the adjustment module is used for determining the game map to be adjusted corresponding to the map task queue to be adjusted, and adjusting the task execution mode of the map task queue to be adjusted or the running mode of the game map to be adjusted.
In another embodiment, the adjustment module is configured to calculate a difference between a target task total amount of the to-be-adjusted map task queue and the task amount threshold, determine an adjustment number corresponding to the difference, extract the adjustment number of map tasks from the to-be-adjusted map task queue when the map tasks in the to-be-adjusted map task queue are executed, and execute the adjustment number of map tasks based on a target work thread; or determining a preset reduction value corresponding to the difference value, determining an adjustable map task in the map task queue to be adjusted, and reducing the number of the adjustable map tasks in the map task queue to be adjusted to the preset reduction value.
In another embodiment, the adjustment module is configured to determine a player number threshold, set a preset player number threshold in the game map to be adjusted, and control the number of players entering the game map to be adjusted according to the player number threshold; or, acquiring a plurality of entity models set in the game map to be adjusted, determining a target entity model in the entity models, suspending model operation logic of the target entity model in the game map to be adjusted, wherein the target entity model does not detect any player in a map area where the game map to be adjusted is located, and the map area is built by taking the target entity model as a center and taking a preset distance as a radius.
According to a third aspect of the present application there is provided an apparatus comprising a memory storing a computer program and a processor implementing the steps of the method of the first aspect described above when the computer program is executed by the processor.
According to a fourth aspect of the present application there is provided a computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of the method of the first aspect described above.
By means of the technical scheme, the game task execution method, the game task execution device, the game task execution equipment and the game task execution computer readable storage medium, when the game program is detected to be in the running state, the global task queue of the game program is obtained, the map task queue to be processed is selected from the global task queue, the first map tasks with the preset number are extracted from the map task queue to be processed, the first map tasks with the preset number are executed based on the target working threads, when the second map tasks except the first map tasks with the preset number exist in the map task queue to be processed, the map task queue to be processed is added to the global task queue again to wait for task execution, so that map tasks in a game map are executed in a certain working thread at the same time, the situation that the same service logic is scattered in different code files is avoided on the basis of realizing the multithreaded execution of the map tasks, difficulty of game development is simplified, complex service logic is not required to be written, and error risks and labor and material costs are reduced.
The foregoing description is only an overview of the technical solutions of the present application, and may be implemented according to the content of the specification in order to make the technical means of the present application more clearly understood, and in order to make the above-mentioned and other objects, features and advantages of the present application more clearly understood, the following detailed description of the present application will be given.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the application. Also, like reference numerals are used to designate like parts throughout the figures. In the drawings:
fig. 1 is a schematic flow chart of a task execution method of a game according to an embodiment of the present application;
FIG. 2A is a schematic flow chart of a method for executing a task of a game according to an embodiment of the present application;
FIG. 2B is a schematic diagram of a method for executing a task of a game according to an embodiment of the present application;
FIG. 2C is a schematic flow chart of a method for executing a task of a game according to an embodiment of the present application;
FIG. 2D is a schematic flow chart of a method for executing a task of a game according to an embodiment of the present application;
fig. 3A is a schematic structural diagram of a task execution device of a game according to an embodiment of the present application;
fig. 3B is a schematic structural diagram of a task execution device of a game according to an embodiment of the present application;
fig. 3C is a schematic structural diagram of a task execution device of a game according to an embodiment of the present application;
Fig. 4 shows a schematic device structure of a computer device according to an embodiment of the present application.
Detailed Description
Exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present application are shown in the drawings, it should be understood that the present application may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
The embodiment of the application provides a game task execution method, as shown in fig. 1, the method includes:
101. when the game program is detected to be in the running state, a global task queue of the game program is obtained, wherein the global task queue comprises a plurality of map task queues corresponding to a plurality of game maps of the game program, and each map task queue in the plurality of map task queues comprises map tasks corresponding to the game map.
102. Selecting a map task queue to be processed from the global task queue, and extracting a preset number of first map tasks from the map task queue to be processed.
103. And executing a preset number of first map tasks based on a target working thread, wherein the target working thread is a working thread in an idle state in a plurality of working threads.
104. And if the second map task exists in the map task queue to be processed, re-adding the map task queue to be processed to the global task queue, wherein the second map task is other map tasks except the first map tasks with the preset number in the map task queue to be processed.
According to the method provided by the embodiment of the application, when the game program is detected to be in the running state, the global task queue of the game program is obtained, the map task queue to be processed is selected from the global task queue, the first map tasks with the preset number are extracted from the map task queue to be processed, the first map tasks with the preset number are executed based on the target working threads, and when the second map tasks except the first map tasks with the preset number are determined to exist in the map task queue to be processed, the map task queue to be processed is re-added to the global task queue to wait for task execution, so that map tasks in one game map are executed in a certain working thread at the same time, the situation that the same business logic is dispersed in different code files is avoided on the basis of realizing multithreading of executing the map tasks, the difficulty of game development is simplified, complex business logic is not required to be written, and the risk of mistakes and the cost of manpower and material resources are reduced.
The embodiment of the application provides a game task execution method, as shown in fig. 2A, including:
201. and when the game program is detected to be in the running state, acquiring a global task queue of the game program.
Currently, computing power of computer devices is increasing, in order to better utilize the computing power, many game developers can use a multithreading mechanism for a game map, that is, tasks of one map are executed by a plurality of threads, and the computer is fully utilized to process multi-core computing, so that performance is effectively improved. Generally, two execution schemes exist for executing tasks in a game map in a multithreading manner, wherein the first scheme is that the tasks in one map are executed by a plurality of threads, map tasks such as heartbeat tasks, timing tasks and the like in the game map form a task queue, and the plurality of threads respectively go to the task queue to take the map tasks and execute the map tasks. The second solution is that the tasks in one map are executed by a fixed single thread of the multiple threads, for example, assuming that the task queue a formed by the map tasks in the game map a is executed by the thread 1 of the multiple threads, the thread 1 only executes the tasks in the task queue a.
Further, the application provides a game task execution method, a global task queue is set for a game program, a private map task queue is set for each game map in the game program, the map task queues of the game maps are all registered in the global task queue, one map task queue is selected as a map task queue to be processed in the global task queue, a first map task with a preset number is selected in the map task queue to be processed, a target working thread in an idle state in a plurality of working threads is determined, the first map task with the preset number is executed based on the target working thread, and when a second map task still exists in the map task queue to be processed, the map task queue to be processed is put back into the global task queue to wait for the next execution, so that the map task in one game map is executed in a certain working thread at the same time, difficulty of game development is simplified on the basis of realizing multi-thread execution of the map task, complex business logic is not required to be written, the running speed of the game is improved, the use rate of the game is reduced, and the cost of manpower and material resources is reduced. In addition, in the actual application process, after one map task queue is selected as a map task queue to be processed, all the working threads in an idle state in the plurality of working threads can be mobilized to process the tasks included in the map task queue to be processed, so that the efficiency of task processing is improved while the thread resources are fully utilized. Or a dedicated working thread can be set for each map task queue, and when a certain map task queue is selected, task processing is performed based on the dedicated working thread of the map task queue, so that the concurrency of tasks is reduced.
In the embodiment of the application, two task queues are actually two, strictly speaking, nested two-stage task queues. Because many businesses only occur in the game map, the game map is used as a main body of the task, so that each game map has a private map task queue, and the map task queues are map tasks which need to be executed. That is, when the game map is created and a private map task queue is generated, the private map task queue is registered in the global task queue. Thus, when the worker thread takes out the map task to be executed, the private map task queue is taken out, and the execution of the task is realized. In summary, the global task queue includes a plurality of map task queues corresponding to a plurality of game maps of the game program, each of the plurality of map task queues including map tasks corresponding to the game map. That is, the game program corresponds to a global task queue, each game map in the game program corresponds to a map task queue, and the map task queues corresponding to the game maps are uniformly placed in the global task queue. Referring specifically to fig. 2b, N and N are positive integers, the global task queues include map task queues 1 to N, and each map task queue includes map tasks T1 to Tn. When the map task is executed later, the worker threads 1-n go to the global task queue to take the corresponding map task queue and extract a certain amount of map task execution from the map task queue.
In the actual application process, each game map continuously generates map tasks in the running process of the game program, so that an Input/Output (IO) thread set in a server in charge of running the game program continuously receives protocol information generated by the game program, a created map and a target map task queue of the created map can be determined based on the protocol information, and target map tasks indicated by the protocol information are added into the target map task queue, and the specific process of determining the created map and the target map task queue is as follows: first, the server receives the protocol information, determines a map identifier indicated by the protocol information, and acquires a created map indicated by the map identifier. Then, the server queries the object pool for the target map object corresponding to the map identifier, and extracts the target map task queue from the target map object. In addition, it should be noted that there is a possibility that the target map object is released, and if the target map object is released, tasks cannot be added to the target map task queue any more. Therefore, during the actual application, the server will read the release mark of the created map, which is essentially an object lock for indicating whether the map object is released, and the value of the release mark in the actual application is divided into two types, one is True, which indicates that the map object has been released, and the other is False, which indicates that the map object has not been released. When the release mark indicates that the target map object of the created map is released, it can be determined that the map task cannot be added to the target map task queue currently, so that the server deletes the protocol information, ends the task adding operation of this time, and continues to receive other protocol information. And when the release flag indicates that the target map object of the created map is not released, it may be determined that the map task can be added to the target map task queue, and thus the server continues to add the target map task to the target map task queue. And the server also has a Timer thread which has a task adding function, determines a game map corresponding to the Timer thread, and adds map tasks indicated by the Timer thread into a map task queue of the game map. In addition, the working thread can actually interact with the Timer thread, and the working thread can instruct the Timer thread to generate map tasks and add the map tasks into corresponding map task queues based on the Timer thread.
The work thread takes the map task queue from the global task queue and executes the map tasks in the map task queue, and only the target map task queue is registered in the global task queue, wherein the map tasks are executed, so that the server can detect whether the target map task queue is registered in the global task queue. If the target map task queue is detected to be unregistered in the global task queue, the server registers the target map task queue in the global task queue, and adds the target map task queue to the global task queue so that the subsequent target map task queue can be selected and execute the task. If the server detects that the target map task queue is registered in the global task queue, the registration operation on the target map task queue is executed without executing again, so that the server continues to acquire other map task queues with created maps and detects whether the target map task queue is registered in the global task queue. The specific server adds tasks to the map task queue and registers the map task queue in the global task queue as follows: referring to fig. 2C, the server receives the protocol information and adds the target map task indicated by the protocol information to the target map task queue indicated by the protocol information. The server then detects whether the target map task queue is registered in the global task queue. If the server detects that the target map task queue is not registered in the global task queue, the server registers the target map task queue in the global task queue, adds the target map task queue to the global task queue, and ends the flow. If the server detects that the target map task queue is registered in the global task queue, the process is directly ended.
The above describes a procedure in which the server adds a map task to a map task queue corresponding to a game map and registers the map task in a global task queue, which may be continuously performed during the running of a game program. In this way, the global task queue includes a plurality of map task queues, and each map task queue includes a certain number of map tasks waiting for execution, so when detecting that the game program is in a running state, the server obtains the global task queue of the game program, and then executes the map tasks in each game map based on the working thread.
202. Selecting a map task queue to be processed from the global task queue, and extracting a preset number of first map tasks from the map task queue to be processed.
In the embodiment of the application, after the server acquires the global task queue, the server selects a to-be-processed map task queue from the global task queue, and extracts a preset number of first map tasks from the to-be-processed map task queue, so that the preset number of first map tasks are executed according to a certain working thread.
When selecting the to-be-processed map task queue, the to-be-processed map task queue may be selected based on a first-in first-out policy, that is, the map task queue added to the global task queue is selected first, and the specific process of selecting the to-be-processed map task queue is as follows: first, adding time points of adding each map task queue to the global task queue in a plurality of map task queues are respectively determined, and a plurality of adding time points are obtained. And then, counting time intervals between a plurality of adding time points and the current time point, and determining a target adding time point in the adding time points, wherein the time interval between the target adding time point and the current time point is larger than other adding time points except the target adding time point in the adding time points, namely, the time interval between the target adding time point and the current time point is the largest. And finally, taking the map task queue corresponding to the target adding time point as a map task queue to be processed. For example, assuming that the current time point is 15 points 30 minutes 26 seconds, the map task queue a is added to the global task queue at 15 points 29 minutes 26 seconds, the map task queue B is added to the global task queue at 15 points 29 minutes 50 seconds, and the map task queue C is added to the global task queue at 15 points 30 minutes 20 seconds, it can be determined that the time interval corresponding to the map task queue a is 60 seconds, the time interval corresponding to the map task queue B is 36 seconds, and the time interval corresponding to the map task queue C is 6 seconds, and thus, the map task queue a is taken as the map task queue to be processed.
When the server adds the map task queue to the global task queue, the server may also number the map task queue, and may sequentially select the map task queue to be processed according to the order of the numbers. Or the map task queue with any number can be randomly selected as the map task queue to be processed. The manner in which the map task queue to be processed is selected is not particularly limited.
After determining the map task queue to be processed, the server extracts a preset number of first map tasks from the map task queue to be processed, and then selects a target working thread for the preset number of first map tasks, and the target working thread executes the preset number of first map tasks. In particular, when extracting a preset number of first map tasks, a plurality of different strategies may be actually adopted: a random selection strategy can be adopted, and a preset number of map tasks are randomly selected from the map task queue to be processed to serve as a preset number of first map tasks. Alternatively, a first-in first-out strategy may be adopted, where the preset number of map tasks that are first added to the map task queue to be processed is used as the preset number of first map tasks. Alternatively, considering that the starting of the game program is usually triggered by the player entering the game, and the map tile generated by each map tile in the game map is different, for the player, the map tile in which the game character is currently located in the game map and the map tile to be reached generate map tiles more important than those generated by other map tiles, and the map tiles are also more focused by the player and need to be preferentially executed. Therefore, when the preset number of first map tasks are extracted, the game roles of the player can be positioned, the current position of the game roles in the game map and the travelling direction of the game roles are determined, the target map block to which the current position belongs is obtained, the adjacent map block to which the game roles are about to arrive is selected around the target map block according to the travelling direction, and the priorities of map tasks generated in the target map block and the adjacent map block are improved, so that when the preset number of first map tasks are extracted, the map tasks which are closely related with the game roles can be preferentially extracted and executed, the map tasks in the map task queue have primary and secondary scores, and the tasks can be extracted according to the importance degree of the tasks.
203. And executing a preset number of first map tasks based on the target working thread.
In the embodiment of the application, after a preset number of first map tasks are obtained, the server selects a target working thread, and executes the preset number of first map tasks based on the target working thread. The target working thread is a working thread in an idle state in the plurality of working threads, the working thread which does not temporarily process tasks is selected to process a preset number of first map tasks, each working thread in the plurality of working threads has no binding relation with the map task queue, and the map task queue is acquired one by one to execute the tasks.
It should be noted that, because the map task in a certain map task queue can only be executed in a certain target working thread at the same time, the execution of the map task in the application can be actually regarded as a single-thread execution, and the logic processing of data interaction is simplified while the multithreading processing task is realized.
In addition, in the practical application process, more idle-state working threads possibly exist in the plurality of working threads, and in order to fully utilize the idle-state working threads, all the idle-state working threads can be arranged to execute a preset number of first map tasks, so that the task processing efficiency is improved. Or a dedicated working thread can be set for each map task queue, and the dedicated working thread of the map task queue to be processed processes the preset number of first map tasks, so that the accurate processing of the tasks is ensured, and meanwhile, the overload caused by parallel work of a large number of working threads can be avoided. The execution mode of the preset number of first map tasks is not particularly limited.
204. Inquiring whether a second map task exists in the to-be-processed map task queue, and if so, executing the following step 205. If there is no second map task in the map task queue to be processed, the following step 206 is executed.
In the embodiment of the present application, the execution of the map task in the map task queue to be processed is achieved through the processes in steps 201 to 203. However, the above process only takes the first map tasks with the preset number in the map task queue to be processed to execute, and there is a high possibility that other map tasks, namely, the second map task, except the first map tasks with the preset number also exist in the map task queue to be processed, and the second map task also needs to be executed, and can not be selected in the execution of this time, and the map task queue to be processed needs to be added to the global task queue again to wait for the next task execution. If the second map task does not exist in the map task queue to be processed, the next task execution is not required, and the map task queue to be processed is not required to be added to the global task queue again.
Therefore, the server will query whether the second map task exists in the to-be-processed map task queue, and if the second map task exists in the to-be-processed map task queue, it indicates that the to-be-processed map task queue needs to be added to the global task queue again to wait for the next task to be executed, that is, execute step 205 described below. If the second map task does not exist in the to-be-processed map task queue, it means that the to-be-processed map task queue does not need to be added to the global task queue again, and does not need to wait for the next task execution, i.e. the following step 206 is executed.
205. And if the second map task exists in the map task queue to be processed, re-adding the map task queue to be processed to the global task queue.
In this embodiment of the present application, if there is a second map task in the to-be-processed map task queue, it indicates that the to-be-processed map task queue needs to be re-added to the global task queue to wait for the next task execution, so that when the to-be-processed map task queue is selected next time, the second map task and the map task added to the to-be-processed map task queue continuously can be continuously executed.
206. And if the second map task does not exist in the to-be-processed map task queue, re-selecting a new to-be-processed map task queue, and executing the to-be-processed task in the new to-be-processed map task queue.
In this embodiment of the present application, if the second map task does not exist in the to-be-processed map task queue, it means that the to-be-processed map task queue does not need to be added to the global task queue again, and does not need to wait for the next task execution, so that the server reselects a new to-be-processed map task queue, and executes the to-be-processed task in the new to-be-processed map task queue.
In summary, the game task execution process in steps 201 to 206 is as follows: referring to fig. 2D, when the server detects that the game program is running, a map task queue to be processed is selected from the global task queue, a preset number of first map tasks are extracted from the map task queue to be processed, and the first map tasks are processed based on the target worker thread. Then, whether a second map task exists in the map task queue to be processed is detected. And if the second map task exists, re-adding the map task queue to be processed to the global task queue, and continuously selecting other map task queues to be processed. If the second map task does not exist, the to-be-processed map task queue is not required to be added to the global task queue again, and the selection of other to-be-processed map task queues is directly started.
In addition, during the actual running of the game program, there is a high possibility that a task explosion occurs in a certain game map, for example, the number of players in a certain game map is particularly large, or the number of NPCs (Non-Player characters) configured in a certain game map is too large, which may cause the task explosion of a single game map. In order to avoid the occurrence of the situation or to alleviate the occurrence of the situation, the server counts the total task amount of the map tasks included in each map task queue in the plurality of map task queues, takes the map task queue with the total task amount larger than the task amount threshold as a map task queue to be adjusted, determines a game map to be adjusted corresponding to the map task queue to be adjusted, adjusts the task execution mode of the map task queue to be adjusted or adjusts the running mode of the game map to be adjusted, reduces the load of a CPU (Central Processing Unit, a central processing unit), and relieves the task processing pressure. Specifically, when the task execution mode of the map task queue to be adjusted is adjusted, the following two modes can be adopted: one way is to calculate the difference between the target task total amount and the task amount threshold of the to-be-adjusted map task queue, determine the adjustment number corresponding to the difference, extract the map tasks with the adjustment number from the to-be-adjusted map task queue when executing the map tasks in the to-be-adjusted map task queue, and execute the map tasks with the adjustment number based on the target work thread. That is, according to the number of tasks of the map task queue to be adjusted exceeding the task amount threshold, the adjustment number is determined, and when the tasks in the map task queue to be adjusted are executed subsequently, the map tasks can be taken in the map task queue to be adjusted based on the adjustment number to be executed, so that the task amount of single processing of the map task queue to be adjusted is adjusted. In another mode, a preset reduction value corresponding to the difference value is determined, an adjustable map task is determined in a map task queue to be adjusted, and the number of the adjustable map tasks in the map task queue to be adjusted is reduced to the preset reduction value. That is, the frequency of executing the adjustable map task is reduced according to the number of tasks of which the current map task queue to be adjusted exceeds the task amount threshold, such as a heartbeat task, a timing task and the like, can be used as the adjustable map task.
When the running mode of the game map to be adjusted is adjusted, the following two modes can be adopted: one way is to determine a player number threshold, set a preset player number threshold in the game map to be adjusted, and control the number of players entering the game map to be adjusted according to the player number threshold. That is, the player number threshold is used to limit the number of players entering the game map to be adjusted, for example, the player number threshold may be 400, and then only 400 players are allowed to enter the game map to be adjusted. In another mode, a plurality of entity models arranged in the game map to be adjusted are obtained, a target entity model is determined in the entity models, the model operation logic of the target entity model in the game map to be adjusted is suspended, no player is detected in a map area where the game map to be adjusted is located by the target entity model, and the map area is built by taking the target entity model as a center and taking a preset distance as a radius. That is, the model running logic of the target solid model without any player around in the game map to be adjusted is suspended, thereby avoiding the target solid model from generating tasks. The plurality of solid models may actually be NPC models in the game map to be adjusted.
According to the method provided by the embodiment of the application, when the game program is detected to be in the running state, the global task queue of the game program is obtained, the map task queue to be processed is selected from the global task queue, the first map tasks with the preset number are extracted from the map task queue to be processed, the first map tasks with the preset number are executed based on the target working threads, and when the second map tasks except the first map tasks with the preset number are determined to exist in the map task queue to be processed, the map task queue to be processed is re-added to the global task queue to wait for task execution, so that map tasks in one game map are executed in a certain working thread at the same time, the situation that the same business logic is dispersed in different code files is avoided on the basis of realizing multithreading of executing the map tasks, the difficulty of game development is simplified, complex business logic is not required to be written, and the risk of mistakes and the cost of manpower and material resources are reduced.
Further, as a specific implementation of the method shown in fig. 1, an embodiment of the present application provides a game task execution apparatus, as shown in fig. 3A, where the apparatus includes: the device comprises an acquisition module 301, an extraction module 302, an execution module 303 and an addition module 304.
The acquiring module 301 is configured to acquire, when it is detected that a game program is in a running state, a global task queue of the game program, where the global task queue includes a plurality of map task queues corresponding to a plurality of game maps of the game program, and each map task queue in the plurality of map task queues includes a map task corresponding to a game map;
the extracting module 302 is configured to select a to-be-processed map task queue from the global task queues, and extract a preset number of first map tasks from the to-be-processed map task queue;
the executing module 303 is configured to execute the preset number of first map tasks based on a target working thread, where the target working thread is a working thread in an idle state in a plurality of working threads;
the adding module 304 is configured to re-add the to-be-processed map task queue to the global task queue if there is a second map task in the to-be-processed map task queue, where the second map task is another map task in the to-be-processed map task queue except the first map task with the preset number.
In a specific application scenario, as shown in fig. 3B, the apparatus further includes: a determination module 305, a detection module 306 and a registration module 307.
The determining module 305 is configured to receive protocol information generated by the game program, and determine a created map and a target map task queue of the created map based on the protocol information;
the adding module 304 is further configured to add the target map task indicated by the protocol information to the target map task queue;
the detection module 306 is configured to detect whether the target map task queue is registered in the global task queue;
the registration module 307 is configured to register the target map task queue in the global task queue and add the target map task queue to the global task queue if it is detected that the target map task queue is not registered in the global task queue;
the extracting module 302 is configured to, if it is detected that the target map task queue is registered in the global task queue, continue to obtain other map task queues with created maps and detect whether the target map task queue is registered in the global task queue.
In a specific application scenario, the determining module 305 is configured to receive the protocol information, determine a map identifier indicated by the protocol information, and obtain the created map indicated by the map identifier; and inquiring a target map object corresponding to the map identifier in an object pool, and extracting the target map task queue from the target map object.
In a specific application scenario, the determining module 305 is further configured to read a release mark of the created map; when the release mark indicates that the target map object of the created map is released, deleting the protocol information, ending the task adding operation of this time, and continuously receiving other protocol information; and when the release mark indicates that the target map object of the created map is not released, continuing to add the target map task to the target map task queue.
In a specific application scenario, the extracting module 302 is configured to determine an adding time point when each of the plurality of map task queues is added to the global task queue, so as to obtain a plurality of adding time points; counting time intervals between the plurality of adding time points and a current time point, and determining a target adding time point in the plurality of adding time points, wherein the time interval between the target adding time point and the current time point is larger than other adding time points except the target adding time point in the plurality of adding time points; and taking the map task queue corresponding to the target adding time point as the map task queue to be processed.
In a specific application scenario, the extracting module 302 is further configured to, if the second map task does not exist in the to-be-processed map task queue, reselect a new to-be-processed map task queue, and execute the to-be-processed task in the new to-be-processed map task queue.
In a specific application scenario, as shown in fig. 3C, the apparatus further includes: a statistics module 308, an adjustment module 309.
The statistics module 308 is configured to count a total amount of tasks of each of the plurality of map task queues including map tasks, and take the map task queue with the total amount of tasks being greater than a task amount threshold as a map task queue to be adjusted;
the adjustment module 309 is configured to determine a game map to be adjusted corresponding to the map task queue to be adjusted, adjust a task execution mode of the map task queue to be adjusted or adjust an operation mode of the game map to be adjusted.
In a specific application scenario, the adjustment module 309 is configured to calculate a difference between a target task total amount of the to-be-adjusted map task queue and the task amount threshold, determine an adjustment number corresponding to the difference, extract the adjustment number of map tasks from the to-be-adjusted map task queue when executing the map tasks in the to-be-adjusted map task queue, and execute the adjustment number of map tasks based on a target work thread; or determining a preset reduction value corresponding to the difference value, determining an adjustable map task in the map task queue to be adjusted, and reducing the number of the adjustable map tasks in the map task queue to be adjusted to the preset reduction value.
In a specific application scenario, the adjustment module 309 is configured to determine a player number threshold, set a preset player number threshold in the game map to be adjusted, and control the number of players entering the game map to be adjusted according to the player number threshold; or, acquiring a plurality of entity models set in the game map to be adjusted, determining a target entity model in the entity models, suspending model operation logic of the target entity model in the game map to be adjusted, wherein the target entity model does not detect any player in a map area where the game map to be adjusted is located, and the map area is built by taking the target entity model as a center and taking a preset distance as a radius.
According to the device provided by the embodiment of the application, when the game program is detected to be in the running state, the global task queue of the game program is obtained, the map task queue to be processed is selected from the global task queue, the first map tasks with the preset number are extracted from the map task queue to be processed, the first map tasks with the preset number are executed based on the target working threads, and when the second map tasks except the first map tasks with the preset number are determined to exist in the map task queue to be processed, the map task queue to be processed is re-added to the global task queue to wait for task execution, so that map tasks in one game map are executed in a certain working thread at the same time, the situation that the same business logic is dispersed in different code files is avoided on the basis of realizing multithreading of executing the map tasks, the difficulty of game development is simplified, complex business logic is not required to be written, and the risk of mistakes and the cost of manpower and material resources are reduced.
It should be noted that, for other corresponding descriptions of each functional unit related to the task execution device for a game provided in the embodiment of the present application, reference may be made to corresponding descriptions in fig. 1 and fig. 2A, and no further description is given here.
In an exemplary embodiment, referring to fig. 4, there is further provided a device 400 including a communication bus, a processor, a memory, and a communication interface, and may further include an input-output interface, and a display device, wherein the functional units may communicate with each other via the bus. The memory stores a computer program, and a processor executes the program stored in the memory to execute the task execution method of the game in the above embodiment.
A computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of a method of performing a task of the game.
From the above description of the embodiments, it will be apparent to those skilled in the art that the present application may be implemented in hardware, or may be implemented by means of software plus necessary general hardware platforms. Based on such understanding, the technical solution of the present application may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (may be a CD-ROM, a U-disk, a mobile hard disk, etc.), and includes several instructions for causing a computer device (may be a personal computer, a server, or a network device, etc.) to perform the methods described in various implementation scenarios of the present application.
Those skilled in the art will appreciate that the drawings are merely schematic illustrations of one preferred implementation scenario, and that the modules or flows in the drawings are not necessarily required to practice the present application.
Those skilled in the art will appreciate that modules in an apparatus in an implementation scenario may be distributed in an apparatus in an implementation scenario according to an implementation scenario description, or that corresponding changes may be located in one or more apparatuses different from the implementation scenario. The modules of the implementation scenario may be combined into one module, or may be further split into a plurality of sub-modules.
The foregoing application serial numbers are merely for description, and do not represent advantages or disadvantages of the implementation scenario.
The foregoing disclosure is merely a few specific implementations of the present application, but the present application is not limited thereto and any variations that can be considered by a person skilled in the art shall fall within the protection scope of the present application.
Claims (12)
1. A method of executing a game task, comprising:
when the game program is detected to be in a running state, acquiring a global task queue of the game program, wherein the global task queue comprises a plurality of map task queues corresponding to a plurality of game maps of the game program, and each map task queue in the plurality of map task queues comprises a map task corresponding to the game map;
Selecting a map task queue to be processed from the global task queue, and extracting a preset number of first map tasks from the map task queue to be processed;
executing the first map tasks with the preset number based on a target working thread, wherein the target working thread is a working thread in an idle state in a plurality of working threads;
and if a second map task exists in the map task queue to be processed, re-adding the map task queue to be processed to the global task queue, wherein the second map task is other map tasks except the first map tasks with the preset number in the map task queue to be processed.
2. The method of claim 1, wherein the method further comprises, prior to obtaining the global task queue for the game program when the game program is detected to be in a run state:
receiving protocol information generated by the game program, and determining a created map and a target map task queue of the created map based on the protocol information;
adding the target map task indicated by the protocol information into the target map task queue;
Detecting whether the target map task queue is registered in the global task queue;
if the target map task queue is detected not to be registered in the global task queue, registering the target map task queue in the global task queue, and adding the target map task queue to the global task queue;
if the target map task queue is detected to be registered in the global task queue, continuing to acquire other map task queues with built maps and detecting whether the target map task queue is registered in the global task queue.
3. The method of claim 2, wherein the receiving the protocol information generated by the game program, determining a created map and a target map task queue for the created map based on the protocol information, comprises:
receiving the protocol information, determining a map identifier indicated by the protocol information, and acquiring the created map indicated by the map identifier;
and inquiring a target map object corresponding to the map identifier in an object pool, and extracting the target map task queue from the target map object.
4. The method of claim 2, wherein the receiving the protocol information generated by the game program, determining a created map and a target map task queue for the created map based on the protocol information, the method further comprises:
Reading a release mark of the created map;
when the release mark indicates that the target map object of the created map is released, deleting the protocol information, ending the task adding operation of this time, and continuously receiving other protocol information;
and when the release mark indicates that the target map object of the created map is not released, continuing to add the target map task to the target map task queue.
5. The method of claim 1, wherein selecting a map task queue to be processed from the global task queues comprises:
respectively determining the adding time points of each map task queue in the plurality of map task queues to the global task queue to obtain a plurality of adding time points;
counting time intervals between the plurality of adding time points and a current time point, and determining a target adding time point in the plurality of adding time points, wherein the time interval between the target adding time point and the current time point is larger than other adding time points except the target adding time point in the plurality of adding time points;
and taking the map task queue corresponding to the target adding time point as the map task queue to be processed.
6. The method according to claim 1, wherein the method further comprises:
and if the second map task does not exist in the to-be-processed map task queue, re-selecting a new to-be-processed map task queue, and executing the to-be-processed task in the new to-be-processed map task queue.
7. The method according to claim 1, wherein the method further comprises:
counting the total amount of tasks of each map task queue comprising map tasks in the plurality of map task queues, and taking the map task queue with the total amount of tasks being larger than a task amount threshold as a map task queue to be adjusted;
and determining a game map to be adjusted corresponding to the map task queue to be adjusted, and adjusting the task execution mode of the map task queue to be adjusted or the running mode of the game map to be adjusted.
8. The method of claim 7, wherein adjusting the task execution mode of the map task queue to be adjusted comprises:
calculating a difference value between the total target task amount of the map task queue to be adjusted and the task amount threshold value, determining an adjustment number corresponding to the difference value, extracting the map tasks with the adjustment number from the map task queue to be adjusted when the map tasks in the map task queue to be adjusted are executed, and executing the map tasks with the adjustment number based on a target working thread; or alternatively, the first and second heat exchangers may be,
And determining a preset reduction value corresponding to the difference value, determining an adjustable map task in the map task queue to be adjusted, and reducing the number of the adjustable map tasks in the map task queue to be adjusted to the preset reduction value.
9. The method of claim 7, wherein said adjusting the manner in which the game map is to be adjusted comprises:
determining a player quantity threshold, setting a preset player quantity threshold in the game map to be adjusted, and controlling the quantity of players entering the game map to be adjusted according to the player quantity threshold; or alternatively, the first and second heat exchangers may be,
obtaining a plurality of entity models arranged in the game map to be adjusted, determining a target entity model in the entity models, suspending model operation logic of the target entity model in the game map to be adjusted, wherein the target entity model does not detect any player in a map area where the game map to be adjusted is located, and the map area is built by taking the target entity model as a center and taking a preset distance as a radius.
10. A game task execution apparatus, comprising:
The system comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring a global task queue of a game program when the game program is detected to be in a running state, the global task queue comprises a plurality of map task queues corresponding to a plurality of game maps of the game program, and each map task queue in the plurality of map task queues comprises map tasks corresponding to the game map;
the extraction module is used for selecting a map task queue to be processed from the global task queue, and extracting a preset number of first map tasks from the map task queue to be processed;
the execution module is used for executing the first map tasks with the preset number based on a target working thread, wherein the target working thread is a working thread in an idle state in a plurality of working threads;
and the adding module is used for re-adding the map task queue to be processed to the global task queue if a second map task exists in the map task queue to be processed, wherein the second map task is other map tasks except the first map tasks with the preset number in the map task queue to be processed.
11. An apparatus comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any one of claims 1 to 9 when the computer program is executed.
12. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 9.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011594399.2A CN112604284B (en) | 2020-12-29 | 2020-12-29 | Game task execution method, device, equipment and computer readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011594399.2A CN112604284B (en) | 2020-12-29 | 2020-12-29 | Game task execution method, device, equipment and computer readable storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112604284A CN112604284A (en) | 2021-04-06 |
CN112604284B true CN112604284B (en) | 2024-04-16 |
Family
ID=75248867
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011594399.2A Active CN112604284B (en) | 2020-12-29 | 2020-12-29 | Game task execution method, device, equipment and computer readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112604284B (en) |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CA2163500A1 (en) * | 1994-11-29 | 1996-05-30 | Reuven Gagin | Real-time multi-user game communication system using existing cable television infrastructure |
GB201209170D0 (en) * | 2011-08-18 | 2012-07-04 | Ibm | Multithreaded physics engine with impulse proragation |
CN106861182A (en) * | 2017-04-05 | 2017-06-20 | 天津卓越互娱科技有限公司 | The method and server management system of a kind of efficient utilization server resource |
CN109603157A (en) * | 2018-12-19 | 2019-04-12 | 北京像素软件科技股份有限公司 | Task management method and device |
CN109697123A (en) * | 2017-10-24 | 2019-04-30 | 腾讯科技(深圳)有限公司 | The rendering method and device of game animation, storage medium, electronic device |
CN110064198A (en) * | 2019-04-11 | 2019-07-30 | 网易(杭州)网络有限公司 | Processing method and processing device, storage medium and the electronic device of resource |
CN111013133A (en) * | 2019-11-29 | 2020-04-17 | 北京奇艺世纪科技有限公司 | Data processing method and device |
CN112090079A (en) * | 2020-08-27 | 2020-12-18 | 腾讯科技(深圳)有限公司 | Game task running method and device, computer equipment and storage medium |
-
2020
- 2020-12-29 CN CN202011594399.2A patent/CN112604284B/en active Active
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CA2163500A1 (en) * | 1994-11-29 | 1996-05-30 | Reuven Gagin | Real-time multi-user game communication system using existing cable television infrastructure |
GB201209170D0 (en) * | 2011-08-18 | 2012-07-04 | Ibm | Multithreaded physics engine with impulse proragation |
CN103106120A (en) * | 2011-08-18 | 2013-05-15 | 国际商业机器公司 | Multithreaded physics engine with impulse propagation |
CN106861182A (en) * | 2017-04-05 | 2017-06-20 | 天津卓越互娱科技有限公司 | The method and server management system of a kind of efficient utilization server resource |
CN109697123A (en) * | 2017-10-24 | 2019-04-30 | 腾讯科技(深圳)有限公司 | The rendering method and device of game animation, storage medium, electronic device |
CN109603157A (en) * | 2018-12-19 | 2019-04-12 | 北京像素软件科技股份有限公司 | Task management method and device |
CN110064198A (en) * | 2019-04-11 | 2019-07-30 | 网易(杭州)网络有限公司 | Processing method and processing device, storage medium and the electronic device of resource |
CN111013133A (en) * | 2019-11-29 | 2020-04-17 | 北京奇艺世纪科技有限公司 | Data processing method and device |
CN112090079A (en) * | 2020-08-27 | 2020-12-18 | 腾讯科技(深圳)有限公司 | Game task running method and device, computer equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN112604284A (en) | 2021-04-06 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US20200139256A1 (en) | Method for creating a mini-game | |
CN108776897B (en) | Data processing method, device, server and computer readable storage medium | |
CN105159776A (en) | Process handling method and apparatus | |
US10698728B1 (en) | Systems and methods for forming application-specific blockchains | |
WO2020142906A1 (en) | Structured directed acyclic graph-based transaction allocation method and apparatus | |
CN112363821A (en) | Computing resource scheduling method and device and computer equipment | |
CN115509986B (en) | Inter-core communication method, electronic device, and storage medium | |
EP4195149A1 (en) | Target detection and tracking method and apparatus, electronic device, and storage medium | |
CN111708642B (en) | Processor performance optimization method and device in VR system and VR equipment | |
JP2009116380A (en) | Virtual server movement controller, virtual server movement control method and program | |
US20230305880A1 (en) | Cluster distributed resource scheduling method, apparatus and device, and storage medium | |
CN103995863B (en) | A kind of method and device of data de-duplication | |
CN112604284B (en) | Game task execution method, device, equipment and computer readable storage medium | |
CN114021507A (en) | Automatic integrated circuit parallel simulation method | |
CN106407063B (en) | The emulation generation of memory access sequence and sort method at a kind of GPU L1 Cache | |
WO2015090044A1 (en) | Data scanning method and device | |
US20170340970A1 (en) | Dynamic quality of service management in multiplayer gaming | |
CN109426554A (en) | A kind of the timing implementation method and device of server | |
WO2023066141A1 (en) | Method and apparatus for obtaining lock resources, and device | |
JP3722422B2 (en) | Dynamic scaling back of latch requests for computer system resources | |
CN107544840A (en) | A kind of process management method and device | |
CN111143053A (en) | Scheduling method of timing task, server and storage device | |
CN115577271A (en) | Competition opponent matching method and device, electronic equipment and storage medium | |
CN111261206B (en) | Read-write method and device, electronic equipment and readable storage medium | |
CN111346372A (en) | Game login loading method and device based on data backup and server |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |