UE4 3D scene code injection secondary development method, medium and device based on webrtc
By introducing lua code injection function in UE4 three-dimensional scenarios, using webrtc to transmit encrypted lua scripts and hash values for consistency and security verification, the problem of slow development cycle and response in the existing technology is solved, and faster and Flexible three-dimensional scene effects and business interaction logic.
Patent Information
- Application Number
- CN202210659151.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-13
- Publication Date
- 2024-12-27
- Estimated Expiration
- 2042-06-13
AI Technical Summary
The development cycle and response of the existing UE4 three-dimensional scenario secondary development method is slow, and it cannot quickly meet new business needs and effects.
Using lua code injection function to realize UE4 three-dimensional scene code injection through webrtc, the browser integrates secondary development of SDK, querys layer and model information, writes lua scripts, and uses encrypted transmission lua scripts and hash values to perform consistency and security verification. Execute the script after verification.
It realizes more flexible and fast UE4 three-dimensional scene effects and business interaction logic, solving the problem of slow development cycle and response.
Smart Images

Figure CN115080031B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of software and information technology, and in particular to a UE4 three-dimensional scene code injection secondary development method, medium and device based on webrtc. Background Art
[0002] like Figure 1 As shown, the UE4 three-dimensional scene secondary development method implemented in the prior art includes the following steps:
[0003] The first step is to develop a control interface on the UE4 3D scene side;
[0004] The second step is to use js language to encapsulate the control interface developed on the UE4 3D scene end into a secondary development SDK, and the communication protocol uses webrtc or http;
[0005] The third step is to integrate the secondary development SDK into the browser of the third-party system. After the secondary development SDK is integrated, the browser page of the third-party system can call the cloud rendering screen of UE4 as the 3D base map;
[0006] In the fourth step, developers can implement secondary development of UE4 3D scenes by calling functions in the secondary development SDK on the browser side of the third-party system.
[0007] The secondary development capability provided by the above existing technologies depends on the secondary development interface exposed by UE4. When there are new business requirements or effects to be implemented, it is necessary to contact the developer of UE4 3D scene to develop the corresponding interface first, and then republish the corresponding scene. The development cycle and response are slow. Summary of the invention
[0008] The present invention aims to provide a UE4 three-dimensional scene code injection secondary development method, medium and device based on webrtc, so as to solve the problems of slow development cycle and slow response in the prior art method for implementing the UE4 three-dimensional scene secondary development.
[0009] The present invention provides a UE4 three-dimensional scene code injection secondary development method based on webrtc, comprising:
[0010] The lua code injection function is used to implement the UE4 three-dimensional scene code injection secondary development method based on webrtc.
[0011] In some embodiments, the UE4 three-dimensional scene code injection secondary development method based on webrtc includes the following steps:
[0012] The first step is to integrate the secondary development SDK of UE4 3D scene into the browser;
[0013] In the second step, the browser calls the layer and model query function of the secondary development SDK to query the layer and model information exposed by the 3D scene;
[0014] The third step is to write a Lua script based on the layers and model information exposed by the 3D scene queried in the second step;
[0015] The fourth step is to call the Lua code injection interface provided by the secondary development SDK to send a code injection request to the UE4 3D scene. The code injection request contains the Lua script and the hash value of the Lua script.
[0016] In the fifth step, after receiving the code injection request, the UE4 3D scene uses the hash value of the Lua script to perform a consistency check on the Lua script. If the consistency check passes, the sixth step is executed;
[0017] Step 6: Perform security check on the Lua script and execute the Lua script after the security check passes.
[0018] In some embodiments, the transmission of the Lua script and the hash value of the Lua script needs to be encrypted and decrypted.
[0019] Furthermore, the method for encrypting and decrypting the transmission of the Lua script and the hash value of the Lua script includes:
[0020] In the fourth step, when calling the Lua code injection interface provided by the secondary development SDK to send a code injection request to the UE4 3D scene, the Lua script and the hash value of the Lua script contained in the code injection request must be encrypted and transmitted;
[0021] In the fifth step, after the UE4 3D scene receives the code injection request, it uses the decryption method corresponding to the encryption to decrypt the Lua script and the hash value of the Lua script, and then uses the hash value of the Lua script to perform consistency verification on the Lua script.
[0022] In some embodiments, if the security check fails in the sixth step, the Lua script is not executed, and a Lua script error prompt message is returned.
[0023] In some embodiments, the situation where the security check fails includes:
[0024] (1) The lua script contains the operation of closing the UE4 program;
[0025] (2) The Lua script contains operations to delete files;
[0026] (3) Operations that call dangerous operating system commands.
[0027] The present invention also provides a computer terminal storage medium storing computer terminal executable instructions, wherein the computer terminal executable instructions are used to execute the above-mentioned UE4 three-dimensional scene code injection secondary development method based on webrtc.
[0028] The present invention also provides a computing device, comprising:
[0029] At least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the above-mentioned UE4 three-dimensional scene code injection secondary development method based on webrtc.
[0030] In summary, due to the adoption of the above technical solution, the beneficial effects of the present invention are:
[0031] The present invention adds a secondary development technology of Lua code injection on the basis of the existing technology, which can realize the desired UE4 three-dimensional scene effect and business interaction logic more flexibly and quickly, and solve the problems of slow development cycle and response. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.
[0033] Figure 1 The present invention is a flowchart of a UE4 three-dimensional scene secondary development method implemented in the prior art.
[0034] Figure 2 This is a flow chart of a secondary development method for injecting UE4 three-dimensional scene code based on webrtc in Example 1 of the present invention.
[0035] Figure 3 This is a flow chart of a secondary development method for injecting code into a UE4 three-dimensional scene based on webrtc in Example 2 of the present invention.
[0036] Figure 4 This is a flow chart of a secondary development method for injecting code into a UE4 three-dimensional scene based on webrtc in Example 3 of the present invention. DETAILED DESCRIPTION
[0037] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.
[0038] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0039] The abbreviations and key terms used in the present invention are defined as follows:
[0040] webrtc: The abbreviation of Web Real-Time Communication, is an API that supports web browsers to conduct real-time voice or video conversations.
[0041] 3D scene: A 3D simulation scene created using the UE4 rendering engine and art tools.
[0042] Cloud rendering: The cloud rendering mode is similar to conventional cloud computing, that is, the 3D program is rendered in a remote server. The user terminal clicks a "cloud rendering" button through Web software or directly in the local 3D program and accesses resources with the help of high-speed Internet access. The command is issued from the user terminal, and the server executes the corresponding rendering task according to the command, and the rendering result image is transmitted back to the user terminal for display.
[0043] Secondary development: refers to customizing and modifying the existing 3D scene, expanding its functions, and achieving the desired functions and effects. Generally speaking, the core of the original scene will not be changed.
[0044] sdk: software development kit, in this invention, refers to the UE4 3D scene remote calling interface encapsulated in js language.
[0045] lua: A small scripting language that can be used for UE4 development.
[0046] The present invention proposes a UE4 three-dimensional scene code injection secondary development method based on webrtc, comprising:
[0047] The lua code injection function is used to implement the UE4 three-dimensional scene code injection secondary development method based on webrtc.
[0048] That is, the present invention adds a secondary development technology of Lua code injection on the basis of the existing technology, which can realize the desired UE4 three-dimensional scene effects and business interaction logic more flexibly and quickly, and solve the problems of slow development cycle and response.
[0049] Example 1
[0050] like Figure 2 As shown, the UE4 three-dimensional scene code injection secondary development method based on webrtc in this embodiment includes the following steps:
[0051] The first step is to integrate the secondary development SDK of UE4 3D scene into the browser;
[0052] In the second step, the browser calls the layer and model query function of the secondary development SDK to query the layer and model information exposed by the 3D scene;
[0053] The third step is to write a Lua script based on the layers and model information exposed by the 3D scene queried in the second step;
[0054] The fourth step is to call the Lua code injection interface provided by the secondary development SDK to send a code injection request to the UE4 3D scene. The code injection request contains the Lua script and the hash value of the Lua script.
[0055] In the fifth step, after receiving the code injection request, the UE4 3D scene uses the hash value of the Lua script to perform a consistency check on the Lua script. If the consistency check passes, the sixth step is executed;
[0056] Step 6: Perform security check on the Lua script and execute the Lua script after the security check passes.
[0057] Example 2
[0058] On the basis of Example 1, a technical solution is added in which the transmission of the Lua script and the hash value of the Lua script needs to be encrypted and decrypted. That is:
[0059] In the fourth step, when calling the Lua code injection interface provided by the secondary development SDK to send a code injection request to the UE4 3D scene, the Lua script and the hash value of the Lua script contained in the code injection request must be encrypted and transmitted;
[0060] In the fifth step, after the UE4 3D scene receives the code injection request, it uses the decryption method corresponding to the encryption to decrypt the Lua script and the hash value of the Lua script, and then uses the hash value of the Lua script to perform consistency verification on the Lua script.
[0061] Therefore, if Figure 3 As shown, the UE4 three-dimensional scene code injection secondary development method based on webrtc in this embodiment includes the following steps:
[0062] The first step is to integrate the secondary development SDK of UE4 3D scene into the browser;
[0063] In the second step, the browser calls the layer and model query function of the secondary development SDK to query the layer and model information exposed by the 3D scene;
[0064] The third step is to write a Lua script based on the layers and model information exposed by the 3D scene queried in the second step;
[0065] The fourth step is to call the Lua code injection interface provided by the secondary development SDK to send a code injection request to the UE4 3D scene. The code injection request contains the encrypted Lua script and the hash value of the Lua script.
[0066] In the fifth step, after receiving the code injection request, the UE4 3D scene uses the decryption method corresponding to the encryption to decrypt the Lua script and the hash value of the Lua script, and then uses the hash value of the Lua script to perform a consistency check on the Lua script. After the consistency check passes, the sixth step is executed;
[0067] Step 6: Perform security check on the Lua script and execute the Lua script after the security check passes.
[0068] Example 3
[0069] On the basis of Example 2, a technical solution is added in which the Lua script is not executed when the security check fails, and the Lua script error prompt information is returned. Figure 4 As shown, the UE4 three-dimensional scene code injection secondary development method based on webrtc in this embodiment includes the following steps:
[0070] The first step is to integrate the secondary development SDK of UE4 3D scene into the browser;
[0071] In the second step, the browser calls the layer and model query function of the secondary development SDK to query the layer and model information exposed by the 3D scene;
[0072] The third step is to write a Lua script based on the layers and model information exposed by the 3D scene queried in the second step;
[0073] The fourth step is to call the Lua code injection interface provided by the secondary development SDK to send a code injection request to the UE4 3D scene. The code injection request contains the encrypted Lua script and the hash value of the Lua script.
[0074] In the fifth step, after receiving the code injection request, the UE4 3D scene uses the decryption method corresponding to the encryption to decrypt the Lua script and the hash value of the Lua script, and then uses the hash value of the Lua script to perform a consistency check on the Lua script. After the consistency check passes, the sixth step is executed;
[0075] Step 6: Check the security of the Lua script:
[0076] Execute the Lua script after the security check passes;
[0077] If the security check fails, the Lua script will not be executed, and a Lua script error message will be returned; where the security check fails, the following situations may occur:
[0078] (1) The lua script contains the operation of closing the UE4 program;
[0079] (2) The Lua script contains operations to delete files;
[0080] (3) Operations that call dangerous operating system commands.
[0081] It should be noted that the above situations where the security check fails are just some common examples. There may be some other operations that cause the security check to fail, and this should not be used to limit the scope of the invention.
[0082] Example 4
[0083] This embodiment proposes a computer terminal storage medium storing computer terminal executable instructions, which are used to execute the UE4 three-dimensional scene code injection secondary development method based on webrtc as described in Examples 1-3. Examples of computer storage media include magnetic storage media (e.g., floppy disks, hard disks, etc.), optical recording media (e.g., CD-ROMs, DVDs, etc.) or memories, such as memory cards, ROMs, or RAMs. Computer storage media can also be distributed on network-connected computer systems, such as application stores.
[0084] Example 5
[0085] This embodiment proposes a computing device, including: at least one processor; and a memory connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor, so that the at least one processor can execute the UE4 three-dimensional scene code injection secondary development method based on webrtc as described in embodiments 1-3. Examples of computing devices include PCs, tablet computers, smart phones, or PDAs.
[0086] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A UE4 three-dimensional scene code injection secondary development method based on webrtc, characterized in that: The method is: The lua code injection function is used to implement the UE4 three-dimensional scene code injection secondary development method based on webrtc; The method comprises the following steps: The first step is to integrate the secondary development SDK of UE4 3D scene into the browser; In the second step, the browser calls the layer and model query function of the secondary development SDK to query the layer and model information exposed by the 3D scene; The third step is to write a Lua script based on the layers and model information exposed by the 3D scene queried in the second step; The fourth step is to call the Lua code injection interface provided by the secondary development SDK to send a code injection request to the UE4 3D scene. The code injection request contains the Lua script and the hash value of the Lua script. In the fifth step, after receiving the code injection request, the UE4 3D scene uses the hash value of the Lua script to perform a consistency check on the Lua script. If the consistency check passes, the sixth step is executed; Step 6: Perform security check on the Lua script and execute the Lua script after the security check passes.
2. According to the webrtc-based UE4 three-dimensional scene code injection secondary development method implemented in claim 1, it is characterized in that: The transmission of Lua scripts and their hash values must be encrypted and decrypted.
3. According to claim 2, the UE4 three-dimensional scene code injection secondary development method based on webrtc is characterized in that: The method for encrypting and decrypting the transmission of the Lua script and the hash value of the Lua script includes: In the fourth step, when calling the Lua code injection interface provided by the secondary development SDK to send a code injection request to the UE4 3D scene, the Lua script and the hash value of the Lua script contained in the code injection request must be encrypted and transmitted; In the fifth step, after the UE4 3D scene receives the code injection request, it uses the decryption method corresponding to the encryption to decrypt the Lua script and the hash value of the Lua script, and then uses the hash value of the Lua script to perform consistency verification on the Lua script.
4. The UE4 three-dimensional scene code injection secondary development method based on webrtc according to claim 1 is characterized in that: If the security check fails in step 6, the Lua script will not be executed and an error message of the Lua script will be returned.
5. The UE4 three-dimensional scene code injection secondary development method based on webrtc according to claim 1 is characterized in that: The situations where the security check fails include: (1) The lua script contains the operation of closing the UE4 program; (2) The Lua script contains operations to delete files; (3) Operations that call dangerous operating system commands.
6. A computer terminal storage medium storing computer terminal executable instructions, characterized in that: The computer terminal executable instructions are used to execute the UE4 three-dimensional scene code injection secondary development method based on webrtc as described in any one of claims 1 to 5.
7. A computing device, characterized in that: include: at least one processor; And a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the UE4 three-dimensional scene code injection secondary development method based on webrtc as described in any one of claims 1-5.
