3D entity processing method, device and electronic equipment for game scenes

By binding 3D entity objects to multiple 3D entity UI panels and dynamically adjusting the display position of the UI panel according to position information, the problem of UI display and interaction in multiple entity scenes in 3D games is solved, and the interaction effect and development efficiency are improved.

CN114416066BActive Publication Date: 2025-05-09BEIJING PIXEL SOFTWARE TECH
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111645914.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-30
Publication Date
2025-05-09
Estimated Expiration
2041-12-30

AI Technical Summary

Technical Problem

In existing 3D games, 3D physical user interface (UI) is difficult to effectively display and interact in multi-physical scenes, and has high maintenance costs and low development efficiency.

Method used

By binding a 3D entity object with multiple 3D entity UI panels, the display position of the UI panel is determined based on the 3D position information, and the position of the UI panel is dynamically adjusted when the entity moves.

Benefits of technology

The 3D entity UI panel moves along with 3D entity objects, improves dynamic adjustment interaction effect, and reduces maintenance costs and development difficulties.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114416066B_ABST
    Figure CN114416066B_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides a 3D entity processing method, device and electronic device for a game scene, wherein the method includes: binding a 3D entity object to multiple 3D entity UI panels; storing the 3D entity object in a rendering display list, determining the first target 3D position of each 3D entity UI panel according to the 3D position information of the 3D entity object, and displaying each 3D entity UI panel at the corresponding first target 3D position; when detecting the movement of the 3D entity object, obtaining the current 3D position of the 3D entity object; determining the second target 3D position corresponding to each 3D entity UI panel according to the current 3D position; and moving each 3D entity UI panel to the corresponding second target 3D position. In this way, the 3D entity UI panel can follow the movement of the 3D entity object, improve the interactive effect of the dynamically adjusted 3D entity UI panel, reduce the maintenance cost of the 3D entity UI panel interaction, and improve the development efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of game development technology, and in particular to a 3D entity processing method, device and electronic device for a game scene. Background Art

[0002] In today's 3D games, players have higher and higher requirements for the quality of game applications; the user interface (UI) is the main way for game applications to interact with players. The ordinary 2D user interface displayed on the screen has become increasingly unable to meet the players' pursuit of the quality of game applications. A user interface that can move with the game character and can present a 3D stereoscopic sense can meet the players' pursuit of the quality of the interactive interface. In the prior art, the technology for a 3D entity user interface that can move with the game character and can present a 3D stereoscopic sense is immature, and the following two solutions are generally adopted: One solution is that when the game character approaches a physical object, a 2D UI will pop up at a certain position on the screen, such as the upper right corner, to display the entity information and provide interactive behavior. The second solution is that the programmer writes a C# language script, adds corresponding user interface elements to each entity UI, writes the corresponding panel logic, and then puts these entity user UIs at a certain 3D position where the entity is located.

[0003] In the first solution, although 2DUI can be used to display entity information and provide interactive behaviors, the screen size of the player's device is limited. When multiple entities exist at the same time, the 2DUI of multiple entities cannot be displayed on the screen at the same time; in the second technical solution, although it is also a 3D entity UI, this method requires writing corresponding C# language scripts for each entity UI requirement, and using C# language to write the display, hiding and specific interaction logic of the panel, the maintenance cost is high and the development efficiency is low. Summary of the invention

[0004] In order to solve the above technical problems, the embodiments of the present application provide a 3D entity processing method, device and electronic device for a game scene.

[0005] In a first aspect, an embodiment of the present application provides a 3D entity processing method for a game scene, the method comprising:

[0006] Bind 3D entity objects to multiple 3D entity UI panels;

[0007] The 3D entity objects are stored in a rendering display list, a first target 3D position of each 3D entity UI panel is determined according to the 3D position information of the 3D entity objects, and each 3D entity UI panel is displayed at the corresponding first target 3D position;

[0008] When the movement of the 3D entity object is detected, obtaining a current 3D position of the 3D entity object;

[0009] The second target 3D position corresponding to each of the 3D entity UI panels is determined according to the current 3D position, and each of the 3D entity UI panels is moved to the corresponding second target 3D position.

[0010] In a second aspect, an embodiment of the present application provides a 3D entity processing device for a game scene, the device comprising:

[0011] Binding module, used to bind 3D entity objects to multiple 3D entity UI panels;

[0012] A display module, used for storing the 3D entity objects in a rendering display list, determining a first target 3D position of each of the 3D entity UI panels according to the 3D position information of the 3D entity objects, and displaying each of the 3D entity UI panels at the corresponding first target 3D position;

[0013] An acquisition module, configured to acquire a current 3D position of the 3D entity object when movement of the 3D entity object is detected;

[0014] The determination module is used to determine the second target 3D position corresponding to each of the 3D entity UI panels according to the current 3D position, and move each of the 3D entity UI panels to the corresponding second target 3D position.

[0015] In a third aspect, an embodiment of the present application provides an electronic device, including a memory and a processor, wherein the memory is used to store a computer program, and when the computer program is run by the processor, the method for processing 3D entities in the game scene provided in the first aspect is executed.

[0016] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium storing a computer program, which, when running on a processor, executes the 3D entity processing method for the game scene provided in the first aspect.

[0017] The 3D entity processing method of the game scene provided by the above application binds a 3D entity object to multiple 3D entity UI panels; stores the 3D entity object in a rendering display list, determines the first target 3D position of each 3D entity UI panel according to the 3D position information of the 3D entity object, and displays each 3D entity UI panel at the corresponding first target 3D position; when the movement of the 3D entity object is detected, obtains the current 3D position of the 3D entity object; determines the second target 3D position corresponding to each 3D entity UI panel according to the current 3D position; and moves each 3D entity UI panel to the corresponding second target 3D position. In this way, the 3D entity UI panel can follow the movement of the 3D entity object, improve the interactive effect of the dynamically adjusted 3D entity UI panel, reduce the maintenance cost of the 3D entity UI panel interaction, and improve the development efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the technical solution of the present application, the following is a brief introduction to the drawings required for use in the embodiments. It should be understood that the following drawings only illustrate certain embodiments of the present application and should not be regarded as limiting the scope of protection of the present application. In each of the drawings, similar components are numbered similarly.

[0019] Figure 1 A schematic diagram of a process of a 3D entity processing method for a game scene provided by an embodiment of the present application is shown;

[0020] Figure 2 A structural schematic diagram of a 3D entity processing device for a game scene provided in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0021] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments.

[0022] The components of the embodiments of the present application generally described and shown in the drawings herein may be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.

[0023] Hereinafter, the terms "including", "having" and their cognates, which may be used in various embodiments of the present application, are intended only to indicate specific features, numbers, steps, operations, elements, components, or combinations of the foregoing items, and should not be understood as first excluding the existence of one or more other features, numbers, steps, operations, elements, components, or combinations of the foregoing items or adding the possibility of one or more features, numbers, steps, operations, elements, components, or combinations of the foregoing items.

[0024] Furthermore, the terms “first”, “second”, “third”, etc. are merely used for distinguishing descriptions and are not to be understood as indicating or implying relative importance.

[0025] Unless otherwise defined, all terms (including technical terms and scientific terms) used herein have the same meanings as those generally understood by those skilled in the art to which the various embodiments of the present application belong. The terms (such as those defined in generally used dictionaries) will be interpreted as having the same meanings as the contextual meanings in the relevant technical field and will not be interpreted as having idealized meanings or overly formal meanings unless clearly defined in the various embodiments of the present application.

[0026] Example 1

[0027] The disclosed embodiment provides a 3D entity processing method for a game scene.

[0028] For details, see Figure 1 , the 3D entity processing methods of the game scene include:

[0029] Step S101 : Binding a 3D entity object to a plurality of 3D entity UI panels.

[0030] In this embodiment, a 3D entity object represents a class that manages an object in a game world in a 3D game. A 3D entity object may be a game protagonist object, a non-player character (NPC) object, various prop objects, etc. A 3D entity UI panel represents a UI panel attached to a 3D object in a 3D game, which facilitates the player user to interactively control the 3D entity object. Among them, a player character represents a game character that a player can operate in a 3D game.

[0031] In this embodiment, a panel type may be marked for each 3D entity UI panel, each 3D entity object can only display one 3D entity UI panel of the same panel type, and multiple 3D entity UI panels of different panel types may be displayed simultaneously.

[0032] In this embodiment, a virtual orthogonal camera (Camera3DUI) is created through a camera object, and the virtual orthogonal camera is used to render a layer as a 3D entity UI panel.

[0033] Step S102, storing the 3D entity object in a rendering display list, determining a first target 3D position of each 3D entity UI panel according to the 3D position information of the 3D entity object, and displaying each 3D entity UI panel at the corresponding first target 3D position.

[0034] In this embodiment, for the 3D entity UI panel, when the 3D entity UI panel does not need to be displayed, the 3D entity UI panel can be placed in the memory pool for next display; when the 3D entity UI panel needs to be displayed, the 3D entity UI panel is placed in the rendering display list.

[0035] Step S103: when the movement of the 3D entity object is detected, the current 3D position of the 3D entity object is obtained.

[0036] In this embodiment, the 3D position of the 3D entity UI panel can be calculated in real time according to the current 3D position of the 3D entity object to ensure that it moves with the entity. The 3D entity UI panel far away from the player protagonist can also be calculated to be temporarily hidden, and the 3D entity UI panel far away from the player protagonist can be removed from the field of view and not rendered.

[0037] Step S104: determining a second target 3D position corresponding to each of the 3D entity UI panels according to the current 3D position, and moving each of the 3D entity UI panels to the corresponding second target 3D position.

[0038] In this embodiment, the 3D entity processing method of the game scene also includes:

[0039] Detect the current number of 3D entity UI panels displayed on the screen;

[0040] If the current display quantity of the 3D entity UI panel is equal to the pre-acquired maximum display quantity, then control is performed not to display other 3D entity UI panels.

[0041] In this way, by configuring the maximum display number of 3D entity UI panels, the number of panels displayed on the same screen can be effectively controlled.

[0042] In this embodiment, the 3D entity processing method of the game scene also includes:

[0043] When a screen click operation is detected, determining whether the screen click operation acts on the 2D physical UI panel;

[0044] If the screen-clicking operation does not act on the 2D physical UI panel, determining whether the screen-clicking operation acts on the 3D physical UI panel;

[0045] If the screen click operation acts on the 3D entity UI panel, a pre-established camera object is obtained, a screen 2D position is determined according to the screen click operation through the camera object, and the screen 2D position is matrix-converted to obtain a third target 3D position;

[0046] Projecting a ray at the UI3D layer with the third target 3D position as a starting point, and determining at least one RaycastHit2D object to which the ray is projected;

[0047] Determine whether there is a target RaycastHit2D object with a ClickScnObjUI component in at least one of the RaycastHit2D objects;

[0048] If the target RaycastHit2D object exists, determine whether the ClickScnObjUI component contains a Lua callback function for the click event;

[0049] If the ClickScnObjUI component contains a click event lua callback function, the click event lua callback function is called to execute the click event logic of the 3D entity UI panel.

[0050] In this embodiment, the camera object is also responsible for the click detection and click event function triggering of the 3D entity UI panel. Specifically, when the player character clicks the screen, if no 2D UI panel element is clicked, the 3D entity UI click detection is performed. Get the Camera3DUI camera object, convert the 2D coordinates of the clicked screen into 3D coordinates in the world coordinate system and store them in beginVec3. Take the 3D coordinates as the starting point, project rays in the UI_3D layer, and in the RaycastHit2D object object returned by the ray, determine whether there is a ClickScnObjUI component. If not, it means that the 3D entity UI panel is not clicked; if so, determine whether the ClickScnObjUI component contains a click event lua callback function. If not, it means that the 3D entity UI panel is not clicked. If so, call the click event lua callback function on the ClickScnObjUI component to execute the click event logic of the 3D entity UI panel.

[0051] In this embodiment, the 3D entity processing method of the game scene also includes:

[0052] If the target RaycastHit2D object does not exist, it is determined that the screen click operation does not act on the 3D entity UI panel; or,

[0053] If the ClickScnObjUI component does not contain the click event lua callback function, it is determined that the click screen operation does not act on the 3D entity UI panel.

[0054] In this embodiment, before the step of binding the 3D entity object to the plurality of 3D entity UI panels, the method further includes:

[0055] Configure the entity UI configuration file of the 3D entity object through an entity configuration tool, wherein the entity UI configuration file includes panel information of multiple 3D entity UI panels, wherein the panel information includes: panel type, prefabricated body file path, maximum display quantity, unbinding configuration information, and field of view, and each 3D entity UI panel is provided with a different panel type;

[0056] When starting the game application, the entity UI configuration file is loaded, and the panel information in the entity UI configuration file is stored in the entity UI global data module;

[0057] The corresponding panel information is obtained from the entity UI global data module, and the corresponding 3D entity UI panel is created according to the panel information.

[0058] In this embodiment, a separate type can be set for each 3D entity UI panel through the entity UI configuration file module, which is marked as typeName. The entity UI configuration files of all 3D entity UI panels are configured in the scnobj_ui_cong.json file.

[0059] In the entity UI configuration file, each panel type consists of the following information:

[0060] Panel type {"typeName"}: string type, used to identify the type of 3D entity UI panel. For the same type, only one can be displayed on an entity object, but different types of panels can be displayed at the same time.

[0061] prefab path {"prefabPath"}: string type, records the directory where the prefab file (prefab) of the 3D entity UI panel is stored. When creating a 3D entity UI panel, the corresponding 3D entity UI panel is created according to the prefab path.

[0062] Maximum display number {"maxCount"}: int type, used to mark the maximum number of 3D entity UI panels displayed on the same screen. It can control the maximum number of 3D entity UI panels displayed on the same screen, effectively controlling the rendering performance consumption.

[0063] Unbinding configuration information {"todel"}: int type, 1 means that when unbinding the 3D entity UI panel, the 3D entity UI panel and all its resources are deleted, and they are recreated the next time they are used; 0 means that when unbinding, the panel information of the 3D entity UI panel is put into the memory pool, and the panel information of the 3D entity UI panel is taken out from the memory pool the next time it is used, which effectively improves the memory usage efficiency.

[0064] Field of view, {"dis"}: int type, field of view can also be called the display distance, 0 means execution according to the rendering list rules; when it is greater than 0, for example, fill in 1, it means that the entity to which the panel belongs is automatically hidden when it is 1 meter away from the protagonist and the panel is removed from the field of view; dis is invalid for the protagonist.

[0065] In this embodiment, the generated configuration file is as follows:

[0066]

[0067] In this embodiment, when the game character is created, ui_scnobj_head.Open(playerObj) is called to complete the creation and display of the 3D entity UI panel; when the game character dies, ui_scnobj_head.Hide(playerObj) is called to complete the hiding of the 3D entity UI panel; when the game character leaves the same screen, the rendering list will automatically remove the 3D entity UI panel from the field of view, so that the 3D entity UI panel is not rendered.

[0068] In this embodiment, a new panel type or an existing panel type can be created or edited by using the entity UI type configuration tool. By clicking the Save button, information such as the panel type can be stored in the scnobj_ui_cong.json file for saving. When the game application is started, the type information in the scnobj_ui_cong.json file can be loaded into the memory through the file loading module for use by other modules. Specifically, the entity UI configuration file, i.e., scnobj_ui_cong.json, is loaded through the file loading module. When the game application is started, the information in scnobj_ui_cong.json is loaded into the memory and stored in the entity UI global data module. When it is necessary to create an entity UI panel, the type information can be obtained from the entity UI global data module for creation. The lua script file used by the entity UI panel logic is loaded so that when displaying or hiding the 3D entity UI panel, the function with the specified name in the lua script file can be called to execute the interface logic.

[0069] In this embodiment, the file loading module supports dynamic loading, that is, during the execution of the game application, the scnobj_ui_cong.json file and the lua script file used by the body UI panel logic are dynamically loaded, so that the latest interface logic can be executed.

[0070] In this embodiment, the entity UI management module uses the ScnObjUIPanel component to manage the prefab file (prefab) of each 3D entity UI panel. The ScnObjUIPanel component is responsible for the creation, display, hiding, binding, unbinding, execution of interface logic in the lua script file and other management logic of the interface panel.

[0071] In this embodiment, before the step of binding the 3D entity object to the plurality of 3D entity UI panels, the method further includes:

[0072] Call the OnScnObjUIPanelInit function pre-set in the lua script file to get the corresponding 3D entity UI panel;

[0073] Call the OnScnObjUIPanelInit function to perform upper-layer logic initialization of the 3D entity UI panel;

[0074] The step of displaying each of the 3D entity UI panels at a corresponding first target 3D position includes:

[0075] The OnScnObjPanelShow function in the corresponding lua script file is called, and each of the 3D entity UI panels is displayed at the corresponding first target 3D position through the OnScnObjPanelShow function.

[0076] Specifically, the steps of creating a 3D entity UI panel include: the ScnObjUIPanel component calls the Init function of ScnObjUIPanel to complete the initialization work; binds the 3D entity UI panel to a specific 3D entity object; calls the OnScnObjUIPanelInit function in the corresponding lua script file to complete the initialization of the upper-level logic of the interface.

[0077] Specifically, the steps of displaying the 3D entity UI panel include:

[0078] The ScnObjUIPanel component displays the 3D entity UI panel. It performs matrix transformation on the 3D position of the 3D entity object to obtain the 3D position where the 3D entity UI panel needs to be displayed, and displays the 3D entity UI panel at the corresponding 3D position. It calls the OnScnObjPanelShow function in the corresponding lua script file to execute the display operation of the interface logic.

[0079] In this embodiment, the 3D entity processing method of the game scene also includes:

[0080] When the 3D entity UI panel moves out of the field of view, the 3D entity UI panel is controlled not to be rendered, and the OnScnObjPanelHide function in the corresponding lua script file is called to perform a hiding operation on the 3D entity UI panel;

[0081] When the binding relationship between the 3D entity object and the corresponding 3D entity UI panel is released, the unbound 3D entity UI panel is moved out of the field of view, a hiding operation is performed on the unbound 3D entity UI panel, and data corresponding to the unbound 3D entity UI panel is cleared.

[0082] Specifically, the steps to hide the 3D entity UI panel include:

[0083] The ScnObjUIPanel component hides the 3D entity UI panel and puts the 3D entity UI panel out of the field of view, that is, removes the 3D entity UI panel from the field of view and does not render it; calls the OnScnObjPanelHide function in the lua script file to execute the hiding operation of the interface logic.

[0084] Specifically, the steps to unbind the 3D entity UI panel include:

[0085] The ScnObjUIPanel component controls the 3D entity UI panel that is unbound from the 3D entity object, removes the unbound 3D entity UI panel from the field of view, hides the unbound 3D entity UI panel, and clears the data of the unbound 3D entity UI panel.

[0086] In this embodiment, the main code of the ScnObjUIPanel component is as follows:

[0087]

[0088]

[0089]

[0090]

[0091]

[0092]

[0093] In this embodiment, the rendering display list includes at least one panel object to be displayed, and the 3D entity processing method of the game scene further includes:

[0094] Traversing each panel object to be displayed in the rendering display list, and determining the owner object to which the current panel object to be displayed belongs;

[0095] Determine the 3D position of the owner object, and judge whether the 3D position of the owner object is within the field of view;

[0096] If the 3D position of the owner object is not within the field of view, the panel object to be displayed is moved out of the field of view, the rendering operation of the panel object to be displayed is controlled not to be performed, and the OnScnObjPanelHide function in the lua script file is called to perform the hiding operation of the panel object to be displayed;

[0097] If the 3D position of the owner object is within the field of view and the owner is in an invisible state, the panel object to be displayed is moved out of the field of view, the rendering operation of the panel object to be displayed is controlled not to be performed, and the OnScnObjPanelHide function in the lua script file is called to perform the hiding operation of the panel object to be displayed;

[0098] If the 3D position of the owner object is within the field of view and the owner is in a visible state, the OnScnObjPanelShow function in the lua script file is called to perform a display operation on the panel object to be displayed.

[0099] In this embodiment, the entity UI management module is mainly used to store each type of 3D entity UI panel and cache it.

[0100] Specifically, when creating a 3D entity UI panel, first obtain the typeInfo object of the 3D entity UI panel from uiPanelInfoMap according to the panel typeName. The typeInfo object is responsible for the creation and caching of the type of panel.

[0101] When this type of panel is created for the first time, a typeInfo object is constructed with typeName as the key and typeInfo as the value, and stored in uiPanelInfoMap. The typeInfo object is composed of the following:

[0102] curCount: int type, records the number of 3D entity UI panels of this type that are currently cached.

[0103] queue: array type, a cache list of panel objects; when creating a panel, if there is a cached 3D entity UI panel in the list, the 3D entity UI panel will be taken out for use; when unbinding a 3D entity UI panel, the unused 3D entity UI panel can be put into the cache array and used again next time; it can effectively control the memory usage.

[0104] In this embodiment, when creating again, if the typeInfo object already exists, the 3D entity UI panel can be taken out from its cache to achieve the purpose of reusing the 3D entity UI panel and improve memory usage efficiency. When deleting a 3D entity UI panel, it can be put into the cache of the typeInfo object for next use.

[0105] In this embodiment, the entity UI management module can realize the binding of 3D entity objects to 3D entity UI panels. The entity UI management module is mainly used to bind an entity UI panel of a certain panel type to a specific entity object so that the 3D entity UI panel can be displayed at the position of the 3D entity object.

[0106] Specifically, when creating a 3D entity UI panel, you need to specify a specific 3D entity object pointer. After creating the 3D entity UI panel, the 3D entity UI panel will input the 3D entity object pointed to by the 3D entity object pointer. Subsequent display and other logical processing work are all operated according to the entity object pointer. When the 3D entity object does not need the 3D entity UI panel, it is necessary to unbind the 3D entity UI panel from the 3D entity object. The unbound 3D entity UI panel is generally stored in the typeInfo cache so that other entities can use the 3D entity UI panel again.

[0107] In this embodiment, the 3D entity processing method of the game scene also includes:

[0108] The 3D position of the game protagonist and the 3D position of the owner object are obtained, the zoom factor of the panel object to be currently displayed is determined according to the distance between the 3D position of the game protagonist and the 3D position of the owner object, and the panel object to be currently displayed is zoomed according to the zoom factor.

[0109] In this embodiment, a rendering display list of a 3D entity UI panel may be maintained by the entity UI rendering list module, which is responsible for the rendering work of the 3D entity UI panel.

[0110] Specifically, when a 3D entity UI panel needs to be displayed, the 3D entity UI panel needs to be put into the rendering display list. The entity UI rendering list module traverses the rendering display list every frame. For each traversal, the steps are as follows:

[0111] Get the owner object (owner) of the 3D entity UI panel, get the 3D position of the owner object, determine whether the position is within the field of view, if not within the field of view, remove the 3D entity UI panel outside the field of view, and do not render; call the OnScnObjUIPanelHide function to perform the hiding operation. If it is within the field of view and the owner object is not visible, perform the steps of removing the 3D entity UI panel from the field of view, do not render, and call the hiding function of ScnObjUIPanel. If it is within the field of view and the owner object is visible, if the 3D entity UI panel is currently outside the field of view, call the display panel interface of the ScnObjUIPanel component to complete a display operation of the 3D entity UI panel; perform a matrix transformation on the 3D position of the owner object to obtain the 3D position where the panel needs to be displayed, and update the position of the 3D entity UI panel. Get the 3D position of the ranger character, calculate the zoom factor required for the current 3D entity UI panel based on the distance between the 3D position of the owner object and the 3D position of the game protagonist, and perform control operations based on the zoom factor. When a 3D entity UI panel is hidden, the corresponding 3D entity UI panel also needs to be removed from the rendering display list, so that the subsequent frames do not need to render the panel.

[0112] In this embodiment, the 3D entity processing method of the game scene also includes:

[0113] Configure the panel type of the physical UI panel through the physical UI type editor, edit the corresponding name of the 3D physical UI panel, create a prefab file with the same name, attach a LuaBind component to the root node of the 3D physical UI panel, and set the name of the lua script file to the position corresponding to the name field of the physical UI panel;

[0114] Mount the ScnObjUIPanel component on the root node of the 3D entity UI panel, and mount the corresponding Lua component on the ScnObjUIPanel component;

[0115] A lua script file with the same name is created according to the name of the 3D entity UI panel through the entity UI type editor, and OnScnObjUIPanelInit function, OnScnObjUIPanelShow function, OnScnObjUIPanelHide function and OnScnObjUIPanelCleanup function are set in the created lua script file.

[0116] In this embodiment, the creation tool module can be used to create and edit entity UI type information, as well as complete the necessary panel creation initialization work, which can greatly save the developer's preliminary preparation work. Specifically, the creation tool module includes an entity UI type configuration editor, which is responsible for the creation, editing, and saving of panel types in the configuration file. The entity UI type configuration editor can edit the panel type of each entity object. After creation or editing, you can click the Save button to save the changes to the configuration file. When the game application is running, the saved configuration file can be loaded into the memory in real time for real-time update and viewing in the game.

[0117] In this embodiment, the production tool module also includes an entity UI panel creation editor, which is used to create a new type of 3D entity UI panel. After creating a 3D entity UI panel of a specified panel type, the entity UI type editor is first called to configure the new panel type. After editing the panel type, the name of the panel type is specified. The entity UI panel creation editor creates a prefab file with the same name based on the 3D entity UI panel. After creating the prefab, the following steps are automatically performed: the LuaBind component is automatically mounted at the root node, and the name of the specified lua script file is automatically set to the name field of the 3D entity UI panel; the ScnObjUIPanel component is automatically mounted at the root node, and the lua component to which the LuaBind component is mounted is specified.

[0118] The entity UI panel creation editor creates a lua script file with the same name according to the 3D entity UI panel, and predefines the entry functions for the interface logic execution in the lua script file. These functions include: OnScnObjUIPanelInit(self), OnScnObjUIPanelShow(self), OnScnObjUIPanelHide(self), OnScnObjUIPanelUpdate(self), OnScnObjUIPanelCleanup(self)

[0119] In this embodiment, the workflow of creating a 3D entity object can be explained by taking the creation of a clickable character name as an example: use the type editing tool to create a new entity UI type with the name and type of "ui_scnobj_head"; use the entity UI editor to generate the corresponding prefab file and lua script file, and create a Label component under the parent node of the 3D entity object to display the name; attach the ClickScnObjUI component to the Label component to trigger a click event.

[0120] In this embodiment, the generated and edited Lua script file ui_scnobj_head.lua is as follows:

[0121]

[0122]

[0123] By classifying 3D entity UI panels, the present invention can make a single 3D entity object display only one 3D entity UI panel of panel type at a time, and can display 3D entity UI panels of different panel types at the same time; by classified storage, temporarily unused 3D entity UI panels can be put into memory cache, which greatly improves memory use efficiency; by the maximum display quantity on the same screen, the number of 3D entity UI panels displayed on the same screen can be effectively controlled, and the rendering efficiency of the 3D entity UI panel can be improved; by rendering the display list, the performance consumption caused by the rendering of the 3D entity UI panel can be effectively controlled; the high efficiency of the memory and rendering of the 3D entity UI panel is guaranteed; when the 3D entity UI panel is displayed, hidden, etc., by calling the corresponding function in the lua script file, it is realized that the interface logic can be written in the lua language, so that the interface logic can be quickly and efficiently iterated and developed; by the type editing tool and the entity UI creation editor, it is convenient for developers to create and edit the 3D entity UI panel, which greatly improves work efficiency. The 3D entity processing method for the game scene provided by this embodiment not only improves the efficiency of creating and rendering the 3D entity processing method for the game scene, but also provides a workflow for editing the 3D entity processing method for the game scene, which can greatly improve the rapid iterative development of the game and meet the creation and modification of high-quality entity UI panels.

[0124] The 3D entity processing method of the game scene provided in this embodiment binds a 3D entity object to multiple 3D entity UI panels; stores the 3D entity object in a rendering display list, determines the first target 3D position of each 3D entity UI panel according to the 3D position information of the 3D entity object, and displays each 3D entity UI panel at the corresponding first target 3D position; when the movement of the 3D entity object is detected, obtains the current 3D position of the 3D entity object; determines the second target 3D position corresponding to each 3D entity UI panel according to the current 3D position; and moves each 3D entity UI panel to the corresponding second target 3D position. In this way, the 3D entity UI panel can follow the movement of the 3D entity object, improve the interactive effect of the dynamically adjusted 3D entity UI panel, reduce the maintenance cost of the 3D entity UI panel interaction, and improve the development efficiency.

[0125] Example 2

[0126] In addition, an embodiment of the present disclosure provides a 3D entity processing device for a game scene.

[0127] Specifically, Figure 2 As shown, the 3D entity processing device 200 of the game scene includes:

[0128] A binding module 201 is used to bind a 3D entity object to a plurality of 3D entity UI panels;

[0129] The display module 202 is used to store the 3D entity objects in a rendering display list, determine the first target 3D position of each 3D entity UI panel according to the 3D position information of the 3D entity objects, and display each 3D entity UI panel at the corresponding first target 3D position;

[0130] An acquisition module 203 is used to acquire a current 3D position of the 3D entity object when movement of the 3D entity object is detected;

[0131] The determination module 204 is used to determine the second target 3D position corresponding to each of the 3D entity UI panels according to the current 3D position, and move each of the 3D entity UI panels to the corresponding second target 3D position.

[0132] In this embodiment, the 3D entity processing device 200 of the game scene further includes:

[0133] The first processing module is used to detect the current number of 3D entity UI panels displayed on the screen;

[0134] If the current display quantity of the 3D entity UI panel is equal to the pre-acquired maximum display quantity, then control is performed not to display other 3D entity UI panels.

[0135] In this embodiment, the 3D entity processing device 200 of the game scene further includes:

[0136] The second processing module is used to determine whether the screen clicking operation acts on the 2D physical UI panel when the screen clicking operation is detected;

[0137] If the screen-clicking operation does not act on the 2D physical UI panel, determining whether the screen-clicking operation acts on the 3D physical UI panel;

[0138] If the screen click operation acts on the 3D entity UI panel, a pre-established camera object is obtained, a screen 2D position is determined according to the screen click operation through the camera object, and the screen 2D position is matrix-converted to obtain a third target 3D position;

[0139] Projecting a ray at the UI3D layer with the third target 3D position as a starting point, and determining at least one RaycastHit2D object to which the ray is projected;

[0140] Determine whether there is a target RaycastHit2D object with a ClickScnObjUI component in at least one of the RaycastHit2D objects;

[0141] If the target RaycastHit2D object exists, determine whether the ClickScnObjUI component contains a Lua callback function for the click event;

[0142] If the ClickScnObjUI component contains a click event lua callback function, the click event lua callback function is called to execute the click event logic of the 3D entity UI panel.

[0143] In this embodiment, the second processing module is further configured to determine that the screen click operation does not act on the 3D entity UI panel if the target RaycastHit2D object does not exist; or,

[0144] If the ClickScnObjUI component does not contain the click event lua callback function, it is determined that the click screen operation does not act on the 3D entity UI panel.

[0145] In this embodiment, the 3D entity processing device 200 of the game scene further includes:

[0146] A fourth processing module is used to configure a physical UI configuration file of the 3D physical object through a physical configuration tool, wherein the physical UI configuration file includes panel information of multiple 3D physical UI panels, wherein the panel information includes: panel type, prefabricated body file path, maximum display quantity, unbinding configuration information, and field of view, and each 3D physical UI panel is provided with a different panel type;

[0147] When starting the game application, the entity UI configuration file is loaded, and the panel information in the entity UI configuration file is stored in the entity UI global data module;

[0148] The corresponding panel information is obtained from the entity UI global data module, and the corresponding 3D entity UI panel is created according to the panel information.

[0149] In this embodiment, the 3D entity processing device 200 of the game scene further includes:

[0150] The fourth processing module is used to call the OnScnObjUIPanelInit function preset in the lua script file to obtain the corresponding 3D entity UI panel;

[0151] Call the OnScnObjUIPanelInit function to perform upper-layer logic initialization of the 3D entity UI panel;

[0152] The step of displaying each of the 3D entity UI panels at a corresponding first target 3D position includes:

[0153] The OnScnObjPanelShow function in the corresponding lua script file is called, and each of the 3D entity UI panels is displayed at the corresponding first target 3D position through the OnScnObjPanelShow function.

[0154] In this embodiment, the 3D entity processing device 200 of the game scene further includes:

[0155] A fifth processing module is used for controlling not to render the 3D entity UI panel when the 3D entity UI panel moves out of the field of view, calling the OnScnObjPanelHide function in the corresponding lua script file, and performing a hiding operation on the 3D entity UI panel;

[0156] When the binding relationship between the 3D entity object and the corresponding 3D entity UI panel is released, the unbound 3D entity UI panel is moved out of the field of view, a hiding operation is performed on the unbound 3D entity UI panel, and data corresponding to the unbound 3D entity UI panel is cleared.

[0157] In this embodiment, the rendering display list includes at least one panel object to be displayed, and the 3D entity processing device 200 of the game scene also includes:

[0158] A sixth processing module, used for traversing each panel object to be displayed in the rendering display list, and determining the owner object to which the current panel object to be displayed belongs;

[0159] Determine the 3D position of the owner object, and judge whether the 3D position of the owner object is within the field of view;

[0160] If the 3D position of the owner object is not within the field of view, the panel object to be displayed is moved out of the field of view, the rendering operation of the panel object to be displayed is controlled not to be performed, and the OnScnObjPanelHide function in the lua script file is called to perform the hiding operation of the panel object to be displayed;

[0161] If the 3D position of the owner object is within the field of view and the owner is in an invisible state, the panel object to be displayed is moved out of the field of view, the rendering operation of the panel object to be displayed is controlled not to be performed, and the OnScnObjPanelHide function in the lua script file is called to perform the hiding operation of the panel object to be displayed;

[0162] If the 3D position of the owner object is within the field of view and the owner is in a visible state, the OnScnObjPanelShow function in the lua script file is called to perform a display operation on the panel object to be displayed.

[0163] In this embodiment, the 3D entity processing device 200 of the game scene further includes:

[0164] The seventh processing module is used to obtain the 3D position of the game protagonist and the 3D position of the owner object, determine the zoom factor of the panel object to be currently displayed according to the distance between the 3D position of the game protagonist and the 3D position of the owner object, and scale the panel object to be currently displayed according to the zoom factor.

[0165] In this embodiment, the 3D entity processing device 200 of the game scene further includes:

[0166] An eighth processing module, configured to configure the panel type of the physical UI panel through a physical UI type editor, edit the corresponding name of the 3D physical UI panel, create a prefabricated file with the same name, attach a LuaBind component to the root node of the 3D physical UI panel, and set the name of the lua script file to the position corresponding to the name field of the physical UI panel;

[0167] Mount the ScnObjUIPanel component on the root node of the 3D entity UI panel, and mount the corresponding Lua component on the ScnObjUIPanel component;

[0168] A lua script file with the same name is created according to the name of the 3D entity UI panel through the entity UI type editor, and OnScnObjUIPanelInit function, OnScnObjUIPanelShow function, OnScnObjUIPanelHide function and OnScnObjUIPanelCleanup function are set in the created lua script file.

[0169] The 3D entity processing device for the game scene provided in this embodiment binds a 3D entity object to multiple 3D entity UI panels; stores the 3D entity object in a rendering display list, determines the first target 3D position of each 3D entity UI panel according to the 3D position information of the 3D entity object, and displays each 3D entity UI panel at the corresponding first target 3D position; when the movement of the 3D entity object is detected, the current 3D position of the 3D entity object is obtained; the second target 3D position corresponding to each 3D entity UI panel is determined according to the current 3D position; and each 3D entity UI panel is moved to the corresponding second target 3D position. In this way, the 3D entity UI panel can follow the movement of the 3D entity object, improve the interactive effect of the dynamically adjusted 3D entity UI panel, reduce the maintenance cost of the 3D entity UI panel interaction, and improve the development efficiency.

[0170] Example 3

[0171] In addition, an embodiment of the present disclosure provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and when the computer program runs on the processor, the 3D entity processing method of the game scene provided in the above-mentioned embodiment 1 is executed.

[0172] It should be noted that the electronic device provided in this embodiment can execute the 3D entity processing method of the game scene provided in Example 1 to achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0173] Example 4

[0174] In addition, an embodiment of the present disclosure provides a computer-readable storage medium storing a computer program, which executes the 3D entity processing method of the game scene provided in Example 1 when running on a processor.

[0175] It should be noted that the computer-readable storage medium provided in this embodiment can execute the 3D entity processing method of the game scene provided in Example 1 to achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0176] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and structure diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in an alternative implementation, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the structure diagram and / or the flow chart, and the combination of boxes in the structure diagram and / or the flow chart, can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.

[0177] In addition, the functional modules or units in the various embodiments of the present invention may be integrated together to form an independent part, or each module may exist independently, or two or more modules may be integrated to form an independent part.

[0178] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a smart phone, a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0179] The above description is only a specific implementation mode of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be covered by the protection scope of the present invention.

Claims

1. A 3D entity processing method for a game scene, characterized in that: The method comprises: Bind 3D entity objects to multiple 3D entity UI panels; The 3D entity objects are stored in a rendering display list, a first target 3D position of each 3D entity UI panel is determined according to the 3D position information of the 3D entity objects, and each 3D entity UI panel is displayed at the corresponding first target 3D position; When the movement of the 3D entity object is detected, obtaining a current 3D position of the 3D entity object; Determine a second target 3D position corresponding to each of the 3D entity UI panels according to the current 3D position, and move each of the 3D entity UI panels to the corresponding second target 3D position; When a screen click operation is detected, determining whether the screen click operation acts on the 2D physical UI panel; If the screen-clicking operation does not act on the 2D physical UI panel, determining whether the screen-clicking operation acts on the 3D physical UI panel; If the screen click operation acts on the 3D entity UI panel, a pre-established camera object is obtained, a screen 2D position is determined according to the screen click operation through the camera object, and the screen 2D position is matrix-converted to obtain a third target 3D position; Projecting a ray at the UI3D layer with the third target 3D position as a starting point, and determining at least one RaycastHit2D object to which the ray is projected; Determine whether there is a target RaycastHit2D object with a ClickScnObjUI component in at least one of the RaycastHit2D objects; If the target RaycastHit2D object exists, determine whether the ClickScnObjUI component contains a Lua callback function for the click event; If the ClickScnObjUI component contains a click event lua callback function, the click event lua callback function is called to execute the click event logic of the 3D entity UI panel.

2. The method according to claim 1, characterized in that The method further comprises: Detect the current number of 3D entity UI panels displayed on the screen; If the current display quantity of the 3D entity UI panel is equal to the pre-acquired maximum display quantity, then control is performed not to display other 3D entity UI panels.

3. The method according to claim 2, characterized in that The method further comprises: If the target RaycastHit2D object does not exist, it is determined that the screen click operation does not act on the 3D entity UI panel; or, If the ClickScnObjUI component does not contain the click event lua callback function, it is determined that the click screen operation does not act on the 3D entity UI panel.

4. The method according to claim 1, characterized in that: Before the step of binding the 3D entity object to the plurality of 3D entity UI panels, the method further comprises: Configure the entity UI configuration file of the 3D entity object through an entity configuration tool, wherein the entity UI configuration file includes panel information of multiple 3D entity UI panels, wherein the panel information includes: panel type, prefabricated body file path, maximum display quantity, unbinding configuration information, and field of view, and each 3D entity UI panel is provided with a different panel type; When starting the game application, the entity UI configuration file is loaded, and the panel information in the entity UI configuration file is stored in the entity UI global data module; The corresponding panel information is obtained from the entity UI global data module, and the corresponding 3D entity UI panel is created according to the panel information.

5. The method according to claim 1, characterized in that Before the step of binding the 3D entity object to the plurality of 3D entity UI panels, the method further comprises: Call the OnScnObjUIPanelInit function pre-set in the lua script file to get the corresponding 3D entity UI panel; Call the OnScnObjUIPanelInit function to perform upper-layer logic initialization of the 3D entity UI panel; The step of displaying each of the 3D entity UI panels at a corresponding first target 3D position includes: The OnScnObjPanelShow function in the corresponding lua script file is called, and each of the 3D entity UI panels is displayed at the corresponding first target 3D position through the OnScnObjPanelShow function.

6. The method according to claim 1, characterized in that The method further comprises: When the 3D entity UI panel moves out of the field of view, the 3D entity UI panel is controlled not to be rendered, and the OnScnObjPanelHide function in the corresponding lua script file is called to perform a hiding operation on the 3D entity UI panel; When the binding relationship between the 3D entity object and the corresponding 3D entity UI panel is released, the unbound 3D entity UI panel is moved out of the field of view, a hiding operation is performed on the unbound 3D entity UI panel, and data corresponding to the unbound 3D entity UI panel is cleared.

7. The method according to claim 1, characterized in that The rendering display list includes at least one panel object to be displayed, and the method further includes: Traversing each panel object to be displayed in the rendering display list, and determining the owner object to which the current panel object to be displayed belongs; Determine the 3D position of the owner object, and judge whether the 3D position of the owner object is within the field of view; If the 3D position of the owner object is not within the field of view, the panel object to be displayed is moved out of the field of view, the rendering operation of the panel object to be displayed is controlled not to be performed, and the OnScnObjPanelHide function in the lua script file is called to perform the hiding operation of the panel object to be displayed; If the 3D position of the owner object is within the field of view and the owner is in an invisible state, the panel object to be displayed is moved out of the field of view, the rendering operation of the panel object to be displayed is controlled not to be performed, and the OnScnObjPanelHide function in the lua script file is called to perform the hiding operation of the panel object to be displayed; If the 3D position of the owner object is within the field of view and the owner is in a visible state, the OnScnObjPanelShow function in the lua script file is called to perform a display operation on the panel object to be displayed.

8. The method according to claim 7, characterized in that The method further comprises: The 3D position of the game protagonist and the 3D position of the owner object are obtained, the zoom factor of the panel object to be currently displayed is determined according to the distance between the 3D position of the game protagonist and the 3D position of the owner object, and the panel object to be currently displayed is zoomed according to the zoom factor.

9. The method according to claim 1, characterized in that: The method further comprises: Configure the panel type of the physical UI panel through the physical UI type editor, edit the corresponding name of the 3D physical UI panel, create a prefab file with the same name, attach a LuaBind component to the root node of the 3D physical UI panel, and set the name of the lua script file to the position corresponding to the name field of the physical UI panel; Mount the ScnObjUIPanel component on the root node of the 3D entity UI panel, and mount the corresponding Lua component on the ScnObjUIPanel component; A lua script file with the same name is created according to the name of the 3D entity UI panel through the entity UI type editor, and OnScnObjUIPanelInit function, OnScnObjUIPanelShow function, OnScnObjUIPanelHide function and OnScnObjUIPanelCleanup function are set in the created lua script file.

10. A 3D entity processing device for a game scene, characterized in that: The device comprises: Binding module, used to bind 3D entity objects to multiple 3D entity UI panels; A display module, used for storing the 3D entity objects in a rendering display list, determining a first target 3D position of each of the 3D entity UI panels according to the 3D position information of the 3D entity objects, and displaying each of the 3D entity UI panels at the corresponding first target 3D position; An acquisition module, configured to acquire a current 3D position of the 3D entity object when movement of the 3D entity object is detected; A determination module, configured to determine a second target 3D position corresponding to each of the 3D entity UI panels according to the current 3D position, and move each of the 3D entity UI panels to the corresponding second target 3D position; The second processing module is used to determine whether the screen click operation acts on the 2D physical UI panel when a screen click operation is detected; if the screen click operation does not act on the 2D physical UI panel, determine whether the screen click operation acts on the 3D physical UI panel; if the screen click operation acts on the 3D physical UI panel, obtain a pre-established camera object, determine the screen 2D position according to the screen click operation through the camera object, and perform matrix conversion on the screen 2D position to obtain a third target 3D position; project a ray with the third target 3D position as the starting point in the UI3D layer to determine Determine at least one RaycastHit2D object to which the ray is projected; determine whether there is a target RaycastHit2D object with a ClickScnObjUI component in at least one of the RaycastHit2D objects; if the target RaycastHit2D object exists, determine whether the ClickScnObjUI component contains a lua callback function for a click event; if the ClickScnObjUI component contains a lua callback function for a click event, call the lua callback function for the click event to execute the click event logic of the 3D entity UI panel.

11. An electronic device, characterized in that: It comprises a memory and a processor, wherein the memory stores a computer program, and when the computer program is run by the processor, the 3D entity processing method of the game scene described in any one of claims 1 to 9 is executed.

12. A computer-readable storage medium, characterized in that: It stores a computer program, which, when running on a processor, executes the 3D entity processing method for a game scene as described in any one of claims 1 to 9.

Citation Information

Patent Citations

  • Game display control method, non-volatile storage medium and electronic device

    CN113318428A