Dynamic interaction processing method and system for game scene

By dividing the game scene into grid cells and using a binary bitmap data structure for collision detection and terrain updates, the high computational complexity and data redundancy problems in existing technologies are solved, achieving efficient dynamic interaction processing, which is suitable for 2D physics combat and demolition games.

CN122032078APending Publication Date: 2026-05-15GUANGZHOU AIYOU INFORMATION TECH
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
GUANGZHOU AIYOU INFORMATION TECH
Filing Date
2026-03-26
Publication Date
2026-05-15

AI Technical Summary

Technical Problem

Existing technologies for collision detection and terrain destruction handling in 2D physics-based combat, demolition, or sandbox games suffer from high computational complexity, poor real-time performance, and low data redundancy and collaborative efficiency.

Method used

The game scene is divided into multiple grid cells, and a binary bitmap data structure is associated with each grid cell. Collision detection and terrain updates are performed through this data structure. A sparse storage strategy is adopted to store only non-all-zero grid cell data, thereby reducing the computational complexity and optimizing memory for interactive detection and updates.

Benefits of technology

It reduces the computational complexity and memory usage of high-frequency interactive games, and improves the real-time performance and consistency of dynamic interactions, making it suitable for 2D side-scrolling games and top-down shooters.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122032078A_ABST
    Figure CN122032078A_ABST
Patent Text Reader

Abstract

The invention provides a dynamic interaction processing method and system for a game scene, and the method comprises the steps: dividing the game scene into a plurality of grid units, associating a binary bitmap data structure for each grid unit, mapping each bit in the binary bitmap data structure to a pixel region in the grid unit, the method is used for representing the obstacle state of the pixel area. In response to a dynamic interaction event in the game, processing is performed based on the binary bitmap data structure, the processing including interaction detection processing and scene update processing. And the interaction detection processing at least performs collision detection on the dynamic interaction event by querying a binary bitmap data structure. The scene updating processing comprises the step of updating the scene state by modifying the binary bitmap data structure associated with the at least one target grid unit when the interaction result is destructive interaction. According to the method, double reduction of calculation complexity of detection and updating of the high-frequency interactive game can be realized, and the performance bottleneck limitation of high-frequency interaction is broken through.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of game processing technology, and in particular to a method and system for dynamic interaction processing of game scenes. Background Technology

[0002] In modern 2D physics-based combat, demolition, or sandbox games, achieving realistic dynamic interactions is core to enhancing the gaming experience. This mainly involves two closely related and computationally intensive aspects: first, real-time collision detection between moving objects (such as bullets and projectiles) and complex terrain; and second, the dynamic damage (digging) effects on the terrain after a collision. These two aspects together constitute a dynamic interaction loop of "perception-change" of the scene. However, existing technical solutions struggle to meet the demands of high real-time performance and high complexity game scenarios when handling these two types of scenarios.

[0003] Firstly, in collision detection, traditional methods typically employ pixel-by-pixel traversal detection algorithms. That is, along the predicted path of a moving object, each pixel it covers is sampled and its state is queried sequentially to determine whether it intersects with an obstacle. For example, a bullet traveling 1000 pixels requires approximately 1000 pixel-level detections. When a game features a large number of bullets or high-speed moving objects, this computational complexity (O(L)) linear with path length leads to enormous computational overhead, becoming a major cause of frame rate drops and severely limiting the number of entities and interaction frequency that can be handled simultaneously in the game.

[0004] Secondly, in terms of terrain destruction handling, traditional methods also rely on independent operations on each pixel within the destroyed area. When an explosion or collision occurs, the system needs to traverse and modify the terrain state data of every pixel within the affected area. Handling a crater with an area of ​​1000 pixels requires approximately 1000 memory accesses and assignment operations. The time complexity of this approach is directly proportional to the destroyed area, causing significant computational delays when faced with frequent or large-scale terrain changes, thus disrupting the game's smoothness.

[0005] More importantly, these two processes are often fragmented in traditional architectures. The collision detection module uses one data structure (such as a pixel-based collision mask) for fast lookup, while the terrain system may use another structure (such as a pixel map array) to store terrain states. This fragmentation not only leads to data redundancy and memory waste but also results in low collaborative efficiency. For example, collision detection results (precise hit points, attributes of hit objects) are difficult to efficiently and directly pass to the terrain destruction module, and after the destruction module updates the terrain, the new terrain state cannot be immediately and losslessly fed back to the collision detection system. This latency and conversion overhead disrupt the real-time performance and consistency of dynamic interactions.

[0006] Therefore, it is necessary to improve the existing dynamic interaction processing methods for game scenarios in order to overcome the shortcomings of existing technologies. Summary of the Invention

[0007] To overcome the problems existing in related technologies, one of the objectives of this invention is to provide a dynamic interaction processing method for game scenes. This method can achieve a double reduction in the computational complexity of detection and updating of high-frequency interactive games, reduce memory usage, and break through the performance bottleneck limitation of high-frequency interaction.

[0008] A method for handling dynamic interactions in a game scene, comprising: The game scene is divided into multiple grid cells, and each grid cell is associated with a binary bitmap data structure. Each bit in the binary bitmap data structure is mapped to a pixel area within the grid cell to represent the obstacle state of that pixel area. The obstacle state is indicated by whether the binary bitmap data structure is not all zeros. In response to dynamic interactive events in the game, processing is performed based on the binary bitmap data structure, the processing including: Interaction detection processing: At least by querying the binary bitmap data structure, collision detection is performed on the dynamic interaction event to determine the interaction result between the dynamic interaction event and the scene; Scene update processing: When the interaction result is a destructive interaction, the scene state is updated by modifying the binary bitmap data structure associated with at least one target grid cell.

[0009] In a preferred embodiment of the present invention, the step of associating each grid cell with a binary bitmap data structure is implemented using a sparse storage strategy, specifically including: For grid cells in the binary bitmap data structure that are not all zeros, store their data; For grid cells in the binary bitmap data structure that are all zeros, their data is not stored; If the current grid cell has data to implement, then it is determined that the current grid cell contains obstacles.

[0010] In a preferred embodiment of the present invention, the interactive detection processing specifically includes bullet flight collision detection; specifically, it includes the following steps: The game scene is divided into multiple grid units according to a preset grid size, and an obstacle status identifier is associated with each grid unit through a binary bitmap data structure. The obstacle status identifier is used to indicate whether the grid unit contains at least one obstacle pixel. In response to a bullet firing event, obtain the starting and ending coordinates of the bullet's flight path; Through geometric calculations, the sequence of grid cells traversed by the bullet's flight trajectory line segment from the starting point coordinates to the ending point coordinates is determined; Perform two-level collision detection on each grid cell in the grid cell sequence sequentially: Level 1 detection: Determine whether the current grid cell contains an obstacle based on the obstacle status identifier associated with it; If there are no obstacles, skip the current grid cell and continue to the next grid cell for detection; If obstacles are present, a second level of detection is performed: pixel-level precise collision detection is carried out on the flight trajectory sub-segments located within the current grid cell to determine whether an obstacle has been hit. When an obstacle is detected in the second-level detection of any grid cell, the collision hit information is returned and the detection is terminated.

[0011] In a preferred embodiment of the present invention, determining the sequence of grid cells traversed by the bullet's trajectory line segment through geometric calculation includes: Calculate the set of first intersection points between the bullet's trajectory line segment and all grid boundary lines parallel to the horizontal direction of the scene; Calculate the set of second intersection points between the bullet's trajectory line segment and all grid boundary lines parallel to the scene's longitudinal direction; The key point sequence is obtained by sorting the points in the starting point, ending point, first intersection point set, and second intersection point set according to their spatial order on the flight trajectory line segment. The line segment between every two adjacent points in the key point sequence is defined as a trajectory sub-segment; The grid cell sequence is obtained by calculating the grid cell containing any point on each trajectory sub-segment.

[0012] In a preferred embodiment of the present invention, calculating the intersection points of the flight trajectory line segment and all grid boundary lines includes: Determine the bullet's flight direction based on the coordinates of its starting and ending points; Starting from the grid boundary where the starting point is located, the coordinates of the intersection points of the flight trajectory line segment and each subsequent grid boundary line are calculated in steps of grid size, until the coordinates of the endpoint are exceeded.

[0013] In a preferred embodiment of the present invention, the step of performing pixel-level precise collision detection on the flight trajectory sub-segments located within the current grid cell includes: Obtain the start and end pixel positions of the flight trajectory sub-segment within the current grid cell; Iterate through every pixel traversed by the sub-segment of the trajectory; For each pixel, query the bit value corresponding to that pixel in the binary bitmap data structure corresponding to that grid cell; If the bit value represents an obstacle, a hit is determined, and the current pixel coordinates are returned as the collision point; If no match is found after traversing all pixels, it is determined that no collision has occurred within the current grid cell.

[0014] In a preferred embodiment of the present invention, the scene update processing specifically involves terrain destruction processing, which includes the following steps: The game scene is divided into multiple grid cells, and a binary bitmap data structure is associated with each grid cell. Each bit in the binary bitmap data structure is mapped to a pixel area within the grid cell to represent the obstacle state of that pixel area. In response to an explosion event in the game, obtain one or more terrain destruction areas defined by the explosion event; For each area of ​​terrain destruction, perform scene update processing, including: Identify one or more target grid cells covered by the terrain destruction area; specifically, this includes calculating the boundary of the terrain destruction area; and based on the spatial relationship between the calculated boundary and the grid cells, selecting all grid cells that intersect with or are contained within the area as target grid cells. For each target mesh cell: Based on the intersection of the terrain destruction area and the target grid cell, a corresponding binary destruction mask is generated; Read the binary bitmap data structure currently associated with the target grid cell; By performing bitwise operations, the read binary bitmap data structure is logically manipulated with the binary destruction mask to generate updated binary data; The updated binary data is associated with the new binary bitmap data structure of the target grid cell.

[0015] In a preferred embodiment of the present invention, the terrain destruction treatment further includes: It also includes storage optimization steps: After associating the updated binary data with the target grid cell, determine whether the updated binary data indicates that the grid cell is free of any obstacles; If so, the association between the target grid cell and the binary bitmap data structure is removed, and its data is no longer stored.

[0016] In a preferred embodiment of the present invention, in the binary destruction mask, the bits representing the pixel region to be destroyed are set to a first logical value, and the bits representing the pixel region to be retained are set to a second logical value; the bitwise operation is a bitwise AND operation, wherein the second logical value is used to protect the region to be retained; When the target mesh cell contains a preset indestructible region, the step of generating the binary destruction mask further includes: Obtain the indestructible region protection mask for the target mesh cell; Perform a logical OR operation between the binary destruction mask and the indestructible area protection mask to obtain a final mask; The bitwise operations are performed using the final mask and the read binary bitmap data structure.

[0017] The second objective of this invention is to provide a dynamic interaction processing system for game scenes, used to implement the dynamic interaction processing method for game scenes as described above; The system includes: A unified scene representation module is used to dynamically divide the game scene into multiple grid units according to a preset grid size, and associate each grid unit with a binary bitmap data structure, wherein each bit of the binary bitmap data structure corresponds to a pixel area within the grid unit, and the value of the bit is used to represent the obstacle state of the corresponding pixel area. An interactive event handling module, connected to the unified scene representation module, is used to respond to dynamic interactive events within the game and process them based on the data structure maintained by the unified scene representation module. The processing includes: The interaction detection submodule is used to perform collision detection on interaction events, and at least by querying the binary bitmap data structure to determine the interaction result between the event and the scene; The scene update submodule is used to dynamically update the scene state by modifying the binary bitmap data structure when the interaction detection submodule determines that a specific interaction result has occurred.

[0018] The beneficial effects of this invention are as follows: This invention provides a dynamic interaction processing method for game scenes. The method includes: dividing the game scene into multiple grid cells and associating each grid cell with a binary bitmap data structure. Each bit in the binary bitmap data structure maps to a pixel region within the grid cell, representing the obstacle state of that pixel region. The obstacle state identifier indicates whether the binary bitmap data structure is not all zeros. By setting the obstacle state identifier as an indicator of whether the binary bitmap data structure is not all zeros, the system can naturally distinguish between "empty cells" and "non-empty cells." During interaction detection processing, empty cells with all zeros can be skipped directly without any pixel-level calculations; after scene update processing, if a cell becomes all zeros, it automatically becomes a "no storage association" state. This mechanism adapts the computational overhead to the actual obstacle density of the scene, with particularly significant performance advantages in open scenes. The method also includes responding to dynamic interaction events in the game by performing processing based on the binary bitmap data structure, including interaction detection processing and scene update processing. This method unifies collision detection and terrain destruction processing on the binary bitmap data structure. This data structure uses "bits" as the smallest storage unit, enabling the system to process pixel states in batches through bit-level parallel operations. The interaction detection process, at least, involves querying the binary bitmap data structure to perform collision detection on dynamic interaction events to determine the interaction result between the dynamic interaction event and the scene. In the interaction detection process, by querying whether the binary bitmap data structure is not all zeros, the presence of obstacles in the entire grid cell can be quickly determined in a short time, avoiding the overhead of pixel-by-pixel traversal. Scene update processing includes updating the scene state by modifying the binary bitmap data structure associated with at least one target grid cell when the interaction result is destructive. In the scene update process, by modifying the binary bitmap data structure, a single bit operation can operate on multiple pixels simultaneously, effectively reducing the complexity of traditional pixel-by-pixel modification.

[0019] This application also provides a processing system that implements the above-described method. This system can adaptively allocate computing resources, reduce memory usage, and lower system implementation complexity and maintenance costs. Furthermore, the method is highly universal and easy to promote and apply in industry, especially suitable for high-frequency interactive games such as 2D side-scrolling games and top-down shooting games. Attached Figure Description

[0020] Figure 1 This is a flowchart of a dynamic interaction processing method for game scenes provided in an embodiment of the present invention. Detailed Implementation

[0021] Preferred embodiments of the invention will now be described in more detail with reference to the accompanying drawings. While preferred embodiments of the invention are shown in the drawings, it should be understood that the invention may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that the invention will be thorough and complete, and will fully convey the scope of the invention to those skilled in the art.

[0022] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. The singular forms “a,” “the,” and “the” used in this invention and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any or all possible combinations of one or more of the associated listed items.

[0023] It should be understood that although the terms "first," "second," "third," etc., may be used in this invention to describe various information, this information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, without departing from the scope of this invention, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Thus, features defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this invention, "a plurality of" means two or more, unless otherwise explicitly specified.

[0024] Example 1 like Figure 1 As shown in the figure, this embodiment provides a dynamic interaction processing method for a game scene, which includes the following steps: S100. Divide the game scene into multiple grid units and associate each grid unit with a binary bitmap data structure. Each bit in the binary bitmap data structure is mapped to a pixel area within the grid unit to represent the obstacle state of that pixel area. The obstacle state identifier is an indication of whether the binary bitmap data structure is not all zeros. S200. In response to dynamic interactive events in the game, perform processing based on the binary bitmap data structure, the processing including: Interaction detection processing: At least by querying the binary bitmap data structure, collision detection is performed on the dynamic interaction event to determine the interaction result between the dynamic interaction event and the scene; Scene update processing: When the interaction result is a destructive interaction, the scene state is updated by modifying the binary bitmap data structure associated with at least one target grid cell.

[0025] This method unifies collision detection and terrain destruction processing on a binary bitmap data structure. This data structure uses a "bit" as the smallest storage unit, enabling the system to process pixel states in batches through bit-level parallel operations.

[0026] In interactive detection processing, by querying whether the binary bitmap data structure is not all zero, it is possible to quickly determine whether there is an obstacle in the entire grid cell in O(1) constant time, thus avoiding the overhead of pixel-by-pixel traversal.

[0027] In scene update processing, by modifying the binary bitmap data structure, a single bit operation can operate on multiple pixels simultaneously (such as 8-bit, 16-bit, 32-bit, or even 64-bit), reducing the complexity of traditional pixel-by-pixel modification from O (crater area) to a constant multiple of O (number of grid cells involved), resulting in a performance improvement of approximately 8-32 times.

[0028] Furthermore, the binary bitmap data structure associated with each grid cell is implemented using a sparse storage strategy, specifically including: For grid cells in the binary bitmap data structure that are not all zeros, store their data; For grid cells in the binary bitmap data structure that are all zeros, their data is not stored; If the current grid cell has data to implement, then it is determined that the current grid cell contains obstacles.

[0029] This embodiment "associates a binary bitmap data structure with each grid cell," but does not require that the data structure be actually stored for all grid cells. Combined with the feature that "the obstacle state is identified as an indication of whether it is not all zeros," those skilled in the art can directly and uniquely deduce that only non-all-zero grid cells need to store binary bitmap data, while all-zero grid cells do not require any storage association.

[0030] This sparse storage strategy makes memory usage proportional to the actual number of obstacles in the scene, rather than proportional to the scene size. For a typical 1000×1000 pixel game scene, traditional pixel-by-pixel storage requires 1,000,000 bytes, while this method only requires storing a small amount of non-empty binary bitmap data (e.g., 100 squares × 313 bytes ≈ 31.3KB), which can significantly save memory.

[0031] Moreover, this method unifies interaction detection processing and scene update processing on the same binary bitmap data structure, breaking the technical bias of the traditional architecture where collision detection and terrain destruction each maintain independent data copies and frequently perform data format conversions.

[0032] The modification results of the scene update process to the binary bitmap data structure can be immediately queried by the subsequent interaction detection process, realizing a seamless closed loop of "detection-destruction-update-re-detection" and ensuring the real-time performance and consistency of dynamic scene interaction.

[0033] Example 1 In this embodiment, the interaction detection process specifically includes bullet flight collision detection; specifically, it includes the following steps: The game scene is divided into multiple grid units according to a preset grid size, and an obstacle status identifier is associated with each grid unit through a binary bitmap data structure. The obstacle status identifier is used to indicate whether the grid unit contains at least one obstacle pixel. In response to a bullet firing event, obtain the starting and ending coordinates of the bullet's flight path; Through geometric calculations, the sequence of grid cells traversed by the bullet's flight trajectory line segment from the starting point coordinates to the ending point coordinates is determined; Perform two-level collision detection on each grid cell in the grid cell sequence sequentially: Level 1 detection: Determine whether the current grid cell contains an obstacle based on the obstacle status identifier associated with it; If there are no obstacles, skip the current grid cell and continue to the next grid cell for detection; If obstacles are present, a second level of detection is performed: pixel-level precise collision detection is carried out on the flight trajectory sub-segments located within the current grid cell to determine whether an obstacle has been hit. When an obstacle is detected in the second-level detection of any grid cell, the collision hit information is returned and the detection is terminated.

[0034] In this scheme, geometric calculations are used to directly locate the sequence of grid cells traversed by the trajectory, compressing the detection target from "all pixels" to "a small number of grid cells traversed by the trajectory." A 1000-pixel path traverses only about 20 grid cells (grid size 50 pixels), significantly reducing the detection base.

[0035] The first-level detection determines whether a grid cell contains an obstacle by using obstacle status identifiers (O(1) hash table lookup). Empty cells without obstacles are skipped directly without any pixel-level calculations. In open scenes (80% of the cells are empty), a 1000-pixel path only requires pixel-level detection of 4 cells with obstacles, significantly reducing the number of detections and effectively improving performance; in bullet hell scenes, the performance improvement can reach tens of times when hundreds of bullets are on screen simultaneously.

[0036] The second-level detection employs the Bresenham line algorithm to traverse the trajectory sub-segments pixel by pixel, and determines the obstacle state bit by bit based on the binary bitmap. This method achieves the same accuracy as traditional pixel-by-pixel detection methods, accurately determining collision locations at the pixel level without sacrificing any detection accuracy for performance optimization.

[0037] The computational complexity of this implementation adapts to the actual obstacle density of the scene: In open scenes (where empty spaces make up a large proportion of the total): most of the cells are skipped in the first level, and the computational cost approaches O (number of intersections). In dense scenes (high obstacle ratio): the number of grid cells entering the second-level detection increases, leading to a corresponding increase in computational overhead, but it is still significantly better than the traditional pixel-by-pixel method. This adaptive characteristic allows this solution to simultaneously achieve extreme efficiency in open scenes and reliable performance in dense scenes.

[0038] Furthermore, the sequence of grid cells traversed by the bullet's trajectory line segment is determined through geometric calculations, including: Calculate the set of first intersection points between the bullet's trajectory line segment and all grid boundary lines parallel to the horizontal direction of the scene; Calculate the set of second intersection points between the bullet's trajectory line segment and all grid boundary lines parallel to the scene's longitudinal direction; The key point sequence is obtained by sorting the points in the starting point, ending point, first intersection point set, and second intersection point set according to their spatial order on the flight trajectory line segment. The line segment between every two adjacent points in the key point sequence is defined as a trajectory sub-segment; The grid cell sequence is obtained by calculating the grid cell containing any point on each trajectory sub-segment.

[0039] By calculating the intersections of the straight line with all X / Y direction grid boundary lines and sorting the start point, end point, and intersection points in sequence, every grid cell traversed by the bullet trajectory is completely and without omission. Any trajectory crossing the grid boundary is divided by the intersection points, ensuring that no grid is skipped, achieving 100% detection coverage.

[0040] Furthermore, the intersection points of the flight trajectory segment and all grid boundary lines are calculated, including: Determine the bullet's flight direction based on the coordinates of its starting and ending points; Starting from the grid boundary where the starting point is located, the coordinates of the intersection points of the flight trajectory line segment and each subsequent grid boundary line are calculated in steps of grid size, until the coordinates of the endpoint are exceeded.

[0041] Furthermore, the pixel-level precise collision detection of the flight trajectory sub-segments located within the current grid cell includes: Obtain the start and end pixel positions of the flight trajectory sub-segment within the current grid cell; Iterate through every pixel traversed by the sub-segment of the trajectory; For each pixel, query the bit value corresponding to that pixel in the binary bitmap data structure corresponding to that grid cell; If the bit value represents an obstacle, a hit is determined, and the current pixel coordinates are returned as the collision point; If no match is found after traversing all pixels, it is determined that no collision has occurred within the current grid cell.

[0042] This method only needs to calculate the intersection points of the boundary lines that actually intersect the trajectory line segments, and each boundary line is calculated only once. For a trajectory of length L and grid size S, the number of intersection points in the X direction is approximately L / S, the number of intersection points in the Y direction is also approximately L / S, and the total number of intersection points is approximately 2L / S. Calculating each intersection point requires only one multiplication and division operation (for the linear equation), with a time complexity of O(L / S). In contrast, the traditional DDA algorithm requires iterative calculation cell by cell, with floating-point comparisons and boundary checks at each step, and while the number of iterations is also O(L / S), the computational cost per step is much higher. This method simplifies the iteration process to generating an arithmetic sequence and directly finding the intersection, significantly improving computational efficiency.

[0043] This method starts from the next boundary after the starting boundary and increases in step size by the grid size, accurately hitting all crossed boundaries without calculating uncrossed boundaries, thus avoiding traversing all grid boundaries. It directly uses geometric formulas for intersection calculation, eliminating the need for pixel-by-pixel sampling and avoiding the slope accumulation and floating-point error accumulation at each step in the DDA algorithm. Overall, this method avoids redundant calculations and helps improve computational efficiency.

[0044] Furthermore, this method naturally supports bullet flight in any direction (left / right, up / down), and only requires adjusting the step size based on the coordinate relationship between the starting point and the ending point.

[0045] Furthermore, the keypoint sequence output naturally divides the bullet trajectory into sub-segments within the grid, which can be directly used as input for two-level collision detection: Each sub-segment corresponds to a specific grid cell; During the first level of detection, the obstacle status indicators of the grid cell are queried directly in sequence; In the second-level detection, the start and end points of the sub-segments are clear, and pixel-level traversal can be performed directly.

[0046] This process of "first finding intersection, then segmenting, and then detecting" decouples geometric positioning and collision detection, making the entire bullet flight processing pipeline clear and efficient.

[0047] Using a 2D bullet hell game as an application scenario, the specific implementation of the interaction detection processing in this application, including bullet flight collision detection, will be described in detail: The game screen resolution is 800×600 pixels. First, the game scene is divided into multiple grid units according to the preset grid size. For ease of explanation, this embodiment sets the grid size to 50 pixels × 50 pixels, so the scene is divided into 16 columns × 12 rows, for a total of 192 grid units.

[0048] Each grid cell is associated with a binary bitmap data structure to accurately represent the obstacle state of each pixel within that grid cell. The binary bitmap is a 2500-bit (50×50) binary string, with each bit mapping to a pixel within the grid cell: 1 indicates an obstacle, and 0 indicates passage.

[0049] The system employs a sparse storage strategy: grid cells are only stored in a hash table (with grid coordinates as the key) when their binary bitmap is not all zeros; all-zero grid cells do not occupy any storage space. The obstacle status identifier for each grid cell is a Boolean value indicating whether the grid cell exists in the hash table.

[0050] The bullet flight collision detection process is as follows: Step 1: Obtain bullet flight trajectory parameters Suppose that in the current frame, a bullet is fired from the starting point coordinates A(73,25) to the ending point coordinates B(287,180). The bullet's trajectory is a straight line segment from A to B.

[0051] Step 2: Determine the sequence of grid cells traversed by the trajectory through geometric calculations. The core of this step is that instead of traversing all grid cells or the entire trajectory pixel by pixel, the grid cells through which the trajectory passes are precisely and directly located by calculating the intersection of the straight line and the grid boundary line.

[0052] 2.1 Calculate the intersection point with the grid boundary line in the X direction. The grid boundary line in the X direction is located at x=50,100,150,200,250,300,… The bullet's starting point Ax=73 and ending point Bx=287.

[0053] The actual X boundary line that the bullet passes through is: starting from ceil(73 / 50)×50=100, increasing by 50 increments until it does not exceed the endpoint x=287.

[0054] The set of boundary lines for X is obtained: x=100,150,200,250 (4 lines in total).

[0055] For each X-boundary line, calculate the corresponding Y-coordinate using the equation of the straight line: Y=StartY+(X-StartX)×(EndY-StartY) / (EndX-StartX) =25+(X-73)×(180-25) / (287-73) =25+(X-73)×155 / 214 The calculation results are as follows: 2.2 Calculate the intersection point with the grid boundary line in the Y direction. The Y-axis grid boundary line is located at y=50, 100, 150, 200, ..., where the bullet's starting point is Ay=25 and its ending point is By=180. The Y-axis boundary line that the bullet actually passes through is: starting from ceil(25 / 50)×50=50, increasing by 50 increments until it does not exceed the ending point y=180.

[0056] The set of boundary lines for Y is obtained: y=50,100,150 (3 lines in total).

[0057] For each Y-boundary line, calculate the corresponding X-coordinate using the equation of the straight line: X=StartX+(Y-StartY)×(EndX-StartX) / (EndY-StartY) =73+(Y-25)×(287-73) / (180-25) =73+(Y-25)×214 / 155 The calculation results are as follows: 2.3 Constructing the key point sequence and determining the mesh cell sequence Sort the starting point A, all intersections in the X direction, all intersections in the Y direction, and the ending point B in ascending order of their X coordinates (in this example, the bullet flies from left to right) to obtain the key point sequence: A(73,25), (100,45), (108,50), (150,81), (177,100), (200,117), (246,150), (250,153), B(287,180) In a sequence of key points, the line segment between any two adjacent points must lie entirely within the same grid cell (because it does not cross any grid boundary lines). Therefore, each line segment between adjacent points constitutes a trajectory sub-segment.

[0058] Based on the grid coordinate calculation formulas: GridX=floor(X / 50), GridY=floor(Y / 50), the grid cell containing each trajectory sub-segment can be calculated. Specifically as follows: Thus, the sequence of grid cells through which the bullet's trajectory passes, determined directly through geometric calculations, is: (1,0), (2,0), (2,1), (3,1), (3,2), (4,2), (4,3), (5,3), totaling 8 grid cells.

[0059] Step 3: Two-stage collision detection Perform two-level collision detection on each of the grid cells in the above grid cell sequence in sequence.

[0060] 3.1 First-level detection: Grid-level rapid judgment For the current grid cell, query whether the grid cell exists in the hash table (i.e., whether it is associated with non-all-zero binary bitmap data): If it does not exist, the grid cell is determined to be an empty cell (no obstacle), and then it is skipped and the next grid cell is detected. If an obstacle is found, the grid cell is determined to contain an obstacle, and then the second level of detection is initiated.

[0061] This embodiment assumes that only grid cells (2,1) and (4,3) contain obstacles (which exist in the hash table), and the remaining grid cells are empty. Therefore, the first-level detection results are as follows: 3.2 Second-level detection: pixel-level precise collision detection Taking grid cell (2,1) as an example, its internal trajectory sub-segments are (108,50) to (150,81).

[0062] The testing steps are as follows: Read the binary bitmap data (2500 bits) corresponding to grid cell (2,1) from the hash table.

[0063] The Bresenham line algorithm is used to discretize the trajectory sub-segment into a sequence of pixels, thus obtaining the coordinates of all pixels traversed by the line segment.

[0064] For each pixel (x, y): Calculate the relative coordinates of the pixel within the grid cell: relX = x - starting X coordinate of the grid cell (the starting coordinates of grid cell (2,1) are (100,50)) relY = y - starting Y coordinate of the grid cell Calculate the bit index of the pixel in the bitmap (stored row by row): BitIndex = relY × 50 + relX + 1 Read the value of the BitIndex bit from the Bitmap (using bitwise operations, with a time complexity of O(1)).

[0065] If the value of this bit is 1, it is determined that an obstacle has been hit, the current pixel coordinates are immediately returned as the collision point, and the entire detection process is terminated.

[0066] If no value of 1 is encountered after traversing all pixels, it is determined that no collision has occurred in that grid cell, and the next grid cell is then detected.

[0067] If the bit value corresponding to pixel (120,60) is 1 on the trajectory sub-segment of grid cell (2,1), then the detection terminates and the collision point (120,60) is returned.

[0068] If no match is found in grid cell (2,1), the same pixel-level detection is performed on grid cell (4,3). If no match is found in any grid cell, it is determined that no collision occurred during the bullet's flight.

[0069] Step 4: Multi-bullet concurrent processing This embodiment supports concurrent collision detection for hundreds or thousands of bullets within a single frame. Each bullet independently performs the aforementioned geometric calculations and two-level detection process. Since grid-level detection is only an O(1) hash table lookup, and pixel-level detection is only performed in a very small number of grids with obstacles, the overall computational overhead is sublinearly related to the number of bullets, which can easily support the high-frequency bullet firing requirements of bullet hell games.

[0070] Example 2 This embodiment provides a detailed implementation process for scene update processing.

[0071] Specifically, the scene update process is a terrain destruction process, which includes the following steps: The game scene is divided into multiple grid cells, and a binary bitmap data structure is associated with each grid cell. Each bit in the binary bitmap data structure is mapped to a pixel area within the grid cell to represent the obstacle state of that pixel area. In response to an explosion event in the game, obtain one or more terrain destruction areas defined by the explosion event; For each area of ​​terrain destruction, perform scene update processing, including: Identify one or more target grid cells covered by the terrain destruction area; specifically, this includes calculating the boundary of the terrain destruction area; and based on the spatial relationship between the calculated boundary and the grid cells, selecting all grid cells that intersect with or are contained within the area as target grid cells. For each target mesh cell: Based on the intersection of the terrain destruction area and the target grid cell, a corresponding binary destruction mask is generated; Read the binary bitmap data structure currently associated with the target grid cell; By performing bitwise operations, the read binary bitmap data structure is logically manipulated with the binary destruction mask to generate updated binary data; The updated binary data is associated with the new binary bitmap data structure of the target grid cell.

[0072] Traditional terrain destruction methods require traversing every pixel within the crater area and performing independent read-modify-write operations on each pixel. For a crater with an area of ​​A pixels, the time complexity is O(A), linearly related to the crater area. When the crater area is large or there are multiple explosions within a single frame, the computational overhead increases dramatically. In this embodiment, pixel-level serial operations are transformed into bit-level parallel operations. A single bit operation instruction (AND, OR, NOT, etc.) can simultaneously operate on 8-bit, 16-bit, 32-bit, or even 64-bit pixel data, thereby effectively improving operating efficiency. Furthermore, through the design of "associating binary bitmap data structures only with non-all-zero grid cells," adaptive optimization of memory usage is achieved.

[0073] Furthermore, terrain disruption treatment also includes: It also includes storage optimization steps: After associating the updated binary data with the target grid cell, determine whether the updated binary data indicates that the grid cell is free of any obstacles; If so, the association between the target grid cell and the binary bitmap data structure is removed, and its data is no longer stored.

[0074] Furthermore, in the binary destruction mask, the bits representing the pixel regions that need to be destroyed are set to a first logical value, and the bits representing the pixel regions that need to be preserved are set to a second logical value; the bitwise operation is a bitwise AND operation, wherein the second logical value is used to protect the regions that need to be preserved; When the target mesh cell contains a preset indestructible region, the step of generating the binary destruction mask further includes: Obtain the indestructible region protection mask for the target mesh cell; Perform a logical OR operation between the binary destruction mask and the indestructible area protection mask to obtain a final mask; The bitwise operations are performed using the final mask and the read binary bitmap data structure.

[0075] This embodiment will be described in detail using a 2D demolition game as an application scenario: 1. The game screen resolution is 1000×1000 pixels. The game scene is divided into multiple grid units according to the preset grid size. For ease of explanation, this embodiment sets the grid size to 50 pixels × 50 pixels, so the scene is divided into 20 columns × 20 rows, for a total of 400 grid units.

[0076] (1) Binary bitmap data structure Associate each grid cell with a binary bitmap data structure to accurately represent the obstacle state of each pixel within that grid cell: The bitmap length is 50 × 50 = 2500 bits; Each bit is mapped to a pixel region within a grid cell; 1 indicates an obstacle (impassable), 0 indicates a passable path (no obstacle); The data can be organized by row or column. This embodiment uses row storage, with 50 bits per row, for a total of 50 rows and a total storage space of approximately 313 bytes (2500 bits ÷ 8 = 312.5 bytes).

[0077] (2) Sparse storage strategy The system uses a hash table (Key-Value Store) as its underlying storage engine. Key: Grid cell coordinates (GridX, GridY); Value: The binary bitmap data of this grid cell; Storage rules: Grid cells are stored in the hash table only if their binary bitmap is not all zeros (i.e., they contain at least one obstacle pixel); all-zero grid cells do not occupy any storage space.

[0078] This strategy makes memory usage proportional to the actual number of obstacles in the scene, rather than proportional to the scene size.

[0079] (3) Indestructible area protection mask For mesh cells containing indestructible regions, the system additionally stores a protection mask: The protection mask is a binary string of the same length as the binary bitmap; 1 indicates that this pixel is an indestructible area and cannot be cleared by any explosion. 0 indicates that the pixel is a destructible area and can be normally cleared by an explosion event.

[0080] The protection mask is loaded during game initialization or predefined by the level editor.

[0081] II. Detailed Process of Terrain Damage Treatment 2.1 Triggering of Explosion Events and Definition of Crater Areas Suppose an explosion event occurs in the game during the current frame: Explosion center coordinates: P(250,150) Explosion radius: R = 30 pixels To simplify the calculation, this embodiment defines the crater as a rectangular region with the coordinates of its upper left corner (Px-R, Py-R) and the coordinates of its lower right corner (P.x+R, P.y+R).

[0082] Substitute the data: Top left corner of the crater: (220, 120) Bottom right corner of the crater: (280, 180) Crater width: 60 pixels, height: 60 pixels, total area: 3600 pixels 2.2 Determine the target mesh element Calculate all the grid cells covered by the rectangular region of the crater based on its boundary coordinates.

[0083] Step 1: Calculate the mesh cell range The formula for calculating grid cell coordinates is: GridX = floor(X / CellSize), GridY = floor(Y / CellSize), where CellSize = 50.

[0084] Minimum X grid: floor(220 / 50) = 4 Maximum X grid: floor(280 / 50) = 5 Minimum Y-grid: floor(120 / 50) = 2 Maximum Y-grid: floor(180 / 50) = 3 Step 2: Generate a list of target mesh cells Traversing the Cartesian product of GridX=4,5 and GridY=2,3, we obtain 4 target grid cells: (4,2),(4,3),(5,2),(5,3) 2.3 Generate a binary destruction mask for each target mesh cell. Taking grid cell (4,2) as an example, the generation process of binary destruction mask is explained in detail.

[0085] Step 1: Determine the pixel space range of the grid cells The starting pixel coordinates of grid cell (4,2) are: Initial X = 4 × 50 = 200 Initial Y = 2 × 50 = 100 The final value is X = 200 + 49 = 249. The final value is Y = 100 + 49 = 149. Step 2: Calculate the intersection region between the crater and the mesh cell. Rectangular area of ​​the crater: X range: 220~280 Y range: 120~180 The intersecting region is the intersection of the two rectangles: Range of X: max(220,200)=220~min(280,249)=249 Y range: max(120,100)=120~min(180,149)=149 Intersecting region width: 30 pixels (220-249), height: 30 pixels (120-149), area: 900 pixels.

[0086] Step 3: Generate a binary corruption mask The binary corruption mask is a 2500-bit binary string of the same length as the grid cell binary bitmap, generated according to the following rules: Pixels located within the intersecting area: set to 0 (indicating that the location will be removed and the obstacle cleared); Pixels located outside the intersection area: set to 1 (meaning that the position remains unchanged).

[0087] In practice, a 2500-bit mask with all 1s can be generated first, and then the bits at the corresponding positions can be cleared to zero according to the pixel coordinate range of the intersecting area.

[0088] 2.4 Perform bitwise operations to modify terrain data Step 1: Read the current binary bitmap data Check if grid cell (4,2) exists in the hash table: If it does not exist (i.e. the grid cell was originally an empty cell): then the current binary bitmap data is considered to be all 0s; If it exists, then read its stored binary bitmap data GridBitmap.

[0089] In this embodiment, the grid cell (4,2) is originally a complete solid terrain, and its binary bitmap data is all 1s (all 2500 bits are 1).

[0090] Step 2: Perform a bitwise AND operation NewBitmap = GridBitmap AND Destruction Mask The operational principle is as follows: In this example, GridBitmap is all 1s, the destruction mask is 0 within the intersecting region and 1 outside the intersecting region, therefore: Within the intersecting region: if 1 AND 0 = 0, then the obstacle is cleared; Outside the intersecting region: if 1 AND 1 = 1, then the obstacle is preserved.

[0091] Step 3: Store the updated binary data Write NewBitmap back to the hash table and associate it with grid cell (4,2) as the key.

[0092] 2.5 Storage Optimization: Automatic Reclamation of Empty Spaces Step 1: Determine if it is all zeros Before storing NewBitmap into the hash table, first check if it is all zeros.

[0093] Step 2: If all zeros are received, delete the cell record. If NewBitmap is all zeros, it means there are no obstacles within that grid cell. At this point: No storage operation is performed; Delete the existing record for this grid cell from the hash table (if it exists); The grid cell is restored to an "empty cell" state and no longer occupies any memory.

[0094] Step 3: If not all zeros, store normally. If NewBitmap is not all zeros, then store it in the hash table (update or insert).

[0095] Example of this embodiment: The grid cell (4,2) was originally a solid terrain with all 1s. After the explosion, the intersecting area (900 pixels) was cleared, and the remaining 1600 pixels remained in the obstacle state. If NewBitmap is not all zeros, it will be stored and updated normally.

[0096] If a grid cell (5,3) originally contained only one sparse obstacle, and that obstacle is completely cleared after the explosion, then NewBitmap will be all zeros. In this case, the cell record will be deleted, and memory will be released.

[0097] 2.6 Hybrid Grid Processing: Protection of Indestructible Areas For mesh cells containing indestructible regions, the system needs to perform an additional protection mask merging operation after generating the binary destruction mask.

[0098] Step 1: Obtain the protection mask Assuming the top-left region of grid cell (4,3) is indestructible bedrock, its protection mask is: Within the pixel area (200~249, 150~199), the first two rows (Y=150~151) are indestructible areas; In the protection mask, the corresponding bits are set to 1, and the remaining bits are 0.

[0099] Step 2: Merge protection masks Final mask = Destructive mask OR Protective mask Operational principle: A destruction mask of 0 indicates "to be dug out", while a protection mask of 1 indicates "cannot be destroyed". If 0 OR 1 = 1, then even if the mask is destroyed and needs to be removed, the final mask will still be 1 because the protection mask is forced to be 1. This area will be preserved in subsequent AND operations, achieving the "damage-free" effect of an indestructible area.

[0100] Step 3: Perform bitwise operations using the final mask NewBitmap = GridBitmap AND final mask 2.7 Concurrent Handling of Multiple Craters This embodiment supports concurrent processing of multiple explosion events within a single frame: Sequential processing mode: Perform the complete process described above on each crater in sequence; Batch merging mode: For multiple craters that are spatially close, their damaged areas can be merged in advance to generate a composite mask. Multiple destructions can be completed in one bit operation, further reducing the number of operations.

[0101] The terrain destruction processing method disclosed in this embodiment replaces the traditional double-loop (row and column traversal) with a single bitwise operation instruction, completely eliminating loop overhead and eliminating the need for pixel-by-pixel looping, thereby effectively improving computational efficiency. Furthermore, it only stores non-zero cells, with empty cells occupying zero memory; each pixel uses only 1 bit, significantly compressing it compared to the traditional 1-byte pixel; and cells are automatically deleted after being hollowed out, dynamically optimizing memory usage as the game progresses, thus saving substantial memory. More preferably, this embodiment and the bullet collision detection embodiment can share the same binary bitmap data structure. Modifications to the binary bitmap caused by terrain destruction can be immediately queried by bullet collision detection in the next frame, enabling immediate perception of destruction and improving the gaming experience. Collision detection and terrain destruction do not require maintaining separate copies of terrain data, eliminating memory waste and synchronization overhead; there is no need to convert terrain destruction results from "destruction system format" to "collision system format," achieving zero-latency feedback.

[0102] Example 3 This embodiment provides a dynamic interaction processing system for game scenes, used to implement the dynamic interaction processing method for game scenes as described above; The system includes: The unified scene representation module is used to dynamically divide the game scene into multiple grid units according to the preset grid size, and associate each grid unit with a binary bitmap data structure. Each bit of the binary bitmap data structure corresponds to a pixel area within the grid unit, and the value of the bit is used to represent the obstacle state of the corresponding pixel area. This module is responsible for the grid division of the game scene, the maintenance and sparse storage of the binary bitmap data structure.

[0103] An interactive event handling module, connected to the unified scene representation module, is used to respond to dynamic interactive events in the game and process them based on the data structure maintained by the unified scene representation module. The processing includes: the module is connected to the unified scene representation module, responds to various dynamic interactive events, and performs collision detection and scene updates based on the unified data representation.

[0104] The interaction detection submodule is used to perform collision detection on interaction events, and determines the interaction result between the event and the scene by querying the binary bitmap data structure at least once. This submodule is responsible for performing collision detection on interaction events, and determining the interaction result between the event and the scene by querying the binary bitmap data structure at least once.

[0105] The scene update submodule is used to dynamically update the scene state by modifying the binary bitmap data structure when the interaction detection submodule determines that a specific interaction result has occurred.

[0106] The collaborative workflow of each module in this system: Step 1: Initialization Phase The unified scene representation module loads level terrain data and stores non-empty binary bitmaps into the sparse storage engine. The interactive event handling module has completed initialization and registered callbacks for bullet collision detection and terrain destruction handling.

[0107] Step 2: Bullet Firing The game logic layer generates a bullet firing event, carrying parameters such as the starting point (73,25) and the ending point (287,180); The interactive event scheduler dispatches the event to the bullet flight collision detection unit of the interactive detection submodule.

[0108] Step 3: Collision Detection The bullet flight collision detection unit calls the interface of the unified scene representation module: The eight grid cells traversed by the trajectory are determined through geometric calculations; Calling IsGridHaveBarrier on each grid cell reveals that (2,1) and (4,3) are cells with obstacles. Perform pixel-level detection on the trajectory sub-segment within (2,1), read GetGridBitmap(2,1), and hit pixel (120,60) in the bitmap; Returns collision hit information: collision point (120,60), hit grid cell (2,1).

[0109] Step 4: Trigger terrain destruction The game logic layer generates an explosion event (bullet hit explosion) based on collision hit information. The interactive event dispatcher dispatches the explosion event to the terrain destruction processing unit of the scene update submodule.

[0110] Step 5: Terrain Destruction The terrain destruction processing unit determines the target grid cell (2,1) and its adjacent cells based on the explosion center (120,60) and radius of 30 pixels; For mesh cell (2,1): Calculate the intersection area between the crater and the grid, and generate a binary destruction mask; Read the original bitmap using GetGridBitmap(2,1); Execute `newBitmap = oldBitmap & destroyMask`; Call SetGridBitmap(2,1,newBitmap) to update the data.

[0111] Storage engine automatic management: If newBitmap is not all zeros, update it; if it is all zeros, delete it.

[0112] Step 6: Interactive Feedback The terrain destruction handling unit notifies the game logic layer via a callback: the terrain of grid cell (2,1) has been updated; The game logic layer plays explosion effects, updates the minimap, and synchronizes network status.

[0113] Step 7: Subsequent Bullet Detection In the next frame, another bullet follows the same trajectory: If you query IsGridHaveBarrier(2,1) again, the grid cell may have become an empty cell (if it is completely hollowed out) or some obstacles may remain. The collision detection results will reflect terrain changes in real time, achieving a dynamic interactive closed loop.

[0114] This system integrates two core functions—bullet flight collision detection and terrain destruction processing—within the same technical framework through the organic combination of a unified scene representation module and an interactive event processing module. It provides 2D game developers with a ready-to-use, high-performance, and cost-effective dynamic interaction solution.

[0115] Unless otherwise specifically stated, the relative arrangement, numerical expressions, and values ​​of the components and steps described in these embodiments do not limit the scope of this application. It should also be understood that, for ease of description, the dimensions of the various parts shown in the accompanying drawings are not drawn to actual scale. Techniques, methods, and devices known to those skilled in the art may not be discussed in detail, but where appropriate, such techniques, methods, and devices should be considered part of the specification. In all examples shown and discussed herein, any specific values ​​should be interpreted as merely exemplary and not as limitations.

Claims

1. A method for dynamic interaction processing in a game scene, characterized in that, include: The game scene is divided into multiple grid cells, and each grid cell is associated with a binary bitmap data structure. Each bit in the binary bitmap data structure is mapped to a pixel area within the grid cell to represent the obstacle state of that pixel area. The obstacle state is indicated by whether the binary bitmap data structure is not all zeros. In response to dynamic interactive events in the game, processing is performed based on the binary bitmap data structure, the processing including: Interaction detection processing: At least by querying the binary bitmap data structure, collision detection is performed on the dynamic interaction event to determine the interaction result between the dynamic interaction event and the scene; Scene update processing: When the interaction result is a destructive interaction, the scene state is updated by modifying the binary bitmap data structure associated with at least one target grid cell.

2. The dynamic interaction processing method for game scenes according to claim 1, characterized in that: The aforementioned binary bitmap data structure associated with each grid cell is implemented using a sparse storage strategy, specifically including: For grid cells in the binary bitmap data structure that are not all zeros, store their data; For grid cells in the binary bitmap data structure that are all zeros, their data is not stored; If the current grid cell has data to implement, then it is determined that the current grid cell contains obstacles.

3. The dynamic interaction processing method for game scenes according to claim 1, characterized in that: The interactive detection process specifically includes bullet flight collision detection; specifically, it includes the following steps: The game scene is divided into multiple grid units according to a preset grid size, and an obstacle status identifier is associated with each grid unit through a binary bitmap data structure. The obstacle status identifier is used to indicate whether the grid unit contains at least one obstacle pixel. In response to a bullet firing event, obtain the starting and ending coordinates of the bullet's flight path; Through geometric calculations, the sequence of grid cells traversed by the bullet's flight trajectory line segment from the starting point coordinates to the ending point coordinates is determined; Perform two-level collision detection on each grid cell in the grid cell sequence sequentially: Level 1 detection: Determine whether the current grid cell contains an obstacle based on the obstacle status identifier associated with it; If there are no obstacles, skip the current grid cell and continue to the next grid cell for detection; If obstacles are present, a second level of detection is performed: pixel-level precise collision detection is carried out on the flight trajectory sub-segments located within the current grid cell to determine whether an obstacle has been hit. When an obstacle is detected in the second-level detection of any grid cell, the collision hit information is returned and the detection is terminated.

4. The dynamic interaction processing method for game scenes according to claim 3, characterized in that: The sequence of grid cells traversed by the bullet's trajectory line segment is determined through geometric calculations, including: Calculate the set of first intersection points between the bullet's trajectory line segment and all grid boundary lines parallel to the horizontal direction of the scene; Calculate the set of second intersection points between the bullet's trajectory line segment and all grid boundary lines parallel to the scene's longitudinal direction; The key point sequence is obtained by sorting the points in the starting point, ending point, first intersection point set, and second intersection point set according to their spatial order on the flight trajectory line segment. The line segment between every two adjacent points in the key point sequence is defined as a trajectory sub-segment; The grid cell sequence is obtained by calculating the grid cell containing any point on each trajectory sub-segment.

5. The dynamic interaction processing method for game scenes according to claim 4, characterized in that: Calculate the intersection points of the flight trajectory line segment with all grid boundary lines, including: Determine the bullet's flight direction based on the coordinates of its starting and ending points; Starting from the grid boundary where the starting point is located, the coordinates of the intersection points of the flight trajectory line segment and each subsequent grid boundary line are calculated in steps of grid size, until the coordinates of the endpoint are exceeded.

6. The dynamic interaction processing method for game scenes according to claim 3, characterized in that: The pixel-level precise collision detection of the flight trajectory sub-segments located within the current grid cell includes: Obtain the start and end pixel positions of the flight trajectory sub-segment within the current grid cell; Iterate through every pixel traversed by the sub-segment of the trajectory; For each pixel, query the bit value corresponding to that pixel in the binary bitmap data structure corresponding to that grid cell; If the bit value represents an obstacle, a hit is determined, and the current pixel coordinates are returned as the collision point; If no match is found after traversing all pixels, it is determined that no collision has occurred within the current grid cell.

7. The dynamic interaction processing method for game scenes according to claim 1, characterized in that: The scene update process specifically involves terrain destruction processing, which includes the following steps: The game scene is divided into multiple grid cells, and a binary bitmap data structure is associated with each grid cell. Each bit in the binary bitmap data structure is mapped to a pixel area within the grid cell to represent the obstacle state of that pixel area. In response to an explosion event in the game, obtain one or more terrain destruction areas defined by the explosion event; For each area of ​​terrain destruction, perform scene update processing, including: Identify one or more target grid cells covered by the terrain destruction area; specifically, this includes calculating the boundary of the terrain destruction area; and based on the spatial relationship between the calculated boundary and the grid cells, selecting all grid cells that intersect with or are contained within the area as target grid cells. For each target mesh cell: Based on the intersection of the terrain destruction area and the target grid cell, a corresponding binary destruction mask is generated; Read the binary bitmap data structure currently associated with the target grid cell; By performing bitwise operations, the read binary bitmap data structure is logically manipulated with the binary destruction mask to generate updated binary data; The updated binary data is associated with the new binary bitmap data structure of the target grid cell.

8. The dynamic interaction processing method for game scenes according to claim 7, characterized in that: Terrain destruction treatment also includes: It also includes storage optimization steps: After associating the updated binary data with the target grid cell, determine whether the updated binary data indicates that the grid cell is free of any obstacles; If so, the association between the target grid cell and the binary bitmap data structure is removed, and its data is no longer stored.

9. The dynamic interaction processing method for game scenes according to claim 7, characterized in that: In the binary destruction mask, the bits representing the pixel region to be destroyed are set to a first logical value, and the bits representing the pixel region to be preserved are set to a second logical value; the bitwise operation is a bitwise AND operation, wherein the second logical value is used to protect the region to be preserved; When the target mesh cell contains a preset indestructible region, the step of generating the binary destruction mask further includes: Obtain the indestructible region protection mask for the target mesh cell; Perform a logical OR operation between the binary destruction mask and the indestructible area protection mask to obtain a final mask; The bitwise operations are performed using the final mask and the read binary bitmap data structure.

10. A dynamic interactive processing system for game scenes, characterized in that: A method for implementing dynamic interaction processing of game scenes as described in any one of claims 1-9; The system includes: A unified scene representation module is used to dynamically divide the game scene into multiple grid units according to a preset grid size, and associate each grid unit with a binary bitmap data structure, wherein each bit of the binary bitmap data structure corresponds to a pixel area within the grid unit, and the value of the bit is used to represent the obstacle state of the corresponding pixel area. An interactive event handling module, connected to the unified scene representation module, is used to respond to dynamic interactive events within the game and process them based on the data structure maintained by the unified scene representation module. The processing includes: The interaction detection submodule is used to perform collision detection on interaction events, and at least by querying the binary bitmap data structure to determine the interaction result between the event and the scene; The scene update submodule is used to dynamically update the scene state by modifying the binary bitmap data structure when the interaction detection submodule determines that a specific interaction result has occurred.