Bullet screen publishing method and device, electronic equipment, computer readable storage medium and computer program product
By combining quadtree blocks with the spatial partitioning structure based on the track principle, the problem of low efficiency in bullet screen collision detection is solved, enabling real-time and flexible bullet screen publishing and improving the user interaction experience.
Patent Information
- Application Number
- CN202410575663.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-08
- Publication Date
- 2025-11-11
AI Technical Summary
Existing bullet screen publishing technology struggles to efficiently avoid bullet screen collisions when multiple users publish bullet screens simultaneously, leading to overlaps and overlays that negatively impact the viewer's experience.
It adopts a quadtree block combined with the track principle, and performs bullet screen collision detection through a spatial partitioning structure. The screen area is divided into multiple subtree areas using a quadtree, and collision detection is only performed in the subtree area where the bullet screen to be published is located, thereby improving detection efficiency.
It improves the efficiency of bullet screen collision detection, ensures the real-time and flexible nature of bullet screen posting, and enhances the real-time interactive experience for users.
Smart Images

Figure CN120935393A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence, and in particular to a method, apparatus, electronic device, computer-readable storage medium, and computer program product for publishing bullet comments. Background Technology
[0002] Bullet comments (or danmaku) are a common interactive feature in online videos and live streams. They allow users to post comments in real-time while watching videos or live streams, creating an instant interactive atmosphere where users can share opinions, emotions, and viewing experiences. To ensure that bullet comments do not overlap when multiple users post them simultaneously, thus guaranteeing a smooth viewing experience, it is necessary to detect the position, size, and direction of bullet comments in real-time and employ appropriate bullet comment posting methods. This can effectively prevent bullet comment collisions and improve the stability and reliability of the bullet comment system. However, while effectively avoiding bullet comment collisions, the real-time nature of bullet comment posting, i.e., the efficiency of collision detection during the bullet comment posting process, is equally crucial. Summary of the Invention
[0003] This application provides a method, apparatus, electronic device, computer-readable storage medium, and computer program product for publishing bullet comments, which can improve the collision detection efficiency for bullet comments to be published.
[0004] The technical solution of this application embodiment is implemented as follows:
[0005] This application provides a method for publishing bullet comments, the method comprising: in response to a bullet comment publishing request for a bullet comment to be published, obtaining bullet comment attributes of the bullet comment to be published; based on the bullet comment attributes, determining candidate tracks of the bullet comment to be published in a screen area and a quadtree corresponding to the candidate tracks; the quadtree includes multiple subtrees, each subtree corresponding to a subtree area in the screen area; determining published bullet comments located in the subtree area of each subtree at the current time; for at least one subtree in the quadtree, performing collision detection between the bullet comment to be published and the published bullet comments in the subtree area of the subtree, and obtaining a collision detection result; based on the collision detection result, determining a bullet comment publishing area for publishing the bullet comment to be published from the subtree area corresponding to the at least one subtree; and publishing the bullet comment to be published in the bullet comment publishing area.
[0006] This application provides a bullet screen publishing device, comprising: an acquisition module, configured to acquire bullet screen attributes of the bullet screen to be published in response to a bullet screen publishing request; a subtree region determination module, configured to determine, based on the bullet screen attributes, a candidate track in the screen region corresponding to the bullet screen to be published and a quadtree corresponding to the candidate track; the quadtree includes multiple subtrees, each subtree corresponding to a subtree region in the screen region; a published bullet screen determination module, configured to determine published bullet screens located in the subtree region of each subtree at the current time; a collision detection module, configured to perform collision detection on the bullet screen to be published and the published bullet screens in the subtree region corresponding to at least one subtree in the quadtree, and obtain a collision detection result; a bullet screen publishing region determination module, configured to determine, based on the collision detection result, a bullet screen publishing region for publishing the bullet screen to be published from the subtree region corresponding to the at least one subtree; and a bullet screen publishing module, configured to publish the bullet screen to be published in the bullet screen publishing region.
[0007] In some embodiments, the collision detection module is further configured to: obtain the boundary of the bullet screen to be published; determine at least one target subtree region for publishing the bullet screen to be published based on the bullet screen boundary and the region boundary of the subtree region corresponding to each subtree in the at least one subtree; generate a collision candidate list based on the published bullet screens located in the target subtree region at the current time; and perform collision detection on the bullet screen to be published based on the collision candidate list to obtain the collision detection result.
[0008] In some embodiments, the boundaries of the bullet comments to be published include a left boundary, a right boundary, an upper boundary, and a lower boundary. The collision detection module is further configured to: for any subtree, if the left boundary of the bullet comments to be published is located to the right of the left boundary of the subtree region corresponding to the subtree, and the upper boundary of the bullet comments to be published is located below the upper boundary of the subtree region corresponding to the subtree, determine the positions of the right boundary and the lower boundary of the bullet comments to be published; if the right boundary of the bullet comments to be published is located to the left of the right boundary of the subtree region corresponding to the subtree, and the lower boundary of the bullet comments to be published is located above the lower boundary of the subtree region corresponding to the subtree, determine the subtree region corresponding to the subtree as a target subtree region for publishing the bullet comments to be published.
[0009] In some embodiments, the collision detection module is further configured to: for any subtree, if the left boundary of the barrage to be published is located to the right of the left boundary of the subtree region corresponding to the subtree, and the upper boundary of the barrage to be published is located below the upper boundary of the subtree region corresponding to the subtree, determine the positions of the right boundary and the lower boundary of the barrage to be published; if the right boundary of the barrage to be published is located to the left of the right boundary of the subtree region corresponding to any other subtree to the right of the subtree region, and the lower boundary of the barrage to be published is located above the lower boundary of the subtree region corresponding to the other subtree, determine the subtree, the other subtree, and all subtree regions corresponding to the subtrees connected between the subtree and the other subtree as multiple target subtree regions for publishing the barrage to be published.
[0010] In some embodiments, the collision detection module is further configured to: for any subtree, if the left boundary of the barrage to be published is located to the right of the left boundary of the subtree region corresponding to the subtree, and the upper boundary of the barrage to be published is located below the upper boundary of the subtree region corresponding to the subtree, determine the positions of the right boundary and the lower boundary of the barrage to be published; if the lower boundary of the barrage to be published is located above the lower boundary of the subtree region corresponding to any other subtree below the subtree region, and the right boundary of the barrage to be published is located to the left of the right boundary of the subtree region corresponding to the other subtree, determine the subtree, the other subtree, and all subtree regions corresponding to the subtrees connected between the subtree and the other subtree as multiple target subtree regions for publishing the barrage to be published.
[0011] In some embodiments, the collision detection module is further configured to: determine all or part of the published bullet comments located in each of the target subtree regions at the current moment; and add the published bullet comments to the collision candidate list.
[0012] In some embodiments, the collision detection module is further configured to: determine at least one candidate publishing region from the target subtree region that can publish the bullet screen to be published; for each candidate publishing region, after inserting the bullet screen to be published into the candidate publishing region, perform collision detection between the bullet screen to be published inserted into the candidate publishing region and each published bullet screen in the collision candidate list, and obtain the collision detection result corresponding to each candidate publishing region.
[0013] In some embodiments, the bullet screen publishing area determination module is further configured to: determine the candidate publishing area that does not collide with each published bullet screen from the collision detection results corresponding to all candidate publishing areas as the target candidate publishing area; and select the bullet screen publishing area for publishing the bullet screen to be published from the target candidate publishing area.
[0014] In some embodiments, the collision detection module is further configured to: for each candidate publishing area, after inserting the bullet comment to be published into the candidate publishing area, obtain from the collision candidate list the published bullet comments that are horizontally adjacent to the bullet comment to be published, the current bullet comment position of the bullet comment to be published, and the current bullet comment speed; determine the current bullet comment position and current bullet comment speed of the published bullet comments that are horizontally adjacent to the bullet comment to be published; determine the horizontal distance between the bullet comment to be published and the adjacent published bullet comments based on the current bullet comment position of the bullet comment to be published and the current bullet comment position of the adjacent published bullet comments; determine the speed difference between the bullet comment to be published and the adjacent published bullet comments based on the current bullet comment speed of the bullet comment to be published and the current bullet comment speed of the adjacent published bullet comments; determine the encounter probability between the bullet comment to be published and the adjacent published bullet comments based on the horizontal distance and the speed difference; and determine the collision detection result corresponding to each candidate publishing area based on the encounter probability.
[0015] In some embodiments, the bullet screen publishing area determination module is further configured to: for each candidate publishing area, if the collision detection result corresponding to the candidate publishing area indicates that the bullet screen to be published inserted into the candidate publishing area collides with the adjacent published bullet screen, update the current bullet screen speed of the bullet screen to be published to obtain a first bullet screen speed of the bullet screen to be published; and if, based on the first bullet screen speed and the collision candidate list, it is determined that the bullet screen to be published does not collide with any published bullet screen in the collision candidate list, determine the candidate publishing area as the target candidate publishing area.
[0016] In some embodiments, the apparatus further includes a removal module, which is configured to, after publishing the bullet comment to be published in the bullet comment publishing area, determine the bullet comment to be published as a currently published bullet comment in the target subtree area; obtain the area boundary of the screen area and the bullet comment boundary of the currently published bullet comment; and remove the currently published bullet comment from the target subtree area when the right boundary of the bullet comment boundary of the currently published bullet comment is located to the left of the left boundary of the boundary area of the screen area, or the lower boundary of the bullet comment boundary of the currently published bullet comment is located above the upper boundary of the boundary area of the screen area.
[0017] This application provides an electronic device, including: a memory for storing computer-executable instructions; and a processor for executing the computer-executable instructions stored in the memory to implement the bullet screen publishing method provided in this application.
[0018] This application provides a computer-readable storage medium storing computer-executable instructions for implementing the bullet screen publishing method provided in this application when executed by a processor.
[0019] This application provides a computer program product, which includes computer-executable instructions stored in a computer-readable storage medium. When the processor of an electronic device reads the computer-executable instructions from the computer-readable storage medium and executes the computer-executable instructions, it implements the bullet screen publishing method provided in this application.
[0020] The embodiments of this application have the following beneficial effects:
[0021] First, in response to a request to publish a bullet comment, the bullet comment attributes are obtained. Based on the bullet comment attributes, candidate tracks for the bullet comment in the screen area and the corresponding quadtrees are determined. The quadtree includes multiple subtrees, and each subtree corresponds to a subtree area in the screen area. Next, the published bullet comments located in the subtree area of each subtree at the current moment are determined. Then, for at least one subtree in the quadtree, a bullet comment publishing area for publishing the bullet comment is determined from the subtree area corresponding to at least one subtree by performing collision detection between the bullet comment to be published and the published bullet comments in the subtree area corresponding to the subtree. Finally, the bullet comment to be published is published in the bullet comment publishing area.
[0022] Thus, based on the candidate tracks determined by the attributes of the bullet comments to be published, the candidate tracks are further divided into regions according to the quadtree principle to obtain subtree regions in the candidate tracks. Collision detection is then performed between the bullet comments to be published and the published bullet comments in the subtree regions. Compared with the collision detection process within the tracks, this greatly reduces the amount of data involved in collision detection, improves the collision detection efficiency for bullet comments to be published, and ensures the real-time publication of bullet comments, thereby enhancing the real-time interactive experience for users. Attached Figure Description
[0023] Figure 1 This is a schematic diagram of the architecture of the bullet screen publishing system provided in the embodiments of this application;
[0024] Figure 2 This is a schematic diagram of the structure of the bullet screen publishing device provided in the embodiments of this application;
[0025] Figure 3This is an optional flowchart illustrating the bullet screen publishing method provided in the embodiments of this application;
[0026] Figure 4 This is another optional flowchart illustrating the bullet screen publishing method provided in the embodiments of this application;
[0027] Figure 5 This is a schematic diagram illustrating the determination of multiple target subtree regions provided in an embodiment of this application;
[0028] Figure 6 This is another schematic diagram illustrating the determination of multiple target subtree regions provided in the embodiments of this application;
[0029] Figure 7 This is a schematic diagram illustrating the determination of the collision candidate list provided in an embodiment of this application;
[0030] Figure 8 This is a schematic diagram illustrating the final effect of bullet comments displayed in the video playback area provided in this embodiment of the application;
[0031] Figure 9 This is a schematic diagram of the overall technical flow of the bullet screen publishing method provided in the embodiments of this application;
[0032] Figure 10 This is a schematic diagram illustrating the specific implementation of the allocation track provided in the embodiments of this application;
[0033] Figure 11 This is a schematic diagram illustrating the implementation flow of the quadtree insertion function provided in this application embodiment;
[0034] Figure 12 This is a schematic diagram illustrating the implementation process of the quadtree removal function provided in this application embodiment;
[0035] Figure 13 This is a schematic diagram illustrating the implementation process of the collision detection function between new and existing bullet comments within a quadtree provided in this application embodiment;
[0036] Figure 14 This is a schematic diagram illustrating the implementation process of the function for querying the position of new bullet comments that do not intersect with existing bullet comments, provided in an embodiment of this application.
[0037] Figure 15 This is a schematic diagram illustrating the implementation process of the collision detection function provided in the embodiments of this application. Detailed Implementation
[0038] To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limitations on this application. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0039] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments, but it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0040] If the application documents contain similar descriptions such as "first / second", the following explanation shall be added: In the following description, the terms "first / second / third" are used only to distinguish similar objects and do not represent a specific order of objects. It is understood that "first / second / third" may be interchanged in a specific order or sequence where permitted, so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein.
[0041] In this application embodiment, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.
[0042] Unless otherwise defined, all technical and scientific terms used in the embodiments of this application have the same meaning as commonly understood by one of ordinary skill in the art. The terminology used in the embodiments of this application is for the purpose of describing the embodiments of this application only and is not intended to limit this application.
[0043] In the implementation of this application, the collection and processing of relevant data should strictly comply with the requirements of relevant national laws and regulations, obtain the informed consent or separate consent of the personal information subject, and carry out subsequent data use and processing within the scope of laws and regulations and the authorization of the personal information subject.
[0044] Before providing a further detailed description of the embodiments of this application, the nouns and terms involved in the embodiments of this application will be explained, and the nouns and terms involved in the embodiments of this application shall be interpreted as follows.
[0045] 1) Track: It can be understood as a series of horizontal bands on the screen, used to contain and manage bullet comments.
[0046] 2) Quad-tree: A quad-tree is a tree-like data structure where each node has four sub-blocks. A quad-tree divides data into four quadrants, and the data range can be regions, points, lines, or curves. Based on data type, quad-trees can typically be classified as: quad-tree blocks, point quad-trees, and edge quad-trees.
[0047] 3) Quadtree for Axis-Aligned Bounding Boxes (AABBs): This is an application of quadtrees specifically designed for storing and retrieving objects within rectangular regions. Quadtree blocks recursively divide a two-dimensional space into four quadrants, each of which can be further subdivided into smaller quadrants. This hierarchical structure allows quadtree blocks to efficiently store and retrieve rectangular region objects. When a region object needs to be inserted into the quadtree, the quadtree automatically assigns it to the appropriate quadrant. If the number of objects in a quadrant exceeds a preset maximum capacity, that quadrant is subdivided into four sub-quadrants, thus achieving dynamic spatial partitioning. Due to this characteristic, quadtree blocks are frequently used in fields such as computer graphics, game development, and geographic information systems.
[0048] 4) Collision Detection: This is an important concept in computer graphics, game development, and physics simulation. It refers to the process of determining whether two or more objects (such as game characters, bullet patterns, sprites, etc.) are in contact or overlapping in space. Simply put, collision detection is detecting whether objects collide.
[0049] 5) Bullet Screen: A form of online video and live streaming interaction that allows viewers to send comments in real time while watching videos or live streams. It provides a way for viewers to participate and interact in real time, enabling them to share opinions, emotions, and viewing experiences. Bullet screens can be text, emoticons, images, or even animations, and are typically displayed in different colors, fonts, and speeds to enhance visual appeal and engagement. These comments are displayed in various forms; common examples include scrolling text appearing on the screen alongside the video content, and continuous bullet screen effects.
[0050] The bullet comment (danmaku) publishing schemes in related technologies are mainly based on the track principle. This principle involves selecting the optimal publishing track by comparing the display duration of the bullet comment to be published with the display duration of existing bullet comments on candidate tracks. When a bullet comment needs to be published, at least one bullet comment track that conforms to the format of the bullet comment to be published is first selected as a candidate track. Then, the display duration of the bullet comment content currently displayed in each candidate track is calculated, obtaining the first duration for each candidate track. Simultaneously, the display duration of the bullet comment content when it is located on each candidate track is calculated, obtaining the second duration for each candidate track. Next, the second duration and the first duration of each candidate track are compared, and the candidate track with the second duration greater than the first duration is selected as the target track. This means that tracks where the display duration of the bullet comment to be published exceeds the display duration of existing bullet comments are selected. Finally, the bullet comment to be published is displayed on the target track. It is evident that these technologies primarily rely on the display duration of bullet comments to select the publishing track, rather than accurately detecting collisions between bullet comments, which may lead to the overlapping and overlay of bullet comments. Furthermore, because track-based bullet comment publishing schemes divide the screen into a fixed number of tracks, this can lead to low track utilization. For example, if a bullet comment on a track has already left the screen, but the display duration of the bullet comment to be published is still less than the display duration of the already published bullet comments, then the bullet comment to be published may not be displayed on that track. Track-based bullet comment publishing schemes restrict bullet comments to fixed tracks, reducing the flexibility of bullet comment display. For example, a user may want to display a bullet comment in a specific location, but this cannot be achieved due to track limitations.
[0051] Based on at least one of the aforementioned technical problems in related technologies, this application provides a spatial partitioning structure combining tracks and quadtree blocks, enabling rapid collision detection for bullet comments to be published. The application of the track principle simplifies the complexity of collision detection, as collisions only need to be detected within the same track, rather than across the entire screen. The application of the quadtree principle further improves the efficiency of collision detection, as it only needs to check published bullet comments in the quadtree subtrees intersecting the boundary of the bullet comment to be published, instead of traversing all published bullet comments on the entire track and finally determining whether a collision will occur based on the display duration of each bullet comment. The combined application of the track and quadtree principles allows for more accurate detection and management of bullet comment collisions within a track, thus allowing more bullet comments to be arranged on the same track and significantly improving the aesthetics of bullet comment display. Furthermore, even if a track already contains bullet comments, as long as there is no collision between the bullet comment to be published and the already published bullet comments, the bullet comment to be published can still be displayed on that track, making the display position of the bullet comments more flexible and aesthetically pleasing.
[0052] The following describes exemplary applications of the bullet screen publishing device (i.e., electronic device) provided in this application embodiment. The device provided in this application embodiment can be implemented as various types of terminals such as laptops, tablets, desktop computers, set-top boxes, smartphones, smart speakers, smartwatches, smart TVs, and vehicle terminals, or it can be implemented as a server. The following will describe exemplary applications when the bullet screen publishing device is implemented as a server.
[0053] See Figure 1 , Figure 1 This is a schematic diagram of the architecture of the bullet screen publishing system 100 provided in this application embodiment. In order to support a bullet screen publishing application, the bullet screen publishing application runs on the terminal 400. The terminal 400 connects to the server 200 through the network 300. The network 300 can be a wide area network or a local area network, or a combination of the two.
[0054] Terminal 400 is used to send a bullet screen publishing request for the current virtual scene to server 200. Server 200 constitutes the bullet screen publishing device of this application embodiment. Server 200 is used to respond to the bullet screen publishing request for the bullet screen to be published, obtain the bullet screen attributes of the bullet screen to be published; based on the bullet screen attributes, determine the candidate track of the bullet screen to be published in the screen area and the quadtree corresponding to the candidate track; the quadtree includes multiple subtrees, and each subtree corresponds to a subtree area in the screen area; determine the published bullet screens located in the subtree area of each subtree at the current time; for at least one subtree in the quadtree, perform collision detection between the bullet screen to be published and the published bullet screens in the subtree area of the subtree, and obtain the collision detection result; based on the collision detection result, determine the bullet screen publishing area for publishing the bullet screen to be published from the subtree area corresponding to at least one subtree; publish the bullet screen to be published in the bullet screen publishing area, and obtain the bullet screen publishing result. After receiving the bullet screen posting result, server 200 returns the bullet screen posting result to terminal 400 so that terminal 400 can display the bullet screen posting result or continue to perform the next business processing based on the bullet screen posting result.
[0055] In some embodiments, server 200 may be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms. Terminal 400 may be a smartphone, tablet, laptop, desktop computer, smart speaker, smartwatch, in-vehicle terminal, etc., but is not limited to these. The terminal and server can be directly or indirectly connected via wired or wireless communication, which is not limited in this embodiment.
[0056] See Figure 2 , Figure 2 This is a schematic diagram of the structure of the electronic device 40 provided in the embodiment of this application. Figure 2 The illustrated electronic device 40 can be a bullet screen display device, which includes at least one processor 410, a memory 450, at least one network interface 420, and a user interface 430. The various components of the bullet screen display device are coupled together via a bus system 440. It is understood that the bus system 440 is used to implement communication between these components. In addition to a data bus, the bus system 440 also includes a power bus, a control bus, and a status signal bus. However, for clarity, in… Figure 2 The general labeled all buses as Bus System 440.
[0057] The processor 410 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor, etc.
[0058] User interface 430 includes one or more output devices 431 that enable the presentation of media content, including one or more speakers and / or one or more visual displays. User interface 430 also includes one or more input devices 432, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.
[0059] The memory 450 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state storage, hard disk drives, optical disk drives, etc. The memory 450 may optionally include one or more storage devices physically located away from the processor 410.
[0060] The memory 450 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), and the volatile memory may be random access memory (RAM). The memory 450 described in this application embodiment is intended to include any suitable type of memory.
[0061] In some embodiments, memory 450 is capable of storing data to support various operations, examples of which include programs, modules, and data structures or subsets or supersets thereof, as illustrated below.
[0062] Operating system 451 includes system programs for handling various basic system services and performing hardware-related tasks, such as the framework layer, core library layer, driver layer, etc., for implementing various basic business functions and handling hardware-based tasks;
[0063] The network communication module 452 is used to reach other electronic devices via one or more (wired or wireless) network interfaces 420, exemplary network interfaces 420 including: Bluetooth, WiFi, and Universal Serial Bus (USB), etc.
[0064] Presentation module 453 is configured to enable the presentation of information (e.g., a user interface for operating peripheral devices and displaying content and information) via one or more output devices 431 (e.g., a display screen, a speaker, etc.) associated with user interface 430;
[0065] The input processing module 454 is used to detect and translate one or more user inputs or interactions from one or more input devices 432.
[0066] In some embodiments, the apparatus provided in this application can be implemented in software. Figure 2 A bullet screen publishing device 455 stored in memory 450 is shown. This device can be software in the form of programs or plugins, and includes the following software modules: an acquisition module 4551, a subtree region determination module 4552, a published bullet screen determination module 4553, a collision detection module 4554, a bullet screen publishing region determination module 4555, and a bullet screen publishing module 4556. These modules are logically connected and can therefore be arbitrarily combined or further divided according to their implemented functions. The functions of each module will be described below.
[0067] In other embodiments, the apparatus provided in this application can be implemented in hardware. As an example, the apparatus provided in this application can be a processor in the form of a hardware decoding processor, which is programmed to execute the bullet screen publishing method provided in this application. For example, the processor in the form of a hardware decoding processor can be one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs), or other electronic components.
[0068] In some embodiments, the terminal or server can implement the bullet screen publishing method provided in this application by running various computer-executable instructions or computer programs. For example, computer-executable instructions can be microprogram-level commands, machine instructions, or software instructions. Computer programs can be native programs or software modules in an operating system; they can be native applications (APPs), i.e., programs that need to be installed in the operating system to run, or they can be applets that can be embedded in any APP, i.e., programs that only need to be downloaded to a browser environment to run. In summary, the aforementioned computer-executable instructions can be any form of instruction, and the aforementioned computer programs can be any form of application, module, or plugin.
[0069] The bullet screen publishing methods provided in the embodiments of this application can be executed by an electronic device, which can be a server or a terminal. That is, the bullet screen publishing methods in the embodiments of this application can be executed by a server, by a terminal, or by interaction between a server and a terminal.
[0070] See Figure 3 , Figure 3 This is an optional flowchart illustrating the bullet screen posting method provided in this application embodiment, which will be combined with... Figure 3 The steps shown will be explained, taking the execution entity of the bullet screen posting method as a server as an example. The method includes the following steps S101 to S106:
[0071] Step S101: In response to the request to publish a bullet comment, obtain the bullet comment attributes of the bullet comment to be published.
[0072] In this embodiment, a pending bullet comment refers to a bullet comment that a user has entered into the bullet comment system on the video content currently displayed on the screen, but which is not yet shown on the screen. Generally, a pending bullet comment undergoes a series of processing steps by the server, and is sorted and its display time is set according to certain rules before being displayed on the screen at an appropriate time. For example, when watching a live broadcast, if a user wants to send a bullet comment like "This music is so good," after entering the text in the text box and clicking the send button, the bullet comment is submitted to the server and enters a pending state. The pending bullet comment will undergo a series of processing steps within a certain time and be displayed on the screen at an appropriate time, allowing other users to see the bullet comment and interact with the publisher. A bullet comment publishing request refers to a request sent by a user to the server after entering and submitting bullet comment content on a video player or live streaming platform. This bullet comment publishing request can include the bullet comment content entered by the user, the sender's user information, and possible publishing location and time information, i.e., the bullet comment attributes of the pending bullet comment.
[0073] In response to a bullet comment publishing request, the server retrieves the bullet comment attributes corresponding to the request. This means the publishing request includes the bullet comment attributes. When a user inputs a bullet comment through the client, the client packages these attributes into a single publishing request and sends it over the network to the bullet comment publishing server. Upon receiving the publishing request, the server directly loads the bullet comment attributes.
[0074] Step S102: Based on the bullet screen attributes, determine the candidate tracks of the bullet screen to be published in the screen area and the quadtree corresponding to the candidate tracks.
[0075] In this embodiment, the attributes of the bullet comments to be published can include bullet comment content, bullet comment size, bullet comment type, and bullet comment position. A screen area refers to a specific area used to display bullet comment content. For example, in a video player, the screen area can be set to the top area, bottom area, or the entire area of the video frame, and this screen area can display multiple bullet comments. To ensure that the bullet comment content is displayed clearly and orderly within the screen area, the screen area can be divided into multiple tracks. Tracks typically refer to vertical or horizontal lines within the screen area used to display bullet comments. Candidate tracks refer to idle tracks among the multiple tracks that can be used to publish bullet comments.
[0076] In some embodiments, the candidate tracks for a to-be-published bullet comment within the screen area can be determined based on its attributes. One method is to determine the candidate tracks based on the bullet comment type. For example, the bullet comment type could be a regular bullet comment, an administrator bullet comment, a system notification, etc., and different bullet comment types can be assigned to different candidate tracks. For instance, administrator bullet comments and system notification bullet comments can be assigned to the top or bottom candidate tracks of the screen area, respectively, so that the user can quickly notice them; regular bullet comments can be assigned to the middle candidate track of the screen area. Another method is to determine the candidate tracks based on the bullet comment size. The bullet comment size refers to the font size of the bullet comment text and the number of characters in the bullet comment text. The size of the bullet comment to be published can be used to determine its boundary. By traversing each track in the screen area, it's determined if there's a free space for publishing the comment. Tracks with free spaces greater than or equal to the bullet comment's boundary are identified as candidate tracks. Another method is to determine candidate tracks based on the bullet comment's position in the screen area. This position can be a user-defined display location. The track corresponding to the bullet comment's position is determined. If the track is a free space available for publishing the comment, it's identified as a candidate track. If not, the position can be changed to further determine candidate tracks based on the bullet comment's type or size.
[0077] A quadtree is a spatially partitioned data structure used for efficient management, retrieval, and collision detection of bullet comments within candidate tracks. Within a screen area, a candidate track corresponds to a track region, and the boundary of the quadtree corresponding to that track region is the same. Based on the quadtree, a track region can be divided into four subtree regions corresponding to the four subtrees of the quadtree. Each subtree region can then be recursively divided into four regions, until the maximum depth of the quadtree is reached. This ensures that the quadtree corresponding to a candidate track includes multiple subtrees, and each subtree corresponds to a subtree region within the screen area.
[0078] Here, by determining the candidate tracks and corresponding quadtrees of the bullet comments to be published within the screen area, the subsequent collision detection between the bullet comments to be published and the published bullet comments can be improved by further dividing the space based on the candidate tracks, according to the quadtree principle. That is, collision detection only needs to be performed within the subtree area of the candidate track, rather than the entire track area, thus simplifying the complexity of collision detection.
[0079] Step S103: Determine the published bullet comments located in the subtree region of each subtree at the current moment.
[0080] In this embodiment, the quadtree corresponding to the candidate track includes multiple subtrees, and each subtree corresponds to a subtree region in the screen area. Each subtree region can include multiple published bullet comments at the current moment, which are bullet comments that have been published at the current moment and are being displayed in the subtree region.
[0081] Here, by determining the published comments in each of the multiple subtree regions located in the candidate track at the current moment, it is convenient to directly determine the subtree region where the comment to be published is located from the multiple subtree regions during the collision detection process, and obtain the published comments in the subtree region where the comment to be published is located at the current moment. This makes collision detection only need to be performed in the subtree region where the comment to be published is located, thereby improving the collision detection efficiency.
[0082] Step S104: For at least one subtree in the quadtree, perform collision detection on the published bullet comments in the subtree region corresponding to the bullet comment to be published, and obtain the collision detection result.
[0083] In this embodiment, collision detection refers to determining whether two or more bullet comments overlap on a screen area using a specific collision detection algorithm or data structure. The collision detection result is the result obtained after performing collision detection between the bullet comment to be published and at least one published bullet comment in a subtree region corresponding to a subtree. This subtree region is the subtree region where the bullet comment to be published is located. The bullet comment to be published may be located in only one subtree region or simultaneously in multiple subtree regions. The collision detection result includes two cases: one is that after collision detection, the bullet comment to be published will collide with any published bullet comment currently located in that subtree region; the other is that after collision detection, the bullet comment to be published will not collide with any published bullet comment currently located in that subtree region.
[0084] When performing collision detection on the published comments in the subtree region corresponding to the subtree to be published, the subtree region where the comment to be published is located is first determined. This subtree region may be one subtree region or multiple subtree regions, and the subtree region where the comment to be published is located is determined as the target subtree region for collision detection. Then, the published comments included in the target subtree region at the current moment are determined. Finally, the collision detection is performed between the comment to be published and the published comments in the target subtree region to obtain the collision detection result.
[0085] Here, the collision detection process in the subtree region facilitates the rapid determination of the bullet comment publishing area in the subtree region based on the collision detection results, ensuring the real-time publication of bullet comments and thus improving the user's real-time interactive experience.
[0086] Step S105: Based on the collision detection results, determine the bullet comment publishing area from the subtree region corresponding to at least one subtree for publishing the bullet comment to be published.
[0087] In this embodiment, the bullet screen publishing area refers to the area on the screen that can be used to publish bullet screens, where the bullet screen to be published can be fully displayed and the bullet screen to be published will not collide with other published bullet screens. At least one subtree corresponds to the subtree area where the bullet screen to be published is located, i.e., the target subtree area mentioned above.
[0088] If the collision detection results indicate that the bullet comment to be published does not collide with any published bullet comments in the target subtree region, a bullet comment publishing area is determined from the target subtree region for publishing the bullet comment to be published; that is, the current bullet comment region where the bullet comment to be published is located is determined as the bullet comment publishing area for publishing the bullet comment to be published. If the collision detection results indicate that the bullet comment to be published collides with any published bullet comments in the target subtree region, the current bullet comment position or current bullet comment speed can be updated. After updating the current bullet comment position or current bullet comment speed, collision detection is performed again until the bullet comment to be published does not collide with any published bullet comments in the target subtree region within the current bullet comment region where the bullet comment to be published is located. At this point, collision detection stops, and the current bullet comment region is determined as the bullet comment publishing area for publishing the bullet comment to be published.
[0089] Here, the bullet comment publishing area is obtained based on the collision detection results, which facilitates the efficient publishing of bullet comments in this area and improves the user experience.
[0090] Step S106: Post the bullet comments to be posted in the bullet comment posting area.
[0091] In this embodiment, after determining the bullet comment publishing area through collision detection, the bullet comment can be published in that area, resulting in a bullet comment publishing result. The bullet comment publishing result can be the display effect of the bullet comment. Based on the design and settings of the bullet comment, the content is displayed in an appropriate manner within the screen area, which may include adjustments to the font style, color, speed, etc., of the bullet comment. Based on the bullet comment publishing result, the bullet comment will be displayed in the client's screen area without colliding with other published bullet comments in that area, allowing users to participate in the video viewing experience, interact with other viewers in real time, and enhance the user's real-time interactive experience.
[0092] The bullet screen publishing method provided in this application embodiment firstly obtains the bullet screen attributes of the bullet screen to be published in response to a bullet screen publishing request; based on the bullet screen attributes, it determines the candidate track of the bullet screen to be published in the screen area and the quadtree corresponding to the candidate track, the quadtree including multiple subtrees, each subtree corresponding to a subtree area in the screen area; then, it determines the published bullet screens located in the subtree area of each subtree at the current time; then, for at least one subtree in the quadtree, it determines the bullet screen publishing area for publishing the bullet screen to be published from the subtree area corresponding to at least one subtree by performing collision detection between the bullet screen to be published and the published bullet screens in the subtree area corresponding to the subtree; finally, it publishes the bullet screen to be published in the bullet screen publishing area. Thus, based on the candidate tracks determined by the attributes of the bullet comments to be published, the candidate tracks are further divided into regions according to the quadtree principle to obtain subtree regions in the candidate tracks. Collision detection is then performed between the bullet comments to be published and the published bullet comments in the subtree regions. Compared with the collision detection process within the tracks, this greatly reduces the amount of data involved in collision detection, improves the collision detection efficiency for bullet comments to be published, and ensures the real-time publication of bullet comments, thereby enhancing the real-time interactive experience for users.
[0093] The following will describe the bullet screen publishing method in this application embodiment in conjunction with the interaction between the terminal and the server in the bullet screen publishing system. It should be noted that the bullet screen publishing method here is a bullet screen publishing method implemented through interaction between the terminal and the server, which is essentially the same as the bullet screen publishing method executed by the server in the above embodiments. The only difference is that this application embodiment also describes the actions performed by the terminal during the execution of the bullet screen publishing method. Furthermore, some steps can be executed by either the terminal or the server. Therefore, for steps in this embodiment that are the same as those in the above embodiments but have different execution subjects, this embodiment is only illustrative. In the implementation process, they can be executed by any execution subject, and this application embodiment does not limit this.
[0094] Figure 4 This is another optional flowchart illustrating the bullet screen posting method provided in the embodiments of this application, such as... Figure 4 As shown, the method includes the following steps S201 to S214:
[0095] Step S201: The terminal receives the user's input for the bullet screen publishing operation.
[0096] In this embodiment, the user can be either the developer or the user of the bullet comment publishing application. The user can input the bullet comment content to be published into the client of the bullet comment publishing application to generate a bullet comment publishing operation for that bullet comment. The bullet comment publishing application can provide a bullet comment publishing function, on which the user can input the bullet comment content to be published into the bullet comment publishing function page to generate a bullet comment publishing operation for that bullet comment, thereby triggering a bullet comment publishing request for that bullet comment.
[0097] In some embodiments, when a user inputs the action to publish a bullet comment, they can also simultaneously input the bullet comment's attributes. Upon receiving these attributes, the terminal will display a confirmation window on the bullet comment publishing function page. After the terminal detects that the user has clicked the confirmation button, the bullet comment is published based on its attributes. Alternatively, in other embodiments, the user can directly input the bullet comment's attributes on the bullet comment publishing function page. Upon receiving these attributes, the terminal can directly trigger the bullet comment publishing function and then publish the bullet comment based on those attributes. Or, in other embodiments, when the terminal receives the user's input to publish a bullet comment, it directly retrieves the bullet comment's attributes from the bullet comment publishing application's backend and then publishes the bullet comment based on those attributes.
[0098] In step S202, the terminal responds to the bullet screen publishing operation by generating a bullet screen publishing request.
[0099] In this embodiment, user-inputted data can be encapsulated into the bullet comment publishing request. For example, the bullet comment attributes to be published are displayed on the bullet comment publishing application's display interface. Users can select or change the data according to their actual needs, and then the bullet comment attributes input by the user are encapsulated into the bullet comment publishing request.
[0100] In step S203, the terminal sends a request to the server to publish the bullet comments to be published.
[0101] Step S204: The server responds to the bullet comment publishing request for the bullet comment to be published and obtains the bullet comment attributes of the bullet comment to be published.
[0102] In this embodiment of the application, in response to a bullet comment publishing request for a bullet comment to be published, if the bullet comment publishing request encapsulates the bullet comment attributes of the bullet comment to be published, the bullet comment attributes of the bullet comment to be published can be directly parsed and obtained. For the specific meaning and implementation method of the step of obtaining the bullet comment attributes of the bullet comment to be published in response to a bullet comment publishing request, please refer to the description of step S101 above, which will not be repeated here.
[0103] In step S205, the server determines the candidate tracks and corresponding quadtrees of the bullet comments to be published in the screen area based on the bullet comment attributes.
[0104] In this embodiment, the quadtree corresponding to the candidate track includes multiple subtrees, and each subtree corresponds to a subtree area in the screen area. For the specific meaning and implementation of the step of determining the candidate track and the corresponding quadtree of the candidate track in the screen area based on the bullet screen attributes, please refer to the description of step S102 above, which will not be repeated here.
[0105] Step S206: The server determines the published bullet comments located in the subtree region of each subtree at the current moment.
[0106] In this embodiment of the application, the specific meaning and implementation of the step of determining the published bullet comments located in the subtree region of each subtree at the current moment can be found in the description of step S103 above, and will not be repeated here.
[0107] Step S207: The server obtains the boundaries of the bullet comments to be published.
[0108] In this embodiment, the boundaries of the bullet comments to be published include the left boundary, right boundary, top boundary, and bottom boundary. Here, obtaining the boundaries of the bullet comments to be published facilitates the subsequent rapid determination of the target subtree region for publishing the bullet comments from multiple subtree regions based on these boundaries.
[0109] In step S208, the server determines at least one target subtree region for publishing the bullet screen based on the bullet screen boundary and the region boundary of the subtree region corresponding to each subtree in at least one subtree.
[0110] In this embodiment, the target subtree region is the subtree region used to publish the bullet comments to be published, and the target subtree region is also the subtree region for collision detection of the bullet comments to be published and the published bullet comments. The target subtree region determined based on the bullet comment boundary and the region boundary of the subtree region can be one or multiple.
[0111] In some embodiments, determining at least one target subtree region for publishing the bullet comment based on the bullet comment boundary and the region boundary of the subtree region corresponding to each subtree in at least one subtree can be achieved in the following way: For any subtree, if the left boundary of the bullet comment to be published is located to the right of the left boundary of the region corresponding to the subtree region, and the upper boundary of the bullet comment to be published is located below the upper boundary of the region corresponding to the subtree region, the positions of the right boundary and the lower boundary of the bullet comment to be published are determined; if the right boundary of the bullet comment to be published is located to the left of the right boundary of the region corresponding to the subtree region, and the lower boundary of the bullet comment to be published is located above the lower boundary of the region corresponding to the subtree region, the subtree region corresponding to the subtree is determined as a target subtree region for publishing the bullet comment to be published.
[0112] In other words, after determining the boundaries of the bullet comments to be published, for any subtree, if the left boundary of the bullet comments to be published is located to the right of the left boundary of the corresponding subtree region, the upper boundary of the bullet comments to be published is located below the upper boundary of the corresponding subtree region, the right boundary of the bullet comments to be published is located to the left of the right boundary of the corresponding subtree region, and the lower boundary of the bullet comments to be published is located above the lower boundary of the corresponding subtree region, then it indicates that the boundaries of the bullet comments to be published are contained within the boundary of the corresponding subtree region. That is, at the current moment, all the bullet comments to be published are located within this subtree region, and this subtree region can be determined as a target subtree region for publishing the bullet comments to be published.
[0113] In some embodiments, determining at least one target subtree region for publishing the bullet comment based on the bullet comment boundary and the region boundary of the subtree region corresponding to each subtree in at least one subtree can also be achieved in the following ways: For any subtree, if the left boundary of the bullet comment to be published is located to the right of the left boundary of the region corresponding to the subtree region of the subtree, and the upper boundary of the bullet comment to be published is located below the upper boundary of the region corresponding to the subtree region of the subtree, the positions of the right boundary and the lower boundary of the bullet comment to be published are determined; if the right boundary of the bullet comment to be published is located to the left of the right boundary of the region corresponding to the subtree region of any other subtree to the right of the subtree region, and the lower boundary of the bullet comment to be published is located above the lower boundary of the region corresponding to the subtree region of other subtrees, the subtree, other subtrees, and all subtree regions corresponding to the subtrees connecting the subtree and other subtrees are determined as multiple target subtree regions for publishing the bullet comment to be published.
[0114] In other words, when the bullet comment to be published is placed horizontally on the screen, after determining the boundaries of the bullet comment, for any subtree, if the left boundary of the bullet comment to be published is to the right of the left boundary of the corresponding subtree region, the upper boundary of the bullet comment to be published is below the upper boundary of the corresponding subtree region, the right boundary of the bullet comment to be published is to the left of the right boundary of the corresponding subtree region of any other subtree to the right of the subtree region, and the lower boundary of the bullet comment to be published is above the lower boundary of the corresponding subtree region of any other subtree, then it indicates that the boundaries of the bullet comment to be published are contained within the boundaries of the corresponding subtree regions of multiple subtrees. That is, at the current moment, the part of the bullet comment to be published is located within the subtree region of any one of the multiple subtrees. For example, see... Figure 5 , Figure 5 This is a schematic diagram illustrating the determination of multiple target subtree regions provided in an embodiment of this application. Figure 5 In the diagram, the boundary of the bullet comment 'a' to be published is contained within the boundaries of subtree region A, subtree region B, and subtree region C. That is, the subtree region corresponding to the subtree is subtree region C, the subtree region corresponding to other subtrees is subtree region A, and the subtree region corresponding to the subtree connecting the subtrees with other subtrees is subtree region B. Subtree region A, subtree region B, and subtree region C are multiple target subtree regions used to publish the bullet comment to be published.
[0115] In some embodiments, determining at least one target subtree region for publishing the bullet comment based on the bullet comment boundary and the region boundary of the subtree region corresponding to each subtree in at least one subtree can also be achieved in the following ways: For any subtree, if the left boundary of the bullet comment to be published is located to the right of the left boundary of the region corresponding to the subtree region of the subtree, and the upper boundary of the bullet comment to be published is located below the upper boundary of the region corresponding to the subtree region of the subtree, the positions of the right boundary and the lower boundary of the bullet comment to be published are determined; if the lower boundary of the bullet comment to be published is located above the lower boundary of the region corresponding to the subtree region of any other subtree below the subtree region, and the right boundary of the bullet comment to be published is located to the left of the right boundary of the region corresponding to the subtree region of other subtrees, the subtree, other subtrees, and all subtree regions corresponding to the subtrees connecting the subtree and other subtrees are determined as multiple target subtree regions for publishing the bullet comment to be published.
[0116] In other words, when the bullet comment to be published is vertically placed on the screen, after determining the boundaries of the bullet comment, for any subtree, if the left boundary of the bullet comment to be published is to the right of the left boundary of the corresponding subtree region, the upper boundary of the bullet comment to be published is below the upper boundary of the corresponding subtree region, the lower boundary of the bullet comment to be published is above the lower boundary of any other subtree region below the subtree region, and the right boundary of the bullet comment to be published is to the left of the right boundary of any other subtree region, then it indicates that the boundaries of the bullet comment to be published are contained within the boundaries of the corresponding subtree regions of multiple subtrees. That is, at the current moment, the part of the bullet comment to be published is located within the subtree region of any one of the multiple subtrees. For example, see... Figure 6 , Figure 6 This is another schematic diagram illustrating the determination of multiple target subtree regions provided in an embodiment of this application. Figure 6 In the diagram, the boundary of the bullet comment b to be published is contained within the boundaries of subtree region C, subtree region D, and subtree region F. That is, the subtree region corresponding to the subtree is subtree region C, the subtree region corresponding to other subtrees is subtree region F, and the subtree region corresponding to the subtree connecting the subtree and other subtrees is subtree region D. Subtree region C, subtree region D, and subtree region F are multiple target subtree regions used to publish the bullet comment to be published.
[0117] Here, when the boundary of the bullet comment to be published is contained within the boundary of two subtree regions, there may be no subtrees connecting the subtrees to other subtrees. When the boundary of the bullet comment to be published is contained within the boundary of more than two subtree regions, there are subtrees connecting the subtrees to other subtrees. Depending on the different placement methods and boundaries of the bullet comments within the screen area, there can be different ways to determine the target subtree region. No specific limitations are made here regarding the method for determining the target subtree region.
[0118] Step S209: The server generates a collision candidate list based on the published bullet comments located in the target subtree region at the current moment.
[0119] In this embodiment of the application, the collision candidate list is used for the collision detection process of the bullet screen to be published. The collision candidate list includes multiple published bullet screens that are collision detected with the bullet screen to be published during the collision detection process. The published bullet screens are the published bullet screens located in the target subtree region at the current moment.
[0120] In some embodiments, a collision candidate list is generated based on the published bullet comments located in the target subtree region at the current moment. This can be achieved by: determining all or part of the published bullet comments located in each target subtree region at the current moment; and adding the published bullet comments to the collision candidate list. In other words, the published bullet comments in the collision candidate list are all or part of the published bullet comments located in each target subtree region at the current moment.
[0121] For example, see Figure 7 , Figure 7 This is a schematic diagram illustrating the determination of the collision candidate list provided in an embodiment of this application. Figure 7 The target subtree region includes four subtree regions: subtree region A, subtree region B, subtree region C, and subtree region D. Subtree region A is the defined target subtree region. Published comments b and c are some of the published comments located in the target subtree region at the current moment. Published comments d and e are all of the published comments located in the target subtree region at the current moment. Therefore, the published comments in the collision candidate list are published comments b, c, d, and e. Published comment a is not included in the collision candidate list.
[0122] In step S210, the server performs collision detection on the bullet comments to be published based on the collision candidate list and obtains the collision detection results.
[0123] In this embodiment of the application, the collision detection result can be divided into two types: one is a result indicating that the bullet comment to be published does not collide with any published bullet comment in the collision candidate list, and the other is a result indicating that the bullet comment to be published collides with any published bullet comment in the collision candidate list.
[0124] In some embodiments, collision detection is performed on the bullet comments to be published based on the collision candidate list to obtain the collision detection results. This can be achieved by: determining at least one candidate publishing region from the target subtree region that can publish the bullet comments to be published; for each candidate publishing region, inserting the bullet comments to be published into the candidate publishing region, and then performing collision detection between the bullet comments to be published inserted into the candidate publishing region and each published bullet comment in the collision candidate list to obtain the collision detection results corresponding to each candidate publishing region.
[0125] Here, the candidate publishing area is the empty area in the target subtree region where the pending comment can be published. The method for determining a candidate publishing area is as follows: find an empty area in the target subtree region, insert the pending comment into the empty area, and then determine whether the pending comment overlaps with adjacent published comments. If the pending comment does not overlap with adjacent published comments, the empty area is determined as a candidate publishing area.
[0126] One method for determining whether a pending bullet comment will overlap with an adjacent published bullet comment is to: obtain the bullet comment boundary of the pending bullet comment, and obtain the first published bullet comment located to the left of the pending bullet comment from the published bullet comments in the target subtree region. If the left boundary of the pending bullet comment boundary is to the right of the right boundary of the first published bullet comment boundary, obtain the second published bullet comment located above the pending bullet comment from the published bullet comments; if the upper boundary of the pending bullet comment boundary is below the lower boundary of the second published bullet comment boundary, obtain the third published bullet comment located to the right of the pending bullet comment from the published bullet comments; if the right boundary of the pending bullet comment boundary is to the left of the left boundary of the third published bullet comment boundary, obtain the fourth published bullet comment located below the pending bullet comment from the published bullet comments; if the lower boundary of the pending bullet comment boundary is above the upper boundary of the fourth published bullet comment boundary, determine that the pending bullet comment does not overlap with an adjacent published bullet comment.
[0127] Specifically, for each candidate publishing area, after inserting the text to be published into the candidate publishing area, collision detection is performed between the text to be published inserted into the candidate publishing area and each published text in the collision candidate list to obtain the collision detection result corresponding to each candidate publishing area. This can be achieved as follows: For each candidate publishing area, after inserting the text to be published into the candidate publishing area, obtain the published texts that are horizontally adjacent to the text to be published, the current text position of the text to be published, and the current text speed of the text to be published from the collision candidate list; determine the text adjacent to the text to be published in the horizontal direction. The algorithm calculates the current position and speed of adjacent published comments; determines the horizontal distance between the comment to be published and its adjacent published comments based on the current position of the comment to be published and the current positions of adjacent published comments; determines the speed difference between the comment to be published and its adjacent published comments based on the current speed of the comment to be published and the current speed difference of adjacent published comments; determines the encounter probability between the comment to be published and its adjacent published comments based on the horizontal distance and speed difference; and determines the collision detection result corresponding to each candidate publishing area based on the encounter probability.
[0128] Here, the encounter probability refers to the probability that the bullet comment to be published will collide with an adjacent published bullet comment in the horizontal direction during its movement within the screen area. After determining the candidate publishing area, the bullet comment to be published is inserted into the candidate publishing area, and it is determined whether the bullet comment to be published will collide with an adjacent published bullet comment in the horizontal direction during its movement within the screen area. Therefore, it is necessary to determine the horizontal distance between the bullet comment to be published and the adjacent published bullet comments based on the current position of the bullet comment to be published and the current position of the adjacent published bullet comments, and to determine the speed difference between the bullet comment to be published and the adjacent published bullet comments based on the current speed of the bullet comment to be published and the current speed of the adjacent published bullet comments. Based on the known horizontal distance and speed difference between the bullet comment to be published and the adjacent published bullet comments, it can be determined whether the bullet comment to be published will collide with an adjacent published bullet comment in the horizontal direction during its movement within the screen area, that is, the encounter probability can be determined. When the encounter probability is greater than 0, it means that the bullet comment to be published will collide with the adjacent published bullet comment in the horizontal direction during its movement within the screen area; when the encounter probability is equal to 0, it means that the bullet comment to be published will not collide with the adjacent published bullet comment in the horizontal direction during its movement within the screen area, thus obtaining the collision detection result corresponding to each candidate publishing area.
[0129] Here, based on the horizontal distance and speed difference between the bullet comment to be published and the adjacent published bullet comments, it is possible to quickly determine whether the bullet comment to be published will collide with the adjacent published bullet comments in the horizontal direction during its movement within the screen area.
[0130] Step S211: Based on the collision detection results, the server determines the bullet screen publishing area for publishing bullet screens from the subtree area corresponding to at least one subtree.
[0131] In this embodiment, the subtree region corresponding to at least one subtree is the aforementioned target subtree region. Based on the collision detection results, the bullet comment publishing region for publishing the bullet comment to be published is determined from the subtree region corresponding to at least one subtree, which can be achieved in the following way: from the collision detection results corresponding to all candidate publishing regions, the candidate publishing regions that do not collide with each published bullet comment are determined as target candidate publishing regions; the bullet comment publishing region for publishing the bullet comment to be published is selected from the target candidate publishing regions.
[0132] Here, after determining the collision detection results corresponding to all candidate publishing regions, the collision detection results represent the candidate publishing regions where the published comment will not collide with each published comment in the target subtree region, and these candidate publishing regions are determined as the target candidate publishing regions. There can be multiple target candidate publishing regions. After determining the target candidate publishing regions, the best publishing region can be selected from the target candidate publishing regions based on the user's actual comment publishing needs; that is, the publishing region used to publish the comment to be published. For example, based on the user-defined initial comment position, the target candidate publishing region that satisfies or is closest to the initial comment position can be selected from multiple target candidate publishing regions, and this target candidate publishing region can be determined as the publishing region used to publish the comment to be published. Thus, determining the target candidate publishing region based on the collision detection results corresponding to each candidate publishing region allows for the rapid determination of the publishing region used to publish the comment to be published from the target candidate publishing regions.
[0133] In some embodiments, from the collision detection results corresponding to all candidate publishing regions, the candidate publishing regions that do not collide with each published barrage are determined as target candidate publishing regions. This can be achieved in the following way: For each candidate publishing region, if the collision detection result corresponding to the candidate publishing region indicates that the barrage to be published inserted into the candidate publishing region collides with an adjacent published barrage, the current barrage speed of the barrage to be published is updated to obtain the first barrage speed of the barrage to be published; if, based on the first barrage speed and the collision candidate list, it is determined that the barrage to be published does not collide with each published barrage in the collision candidate list, the candidate publishing region is determined as the target candidate publishing region.
[0134] Here, the current speed of the pending bullet comment is the speed at which the bullet comment can move on the screen area at the current moment, and the first bullet comment speed is the bullet comment speed after updating the current speed of the pending bullet comment. If the collision detection result corresponding to the candidate publishing area indicates that the pending bullet comment inserted into the candidate publishing area collides with an adjacent published bullet comment, the current bullet comment speed can be updated at least once by increasing or decreasing the current bullet comment speed. This allows collision detection to be performed on the pending bullet comment inserted into the candidate publishing area and its adjacent published bullet comments based on the updated first bullet comment speed. If the pending bullet comment inserted into the candidate publishing area does not collide with any published bullet comment in the collision candidate list, then the candidate publishing area is determined as the target candidate publishing area. If the pending bullet comment inserted into the candidate publishing area collides with any published bullet comment in the collision candidate list, then the candidate publishing area is excluded, meaning it cannot be determined as the target candidate publishing area.
[0135] By updating the current speed of the bullet comments to be published, a new method for determining the target candidate publishing area has been added, providing more options for determining the publishing area for bullet comments to be published, thereby improving the flexibility of bullet comment publishing.
[0136] Step S212: The server publishes the bullet comments to be published in the bullet comment publishing area and obtains the bullet comment publishing result.
[0137] In this embodiment of the application, the specific meaning and implementation method of the step of publishing the barrage to be published in the barrage publishing area and obtaining the barrage publishing result can be referred to the description of step S105 above, and will not be repeated here.
[0138] In some embodiments, after publishing a bullet comment to be published in the bullet comment publishing area, the bullet comment to be published can be determined as the currently published bullet comment in the target subtree area; the area boundary of the screen area and the bullet comment boundary of the currently published bullet comment are obtained; when the right boundary of the bullet comment boundary of the currently published bullet comment is located to the left of the left boundary of the screen area boundary area, or the lower boundary of the bullet comment boundary of the currently published bullet comment is located above the upper boundary of the screen area boundary area, the currently published bullet comment is removed from the target subtree area.
[0139] In other words, after a bullet comment is published in the bullet comment publishing area, its status in the target sub-region can be changed from "pending" to "published," meaning the bullet comment is now considered a published bullet comment in the target sub-region. At different times, the currently published bullet comment moves across the screen area at a certain speed. When the right boundary of the currently published bullet comment is to the left of the left boundary of the screen area's boundary region, it indicates that the currently published bullet comment has left the screen area during its right-to-left movement, and can be removed from the target sub-region, ensuring that it is not present in the target sub-region at the current moment. Alternatively, when the lower boundary of the currently published bullet comment is above the upper boundary of the screen area's boundary region, it indicates that the currently published bullet comment has left the screen area during its upward movement, and can also be removed from the target sub-region, ensuring that it is not present in the target sub-region at the current moment.
[0140] Here, by updating the published comments in the target subtree region, published comments that do not require collision detection are removed from the target subtree region. This ensures that when performing collision detection in the target subtree region, the comment to be published only needs to be collided with the published comments in the target subtree region at the current moment, thereby improving the accuracy of collision detection.
[0141] In step S213, the server sends the bullet screen posting result to the terminal.
[0142] Step S214: The terminal displays the result of the bullet screen posting.
[0143] In this embodiment, firstly, in response to a request to publish a bullet comment, the bullet comment attributes are obtained; based on the bullet comment attributes, candidate tracks for the bullet comment in the screen area are determined; then, the subtree region corresponding to each subtree in the quadtree corresponding to the candidate track in the screen area is determined, as well as the published bullet comments located in the subtree region at the current moment; then, a target subtree region for publishing the bullet comment is determined based on the bullet comment boundary and the region boundary of the subtree region, and a collision candidate list is generated based on the published bullet comments located in the target subtree region at the current moment; based on the collision candidate list, collision detection is performed on the bullet comment to be published to obtain a collision detection result; based on the collision detection result, a bullet comment publishing region for publishing the bullet comment is determined from at least one target subtree region; finally, the bullet comment to be published is published in the bullet comment publishing region. Thus, based on the candidate tracks determined based on the bullet comment attributes, the candidate tracks are further divided into regions based on the quadtree principle to obtain subtree regions in the candidate tracks. Furthermore, the target subtree region containing the bullet comment to be published is identified within the subtree region, and the collision candidate list includes published bullet comments located within the target subtree region. Collision detection is performed on the bullet comment to be published and the published bullet comments located within the target subtree region. Compared to the collision detection process within the track, the collision detection process within the target subtree region can significantly reduce the amount of bullet comment data involved in the collision detection, thereby improving the collision detection efficiency for the bullet comment to be published, ensuring the real-time publication of bullet comments, and enhancing the user's real-time interactive experience.
[0144] The following will describe an exemplary application of the embodiments of this application in a real-world application scenario.
[0145] This application provides a method for publishing bullet comments (danmaku). This method effectively avoids overlap of bullet comments during display, ensuring that users can clearly read each bullet comment and improving the viewing experience. Through a quadtree-based anti-collision detection algorithm, the position of bullet comments can be rationally allocated within the limited screen space, allowing them to be displayed as compactly as possible without collisions, thus improving screen utilization. This method can dynamically adjust the scrolling speed of bullet comments based on their density and screen space to ensure that they are fully displayed on the screen within a limited time, avoiding the problem of users being unable to read them due to excessive speed. During implementation, this method automatically adjusts the display effect of bullet comments based on the screen size and resolution of the user's device, ensuring a good viewing experience on different devices. See also... Figure 8 , Figure 8This is a schematic diagram of the final effect of bullet comments displayed in the video playback area provided in this application embodiment. It can be seen that when this solution is adopted, there will be no collision between bullet comments, and they can all be clearly displayed in the video area.
[0146] This method employs a spatial partitioning structure combining tracks and quadtree blocks to achieve rapid collision detection for bullet comments to be published. First, the screen area is divided into multiple horizontal tracks. An instance object is created for each track, containing its regional attributes such as the top-left corner coordinates, width, and height. Furthermore, the height of each track should be set according to the size of the bullet comments (the track height should be slightly larger than the maximum height of the bullet comments to ensure sufficient spacing). A quadtree instance object is also created for each track's corresponding quadtree, with its boundaries matching the track area. This quadtree is used to manage and detect bullet comment collisions within the track. Then, a fixed speed is assigned to each bullet comment to be published. This speed value can be adjusted based on the display duration of the bullet comment to ensure sufficient display time on the screen area. When a bullet comment needs to be displayed on the screen area, an idle track is selected, and then the quadtree of that track is queried for published bullet comments that may collide with the bullet comment. If the query result is empty, it means that the comment to be published will not collide with any published comments in the quadtree of the track, and the comment can be published. Otherwise, the position of the comment to be published needs to be adjusted, and the query needs to be performed again until a non-collision comment position is found. After finding the comment position, it is necessary to further check whether the speed of the comment to be published will collide with any published comments that have not been fully displayed in the future. If a collision will occur, the speed of the comment to be published can be reduced to ensure the anti-collision effect. However, if no free track can be found, you can choose to wait and insert the comment when a free track becomes available to ensure that there is no collision between comments. As the comments scroll on the track, the position of the comments in the quadtree needs to be updated periodically, which can be achieved by removing old comments and inserting new ones. During this process, the quadtree will automatically adjust its structure to adapt to the current data distribution of the comments. When a comment leaves the screen area, it needs to be removed from the quadtree of the corresponding track. In this way, collisions between comments are effectively avoided while maintaining high anti-collision detection performance.
[0147] See Figure 9 , Figure 9The diagram below illustrates the overall technical flow of the bullet comment publishing method provided in this application embodiment. The overall technical flow of the method is as follows: 01: Initialize bullet comments, quadtree, and track-related parameters: Set parameters such as the maximum number of bullet comments, speed range, and number of tracks. 02: Create corresponding quadtree and track instance objects according to the size of the video playback area. When a user sends a bullet comment, the bullet comment content is received. 03: Create a bullet comment object based on the received bullet comment content. The bullet comment object includes attributes such as the content, position, and speed of the bullet comment. This bullet comment object is the new bullet comment (i.e., the bullet comment to be published mentioned above). 04: Allocate a suitable track to the new bullet comment. The specific implementation diagram of track allocation is shown below. Figure 10 As shown, the final assigned track is track n. 05: Insert the new bullet comment into the quadtree corresponding to the assigned track, thereby checking whether the inserted bullet comment collides with existing bullet comments (i.e., the previously published bullet comments). 06: Check if the new bullet comment collides with existing bullet comments. 07: If a collision occurs, adjust the bullet comment parameters, such as the position or speed of the new bullet comment, or move the bullet comment to another track. 08: If no collision occurs, display the new bullet comment in the video playback area. 09: Update the position of the new bullet comment based on its speed. 10: When the new bullet comment completely leaves the video playback area, remove the displayed new bullet comment from the quadtree and the track.
[0148] When a quadtree instance is created, a quadtree class is constructed, using a constructor to initialize the quadtree's coordinates, range, depth, subtrees, and node properties. This quadtree class contains seven core functions: clear the quadtree, subdivide, contain (to determine if the quadtree boundary contains bullet comments), insert, remove, intersect (to detect collisions between new and existing bullet comments within the quadtree), and queryNonIntersectingRange (to find the position of a new bullet comment that does not collide with existing bullet comments).
[0149] The main principle of the `clear` function for clearing a quadtree is as follows: First, clear the list of nodes in the current quadtree (`this.nodes = []`). Then, traverse the subtrees of the quadtree and recursively call the `clear` method in each subtree to clear its list (`this.children = []`).
[0150] The main principle of the subdivide function is as follows: First, calculate the width and height of the subtree (which are half the width and height of the current quadtree, respectively). Then, calculate the depth of the subtree (the depth of the current quadtree plus 1). Finally, create four subtrees and add them to the subtree list of the current quadtree.
[0151] The main principle behind determining whether a quadtree boundary contains the bullet comments (contains) function is as follows: Check if the left boundary of the bullet comments is to the right of the left boundary of the quadtree; check if the top boundary of the bullet comments is below the top boundary of the quadtree; check if the right boundary of the bullet comments is to the left of the right boundary of the quadtree; check if the bottom boundary of the bullet comments is above the bottom boundary of the quadtree. If all four conditions are met, return success (the quadtree boundary contains the bullet comments); otherwise, return failure (the quadtree boundary does not contain the bullet comments). Specifically, danmaku.x >= this.x && danmaku.y >= this.y && danmaku.x + danmaku.width <= this.x + this.width && danmaku.y + danmaku.height <= this.y + this.height.
[0152] The flowchart of the quadtree insertion function (insert) is shown below. Figure 11 As shown, the specific implementation process of this function is as follows: 11: Check if the quadtree depth has reached the maximum depth; 12: If the maximum depth has been reached, directly add the bullet comment to the current quadtree node list; 13: If the maximum depth has not been reached, continue to check if the quadtree has subtrees; 14: If there are no subtrees, create subtrees first; 15: Traverse the subtrees; 16: Determine if the bullet comment is within the boundary range of a certain subtree; 17: If the bullet comment is within the boundary range of a certain subtree, insert the bullet comment into the node of that subtree; if the bullet comment is not within the boundary range of any subtree (i.e., the position or size of the bullet comment prevents it from being completely within the boundary range of any subtree), return to step 12, that is, add the bullet comment to the current quadtree node list.
[0153] The flowchart of the quadtree removal function (remove) is shown below. Figure 12 As shown, the specific implementation process of this function is as follows: 001: Check if the current quadtree has a subtree; 002: If there is no subtree, remove the bullet comment directly from the current quadtree node list; 003: If there is a subtree, traverse the subtree; 004: Remove the bullet comment from the subtree corresponding to the boundary range where the bullet comment is located.
[0154] Furthermore, the flowchart of the collision detection function (intersect) between new and existing bullet patterns within a quadtree is shown below. Figure 13As shown, the specific implementation flow of this function is as follows: 100: Check if the right boundary of the new bullet screen is to the left of the left boundary of the existing bullet screen located to the right of the new bullet screen. 101: If this condition is met, it means that the new bullet screen and the existing bullet screen do not overlap horizontally, and therefore they do not intersect. Check if the lower boundary of the new bullet screen is above the upper boundary of the existing bullet screen located below the new bullet screen. 102: If this condition is met, it means that the new bullet screen and the existing bullet screen do not overlap vertically, and therefore they do not intersect. Check if the left boundary of the new bullet screen is to the right of the right boundary of the existing bullet screen located to the left of the new bullet screen. 103: If this condition is met, it means that the new bullet screen and the existing bullet screen do not overlap horizontally, and therefore they do not intersect. Check if the upper boundary of the new bullet screen is below the lower boundary of the existing bullet screen located above the new bullet screen. If this condition is met, it means that the new bullet screen and the existing bullet screen do not overlap vertically, and therefore they do not intersect. 104: If all four conditions above are met, it means that the new bullet and the existing bullet do not overlap in the horizontal and vertical directions, so they do not intersect, and the result is returned as success (the new bullet and the existing bullet do not collide within the quadtree); 105: If none of the four conditions above are met, it means that the new bullet and the existing bullet overlap in the horizontal and vertical directions, so they intersect, and the result is returned as failure (the new bullet and the existing bullet collide within the quadtree).
[0155] The flowchart of the function (queryNonIntersectingRange) for querying the position of a new bullet comment that does not intersect with (collide with) existing bullet comments is shown below. Figure 14 As shown, the specific implementation process of this function is as follows: 110: Check if the current quadtree has a subtree; 111: If there is no subtree, it means that the current quadtree is a leaf node. Then, use the new barrage collision detection function (intersect) within the quadtree to find the barrage position that does not intersect with the existing barrage in the current quadtree node list and return it. 112: If the current quadtree has a subtree, traverse the subtree; 113: Find the barrage position that does not intersect with the existing barrage in the subtree node list so that a new barrage can be posted at that position later. 114: Determine whether all barrage positions in the subtree node list intersect with the existing barrage. 115: If yes, it means that there is no barrage position that does not intersect with the existing barrage, and return an empty list. 116: Otherwise, recursively search for barrage positions that do not intersect with the existing barrage in these subtree node lists and return a list of barrage positions that do not intersect with the existing barrage.
[0156] When creating a Track instance object, a Track class is constructed, and a constructor is defined to initialize the track's properties (coordinates, size, contained quadtree), and a collision detection function (insertDanmaku) is declared.
[0157] The flowchart of the collision detection function (insertDanmaku) is shown below. Figure 15 As shown, the specific implementation process of this function is as follows: 20: Call the function (queryNonIntersectingRange) to find the existing bullet comments that do not intersect with the new bullet comments; 21: Traverse the existing bullet comments that do not intersect with the new bullet comments; 22: Calculate the horizontal distance and speed difference between the new bullet comment and the existing bullet comments that do not intersect with the new bullet comment; 23: Calculate the time required for them to meet in the horizontal direction; 24: Determine whether the new bullet comment and the existing bullet comments that do not intersect with the new bullet comment will collide during the bullet comment's duration; 25: If a collision occurs, return failure, indicating that the new bullet comment cannot be published; 26: Otherwise, publish the new bullet comment and return success.
[0158] When a danmaku object is created, a danmaku instance object class is constructed, and a constructor is defined to initialize the danmaku's properties (content, position, size, speed). A function (unpdate) can be used to update the danmaku's position. The danmaku's position (x and y) can be updated based on its speed (velocityX and velocityY) and the elapsed time (deltaTime). For example, the danmaku's position in the x-direction is: this.x = this.velocityX * deltaTime.
[0159] The beneficial effects of this technical solution are mainly reflected in improving the user viewing experience, enhancing user interaction, optimizing the display effect of bullet comments, and improving the efficiency of bullet comment display. By preventing bullet comment overlap, rationally allocating screen space, dynamically adjusting bullet comment speed, and adapting to screen size, users can view bullet comments more comfortably and clearly, thereby improving the overall viewing experience. Furthermore, bullet comments, as a unique form of user interaction, can enhance community activity and user stickiness. In terms of technical implementation, the application of spatial partitioning data structures such as quadtrees can improve the efficiency and effect of bullet comment display, and the quadtree data structure type can reduce the consumption of computing resources. In summary, this technical solution can bring users a better bullet comment viewing experience, while also improving the efficiency and performance of bullet comment display.
[0160] It is understood that in the embodiments of this application, if the content involves user information, such as the attributes of the bullet comments to be published and the published bullet comments, and if it involves data related to user information or enterprise information, when the embodiments of this application are applied to specific products or technologies, it is necessary to obtain user permission or consent, or to obfuscate this information to eliminate the correspondence between this information and the user; and the collection and processing of related data should strictly comply with the requirements of relevant national laws and regulations when applied in practice, obtain the informed consent or separate consent of the personal information subject, and carry out subsequent data use and processing within the scope of laws and regulations and the authorization of the personal information subject.
[0161] The following description continues to illustrate the exemplary structure of the bullet screen publishing device 455 provided in the embodiments of this application as a software module. In some embodiments, such as Figure 2 As shown, the software modules stored in the bullet screen publishing device 455 in the memory 450 may include: an acquisition module 4551, configured to acquire the bullet screen attributes of the bullet screen to be published in response to a bullet screen publishing request for the bullet screen to be published; a subtree region determination module 4552, configured to determine, based on the bullet screen attributes, the candidate track in the screen region corresponding to the bullet screen to be published and the quadtree corresponding to the candidate track; the quadtree includes multiple subtrees, each subtree corresponding to a subtree region in the screen region; and a published bullet screen determination module 4553, configured to determine the published bullet screen in the current... The quadtree contains published bullet comments located in the subtree region of each subtree at any given time; a collision detection module 4554 is used to perform collision detection on the bullet comment to be published and the published bullet comments in the subtree region corresponding to the subtree for at least one subtree in the quadtree, and obtain a collision detection result; a bullet comment publishing area determination module 4555 is used to determine a bullet comment publishing area for publishing the bullet comment to be published from the subtree region corresponding to the at least one subtree based on the collision detection result; and a bullet comment publishing module 4556 is used to publish the bullet comment to be published in the bullet comment publishing area.
[0162] In some embodiments, the collision detection module 4554 is further configured to: obtain the bullet screen boundary of the bullet screen to be published; determine at least one target subtree region for publishing the bullet screen to be published based on the bullet screen boundary and the region boundary of the subtree region corresponding to each subtree in the at least one subtree; generate a collision candidate list based on the published bullet screens located in the target subtree region at the current time; and perform collision detection on the bullet screen to be published based on the collision candidate list to obtain the collision detection result.
[0163] In some embodiments, the boundaries of the bullet comments to be published include a left boundary, a right boundary, an upper boundary, and a lower boundary; the collision detection module 4554 is further configured to: for any subtree, if the left boundary of the bullet comments to be published is located to the right of the left boundary of the subtree region corresponding to the subtree, and the upper boundary of the bullet comments to be published is located below the upper boundary of the subtree region corresponding to the subtree, determine the positions of the right boundary and the lower boundary of the bullet comments to be published; if the right boundary of the bullet comments to be published is located to the left of the right boundary of the subtree region corresponding to the subtree, and the lower boundary of the bullet comments to be published is located above the lower boundary of the subtree region corresponding to the subtree, determine the subtree region corresponding to the subtree as a target subtree region for publishing the bullet comments to be published.
[0164] In some embodiments, the collision detection module 4554 is further configured to: for any subtree, if the left boundary of the barrage to be published is located to the right of the left boundary of the subtree region corresponding to the subtree, and the upper boundary of the barrage to be published is located below the upper boundary of the subtree region corresponding to the subtree, determine the positions of the right boundary and the lower boundary of the barrage to be published; if the right boundary of the barrage to be published is located to the left of the right boundary of the subtree region corresponding to any other subtree to the right of the subtree region, and the lower boundary of the barrage to be published is located above the lower boundary of the subtree region corresponding to the other subtree, determine the subtree, the other subtree, and all subtree regions corresponding to the subtrees connected between the subtree and the other subtree as multiple target subtree regions for publishing the barrage to be published.
[0165] In some embodiments, the collision detection module 4554 is further configured to: for any subtree, if the left boundary of the barrage to be published is located to the right of the left boundary of the subtree region corresponding to the subtree, and the upper boundary of the barrage to be published is located below the upper boundary of the subtree region corresponding to the subtree, determine the positions of the right boundary and the lower boundary of the barrage to be published; if the lower boundary of the barrage to be published is located above the lower boundary of the subtree region corresponding to any other subtree below the subtree region, and the right boundary of the barrage to be published is located to the left of the right boundary of the subtree region corresponding to the other subtree, determine the subtree, the other subtree, and all subtree regions corresponding to the subtrees connected between the subtree and the other subtree as multiple target subtree regions for publishing the barrage to be published.
[0166] In some embodiments, the collision detection module 4554 is further configured to: determine all or part of the published bullet comments located in each of the target subtree regions at the current moment; and add the published bullet comments to the collision candidate list.
[0167] In some embodiments, the collision detection module 4554 is further configured to: determine at least one candidate publishing region capable of publishing the barrage to be published from the target subtree region; for each candidate publishing region, after inserting the barrage to be published into the candidate publishing region, perform collision detection between the barrage to be published inserted into the candidate publishing region and each published barrage in the collision candidate list, and obtain the collision detection result corresponding to each candidate publishing region.
[0168] In some embodiments, the bullet screen publishing area determination module 4555 is further configured to: determine the candidate publishing area that does not collide with each published bullet screen from the collision detection results corresponding to all candidate publishing areas as the target candidate publishing area; and select the bullet screen publishing area for publishing the bullet screen to be published from the target candidate publishing area.
[0169] In some embodiments, the collision detection module 4554 is further configured to: for each candidate publishing area, after inserting the bullet comment to be published into the candidate publishing area, obtain from the collision candidate list the published bullet comments that are horizontally adjacent to the bullet comment to be published, the current bullet comment position of the bullet comment to be published, and the current bullet comment speed; determine the current bullet comment position and current bullet comment speed of the published bullet comments that are horizontally adjacent to the bullet comment to be published; determine the horizontal distance between the bullet comment to be published and the adjacent published bullet comments based on the current bullet comment position of the bullet comment to be published and the current bullet comment position of the adjacent published bullet comments; determine the speed difference between the bullet comment to be published and the adjacent published bullet comments based on the current bullet comment speed of the bullet comment to be published and the current bullet comment speed of the adjacent published bullet comments; determine the encounter probability between the bullet comment to be published and the adjacent published bullet comments based on the horizontal distance and the speed difference; and determine the collision detection result corresponding to each candidate publishing area based on the encounter probability.
[0170] In some embodiments, the bullet screen publishing area determination module 4555 is further configured to: for each candidate publishing area, if the collision detection result corresponding to the candidate publishing area indicates that the bullet screen to be published inserted into the candidate publishing area collides with the adjacent published bullet screen, update the current bullet screen speed of the bullet screen to be published to obtain a first bullet screen speed of the bullet screen to be published; and if, based on the first bullet screen speed and the collision candidate list, it is determined that the bullet screen to be published does not collide with any published bullet screen in the collision candidate list, determine the candidate publishing area as the target candidate publishing area.
[0171] In some embodiments, the device 455 further includes a removal module, which is configured to, after publishing the bullet comment to be published in the bullet comment publishing area, determine the bullet comment to be published as a currently published bullet comment in the target subtree area; obtain the area boundary of the screen area and the bullet comment boundary of the currently published bullet comment; and remove the currently published bullet comment from the target subtree area when the right boundary of the bullet comment boundary of the currently published bullet comment is located to the left of the left boundary of the boundary area of the screen area, or the lower boundary of the bullet comment boundary of the currently published bullet comment is located above the upper boundary of the boundary area of the screen area.
[0172] It should be noted that the description of the apparatus in this application embodiment is similar to the description of the method embodiment described above, and has similar beneficial effects as the method embodiment; therefore, it will not be repeated. For technical details not disclosed in this apparatus embodiment, please refer to the description of the method embodiment of this application for understanding.
[0173] This application provides a computer-readable storage medium storing computer-executable instructions. When these instructions are executed by a processor, they cause the processor to execute the bullet screen posting method provided in this application. For example, ... Figure 3 The method for posting bullet comments is shown.
[0174] This application provides a computer program product including computer-executable instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer-executable instructions from the computer-readable storage medium and executes the computer-executable instructions, causing the electronic device to perform the bullet screen publishing method described above in this application.
[0175] In some embodiments, the computer-readable storage medium may be a memory such as RAM, ROM, flash memory, magnetic surface memory, optical disk, or CD-ROM; or it may be a variety of devices including one or any combination of the above-mentioned memories.
[0176] In some embodiments, computer-executable instructions may take the form of programs, software, software modules, scripts, or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as stand-alone programs or as modules, components, subroutines, or other units suitable for use in a computing environment.
[0177] As an example, computer-executable instructions may, but do not necessarily, correspond to files in a file system. They may be stored as part of a file that holds other programs or data, for example, in one or more scripts in a Hyper Text Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple co-located files (e.g., files that store one or more modules, subroutines, or code sections).
[0178] As an example, computer-executable instructions can be deployed to execute on a single electronic device, or on multiple electronic devices located at one location, or on multiple electronic devices distributed across multiple locations and interconnected via a communication network.
[0179] The above description is merely an embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, and improvements made within the spirit and scope of this application are included within the scope of protection of this application.
Claims
1. A method for publishing bullet comments, characterized in that, The method includes: In response to a request to publish a bullet comment, the bullet comment attributes of the bullet comment to be published are obtained; Based on the bullet screen attributes, the candidate tracks of the bullet screen to be published in the screen area and the quadtree corresponding to the candidate tracks are determined; the quadtree includes multiple subtrees, and each subtree corresponds to a subtree area in the screen area; Determine the published comments located in the subtree region of each subtree at the current moment; For at least one subtree in the quadtree, collision detection is performed between the bullet comment to be published and the published bullet comments in the subtree region of the subtree, and the collision detection result is obtained. Based on the collision detection results, a bullet screen publishing area for publishing the bullet screen to be published is determined from the subtree region of the at least one subtree; The bullet comment to be published is published in the bullet comment publishing area.
2. The method according to claim 1, characterized in that, The step involves performing collision detection on at least one subtree in the quadtree, comparing the published comments in the subtree region corresponding to the subtree to be published, and obtaining the collision detection result, including: Obtain the boundaries of the bullet comments to be published; Based on the bullet screen boundary and the area boundary of the subtree area corresponding to each subtree in the at least one subtree, at least one target subtree area is determined for publishing the bullet screen to be published; Based on the published bullet comments located in the target subtree region at the current moment, a collision candidate list is generated; Based on the collision candidate list, collision detection is performed on the bullet comments to be published to obtain the collision detection results.
3. The method according to claim 2, characterized in that, The boundaries of the bullet comments to be published include the left boundary, the right boundary, the top boundary, and the bottom boundary. The step of determining at least one target subtree region for publishing the bullet screen based on the bullet screen boundary and the region boundary of the subtree region corresponding to each subtree in the at least one subtree includes: For any of the subtrees, if the left boundary of the barrage to be published is located to the right of the left boundary of the region corresponding to the subtree, and the upper boundary of the barrage to be published is located below the upper boundary of the region corresponding to the subtree, then the positions of the right boundary and the lower boundary of the barrage to be published are determined. If the right boundary of the bullet comment to be published is located to the left of the right boundary of the subtree region corresponding to the subtree, and the lower boundary of the bullet comment to be published is located above the lower boundary of the subtree region corresponding to the subtree, then the subtree region corresponding to the subtree is determined as a target subtree region for publishing the bullet comment to be published.
4. The method according to claim 3, characterized in that, The step of determining at least one target subtree region for publishing the bullet screen based on the bullet screen boundary and the region boundary of the subtree region corresponding to each subtree in the at least one subtree further includes: For any of the subtrees, if the left boundary of the barrage to be published is located to the right of the left boundary of the region corresponding to the subtree, and the upper boundary of the barrage to be published is located below the upper boundary of the region corresponding to the subtree, then the positions of the right boundary and the lower boundary of the barrage to be published are determined. If the right boundary of the bullet comment to be published is located to the left of the right boundary of the subtree region corresponding to any other subtree to the right of the subtree region, and the lower boundary of the bullet comment to be published is located above the lower boundary of the subtree region corresponding to the other subtree, then the subtree, the other subtree, and all subtree regions corresponding to the subtrees connecting the subtree and the other subtrees are determined as multiple target subtree regions for publishing the bullet comment to be published.
5. The method according to claim 3, characterized in that, The step of determining at least one target subtree region for publishing the bullet screen based on the bullet screen boundary and the region boundary of the subtree region corresponding to each subtree in the at least one subtree further includes: For any of the subtrees, if the left boundary of the barrage to be published is located to the right of the left boundary of the region corresponding to the subtree, and the upper boundary of the barrage to be published is located below the upper boundary of the region corresponding to the subtree, then the positions of the right boundary and the lower boundary of the barrage to be published are determined. If the lower boundary of the bullet comment to be published is located above the lower boundary of the subtree region corresponding to any other subtree below the subtree region, and the right boundary of the bullet comment to be published is located to the left of the right boundary of the subtree region corresponding to the other subtree, then the subtree, the other subtree, and all subtree regions corresponding to the subtrees connected between the subtree and the other subtree are determined as multiple target subtree regions for publishing the bullet comment to be published.
6. The method according to claim 2, characterized in that, The step of generating a collision candidate list based on the published bullet comments located in the target subtree region at the current time includes: Determine all or part of the published bullet comments located in each of the target subtree regions at the current moment; Add the published bullet comments to the collision candidate list.
7. The method according to claim 2, characterized in that, The step of performing collision detection on the bullet comments to be published based on the collision candidate list, and obtaining the collision detection results, includes: At least one candidate posting region capable of posting the bullet comment to be posted is determined from the target subtree region; For each candidate publishing area, after inserting the bullet comment to be published into the candidate publishing area, collision detection is performed between the bullet comment to be published inserted into the candidate publishing area and each published bullet comment in the collision candidate list to obtain the collision detection result corresponding to each candidate publishing area.
8. The method according to claim 7, characterized in that, The step of determining the bullet comment publishing area for publishing the bullet comment from the subtree region of the at least one subtree based on the collision detection result includes: From the collision detection results corresponding to all candidate publishing areas, the candidate publishing areas that do not collide with each published barrage are determined as the target candidate publishing areas; Select the bullet comment publishing area from the target candidate publishing area for publishing the bullet comment to be published.
9. The method according to claim 8, characterized in that, For each candidate publishing area, after inserting the text to be published into the candidate publishing area, collision detection is performed between the text to be published inserted into the candidate publishing area and each published text in the collision candidate list to obtain the collision detection result corresponding to each candidate publishing area, including: For each candidate publishing area, after inserting the bullet comment to be published into the candidate publishing area, the published bullet comments that are horizontally adjacent to the bullet comment to be published, the current bullet comment position and the current bullet comment speed of the bullet comment to be published are obtained from the collision candidate list. Determine the current position and current speed of the published bullet comments that are horizontally adjacent to the bullet comment to be published; Based on the current position of the bullet comment to be published and the current position of the adjacent published bullet comments, the horizontal distance between the bullet comment to be published and the adjacent published bullet comments is determined. Based on the current speed of the bullet comment to be published and the current speed of the adjacent published bullet comments, determine the speed difference between the bullet comment to be published and the adjacent published bullet comments; Based on the horizontal distance and the speed difference, the probability of the bullet screen to be published and the adjacent published bullet screens being encountered is determined; Based on the encounter probability, the collision detection result corresponding to each candidate release region is determined.
10. The method according to claim 9, characterized in that, The step of identifying the candidate publishing regions that do not collide with any published bullet comments from the collision detection results corresponding to all candidate publishing regions as target candidate publishing regions includes: For each candidate publishing area, if the collision detection result corresponding to the candidate publishing area indicates that the barrage to be published inserted into the candidate publishing area collides with the adjacent published barrage, the current barrage speed of the barrage to be published is updated to obtain the first barrage speed of the barrage to be published. If, based on the first barrage speed and the collision candidate list, it is determined that the barrage to be published will not collide with any published barrage in the collision candidate list, the candidate publishing area is determined as the target candidate publishing area.
11. The method according to any one of claims 2 to 9, characterized in that, After publishing the bullet comment to be published in the bullet comment publishing area, the method further includes: The bullet comments to be published are identified as the currently published bullet comments in the target subtree region; Obtain the area boundary of the screen region and the boundary of the currently published bullet comments; When the right boundary of the currently published bullet comment is located to the left of the left boundary of the screen area, or the lower boundary of the currently published bullet comment is located above the upper boundary of the screen area, the currently published bullet comment is removed from the target subtree area.
12. A bullet screen publishing device, characterized in that, include: The acquisition module is used to acquire the bullet screen attributes of the bullet screen to be published in response to the bullet screen publishing request. The subtree region determination module is used to determine, based on the bullet screen attributes, the candidate track in the screen area corresponding to the bullet screen to be published and the quadtree corresponding to the candidate track; The quadtree includes multiple subtrees, and each subtree corresponds to a subtree area in the screen area; The published bullet screen determination module is used to determine the published bullet screens located in the subtree region of each subtree at the current moment; The collision detection module is used to perform collision detection on the published bullet comments in the subtree region corresponding to the subtree of at least one subtree in the quadtree, and obtain the collision detection result. The bullet screen publishing area determination module is used to determine, based on the collision detection result, a bullet screen publishing area for publishing the bullet screen to be published from the subtree area corresponding to the at least one subtree; The bullet screen publishing module is used to publish the bullet screen to be published in the bullet screen publishing area.
13. An electronic device, characterized in that, include: Memory is used to store executable instructions for a computer; A processor, when executing computer-executable instructions stored in the memory, implements the bullet screen publishing method according to any one of claims 1 to 11.
14. A computer-readable storage medium, characterized in that, The device stores computer-executable instructions, which, when executed by a processor, implement the bullet screen publishing method according to any one of claims 1 to 11.
15. A computer program product, characterized in that, The computer program product includes computer-executable instructions, which are stored in a computer-readable storage medium. When the processor of the electronic device reads the computer-executable instructions from the computer-readable storage medium and executes the computer-executable instructions, it implements the bullet screen publishing method according to any one of claims 1 to 11.