Virtual scene data processing method and device, electronic equipment and storage medium
By creating a two-dimensional grid in the virtual scene and locally searching it, the problem of virtual scene data query consuming a lot of computing resources is solved, more efficient data storage and processing is achieved, and the fluency and processor power of the virtual scene are improved.
Patent Information
- Application Number
- CN202310248367.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-08
- Publication Date
- 2024-09-10
AI Technical Summary
In the existing technology, virtual scene data query consumes a large amount of computing resources, affects the processor's ability to implement more functions in parallel, and lacks an effective way to save computing resources.
By creating a two-dimensional grid of the virtual scene, mapping virtual objects to the two-dimensional grid, and only querying cell information within a local range, reducing unnecessary data queries and improving query efficiency.
It saves data storage space and computing resources, improves the fluency of virtual scenes and processor carrying capacity, and reduces the memory required for interactive behaviors of virtual objects.
Smart Images

Figure CN118615701A
Abstract
Description
Technical Field
[0001] The present application relates to computer technology, and in particular to a data processing method, device, electronic device and storage medium for a virtual scene. Background Art
[0002] Display technology based on graphics processing hardware has expanded the channels for perceiving the environment and obtaining information, especially the display technology of virtual scenes. It can realize diversified interactions between virtual objects controlled by users or artificial intelligence according to actual application needs, and has various typical application scenarios. For example, in virtual scenes such as games, it can simulate the interactive behaviors between virtual objects.
[0003] In the related technology, the data of the virtual scene is composed of multiple stream level data. Each stream level stores serialized objects in the virtual scene and data objects dynamically generated during the operation of the virtual scene. Data query in the virtual scene requires a large amount of computing resources and occupies too much memory, which affects the processor's ability to implement more functions in parallel.
[0004] There is currently no good way in the related art to save the computing resources required for data query in virtual scenes. Summary of the invention
[0005] The embodiments of the present application provide a data processing method, device, electronic device, computer-readable storage medium, and computer program product for a virtual scene, which can save computing resources consumed by performing data query in the virtual scene.
[0006] The technical solution of the embodiment of the present application is implemented as follows:
[0007] The present application provides a method for processing data of a virtual scene, the method comprising:
[0008] Creating a two-dimensional grid of a virtual scene, wherein the two-dimensional grid includes a plurality of cells;
[0009] Combining the cell information of each of the cells in the two-dimensional grid into two-dimensional grid data;
[0010] Acquire a local range corresponding to the virtual object, wherein the local range is an area where the virtual object is a search center;
[0011] Mapping a current position of a virtual object in the virtual scene to the two-dimensional grid to obtain a mapping position of the virtual object in the two-dimensional grid;
[0012] Taking the mapping position as a reference point, querying the cell information of each of the cells in the local range from the two-dimensional grid data;
[0013] The cell information obtained by the query is combined into a search result, wherein the search result is used for the interaction of the virtual object at the current position.
[0014] The present application provides a data processing device for a virtual scene, including:
[0015] A scene creation module, configured to create a two-dimensional grid of a virtual scene, wherein the two-dimensional grid includes a plurality of cells;
[0016] The scene creation module is configured to combine the cell information of each cell in the two-dimensional grid into two-dimensional grid data;
[0017] A data query module, configured to obtain a local range corresponding to a virtual object, wherein the local range is an area where the virtual object is a search center;
[0018] The data query module is configured to map the current position of the virtual object in the virtual scene to the two-dimensional grid to obtain the mapping position of the virtual object in the two-dimensional grid;
[0019] The data query module is configured to query the cell information of each cell within the local range from the two-dimensional grid data with the mapping position as a reference point;
[0020] The data query module is configured to combine the cell information obtained by the query into a search result, wherein the search result is used for the interaction of the virtual object at the current position.
[0021] An embodiment of the present application provides an electronic device, the electronic device comprising:
[0022] A memory for storing computer executable instructions;
[0023] The processor is used to implement the data processing method of the virtual scene provided in the embodiment of the present application when executing the computer executable instructions stored in the memory.
[0024] An embodiment of the present application provides a computer-readable storage medium storing computer-executable instructions for implementing a data processing method for a virtual scene provided in an embodiment of the present application when executed by a processor.
[0025] An embodiment of the present application provides a computer program product, including a computer program or computer executable instructions. When the computer program or computer executable instructions are executed by a processor, the data processing method of the virtual scene provided in the embodiment of the present application is implemented.
[0026] The embodiments of the present application have the following beneficial effects:
[0027] By storing the data corresponding to the virtual scene in a two-dimensional grid, data storage space is saved, and local search is achieved by obtaining the local range of the virtual object to be queried in the two-dimensional grid data and using the cell information corresponding to the local range as the query range, saving the computing resources consumed by the query operation, reducing the memory required for the interactive behavior of the virtual object associated with the query operation, and improving the smoothness of the virtual scene operation. Compared with related technologies, data query is no longer the main time-consuming of the central processor, and the ability of the central processor to carry virtual scene related functions is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1A It is a schematic diagram of an application mode of the data processing method of a virtual scene provided in an embodiment of the present application;
[0029] Figure 1B It is a schematic diagram of an application mode of the data processing method of a virtual scene provided in an embodiment of the present application;
[0030] Figure 2A is a schematic diagram of the structure of the server 200 provided in an embodiment of the present application;
[0031] Figure 2B is a schematic diagram of the structure of a terminal device 400 provided in an embodiment of the present application;
[0032] FIG. 3A to FIG. 3F It is a flowchart of a data processing method for a virtual scene provided in an embodiment of the present application;
[0033] FIG. 4A to FIG. 4B is a schematic diagram of a virtual scene provided in an embodiment of the present application;
[0034] FIG. 5A to FIG. 5D It is an optional flowchart of the data processing method of the virtual scene provided in the embodiment of the present application;
[0035] Fig. 6A is a schematic diagram of boundary division of a virtual scene provided in an embodiment of the present application;
[0036] Figure 6B is a schematic diagram of data storage in a two-dimensional grid provided by an embodiment of the present application;
[0037] Figure 6C It is a schematic diagram of the influence range of the virtual object dynamic object provided in the embodiment of the present application. DETAILED DESCRIPTION
[0038] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. The described embodiments should not be regarded as limiting the present application. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of this application.
[0039] In the following description, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it can be 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] In the following description, the terms "first\second\third" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second\third" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.
[0041] It should be pointed out that in the embodiments of the present application, related data such as user information and user feedback data are involved. When the embodiments of the present application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.
[0042] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0043] Before further describing the embodiments of the present application in detail, the nouns and terms involved in the embodiments of the present application are explained. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations.
[0044] 1) Virtual scenes: using devices to output scenes that are different from the real world, visual perception of virtual scenes can be formed with the naked eye or with the assistance of devices, such as two-dimensional images output by display screens, and three-dimensional images output by stereo display technologies such as stereo projection, virtual reality, and augmented reality. In addition, various possible hardware can also be used to form various perceptions that simulate the real world, such as auditory perception, tactile perception, olfactory perception, and motion perception.
[0045] 2) In response, it is used to indicate the conditions or states on which the executed operations depend. When the dependent conditions or states are met, one or more operations executed may be in real time or have a set delay. Unless otherwise specified, there is no restriction on the order of execution of the multiple operations executed.
[0046] 3) Virtual objects: objects that interact in virtual scenes, which are controlled by users or robot programs (for example, robot programs based on artificial intelligence) and can be still, move, and perform various behaviors in virtual scenes, such as various characters in games.
[0047] 4) Big World Object Manager: manages the data objects in the big world formed by the virtual scene.
[0048] 5) Object. An object can be a variable, a data structure, or a function. It is a term in object-oriented programming. It refers to both a specific thing in the problem space of the objective world (Namespace) and a basic element in the solution space of a software system. In a software system, an object has a unique identifier. An object includes properties and methods. Properties are information that needs to be remembered, and methods are services that an object can provide. In object-oriented software, an object is an instance of a class.
[0049] 6) Serialize the object to store the state of the object in the form of a byte sequence. When the object is used, the bytes in the sequence are assembled into an object.
[0050] 7) Static objects: virtual objects with fixed positions in virtual scenes. For example, scenery, virtual objects, and NPCs in virtual scenes. For example, trees will sway according to a pattern, but their plane positions are fixed, so they are static objects. When a player's virtual object steps on grass, the grass falls down, but its plane position does not move, so the grass is a static object.
[0051] 8) Dynamic objects: virtual objects whose positions in virtual scenes are not fixed, such as player virtual objects and NPCs that can interact with player virtual objects (such as monsters and functional NPCs).
[0052] The embodiments of the present application provide a data processing method for a virtual scene, a data processing device for a virtual scene, an electronic device, a computer-readable storage medium, and a computer program product, which can save computing resources consumed by performing data queries in a virtual scene.
[0053] The following describes an exemplary application of the electronic device provided by the embodiment of the present application. The electronic device provided by the embodiment of the present application can be implemented as a laptop, a tablet computer, a desktop computer, a set-top box, a mobile device (for example, a mobile phone, a portable music player, a personal digital assistant, a dedicated messaging device, a portable gaming device), a vehicle terminal, a virtual reality (VR) device, an augmented reality (AR) device, and other types of user terminals, and can also be implemented as a server. The following describes an exemplary application when the device is implemented as a terminal device or a server.
[0054] In one implementation scenario, reference Figure 1A , Figure 1A It is a schematic diagram of the application mode of the data processing method for the virtual scene provided in the embodiment of the present application, which is suitable for some application modes that completely rely on the graphics processing hardware computing power of the terminal device 400 to complete the relevant data calculation of the virtual scene, such as stand-alone / offline mode games, and the output of the virtual scene is completed through various types of terminal devices 400 such as smart phones, tablet computers and virtual reality / augmented reality devices.
[0055] As an example, types of graphics processing hardware include a central processing unit (CPU) and a graphics processing unit (GPU).
[0056] When forming a visual perception of a virtual scene, the terminal device 400 calculates the data required for display through the graphics computing hardware, and completes the loading, parsing and rendering of the display data, and outputs video frames that can form a visual perception of the virtual scene through the graphics output hardware. For example, two-dimensional video frames are presented on the display screen of a smartphone, or video frames that achieve a three-dimensional display effect are projected on the lenses of augmented reality / virtual reality glasses. In addition, in order to enrich the perception effect, the terminal device 400 can also use different hardware to form one or more of auditory perception, tactile perception, motion perception and taste perception.
[0057] As an example, a client (such as a stand-alone game application) is running on the terminal device 400, and during the operation of the client, a virtual scene including role-playing is output. The virtual scene can be an environment for game characters to interact, such as plains, streets, valleys, etc. for game characters to fight against each other; the virtual object can be a game character controlled by a user, that is, the virtual object is controlled by a real user, and will move in the virtual scene in response to the real user's operation of a controller (such as a touch screen, voice-controlled switch, keyboard, mouse, and joystick, etc.). For example, when the real user moves the joystick to the right, the virtual object will move to the right in the virtual scene, and can also remain still, jump, and control the virtual object to perform shooting operations, etc.
[0058] For example, the virtual scene may be a game virtual scene, the user may be a player, the virtual object may be a virtual object controlled by the player, or a non-player character, and the interaction may be an interaction between virtual objects, such as attacking, virtual objects looking at each other, performing interactive actions, etc. In the embodiment of the present application, the virtual object is an example of a virtual object controlled by a player, and the above examples are used for explanation.
[0059] For example, the terminal device 400 creates a two-dimensional grid of a virtual scene, stores the data of the virtual scene in the form of a two-dimensional grid, and forms two-dimensional grid data. When the user controls the virtual object to trigger the corresponding interactive function of the enemy search in the virtual scene 100, the terminal device 400 maps the current position of the virtual object to the two-dimensional grid to obtain the mapping position, and uses the mapping position as a reference point to query the cell information of each cell in the local range from the two-dimensional grid data to obtain the search result, and based on the search result, the searched enemy virtual object is displayed in a manner different from other parts of the virtual environment 100, so that the player can distinguish the searched enemy virtual object from other virtual objects. The computing resources consumed by data query processing are saved, so that the central processor can carry more other functions in the virtual scene.
[0060] In the right Figure 1BBefore explaining, we first introduce the game modes involved in the solution implemented in collaboration between the terminal device and the server. The solution implemented in collaboration between the terminal device and the server mainly involves two game modes, namely local game mode and cloud game mode. The local game mode refers to the terminal device and the server jointly running the game processing logic. The operation instructions entered by the player in the terminal device are partially processed by the terminal device running the game logic, and the other part is processed by the server running the game logic. In addition, the game logic processing run by the server is often more complex and requires more computing power. The cloud game mode refers to the game logic processing completely run by the server, and the cloud server renders the game scene data into an audio and video stream, and transmits it to the terminal device for display through the network. The terminal device only needs to have basic streaming media playback capabilities and the ability to obtain the player's operation instructions and send them to the server.
[0061] In another implementation scenario, refer to Figure 1B , Figure 1B It is a schematic diagram of an application mode of the data processing method for a virtual scene provided in an embodiment of the present application, which is applied to a terminal device 400 and a server 200, and is suitable for an application mode that relies on the computing power of the server 200 to complete virtual scene calculations and output virtual scenes on the terminal device 400.
[0062] Taking the visual perception of a virtual scene as an example, the server 200 calculates display data related to the virtual scene (such as scene data) and sends it to the terminal device 400 through the network 300. The terminal device 400 relies on graphics computing hardware to complete the loading, parsing and rendering of the display data, and relies on graphics output hardware to output the virtual scene to form visual perception. For example, two-dimensional video frames can be presented on the display screen of a smartphone, or video frames with three-dimensional display effects can be projected on the lenses of augmented reality / virtual reality glasses. As for the perception of the form of the virtual scene, it can be understood that the corresponding hardware output of the terminal device 400 can be used, such as using a microphone to form auditory perception, using a vibrator to form tactile perception, and so on.
[0063] As an example, a client (such as an online version of a game application) is running on the terminal device 400, and during the operation of the client, a virtual scene including role-playing is output. The virtual scene can be an environment for game characters to interact, such as plains, streets, valleys, etc. for game characters to fight against each other; the virtual object can be a game character controlled by a user, that is, the virtual object is controlled by a real user, and will move in the virtual scene in response to the real user's operation of a controller (such as a touch screen, voice-controlled switch, keyboard, mouse, and joystick, etc.). For example, when the real user moves the joystick to the right, the virtual object will move to the right in the virtual scene, and can also remain still, jump, and control the virtual object to perform shooting operations, etc.
[0064] For example, the virtual scene may be a game virtual scene, the user may be a player, the virtual object may be a virtual object controlled by the player, or a non-player character, and the interaction may be an interaction between virtual objects, such as attacking, virtual objects looking at each other, performing interactive actions, etc. In the embodiment of the present application, the virtual object is an example of a virtual object controlled by a player, and the above examples are used for explanation.
[0065] For example, the server 200 creates a two-dimensional grid of a virtual scene, stores data of the virtual scene in a two-dimensional grid manner, forms two-dimensional grid data, runs a virtual scene process, sends a picture corresponding to the virtual scene to the terminal device 400, and displays the virtual scene 100 in the human-computer interaction interface of the terminal device 400. In response to receiving a search request associated with an interactive function sent by the terminal device 400, the server 200 maps the current position of the virtual object to the two-dimensional grid to obtain a mapping position, uses the mapping position as a reference point, queries the cell information of each cell within a local range from the two-dimensional grid data, obtains a search result, generates display data corresponding to the interactive function based on the search result, sends the display data to the terminal device 400, and the terminal device 400 displays the display data of the interactive function. The computing resources consumed by data query processing are saved, so that the central processor can carry more other functions in the virtual scene.
[0066] In some embodiments, the terminal device 400 can implement the data processing method of the virtual scene provided in the embodiment of the present application by running a computer program. For example, the computer program can be a native program or software module in the operating system; it can be a native application (APP, APPlication), that is, a program that needs to be installed in the operating system to run, such as a shooting game APP; it can also be a small program, that is, a program that can be run only by downloading it to a browser environment; it can also be a game small program that can be embedded in any APP. In short, the above-mentioned computer program can be an application, module or plug-in in any form.
[0067] Taking a computer program as an application program as an example, in actual implementation, the terminal device 400 installs and runs an application program that supports a virtual scene. The application program can be any one of a first-person shooter game (FPS), a third-person shooter game, a virtual reality application program, a three-dimensional map program, or a multiplayer survival game. The user uses the terminal device 400 to operate a virtual object in the virtual scene to perform an activity, which includes but is not limited to: adjusting body posture, crawling, walking, running, riding, jumping, driving, picking up, shooting, attacking, throwing, and building a virtual building. Schematically, the virtual object can be a virtual character, such as a simulated character or an anime character.
[0068] The embodiments of the present application can be implemented through database technology. In short, a database can be regarded as an electronic file cabinet where electronic files are stored. Users can add, query, update, delete, etc. data in the files. The so-called "database" is a collection of data that is stored together in a certain way, can be shared with multiple users, has as little redundancy as possible, and is independent of the application program.
[0069] A database management system (DBMS) is a computer software system designed for managing databases. It generally has basic functions such as storage, retrieval, security, and backup. Database management systems can be classified according to the database model they support, such as relational, XML (Extensible Markup Language); or according to the type of computer they support, such as server clusters, mobile phones; or according to the query language used, such as Structured Query Language (SQL), XQuery; or according to performance focus, such as maximum scale, maximum operating speed; or other classification methods. Regardless of the classification method used, some DBMS can cross categories, for example, supporting multiple query languages at the same time.
[0070] The embodiments of the present application can also be implemented through cloud technology. Cloud technology is a general term for network technology, information technology, integration technology, management platform technology, application technology, etc. based on the cloud computing business model application. It can form a resource pool, which is used on demand and is flexible and convenient. Cloud computing technology will become an important support. The background services of the technical network system require a large amount of computing and storage resources, such as video websites, picture websites and more portal websites. With the high development and application of the Internet industry, as well as the promotion of search services, social networks, mobile commerce and open collaboration, each item may have its own hash code identification mark in the future, and all need to be transmitted to the background system for logical processing. Data of different levels will be processed separately, and all kinds of industry data require strong system backing support, which can only be achieved through cloud computing.
[0071] In some embodiments, the server may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The electronic device may be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, etc., but is not limited thereto. The terminal device and the server may be directly or indirectly connected via wired or wireless communication, which is not limited in the embodiments of the present invention.
[0072] refer to Figure 2A , Figure 2A is a schematic diagram of the structure of the server 200 provided in an embodiment of the present application, Figure 2A The server 200 shown includes: at least one processor 410, a memory 450, and at least one network interface 420. The various components in the server 200 are coupled together via a bus system 440. It is understood that the bus system 440 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 440 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, the bus system 440 is not described in detail. Figure 2A Various buses are labeled as bus system 440 .
[0073] 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., where the general-purpose processor can be a microprocessor or any conventional processor, etc.
[0074] The memory 450 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard disk drives, optical disk drives, etc. The memory 450 may optionally include one or more storage devices that are physically remote from the processor 410.
[0075] The memory 450 includes a volatile memory or a non-volatile memory, and may also include both volatile and non-volatile memories. The non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 450 described in the embodiments of the present application is intended to include any suitable type of memory.
[0076] In some embodiments, memory 450 can store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplarily described below.
[0077] Operating system 451, including system programs for processing various basic system services and performing hardware-related tasks, such as a framework layer, a core library layer, a driver layer, etc., for implementing various basic services and processing hardware-based tasks;
[0078] A network communication module 452, used to reach other electronic devices via one or more (wired or wireless) network interfaces 420, exemplary network interfaces 420 include: Bluetooth, Wireless Compatibility Certification (WiFi), and Universal Serial Bus (USB), etc.;
[0079] In some embodiments, the device provided in the embodiments of the present application can be implemented in software. Figure 2A The data processing device 455 of the virtual scene stored in the memory 450 is shown, which can be software in the form of programs and plug-ins, including the following software modules: a scene creation module 4551, a data query module 4552, these modules are logical, and therefore can be arbitrarily combined or further split according to the functions implemented. The functions of each module will be described below.
[0080] refer to Figure 2B , Figure 2B is a schematic diagram of the structure of a terminal device 400 provided in an embodiment of the present application, Figure 2BThe terminal device 400 shown includes: at least one processor 410, a memory 450, at least one network interface 420 and a user interface 430. The various components in the terminal device 400 are coupled together via a bus system 440. It is understood that the bus system 440 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 440 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, the bus system 440 is not shown in FIG. Figure 2B Various buses are labeled as bus system 440 .
[0081] 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., where the general-purpose processor can be a microprocessor or any conventional processor, etc.
[0082] The user interface 430 includes one or more output devices 431 that enable presentation of media content, including one or more speakers and / or one or more visual display screens. The 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.
[0083] The memory 450 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard disk drives, optical disk drives, etc. The memory 450 may optionally include one or more storage devices that are physically remote from the processor 410.
[0084] The memory 450 includes a volatile memory or a non-volatile memory, and may also include both volatile and non-volatile memories. The non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 450 described in the embodiments of the present application is intended to include any suitable type of memory.
[0085] In some embodiments, memory 450 can store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplarily described below.
[0086] Operating system 451, including system programs for processing various basic system services and performing hardware-related tasks, such as a framework layer, a core library layer, a driver layer, etc., for implementing various basic services and processing hardware-based tasks;
[0087] A network communication module 452, used to reach other electronic devices via one or more (wired or wireless) network interfaces 420, exemplary network interfaces 420 include: Bluetooth, Wireless Compatibility Certification (WiFi), and Universal Serial Bus (USB), etc.;
[0088] a presentation module 453 for enabling presentation of information via one or more output devices 431 (e.g., display screen, speaker, etc.) associated with the user interface 430 (e.g., a user interface for operating peripherals and displaying content and information);
[0089] The input processing module 454 is used to detect one or more user inputs or interactions from one of the one or more input devices 432 and translate the detected inputs or interactions.
[0090] In some embodiments, the device provided in the embodiments of the present application can be implemented in software. Figure 2B The data processing device 455 of the virtual scene stored in the memory 450 is shown, which can be software in the form of programs and plug-ins, including the following software modules: a scene creation module 4551, a data query module 4552, these modules are logical, and therefore can be arbitrarily combined or further split according to the functions implemented. The functions of each module will be described below.
[0091] The data processing method for the virtual scene provided in the embodiment of the present application will be explained in combination with the exemplary application and implementation of the terminal provided in the embodiment of the present application.
[0092] The following describes the data processing method for the virtual scene provided by the embodiment of the present application. As mentioned above, the electronic device for implementing the data processing method for the virtual scene provided by the embodiment of the present application may be a terminal, a server, or a combination of the two. Therefore, the execution subject of each step will not be repeatedly described below.
[0093] refer to Figure 3A , Figure 3A is a flow chart of a data processing method for a virtual scene provided in an embodiment of the present application, which will be combined with Figure 3A The steps shown are explained.
[0094] In step 301, a two-dimensional grid of a virtual scene is created.
[0095] For example, the two-dimensional grid includes a plurality of cells. The shape of the cell may be a square, and each cell is mapped to a corresponding area in the virtual scene and is used to store data of the corresponding area.
[0096] In some embodiments, step 301 can be implemented in the following manner: obtaining the two-dimensional spatial range and cell configuration information of the virtual scene, wherein the cell configuration information includes at least one of the following: the total number of cells and the cell size of the two-dimensional grid; gridding the two-dimensional spatial range based on the cell configuration information to obtain a two-dimensional grid, wherein the cell size of each cell is the same.
[0097] For example, the two-dimensional spatial range of the virtual scene is represented by the coordinate values of the boundaries, for example: the value range of the two-dimensional spatial range on the X-axis is (Xmin, Xmax), and the value range on the Y-axis is (Ymin, Ymax). The cell configuration information is the total number of cells N, N is a positive integer, and the cell size of each cell is the ratio of (Xmax-Xmin)*(Ymax-Ymin) to N.
[0098] In step 302, the cell information of each cell in the two-dimensional grid is combined into two-dimensional grid data.
[0099] For example, a cell in a two-dimensional grid stores data corresponding to the horizontal position of the cell in a virtual scene, and the data stored in the cell and the position of the cell constitute the cell information of the cell. For example, virtual object A and virtual object B have the same horizontal position in the virtual scene but different heights, and the object data of virtual object B and virtual object A are stored in the same cell 1. The cell information of cell 1 includes the stored data and the position of cell 1 in the two-dimensional grid. The two-dimensional grid data is also the scene data of the virtual scene, including the object data of each virtual object in the virtual scene and information such as the position of the virtual object.
[0100] In some embodiments, reference Figure 3B , Figure 3B It is a flowchart of a data processing method for a virtual scene provided in an embodiment of the present application; Figure 3A The illustrated step 302 can be implemented by following the steps 3021 to 3023, which are described in detail below.
[0101] In step 3021, object data of a plurality of different virtual objects is obtained.
[0102] For example, the multiple different virtual objects include the following types of virtual objects: scenery in a virtual scene, virtual props, virtual objects of non-player characters, and virtual objects of player characters.
[0103] In step 3022, based on the object type and object data of each virtual object, the cell information of each cell in the initial two-dimensional grid is updated.
[0104] For example, object types can be divided according to whether the position of the object in the virtual scene changes. Objects with fixed positions are static objects, and objects with unfixed positions are dynamic objects. Since the positions of static objects in the virtual scene are fixed and the positions of dynamic objects are unfixed, the efficiency of managing cell information can be improved by updating the cell information in different ways based on the object data of the two.
[0105] In some embodiments, step 3022 may be implemented by performing the following processing on the object data of each virtual object:
[0106] In response to the object type of the virtual object being a static object, the cell information corresponding to the virtual object in the initial two-dimensional grid is updated in a static object update manner, wherein the static object is an object with a fixed position in the two-dimensional grid.
[0107] In response to the object type of the virtual object being a dynamic object, the cell information corresponding to the virtual object in the initial two-dimensional grid is updated in a dynamic object update manner, wherein the dynamic object is an object whose position in the two-dimensional grid is not fixed.
[0108] For example, if the position of a static object in a two-dimensional grid is fixed, the data of the static object is stored in a fixed cell, while the position of a dynamic object in a two-dimensional grid is not fixed. For example, a virtual object periodically moves along a predetermined trajectory in a virtual scene; when a specific condition is met, the position of the virtual object moves horizontally. The data of the dynamic object is synchronously updated in the cell according to the change of the horizontal position of the dynamic object in the virtual scene.
[0109] In some embodiments, reference Figure 3C , Figure 3C is a flow chart of a data processing method for a virtual scene provided in an embodiment of the present application; the updating method of a static object can be performed by Figure 3C Steps 30221 to 30224 in are implemented as described in detail below.
[0110] In step 30221, the object data of the virtual object is added to the static data set corresponding to the two-dimensional grid data.
[0111] For example, different data sets are distinguished for dynamic objects and static objects for management. When a virtual object is a static object, the object data of the virtual object is added to the static data set. Hereinafter, a virtual object whose object type is a static object is referred to as a static virtual object.
[0112] In step 30222, the current position of the virtual object in the two-dimensional grid is obtained.
[0113] For example, the position of the virtual object in the two-dimensional grid is obtained by mapping the current three-dimensional coordinates of the virtual object in the virtual scene.
[0114] In step 30223, cells within the influence range corresponding to the virtual object are obtained.
[0115] For example, the influence range takes the current position as the geometric center. Figure 6B , Figure 6B Schematic diagram of data storage in a two-dimensional grid provided in an embodiment of the present application; assuming that there is an object A, the cull distance of the object A is obtained, the default value of the cull distance is 15000 cm in diameter, and the current location of the object A is taken as the origin to determine each cell covered by the cull distance. Figure 6B The influence range of object A covers 12 cells.
[0116] In step 30224, the object data of the virtual object is superimposed with the cell information of each cell within the affected range to obtain updated cell information.
[0117] For example, for cells within the affected range, a two-dimensional array memory is requested, and the object data of the virtual object is stored in the two-dimensional array of each cell to obtain updated cell information. The updated cell information includes: the original data in the cell and the object data corresponding to the virtual object.
[0118] In some embodiments, reference Figure 3D , Figure 3D is a flow chart of a data processing method for a virtual scene provided in an embodiment of the present application; the updating method of a dynamic object can be performed by Figure 3C Steps 30225 to 30229 in are implemented as described in detail below.
[0119] In step 30225, the object data of the virtual object is added to the dynamic data set corresponding to the two-dimensional grid data.
[0120] For example, the principle of step 30225 is the same as that of step 30221, both of which are to classify and manage the object data of virtual objects, improve management efficiency, and save storage space.
[0121] In step 30226, the current position of the virtual object in the two-dimensional grid is obtained, and the previous position of the virtual object in the two-dimensional grid is obtained.
[0122] For example, there is a position difference between the previous position and the current position. The previous position is the position of the virtual object before it moves in the horizontal direction, and the current position may be the position during or at the end of the movement.
[0123] In some embodiments, in step 30222 or after step 30226, in response to the current position exceeding the two-dimensional spatial range of the two-dimensional grid, the plane coordinate value corresponding to the current position is determined, the plane coordinate value including the horizontal coordinate value and the vertical coordinate value; the following processing is performed on the plane coordinate value exceeding the two-dimensional spatial range: the plane coordinate value is set to the boundary value of the two-dimensional spatial range so that the current position is within the two-dimensional spatial range.
[0124] For example, exceeding the two-dimensional space range includes any of the following situations: the horizontal coordinate value is smaller than the minimum value of the horizontal coordinate value range corresponding to the two-dimensional space range; the horizontal coordinate value is larger than the maximum value of the horizontal coordinate value range corresponding to the two-dimensional space range; the vertical coordinate value is smaller than the minimum value of the vertical coordinate value range corresponding to the two-dimensional space range; the vertical coordinate value is larger than the maximum value of the vertical coordinate value range corresponding to the two-dimensional space range.
[0125] Assumption: the value range of the two-dimensional space range on the X-axis is (Xmin, Xmax), the value range on the Y-axis is (Ymin, Ymax), the coordinates of the current position are (X1, Y1), where Y1 is greater than Ymax, then Y1 is set to Y1=Ymax, and the updated current position is (X1, Ymax), and the current position is within the two-dimensional space range.
[0126] In the embodiment of the present application, the coordinate value of the current position is clipped to avoid the current position exceeding the two-dimensional space range corresponding to the virtual scene, and the data is standardized within a specific interval, thereby saving computing resources.
[0127] In step 30227, cells of the influence range corresponding to the current position and the previous position of the virtual object are obtained.
[0128] For example, the influence range corresponding to the current position takes the current position as the geometric center, and the influence range corresponding to the previous position takes the previous position as the geometric center. Figure 6C , Figure 6C 602 is a schematic diagram of the influence range of the virtual object dynamic object provided in the embodiment of the present application. The influence range 602 of the previous position covers the influence cell 601 (including 12 cells), and the influence range 604 of the current position covers the influence cell 603 (including 9 cells).
[0129] In step 30228, the detection result of whether the cells in the corresponding impact ranges have intersections is obtained.
[0130] For example, detecting the cells of the influence range corresponding to the current position and the previous position can be achieved in the following way: comparing the cells of the influence range of the current position with the cells of the influence range of the previous position, if at least one cell is the same, the two have an intersection; otherwise, the two do not have an intersection.
[0131] In step 30229, based on the detection result, the cell information of each cell in the corresponding impact range is updated to obtain updated cell information.
[0132] For example, different update methods are adopted for different detection results.
[0133] In some embodiments, step 30229 is implemented by:
[0134] Method 1: In response to the existence of an intersection of the corresponding influence ranges, a new influence range and a removed influence range are determined based on the differences between the corresponding influence ranges, the object data of the virtual object is deleted from each cell information within the removed influence range, and the object data of the virtual object is added to each cell information within the newly added influence range to obtain updated cell information.
[0135] For example, the newly added influence range is the range of cells that are not covered by the influence range of the previous position and are covered by the influence range of the current position. The removed influence range is the range of cells that are not covered by the influence range of the current position and are covered by the influence range of the previous position. The object data of the virtual object is deleted from the cells of the removed influence range, and the object data of the virtual object is stored in the cells of the newly added influence range to obtain updated cell information.
[0136] Method 2: In response to the fact that there is no intersection between the corresponding influence ranges, the object data of the virtual object is deleted from each cell information within the influence range corresponding to the previous position, and the object data of the virtual object is added to the cell information of each cell within the influence range corresponding to the current position to obtain updated cell information.
[0137] For example, continue to refer to Figure 6C , the influence ranges corresponding to the current position and the previous position do not have an intersection. The object data of the virtual object in the influence range of the previous position is deleted, and the two-dimensional array memory is requested from the cells in the influence range of the current position, and the object data is stored in the cells in the influence range of the current position to obtain the updated cell information.
[0138] For example, if the object data corresponding to the previous position is different from the object data corresponding to the current position, regardless of whether the influence ranges of the two intersect, the object data of the virtual object stored in the cells within the influence range of the previous position will be deleted, and the object data corresponding to the current position will be stored in each cell within the influence range of the current position to obtain updated cell information.
[0139] Continue to refer Figure 3B , in step 3023, the updated cell information of each cell is combined into two-dimensional grid data.
[0140] For example, the updated cell information of each cell is combined into two-dimensional grid data according to the position of the corresponding cell, and the two-dimensional grid data can be represented as an array for storage.
[0141] In the embodiment of the present application, object data is stored in a two-dimensional grid, and there is no need to consider the height factor of the virtual object in the virtual scene, which saves the space required for storing object data, facilitates data search and processing of the virtual scene, and improves the efficiency of data search and processing.
[0142] Continue to refer Figure 3A , in step 303, the local range corresponding to the virtual object is obtained.
[0143] For example, the virtual object may be a player character or a non-player character. The local range is the area where the virtual object is the search center. The size of the local range and the influence range mentioned above may be the same or different, and the two are ranges for different purposes.
[0144] In step 304, the current position of the virtual object in the virtual scene is mapped to the two-dimensional grid to obtain the mapping position of the virtual object in the two-dimensional grid.
[0145] For example, the mapping position can be represented by a grid position or a coordinate position.
[0146] In some embodiments, step 304 can be implemented by: obtaining the spatial coordinates corresponding to the current position of the virtual object in the virtual scene, where the spatial coordinates include a height value and a plane coordinate value; and using the position of the plane coordinate value of the virtual object in the two-dimensional grid as the mapping position.
[0147] Assumption: In a two-dimensional grid, the mapping position is represented by coordinate values. The spatial coordinates of the virtual object C in the virtual scene are (X2, Y2, Z2), where Z2 is the height value and (X2, Y2) is the plane coordinate value. The current position of the virtual object C is mapped to the two-dimensional grid, and the mapping position is (X2, Y2). If the mapping position is represented by the cell position in the two-dimensional grid, the position of the virtual object C in the two-dimensional grid is the cell where the plane coordinate value (X2, Y2) is located.
[0148] In step 305, the mapping position is used as a reference point to query the cell information of each cell in the local range from the two-dimensional grid data.
[0149] For example, the mapping position is used as a reference point, that is, the mapping position is used as a starting point to traverse the cell information of each cell in the local range. The corresponding search term or search information can be determined according to the interactive behavior to be performed by the virtual object.
[0150] In some embodiments, reference Figure 3E , Figure 3E It is a flowchart of a data processing method for a virtual scene provided in an embodiment of the present application; Figure 3A The illustrated step 305 can be implemented by following the steps 3051 to 3054, which are described in detail below.
[0151] In step 3051, each cell at least partially covered by the local range is regarded as each cell in the local range.
[0152] For example, the principle of determining each cell in the local range is the same as that of determining the cells in the influence range described above. Please refer to step 30223 above, and no further details will be given here.
[0153] In step 3052, cell information of each cell within a local range is extracted from the two-dimensional grid data.
[0154] For example, the two-dimensional grid data is stored in a two-dimensional array, and the corresponding cell information is called from the array according to the corresponding position of the cell.
[0155] In step 3053, the cell occupied by the mapping position is taken as the starting cell, and the cell information of each cell in the local range is traversed according to the ascending order of the distance from the starting cell.
[0156] For example, the cells are sorted in ascending order according to the distance from the starting cell, that is, starting from the starting cell, the traversal operation is performed from near to far.
[0157] In step 3054, the traversed cell information that meets the query condition is obtained.
[0158] For example, the query condition includes: the cell information is associated with the interactive behavior of the virtual object at the current position. Associated with the interactive behavior, that is, other virtual objects corresponding to the object data included in the cell information are the objects with which the virtual object performs the interactive behavior.
[0159] Continue to refer Figure 3A , in step 306, the cell information obtained by the query is combined into a search result.
[0160] For example, the search results are used for interaction with the virtual object at the current location.
[0161] In some embodiments, reference Figure 3F , Figure 3F It is a flowchart of a data processing method for a virtual scene provided in an embodiment of the present application; Figure 3A The illustrated step 306 can be implemented by following the steps 3061 to 3063, which are described in detail below.
[0162] In step 3061, object data of the target virtual object is extracted from the cell information obtained by the query.
[0163] For example, the target virtual object is a virtual object associated with the interactive behavior of the virtual object. For example, the interactive behavior of the virtual object is an attacking behavior, and the target virtual object is the attacked virtual object. The interactive behavior of the virtual object is a gaze behavior, and the direction of the head of the virtual object follows the position of the target virtual object.
[0164] In step 3062, the mapping position of each target virtual object in the two-dimensional grid is restored to the current spatial coordinates of the target virtual object in the virtual scene.
[0165] For example, in actual applications, the interactive functions performed in the virtual scene are implemented based on the position of the virtual object in the three-dimensional space, and the position in the two-dimensional grid is restored to the three-dimensional spatial coordinates to facilitate the execution of related interactive behaviors.
[0166] In step 3063, the current spatial coordinates and object data of each target virtual object are combined into a search result.
[0167] For example, the virtual scene can be run by different functional modules or processes in the server. For example, the virtual scene is run by a large world object management system, an interactive system, a combat system and other systems. The large world object management system is configured to perform query processing, obtain search results, and feed back the search results to the interactive system or combat system that needs the search results.
[0168] In the embodiment of the present application, by restoring the positions in the two-dimensional grid to three-dimensional coordinates in the virtual scene, it is convenient to perform related interactive behaviors based on the search results, thereby improving the interaction efficiency between virtual objects in the virtual scene.
[0169] In some embodiments, after step 306, the following types of interactive behaviors are performed:
[0170] Type 1: In response to the virtual object being a non-player character, controlling the virtual object to perform the following interactive behavior: based on the current spatial coordinates, performing an interactive behavior toward a target virtual object corresponding to the search result.
[0171] For example, the type of the target virtual object may be a non-player character or a player character, and the interactive behavior performed by the non-player character on the target virtual object may be an attack, a gaze, or the like.
[0172] refer to Figure 4A , Figure 4A is a schematic diagram of a virtual scene provided by an embodiment of the present application. When the virtual object is a player character, the data processing method of the virtual scene provided by the embodiment of the present application can be applied to the following Figure 4A In the virtual scene shown in the figure, based on the current positions of virtual objects 402A and 403A, the server periodically searches for player virtual objects within the local search ranges corresponding to virtual objects 402A and 403A, respectively, and in response to the existence of player virtual object 401A within the influence range, controls virtual objects 402A and 403A to perform the action of looking at virtual object 401A (the head moves in the direction of virtual object 401A). Figure 4A The dotted arrows in are used to represent the sight lines of the virtual objects 402A and 403A.
[0173] Type 2: In response to the virtual object being a player character, the target virtual object corresponding to the search result is displayed at the current spatial coordinates of the target virtual object in a manner distinguished from other virtual objects, so that the virtual object can perform interactive behavior.
[0174] For example, when the virtual object is a player character, the target virtual object may be a hostile virtual object (player character or non-player character), and the display method that distinguishes it from other virtual objects includes any of the following: displaying a focus icon, displaying it in a color that is different from other objects, or highlighting it. Figure 4B , Figure 4B is a schematic diagram of a virtual scene provided by an embodiment of the present application. When the virtual object is a player character, the data processing method of the virtual scene provided by the embodiment of the present application can be applied to the following Figure 4BIn the virtual scene shown. The server calls the data processing method of the virtual scene of the embodiment of the present application, and based on the current position of the virtual object 401A, regularly searches for hostile virtual objects within the local search range of the virtual object 401A, and in response to the presence of hostile virtual objects (virtual object 401B, virtual object 402B, virtual object 403B, virtual object 404B) within the local search range, annotates the above four virtual objects with a health progress bar 405B, and annotates the virtual object 402B closest to the virtual object 401A with a focus icon 406B. Implementing local data search through two-dimensional grid data can improve the response rate of interactive behaviors in virtual scenes and save virtual scene memory usage.
[0175] For example, when the virtual object is a player character and the interactive function performed is to search for other virtual objects in the virtual environment, the search results can also be represented by prompt text, sound, etc.
[0176] The embodiment of the present application stores the data corresponding to the virtual scene in a two-dimensional grid, saving data storage space, and in the two-dimensional grid data, by obtaining the local range of the virtual object to be queried, using the cell information corresponding to the local range as the query range, realizing local search, saving the computing resources consumed by the query operation, reducing the memory required for the interactive behavior of the virtual object associated with the query operation, and improving the smoothness of the operation of the virtual scene. Compared with the related technology, data query is no longer the main time-consuming of the central processing unit, and the ability of the central processing unit to carry virtual scene related functions is improved. Data is stored by distinguishing dynamic objects and static objects, improving data management efficiency, saving computing resources required for data update, and reducing memory usage.
[0177] Next, an exemplary application of the data processing method for a virtual scene according to an embodiment of the present application in an actual application scenario will be described.
[0178] At present, Unreal Engine (UE) is widely used in virtual scene construction, such as Unreal Engine 4 and Unreal Engine 5. Taking Unreal Engine 4 as an example, the native search solution in Unreal Engine 4 (UE) searches for all objects in the scene. The implementation principle is as follows: The big world of Unreal Engine 4 is composed of multiple stream levels (level data can be loaded into the virtual scene of the game in the form of data streams). Each stream level stores the serialized objects in the map of the virtual scene and the objects dynamically generated during the game. The parent object (Outer) of the objects dynamically generated during the game is the stream level. The global search can be performed by obtaining all objects in all loaded levels to filter out qualified objects. The above solution is the native solution of Unreal Engine. This solution can be plug-and-play and does not require modification and compatibility.
[0179] From the above analysis, it can be seen that if the traditional Unreal Engine object search solution is directly applied to the project, it will first fail to meet the characteristics of "efficient local search". Efficient search is the basis for each game project to carry more game functions. If the native Unreal Engine global search function is used directly, it will occupy too much time of the central processing unit (CPU), hereinafter referred to as CPU, and reduce the ability of the CPU to carry the game play function, thus losing the possibility of expanding more game functions and game play. Secondly, the design principle of the basic function interface is to be as efficient as possible, but at the same time, it cannot generate too high space-for-time occupation; however, the efficient interface has to accept part of the memory occupation, and the method of exchanging a small amount of memory for efficient execution of high-frequency functions is an acceptable compromise.
[0180] For large-world games, virtual objects in the virtual scene are large in number, diverse in types, and widely distributed. In addition, many other external system functions, such as the interaction system, combat system, and upper-level systems such as the dialogue system, need to search, filter, and access local objects in the virtual scene to build a variety of game functions. For some systems that frequently access local objects and have complex access conditions, object access will become a high-consumption function, which is unacceptable for the CPU time of the game itself. This will cause the CPU time to be used for non-primary functions, which does not meet the original intention of building a large-world virtual scene that is compatible with multiple functions.
[0181] The technical solution of the embodiment of the present application realizes the grid division of the two-dimensional space for the large world of the Unreal Engine, and at the same time, the grid occupation is applied for only when there is a demand for occupation. The extra memory allocation caused by the occupation of the two-dimensional space is saved to the greatest extent. In addition, an efficient local search capability is provided, so that object search is no longer the main time-consuming of the CPU.
[0182] For example, the server is used as the execution subject. The virtual scene is implemented and operated through multiple systems with different functions in the server, such as the large world object management system, game interaction, combat, dialogue and other systems. The large world object management system is configured to configure the virtual scene according to parameters, including the boundaries of the two-dimensional game map, the size of the two-dimensional cell, and the initialization of the basic data for object management. When a dynamic or static object is generated or enters the virtual scene, the large world object management system will be notified. The large world object management system will apply for two-dimensional array memory according to the position of the object, and obtain the total number of grids affected by the current object to store two-dimensional cell information. When the game interaction, combat, dialogue and other systems need to search for objects in a local range, the large world object management system will obtain the current position and the number of two-dimensional cells within the range of influence based on the input position, extract the objects already stored in the cells from the two-dimensional cells corresponding to the range of influence, and return them to the corresponding query system.
[0183] refer to Figure 5A , Figure 5A is an optional flow chart of the data processing method of the virtual scene provided in the embodiment of the present application. The electronic device for implementing the data processing method of the virtual scene in the embodiment of the present application may be a combination of a terminal device and a server. Figure 5A The steps are used to explain the data processing method of the virtual scene provided in the embodiment of the present application.
[0184] In step 501A, a large world object management system is created.
[0185] For example, the creation of a large world object management system can be achieved in the following ways: Get the boundary value of the space range of the virtual scene, as well as the cell size and the total number of cells, divide the space range, and obtain multiple cells in the virtual scene. For example: Set the world space boundary NGRC_SCENE_MAX to 3000000cm, the two-dimensional space limit range is (-NGRC_SCENE_MAX*0.5, -NGRC_SCENE_MAX*0.5), (-NGRC_SCENE_MAX*0.5, NGRC_SCENE_MAX*0.5), (NGRC_SCENE_MAX*0.5, -NGRC_SCENE_MAX*0.5), (NGRC_SCENE_MAX*0.5, NGRC_SCENE_MAX*0.5) area, configure the cell size (Cell Size) equal to 10000cm according to the basic data, and the entire large world is divided into (3000000cm / 10000cm) 2 =90,000 cells.
[0186] refer to Fig. 6A , Fig. 6A Schematic diagram of the boundary division of the virtual scene provided by the embodiment of the present application. The absolute value of the horizontal and vertical coordinates of the boundary value of the space range is set to 1500000, and the cell size is 10000. The mapping position of the cell adjacent to the origin and located in the first quadrant of the coordinate axis is (10000, 10000).
[0187] In step 502A, object data of a virtual object is obtained.
[0188] For example, virtual objects in a virtual scene can be objects placed in the scene (virtual objects in the scene, stationary non-player characters), or virtual objects dynamically created by external system functions (player objects, movable non-player characters).
[0189] In step 503A, register and enter the big world object management system.
[0190] For example, after the virtual object in the virtual scene is created, the process sends a registration event and registers into the big world object management system to add the virtual object to the big world object management system.
[0191] In step 504A, it is determined whether the virtual object is a dynamic object. If the determination result is yes, step 505A is executed to update the two-dimensional grid data in a manner corresponding to a dynamic object. If the determination result is no, step 506A is executed to update the two-dimensional grid data in a manner corresponding to a static object.
[0192] For example, when the virtual object is a static virtual object, the static virtual object big world two-dimensional space data update function is called, and when the virtual object is a dynamic virtual object, the dynamic virtual object big world two-dimensional space data update function is called. For different types of virtual objects, the object data is stored in the divided two-dimensional big world cells through data update.
[0193] refer to Figure 5B , Figure 5B It is an optional flow chart of the data processing method of the virtual scene provided in the embodiment of the present application. Figure 5A Step 506A in can be Figure 5B The steps in are implemented.
[0194] In step 501B, the object data of the virtual object is added to the global static data set.
[0195] For example, a static object is a virtual object at a fixed position in a virtual scene. The data of static objects and dynamic objects are classified and stored to facilitate data query in the application stage.
[0196] In step 502B, the current position of the virtual object is obtained.
[0197] For example, the current position is the position of the static virtual object in the virtual scene.
[0198] In step 503B, it is determined whether the current position exceeds the range of the virtual scene. If the determination result is yes, step 504B is executed to clip the coordinates of the current position to obtain the current coordinates within the range of the virtual scene. If the determination result is no, step 505B is executed to create cell information of the virtual object, and determine the boundary value of the virtual object's influence area according to the current position of the virtual object, the influence range and the cell size.
[0199] For example, the current position of the static virtual object is obtained, and it is determined whether the current position of the static virtual object exceeds the boundary of the big world. If it exceeds the boundary of the big world, the position is clipped. If the horizontal coordinate of the current position is less than the minimum horizontal coordinate value Xmin of the boundary or greater than the maximum horizontal coordinate value Xmax of the boundary, then the horizontal coordinate value of the current position is clipped to make the horizontal coordinate value of the current position equal to the minimum horizontal coordinate value Xmin of the boundary or the maximum horizontal coordinate value Xmax of the boundary. The total coordinate clipping algorithm of the current position is similar to make the current position of the virtual object within the boundary of the big world.
[0200] In step 506B, a two-dimensional array memory is applied for according to the boundary value, and the two-dimensional grid array corresponding to the affected area is traversed to obtain a set of all affected cells.
[0201] For example, the current position of the corrected static virtual object is used to create cell information, and the four boundary values corresponding to the influence range area are determined according to the influence range of the static virtual object, including: the minimum horizontal coordinate Xmin, the minimum vertical coordinate Ymin, the maximum horizontal coordinate Xmax, and the maximum vertical coordinate Ymax. Dynamically apply for the cell two-dimensional array memory according to the maximum horizontal coordinate Xmax and the maximum vertical coordinate Ymax, obtain the affected cell information according to the boundary value, and use the cell information between the two-dimensional coordinates (Xmin, Ymin) to (Xmax, Ymax) as the cell information set within the influence range. If the cell information exists, the cell information is returned, and if the cell information does not exist, new cell information is created.
[0202] In step 507B, all affected cells are traversed.
[0203] In step 508B, the cell information of the virtual object is added to the cell information of the affected cell.
[0204] For example, the data of the static virtual object is added to all the affected cells respectively, so as to complete the update of the two-dimensional space data of the static virtual object world.
[0205] For example, Figure 6B It is a schematic diagram of data storage in a two-dimensional grid provided in an embodiment of the present application; assuming that there is an object A, the influence range (Cell Distance) of object A is obtained, the default value of the influence range is a diameter of 15000 cm, and the current position (Location) of object A is used as the origin to calculate the two-dimensional cell range affected by the object and the specific affected cell object array (Cell Data Array), loop through the cell object array (Cell Data Array), and store the object A in the cell object arrays of all affected cells respectively, to complete the large world two-dimensional spatial data storage update of object A.
[0206] refer to Figure 5C as well as Figure 5D , Figure 5C as well as Figure 5D It is an optional flow chart of the data processing method of the virtual scene provided in the embodiment of the present application. Figure 5C as well as Figure 5D Connect through Node A, Figure 5A Step 505A in can be Figure 5C as well as Figure 5D steps to achieve.
[0207] In step 501C, the object data of the virtual object is added to the global dynamic data set.
[0208] For example, a dynamic object is a virtual object with no fixed position in a virtual scene. The data of static objects and dynamic objects are classified and stored to facilitate data query in the application stage.
[0209] In step 502C, the current position of the virtual object is obtained.
[0210] In step 503C, it is determined whether the current position exceeds the range of the virtual scene. If the determination result is yes, step 504C is executed to clip the coordinates of the current position to obtain the current coordinates within the range of the virtual scene. If the determination result is no, step 505C is executed to create cell information of the virtual object, and determine the boundary value of the virtual object's influence area according to the current position of the virtual object, the influence range and the cell size.
[0211] For example, the principles of step 502C to step 505C are the same as those of step 502B to step 505B, and are not repeated here.
[0212] In step 506C, the cell information of the virtual object at the previous position is obtained.
[0213] For example, the position of the dynamic virtual object in the virtual scene can be moved, and the position of the dynamic virtual object before the plane movement is taken as the previous position, and the current position can be the position during the movement or at the end of the movement. That is, there is a position difference between the current position and the previous position.
[0214] In step 507C, it is determined whether the cell information of the current position of the virtual object is the same as the cell information of the previous position. If the determination result is no, step 513C is executed to apply for two-dimensional array memory according to the boundary value, traverse the two-dimensional grid array corresponding to the affected area, and obtain all affected cell sets. If the determination result is yes, in step 508C, it is determined whether the influence range of the current position of the virtual object and the influence range of the previous position have an intersection.
[0215] For example, if the cell information of the current position of the virtual object is different from the cell information of the previous position, the cell information corresponding to the previous position is cleared, and the cell information corresponding to the current position is determined. If the cell information of the current position of the virtual object is the same as the cell information of the previous position, it is determined whether the influence range has an intersection.
[0216] When the judgment result of step 508C is yes, step 509C is executed to determine the newly affected cells and the removed affected cells according to the cell information of the previous position and the cell information of the current position.
[0217] For example, adding influence means that the influence range of the current position covers the cell, while the influence range of the previous position does not cover the cell. Removing influence means that the influence range of the previous position covers the cell, while the influence range of the current position does not cover the cell.
[0218] Step 509C can be implemented in the following way: create new cell information using the current position, and make a difference between (Xmin, Ymin) to (Xmax, Ymax) of the previous cell information and (Xmin, Ymin) to (Xmax, Ymax) of the new cell information according to the minimum horizontal coordinate Xmin, minimum vertical coordinate Ymin, maximum horizontal coordinate Xmax, and maximum vertical coordinate Ymax of the previous and next cell information, and calculate the newly added affected cell objects and the removed affected cell objects. Traverse all newly added affected two-dimensional cell objects, add dynamic scene objects to the newly added cell objects, traverse all removed affected two-dimensional cell objects, and remove dynamic scene objects from the two-dimensional cell objects.
[0219] After step 509C, step 510C is executed to traverse all newly affected cells and add the cell information of the current position of the virtual object.
[0220] For example, the principle of step 510C is the same as the principle of step 508B above.
[0221] In step 511C, all cells whose influence is to be removed are traversed, and the cell information of the previous position of the virtual object is removed.
[0222] For example, assuming that a cell stores information 1, information 2, and the cell information of the previous position of a virtual object, removing the cell information of the previous position of the virtual object means: retaining the existing information 1 and information 2 in the cell, and deleting the cell information of the previous position of the virtual object.
[0223] When the judgment result of step 508C is no, step 512C is executed to delete the cell information of the virtual object from the cells within the influence range corresponding to the previous position.
[0224] For example, if there is no intersection between the influence of the current position and the influence of the previous position, the cell information of the dynamic virtual object in the influence range corresponding to the previous position is completely deleted.
[0225] refer to Figure 6C , Figure 6C 602 of the previous position covers the affected cell 601, and the influence range 604 of the current position covers the affected cell 603. There is no intersection between the influence ranges corresponding to the current position and the previous position.
[0226] After step 512C, step 513C is executed to apply for two-dimensional array memory according to the boundary value, traverse the two-dimensional grid array corresponding to the affected area, and obtain a set of all affected cells.
[0227] Step 513C has been explained above and will not be repeated here.
[0228] In step 514C, the current cell information of the virtual object is added to the affected cell corresponding to the current position.
[0229] For example, the principle of step 514C refers to step 508B, which will not be repeated here.
[0230] The following is an explanation with examples, for example: the position of the player's virtual object will move, such as: jumping, walking, running, etc., assuming that the influence range of the player's virtual object is the part of its feet on the ground, in response to the movement of the player object, the cell information of the cell object of the virtual environment within the influence range is updated according to the moved position.
[0231] In some embodiments, reference Figure 4A as well as Figure 4B , FIG. 4A to FIG. 4B is a schematic diagram of a virtual scene provided by an embodiment of the present application. When the virtual object is a player character, the data processing method of the virtual scene provided by the embodiment of the present application can be applied to the following Figure 4A In the virtual scene shown in the figure, based on the current positions of virtual objects 402A and 403A, the server periodically searches for player virtual objects within the local search ranges corresponding to virtual objects 402A and 403A, respectively, and in response to the existence of player virtual object 401A within the influence range, controls virtual objects 402A and 403A to perform the action of looking at virtual object 401A (the head moves in the direction of virtual object 401A). Figure 4A The dotted arrows in are used to represent the sight lines of the virtual objects 402A and 403A.
[0232] When the virtual object is a player character, the data processing method of the virtual scene provided in the embodiment of the present application can be applied to the following situations: Figure 4B In the virtual scene shown. The server calls the data processing method of the virtual scene of the embodiment of the present application, and based on the current position of the virtual object 401A, regularly searches for hostile virtual objects within the local search range of the virtual object 401A, and in response to the presence of hostile virtual objects (virtual object 401B, virtual object 402B, virtual object 403B, virtual object 404B) within the local search range, annotates the above four virtual objects with a health progress bar 405B, and annotates the virtual object 402B closest to the virtual object 401A with a focus icon 406B. Implementing local data search through two-dimensional grid data can improve the response rate of interactive behaviors in virtual scenes and save virtual scene memory usage.
[0233] The embodiment of the present application divides the large world objects into two-dimensional space, establishes storage connections, and can greatly accelerate the search speed of large world objects at the expense of a small amount of memory. For developers, there is no need to consider efficiency issues and use the object search interface at any time. In the game system, dynamic objects (objects dynamically generated during the game) are separated from static objects (serialized objects that come with the map) to maximize the space occupied by objects. By adopting a two-dimensional grid algorithm, large world objects are stored in the two-dimensional space of the world, and efficient local object acquisition is achieved. The embodiment of the present application provides efficient object search capabilities for open large world type games, liberates limited CPU capabilities, allows more game content and ecology to be presented in the big world, utilizes limited resources, and provides the most efficient service at runtime.
[0234] The following is a description of an exemplary structure of a virtual scene data processing device 455 provided in an embodiment of the present application implemented as a software module. In some embodiments, Figure 2A or Figure 2B As shown, the software modules in the data processing device 455 of the virtual scene stored in the memory 450 may include: a scene creation module 4551, configured to create a two-dimensional grid of the virtual scene, wherein the two-dimensional grid includes a plurality of cells; the scene creation module 4551, configured to combine the cell information of each cell in the two-dimensional grid into two-dimensional grid data; a data query module 4552, configured to obtain a local range corresponding to the virtual object, wherein the local range is an area where the virtual object is the search center; the data query module 4552, configured to map the current position of the virtual object in the virtual scene to the two-dimensional grid to obtain the mapping position of the virtual object in the two-dimensional grid; the data query module 4552, configured to use the mapping position as a reference point to query the cell information of each cell in the local range from the two-dimensional grid data; the data query module 4552, configured to combine the cell information obtained by the query into search results, wherein the search results are used for the interaction of the virtual object at the current position.
[0235] In some embodiments, the scene creation module 4551 is configured to obtain the two-dimensional spatial range and cell configuration information of the virtual scene, wherein the cell configuration information includes at least one of the following: the total number of cells and the cell size of the two-dimensional grid; gridding the two-dimensional spatial range based on the cell configuration information to obtain a two-dimensional grid, wherein the cell size of each cell is the same.
[0236] In some embodiments, the scene creation module 4551 is configured to obtain object data of multiple different virtual objects; based on the object type and object data of each virtual object, update the cell information of each cell in the initial two-dimensional grid; and combine the updated cell information of each cell into two-dimensional grid data.
[0237] In some embodiments, the scene creation module 4551 is configured to perform the following processing on the object data of each virtual object: in response to the object type of the virtual object being a static object, updating the cell information corresponding to the virtual object in the initial two-dimensional grid in a static object update manner, wherein the static object is an object whose position in the two-dimensional grid is fixed; in response to the object type of the virtual object being a dynamic object, updating the cell information corresponding to the virtual object in the initial two-dimensional grid in a dynamic object update manner, wherein the dynamic object is an object whose position in the two-dimensional grid is not fixed.
[0238] In some embodiments, the scene creation module 4551 is configured to add the object data of the virtual object to a static data set corresponding to the two-dimensional grid data; obtain the current position of the virtual object in the two-dimensional grid; obtain the cell within the influence range corresponding to the virtual object, wherein the influence range has the current position as the geometric center; and superimpose the object data of the virtual object with the cell information of each cell within the influence range to obtain updated cell information.
[0239] In some embodiments, the scene creation module 4551 is configured to add the object data of the virtual object to a dynamic data set corresponding to the two-dimensional grid data; obtain the current position of the virtual object in the two-dimensional grid, and obtain the previous position of the virtual object in the two-dimensional grid; obtain the cells of the influence range corresponding to the current position and the previous position of the virtual object, respectively, wherein the influence range corresponding to the current position has the current position as the geometric center, and the influence range corresponding to the previous position has the previous position as the geometric center; obtain the detection result of whether the cells of the corresponding influence ranges have an intersection; based on the detection result, update the cell information of each cell in the corresponding influence ranges to obtain updated cell information.
[0240] In some embodiments, the scene creation module 4551 is configured to, in response to the existence of an intersection of respectively corresponding influence ranges, determine a new influence range and a removed influence range based on the difference between the respectively corresponding influence ranges, delete the object data of the virtual object from each cell information within the removed influence range, and add the object data of the virtual object to each cell information within the newly added influence range to obtain updated cell information; in response to the absence of an intersection of respectively corresponding influence ranges, delete the object data of the virtual object from each cell information within the influence range corresponding to the previous position, and add the object data of the virtual object to the cell information of each cell within the influence range corresponding to the current position to obtain updated cell information.
[0241] In some embodiments, the scene creation module 4551 is configured to, after obtaining the current position of the virtual object in the two-dimensional grid, determine the plane coordinate value corresponding to the current position in response to the current position exceeding the two-dimensional space range of the two-dimensional grid, the plane coordinate value including the horizontal coordinate value and the vertical coordinate value; and perform the following processing on the plane coordinate value exceeding the two-dimensional space range: set the plane coordinate value to the boundary value of the two-dimensional space range so that the current position is within the two-dimensional space range.
[0242] In some embodiments, the data query module 4552 is configured to obtain the spatial coordinates corresponding to the current position of the virtual object in the virtual scene, where the spatial coordinates include a height value and a plane coordinate value; and the position of the plane coordinate value of the virtual object in the two-dimensional grid is used as the mapping position.
[0243] In some embodiments, the data query module 4552 is configured to take each cell that is at least partially covered by the local range as each cell in the local range; extract the cell information of each cell in the local range from the two-dimensional grid data; take the cell occupied by the mapping position as the starting cell, and traverse the cell information of each cell in the local range in ascending order according to the distance from the starting cell; and obtain the traversed cell information that meets the query conditions, wherein the query conditions include: the cell information is associated with the interactive behavior of the virtual object at the current position.
[0244] In some embodiments, the data query module 4552 is configured to extract object data of the target virtual object from the cell information obtained by the query, wherein the target virtual object is a virtual object associated with the interactive behavior of the virtual object; restore the mapping position of each target virtual object in the two-dimensional grid to the current spatial coordinates of the target virtual object in the virtual scene; and combine the current spatial coordinates and object data of each target virtual object into search results.
[0245] In some embodiments, the data query module 4552 is configured to, after combining the cell information obtained from the query into search results, control the virtual object to perform the following interactive behaviors in response to the virtual object being a non-player character: based on the current spatial coordinates, perform interactive behaviors towards the target virtual object corresponding to the search results; in response to the virtual object being a player character, display the target virtual object corresponding to the search results at the current spatial coordinates of the target virtual object in a manner that is distinguished from other virtual objects, so that the virtual object can perform interactive behaviors.
[0246] The embodiment of the present application provides a computer program product, which includes a computer program or a computer executable instruction, and the computer program or the computer executable instruction is stored in a computer-readable storage medium. The processor of the electronic device reads the computer executable instruction from the computer-readable storage medium, and the processor executes the computer executable instruction, so that the electronic device executes the data processing method of the virtual scene described in the embodiment of the present application.
[0247] The present application embodiment provides a computer-readable storage medium storing computer executable instructions, wherein the computer executable instructions or computer programs are stored. When the computer executable instructions or computer programs are executed by a processor, the processor will be caused to execute the data processing method of the virtual scene provided by the present application embodiment, for example, Figure 3A The data processing method of the virtual scene is shown.
[0248] In some embodiments, the computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, flash memory, magnetic surface storage, optical disk, or CD-ROM; or it may be various devices including one or any combination of the above memories.
[0249] In some embodiments, computer executable instructions may be in the form of a program, software, software module, script 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 a stand-alone program or as a module, component, subroutine or other unit suitable for use in a computing environment.
[0250] As an example, computer-executable instructions may, but need not, correspond to a file in a file system, may be stored as part of a file storing other programs or data, such as in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinated files (e.g., files storing one or more modules, subroutines, or code portions).
[0251] As an example, the executable instructions may be deployed to be executed on one electronic device, or on multiple electronic devices located at one site, or on multiple electronic devices distributed at multiple sites and interconnected by a communication network.
[0252] In summary, the embodiment of the present application stores the data corresponding to the virtual scene in a two-dimensional grid, which saves data storage space, and in the two-dimensional grid data, by obtaining the local range of the virtual object to be queried, the cell information corresponding to the local range is used as the query range, thereby realizing local search, saving the computing resources consumed by the query operation, reducing the memory required for the interactive behavior of the virtual object associated with the query operation, and improving the smoothness of the virtual scene operation. Compared with the related technology, data query is no longer the main time-consuming of the central processor, and the ability of the central processor to carry virtual scene related functions is improved.
[0253] The above is only an embodiment of the present application and is not intended to limit the protection scope of the present application. Any modifications, equivalent substitutions and improvements made within the spirit and scope of the present application are included in the protection scope of the present application.
Claims
1. A data processing method for a virtual scene, characterized in that: The method comprises: Creating a two-dimensional grid of a virtual scene, wherein the two-dimensional grid includes a plurality of cells; Combining the cell information of each of the cells in the two-dimensional grid into two-dimensional grid data; Acquire a local range corresponding to the virtual object, wherein the local range is an area where the virtual object is a search center; Mapping a current position of a virtual object in the virtual scene to the two-dimensional grid to obtain a mapping position of the virtual object in the two-dimensional grid; Taking the mapping position as a reference point, querying the cell information of each of the cells in the local range from the two-dimensional grid data; The cell information obtained by the query is combined into a search result, wherein the search result is used for the interaction of the virtual object at the current position.
2. The method according to claim 1, characterized in that The step of creating a two-dimensional grid of a virtual scene comprises: Acquire the two-dimensional spatial range and cell configuration information of the virtual scene, wherein the cell configuration information includes at least one of the following: the total number of cells and the cell size of the two-dimensional grid; The two-dimensional space range is grid-divided based on the cell configuration information to obtain a two-dimensional grid, wherein the cell size of each of the cells is the same.
3. The method according to claim 1, characterized in that: The step of combining the cell information of each cell in the two-dimensional grid into two-dimensional grid data includes: Acquiring object data of a plurality of different virtual objects; Based on the object type and object data of each virtual object, updating the cell information of each cell in the initial two-dimensional grid; The updated cell information of each of the cells is combined into two-dimensional grid data.
4. The method according to claim 3, characterized in that The updating of the cell information of each cell in the initial two-dimensional grid based on the object type and object data of each virtual object includes: The following processing is performed on the object data of each virtual object: In response to the object type of the virtual object being a static object, updating the cell information corresponding to the virtual object in the initial two-dimensional grid in a static object update manner, wherein the static object is an object with a fixed position in the two-dimensional grid; In response to the object type of the virtual object being a dynamic object, the cell information corresponding to the virtual object in the initial two-dimensional grid is updated in a dynamic object update manner, wherein the dynamic object is an object whose position in the two-dimensional grid is not fixed.
5. The method according to claim 4, characterized in that The updating of the cell information corresponding to the virtual object in the initial two-dimensional grid in a static object updating manner includes: Adding the object data of the virtual object to the static data set corresponding to the two-dimensional grid data; Obtaining a current position of the virtual object in the two-dimensional grid; Obtain cells within an influence range corresponding to the virtual object, wherein the influence range takes the current position as a geometric center; The object data of the virtual object is superimposed with the cell information of each of the cells within the influence range to obtain updated cell information.
6. The method according to claim 4, characterized in that The updating of the cell information corresponding to the virtual object in the initial two-dimensional grid in a dynamic object updating manner includes: Adding the object data of the virtual object to the dynamic data set corresponding to the two-dimensional grid data; Obtaining a current position of the virtual object in the two-dimensional grid, and obtaining a previous position of the virtual object in the two-dimensional grid; Obtain cells of influence ranges corresponding to the current position and the previous position of the virtual object, respectively, wherein the influence range corresponding to the current position has the current position as a geometric center, and the influence range corresponding to the previous position has the previous position as a geometric center; Obtaining a detection result of whether the cells of the respectively corresponding influence ranges have an intersection; Based on the detection result, the cell information of each of the cells in the corresponding influence range is updated to obtain updated cell information.
7. The method according to claim 6, characterized in that The updating process of the cell information of each of the cells in the corresponding influence range based on the detection result to obtain updated cell information includes: In response to the existence of an intersection of the respectively corresponding influence ranges, determining a newly added influence range and a removed influence range based on a difference between the respectively corresponding influence ranges, deleting the object data of the virtual object from each of the cell information within the removed influence range, and adding the object data of the virtual object to each of the cell information within the newly added influence range to obtain updated cell information; In response to the fact that there is no intersection between the respectively corresponding influence ranges, the object data of the virtual object is deleted from each of the cell information within the influence range corresponding to the previous position, and the object data of the virtual object is added to the cell information of each of the cells within the influence range corresponding to the current position to obtain updated cell information.
8. The method according to claim 5 or 6, characterized in that: After obtaining the current position of the virtual object in the two-dimensional grid, the method further includes: In response to the current position exceeding the two-dimensional spatial range of the two-dimensional grid, determining a plane coordinate value corresponding to the current position, the plane coordinate value including a horizontal coordinate value and a vertical coordinate value; The following processing is performed for the plane coordinate value that exceeds the two-dimensional space range: the plane coordinate value is set as a boundary value of the two-dimensional space range so that the current position is within the two-dimensional space range.
9. The method according to claim 1, characterized in that: The step of mapping the current position of the virtual object in the virtual scene to the two-dimensional grid to obtain the mapping position of the virtual object in the two-dimensional grid includes: Acquire the spatial coordinates corresponding to the current position of the virtual object in the virtual scene, wherein the spatial coordinates include a height value and a plane coordinate value; The position of the plane coordinate value of the virtual object in the two-dimensional grid is used as the mapping position.
10. The method according to claim 1, characterized in that The step of taking the mapping position as a reference point and querying the cell information of each cell in the local range from the two-dimensional grid data includes: Each of the cells at least partially covered by the local range is regarded as each of the cells in the local range; Extracting cell information of each of the cells in the local range from the two-dimensional grid data; Taking the cell occupied by the mapping position as the starting cell, sorting in ascending order of distance from the starting cell, and traversing the cell information of each of the cells in the local range; The traversed cell information that meets the query condition is obtained, wherein the query condition includes: the cell information is associated with the interactive behavior of the virtual object at the current position.
11. The method according to any one of claims 1 to 10, characterized in that: The step of combining the cell information obtained by the query into search results includes: Extracting object data of a target virtual object from the cell information obtained by querying, wherein the target virtual object is a virtual object associated with an interactive behavior of the virtual object; Restoring the mapping position of each target virtual object in the two-dimensional grid to the current spatial coordinates of the target virtual object in the virtual scene; The current space coordinates of each target virtual object and the object data are combined into a search result.
12. The method according to claim 11, characterized in that After combining the cell information obtained by the query into search results, the method further includes: In response to the virtual object being a non-player character, controlling the virtual object to perform the following interactive behavior: performing an interactive behavior toward a target virtual object corresponding to the search result based on the current spatial coordinates; In response to the virtual object being a player character, the target virtual object corresponding to the search result is displayed at the current spatial coordinates of the target virtual object in a manner distinguished from other virtual objects, so that the virtual object can perform interactive behavior.
13. A data processing device for a virtual scene, characterized in that: The device comprises: A scene creation module, configured to create a two-dimensional grid of a virtual scene, wherein the two-dimensional grid includes a plurality of cells; The scene creation module is configured to combine the cell information of each cell in the two-dimensional grid into two-dimensional grid data; A data query module, configured to obtain a local range corresponding to a virtual object, wherein the local range is an area where the virtual object is a search center; The data query module is configured to map the current position of the virtual object in the virtual scene to the two-dimensional grid to obtain the mapping position of the virtual object in the two-dimensional grid; The data query module is configured to query the cell information of each cell within the local range from the two-dimensional grid data with the mapping position as a reference point; The data query module is configured to combine the cell information obtained by the query into a search result, wherein the search result is used for the interaction of the virtual object at the current position.
14. An electronic device, characterized in that: The electronic device comprises: A memory for storing computer executable instructions; The processor is used to implement the data processing method of the virtual scene described in any one of claims 1 to 12 when executing the computer executable instructions or computer programs stored in the memory.
15. A computer-readable storage medium storing computer-executable instructions or a computer program, characterized in that: When the computer executable instructions or computer program are executed by a processor, the method according to any one of claims 1 to 12 is implemented.
16. A computer program product comprising computer executable instructions or a computer program, characterized in that When the computer executable instructions or computer program are executed by a processor, the method according to any one of claims 1 to 12 is implemented.
Citation Information
Cited By
Digital twinning virtual-real interaction method and system for deep-sea mining
CN120783003A
