CN113760260B - 3D scene and role driving method and terminal based on xLua - Google Patents

3D scene and role driving method and terminal based on xLua Download PDF

Info

Publication number
CN113760260B
CN113760260B CN202111032644.5A CN202111032644A CN113760260B CN 113760260 B CN113760260 B CN 113760260B CN 202111032644 A CN202111032644 A CN 202111032644A CN 113760260 B CN113760260 B CN 113760260B
Authority
CN
China
Prior art keywords
xlua
scene
building blocks
virtual machine
script
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202111032644.5A
Other languages
Chinese (zh)
Other versions
CN113760260A (en
Inventor
刘德建
彭谦
罗弘
罗迪
刘伟
李路
陈宏�
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fujian Tianquan Educational Technology Ltd
Original Assignee
Fujian Tianquan Educational Technology Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fujian Tianquan Educational Technology Ltd filed Critical Fujian Tianquan Educational Technology Ltd
Priority to CN202111032644.5A priority Critical patent/CN113760260B/en
Publication of CN113760260A publication Critical patent/CN113760260A/en
Application granted granted Critical
Publication of CN113760260B publication Critical patent/CN113760260B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/34Graphical or visual programming
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • G06F8/313Logic programming, e.g. PROLOG programming language
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45562Creating, deleting, cloning virtual machine instances

Abstract

The invention provides an xLua-based 3D scene and role driving method and terminal, comprising the following steps: building blocks in Unity are created, and logic semantics used for programming are configured for the building blocks; obtaining logic semantics corresponding to the built building blocks and converting the logic semantics into executable Lua script codes; loading a preset 3D scene and a preset role, creating an xLua virtual machine, serializing and binding a control script of the 3D scene and the control script of the role into a stack of the xLua virtual machine, and starting the xLua virtual machine to execute executable codes. According to the invention, the building blocks with logic semantics are developed in the Unity engine, so that the 3D rendering effect is more optimized, graphical programming is realized, the logic semantics corresponding to the built building blocks are converted into executable Lua script codes, and the Lua codes are executed by the xLua virtual machine to drive the 3D scene and the roles to display the output results of the codes, so that the building block programming result is more vivid, and the generated executable codes are clearer and easier to understand.

Description

3D scene and role driving method and terminal based on xLua
Technical Field
The invention relates to the technical field of graphical programming, in particular to a 3D scene and role driving method and terminal based on xLua.
Background
Building block programming is an indispensable tool for programming education of children, and needs to have the indispensable capabilities of building blocks, generating building block codes, executing codes and the like. Building blocks, namely building block libraries containing a plurality of logics are needed to organize the blocks into a huge building block set with logics according to any sequence; generating a building block code, namely generating a code (a pseudo code or a real code) of a building block set to be built according to the sequence and the building block logic; executing the code, namely displaying and expressing the corresponding logic effect in a scene (which can be a 2D or 3D scene) according to the generated code logic.
In the prior art, a scratch (global children are patterned into tools) is generally adopted to program building blocks, the scratch adopts an open source code based on google as a core, belongs to a third-party open source mechanism, has larger use limitation, and has the following defects:
1. rendering performance is poor: the scratch adopts a rendering scheme of WebGL to process UI and scene logic, and has poor performance in the aspect of 3D rendering;
2. generating pseudo code: when generating building block codes, the scratch generates pseudo codes, which only describe building block logic and cannot be directly executed.
Disclosure of Invention
The technical problems to be solved by the invention are as follows: the 3D scene and role driving method based on the xLua and the terminal are provided, so that the building block programming result is more vivid.
In order to solve the technical problems, the invention adopts the following technical scheme:
an xLua-based 3D scene and character driving method, comprising the steps of:
s1, building blocks in Unity are created, and logic semantics used for programming are configured for the building blocks;
s2, obtaining the built logic semantics corresponding to the building blocks and converting the logic semantics into executable codes, wherein the executable codes are Lua script codes;
s3, loading a preset 3D scene and a role, creating an xLua virtual machine, serializing and binding control scripts of the 3D scene and the role into a stack of the xLua virtual machine, and starting the xLua virtual machine to execute the executable code.
In order to solve the technical problems, the invention adopts another technical scheme that:
an xLua-based 3D scene and character driver terminal comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the following steps when executing the computer program:
s1, building blocks in Unity are created, and logic semantics used for programming are configured for the building blocks;
s2, obtaining the built logic semantics corresponding to the building blocks and converting the logic semantics into executable codes, wherein the executable codes are Lua script codes;
s3, loading a preset 3D scene and a role, creating an xLua virtual machine, serializing and binding control scripts of the 3D scene and the role into a stack of the xLua virtual machine, and starting the xLua virtual machine to execute the executable code.
The invention has the beneficial effects that: the invention provides a 3D scene and role driving method and terminal based on xLua, which are characterized in that building blocks with logic semantics are developed in a Unity engine, so that graphical programming is realized while the 3D rendering effect is more optimized, the logic semantics corresponding to the built building blocks are converted into executable Lua script codes, and the Lua virtual machine executes the Lua codes to drive the 3D scene and roles to display the output results of the codes, so that the building block programming result is more vivid, and the generated executable codes are clearer and easier to understand.
Drawings
FIG. 1 is a flow chart of an xLua-based 3D scene and character driving method according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of an xLua-based 3D scene and character driving terminal according to an embodiment of the present invention.
Description of the reference numerals:
1. an xLua-based 3D scene and character driving terminal; 2. a memory; 3. a processor.
Detailed Description
In order to describe the technical contents, the achieved objects and effects of the present invention in detail, the following description will be made with reference to the embodiments in conjunction with the accompanying drawings.
Before this, in order to facilitate understanding of the technical solution of the present invention, some english abbreviations, specific nouns, etc. related to the present invention are described as follows:
xLua: the xLua is an open source Lua plug-in for Tencentration development, and can increase the programming capability of Lua scripts for C# environments such as Unity, net, mono and the like, and the Lua codes and the C# can be mutually called by the xLua.
Referring to fig. 1, an xLua-based 3D scene and character driving method includes the steps of:
s1, building blocks in Unity are created, and logic semantics used for programming are configured for the building blocks;
s2, obtaining the built logic semantics corresponding to the building blocks and converting the logic semantics into executable codes, wherein the executable codes are Lua script codes;
s3, loading a preset 3D scene and a role, creating an xLua virtual machine, serializing and binding control scripts of the 3D scene and the role into a stack of the xLua virtual machine, and starting the xLua virtual machine to execute the executable code.
From the above description, the beneficial effects of the invention are as follows: the building block with logic semantics is developed in the Unity engine, so that the 3D rendering effect is more optimized, graphical programming is realized, the logic semantics corresponding to the built building block are converted into executable Lua script codes, the Lua codes are executed by the xLua virtual machine to drive the 3D scene and the roles to display the output result of the codes, the building block programming result is more vivid, and the generated executable codes are clearer and easier to understand.
Further, the step S3 specifically includes the following steps:
s31, starting Unity, loading a preset 3D scene and a role, and adding a C# control script for the 3D scene and the role;
s32, creating an xLua virtual machine, adding a LuaCallCSharp attribute for the C# control script, and injecting the attribute into a stack of the xLua virtual machine in a serialization manner;
and S33, starting the xLua virtual machine to execute the executable code, and calling the C# control script to control the 3D scene and the character to execute corresponding expression results when the executable code is executed to the stack bound with the C# control script.
As can be seen from the above description, the c# control script of the 3D scene and the character is bound to the stack of the xLua virtual machine, that is, the Lua method and the c# method are bound, so that the Lua code calls the Lua method, and thus, the c# method bound thereto is called, that is, the logic semantics of the corresponding c# control script control 3D scene and the character execution building block are called.
Further, the c# control script comprises a 3D scene loading, switching and unloading control script and a character action playing, displaying, hiding and character speaking bubble control script.
As can be seen from the above description, by binding some scripts for controlling 3D scenes and characters, for example, switching, loading, etc. of 3D scenes and actions, speaking, etc. of characters, a realistic and diversified interactive effect of scenes and characters is achieved.
Further, the step S1 specifically includes the following steps:
s11, building the building blocks with different shapes or colors in the Unity by adopting a FGUI editor, and distinguishing the types of the building blocks;
s12, configuring corresponding logic semantics for the building blocks of different types;
s13, building block management lists are created, and building blocks with different shapes or colors are placed in the building block management lists in a classified mode.
It can be seen from the above description that different shapes or colors are set for different types of building blocks, so that the building blocks are diversified, the corresponding logic semantics can be rapidly configured for the building blocks while the types are conveniently distinguished, and meanwhile, the building block management list is conveniently used for rapidly classifying the building blocks of different types according to the different shapes or colors, so that the desired building blocks can be rapidly searched according to the building block management list during subsequent programming, and the efficiency of building block programming is improved.
Further, the step S2 specifically includes the following steps:
s21, prefabricating data nodes according to the logic principle of the C#;
s22, mapping the data nodes into the corresponding building blocks to generate corresponding graphical UI;
s23, acquiring logic semantics corresponding to the built building blocks, and triggering each data node to generate a Lua script fragment;
and S24, graphically integrating the data nodes, acquiring the insertion depth of the corresponding data nodes according to the graphical combination relation, and finally generating the complete Lua script code.
According to the description, some data nodes are prefabricated according to the logic principle of the C# language, mapping is carried out on the data nodes and the logic semantics corresponding to the building blocks, the C# codes are generated in the building process of the building blocks, meanwhile, each data node can correspondingly generate Lua script fragments, and meanwhile, all the Lua script fragments can be integrated through graphics by mapping the data nodes into a graphical UI, so that the complete Lua script codes are finally generated.
Referring to fig. 2, an xLua-based 3D scene and character driving terminal includes a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:
s1, building blocks in Unity are created, and logic semantics used for programming are configured for the building blocks;
s2, obtaining the built logic semantics corresponding to the building blocks and converting the logic semantics into executable codes, wherein the executable codes are Lua script codes;
s3, loading a preset 3D scene and a role, creating an xLua virtual machine, serializing and binding control scripts of the 3D scene and the role into a stack of the xLua virtual machine, and starting the xLua virtual machine to execute the executable code.
From the above description, the beneficial effects of the invention are as follows: based on the same technical conception, the 3D scene and role driving terminal based on xLua is provided by matching with the method for making the entity to play the robot action, the building blocks with logic semantics are developed in the Unity engine, the 3D rendering effect is ensured to be more optimized, graphical programming is realized, the logic semantics corresponding to the built building blocks are converted into executable Lua script codes, and the Lua codes are executed by the xLua virtual machine to drive the 3D scene and the roles to display the output results of the codes, so that the building block programming result is expressed more vividly, and the generated executable codes are clearer and easier to understand.
Further, the step S3 specifically includes the following steps:
s31, starting Unity, loading a preset 3D scene and a role, and adding a C# control script for the 3D scene and the role;
s32, creating an xLua virtual machine, adding a LuaCallCSharp attribute for the C# control script, and injecting the attribute into a stack of the xLua virtual machine in a serialization manner;
and S33, starting the xLua virtual machine to execute the executable code, and calling the C# control script to control the 3D scene and the character to execute corresponding expression results when the executable code is executed to the stack bound with the C# control script.
As can be seen from the above description, the c# control script of the 3D scene and the character is bound to the stack of the xLua virtual machine, that is, the Lua method and the c# method are bound, so that the Lua code calls the Lua method, and thus, the c# method bound thereto is called, that is, the logic semantics of the corresponding c# control script control 3D scene and the character execution building block are called.
Further, the c# control script comprises a 3D scene loading, switching and unloading control script and a character action playing, displaying, hiding and character speaking bubble control script.
As can be seen from the above description, by binding some scripts for controlling 3D scenes and characters, for example, switching, loading, etc. of 3D scenes and actions, speaking, etc. of characters, a realistic and diversified interactive effect of scenes and characters is achieved.
Further, the step S1 specifically includes the following steps:
s11, building the building blocks with different shapes or colors in the Unity by adopting a FGUI editor, and distinguishing the types of the building blocks;
s12, configuring corresponding logic semantics for the building blocks of different types;
s13, building block management lists are created, and building blocks with different shapes or colors are placed in the building block management lists in a classified mode.
It can be seen from the above description that different shapes or colors are set for different types of building blocks, so that the building blocks are diversified, the corresponding logic semantics can be rapidly configured for the building blocks while the types are conveniently distinguished, and meanwhile, the building block management list is conveniently used for rapidly classifying the building blocks of different types according to the different shapes or colors, so that the desired building blocks can be rapidly searched according to the building block management list during subsequent programming, and the efficiency of building block programming is improved.
Further, the step S2 specifically includes the following steps:
s21, prefabricating data nodes according to the logic principle of the C#;
s22, mapping the data nodes into the corresponding building blocks to generate corresponding graphical UI;
s23, acquiring logic semantics corresponding to the built building blocks, and triggering each data node to generate a Lua script fragment;
and S24, graphically integrating the data nodes, acquiring the insertion depth of the corresponding data nodes according to the graphical combination relation, and finally generating the complete Lua script code.
According to the description, some data nodes are prefabricated according to the logic principle of the C# language, mapping is carried out on the data nodes and the logic semantics corresponding to the building blocks, the C# codes are generated in the building process of the building blocks, meanwhile, each data node can correspondingly generate Lua script fragments, and meanwhile, all the Lua script fragments can be integrated through graphics by mapping the data nodes into a graphical UI, so that the complete Lua script codes are finally generated.
Referring to fig. 1, a first embodiment of the present invention is as follows:
an xLua-based 3D scene and character driving method, comprising the steps of:
s1, building blocks are created in the Unity, and logic semantics used for programming are configured for the building blocks.
In this embodiment, the step S1 specifically includes the following steps:
s11, building blocks with different shapes or colors are created in the Unity by adopting a FGUI editor and are used for distinguishing the types of the building blocks.
In this embodiment, the building block generation process specifically includes: the FGUI editor breaks up basic blocks in the Unity into a plurality of horizontal rows or longitudinal columns of gaps, mounts a plurality of basic controls for the gaps, such as characters, input frames, drop-down frames, operator buttons, judging frames, splicing container frames with various shapes and the like, then loads picture resources with different shapes for the gaps by adopting GLoader (loader) controls of the FGUI editor, stretches the gaps with different shapes according to a preset scaling rule after splicing the gaps with different shapes, and finally forms building blocks with different types through overall shape self-adaption, and sets different colors for the building blocks with different types to distinguish. The overall shape self-adaption comprises self-adaption of position and size calculation of the base control mounted by the vacancy according to a preset layout rule, self-adaption of the shape of the vacancy along with real-time change of the shape of the base control and self-adaption of the shape of the building block along with real-time change of the shape of the vacancy. For example, when a certain building block is loaded with the basic control of the input frame, when the content input by the developer in the input frame exceeds the length of the initial input frame, the size of the input frame is adapted to the input content and is transversely prolonged, so that the length of the whole building block is also adapted to the transverse prolonged change.
S12, configuring corresponding logic semantics for building blocks of different types.
The method comprises the steps of setting up a building block, setting up a collision detector for the building block, specifically setting up the collision detector with logic information at the splice of the building block according to the type, shape or color of the building block when the building block is built, enabling the building block to carry out collision splice detection in the dragging process when programming is carried out subsequently, and ensuring that the splice logic of the building blocks is reasonable, namely the logic of building block programming is reasonable. For example, collision detectors may be disposed at protruding or recessed positions of blocks of different shapes, such as diamond-shaped blocks and oval-shaped blocks, collision detectors may be disposed at left heads of the diamond-shaped and oval-shaped blocks, and then specific logic information may be added to the collision detectors, such as data information representing boolean values may be added to the collision detectors of the diamond-shaped blocks, and data information representing character strings may be added to the collision detectors of the oval-shaped blocks.
S13, building block management lists are created, and building blocks with different shapes or colors are placed in the building block management lists in a classified mode.
The method is convenient for the follow-up quick retrieval of the wanted building blocks according to the building block management list when the building block programming is carried out, and the efficiency of the building block programming is improved.
Meanwhile, in the building process of the building blocks, the operation of the building blocks can synchronously trigger the building blocks to generate corresponding logic semantics, namely, the logic semantics can be converted into executable Lua script codes in real time, and the programming efficiency of the graphical building blocks is improved.
S2, obtaining logic semantics corresponding to the built building blocks, and converting the logic semantics into executable codes, wherein the executable codes are Lua script codes.
The step S2 further specifically includes the following steps:
s21, prefabricating data nodes according to the logic principle of the C#;
s22, mapping the data nodes into corresponding building blocks to generate corresponding graphical UI;
s23, obtaining logic semantics corresponding to the built building blocks, and triggering each data node to generate a Lua script fragment;
s24, graphically integrating the data nodes, obtaining the insertion depth of the corresponding data nodes according to the graphical combination relation, and finally generating a complete Lua script code.
In this embodiment, some data nodes are prefabricated according to the logic principle of the c# language, mapping is performed with corresponding logic semantics in the building blocks, and when the c# code is generated in the building block construction process, each data node can correspondingly generate the Lua script fragment, and meanwhile, by mapping the data nodes into the graphical UI, all Lua script fragments can be integrated graphically, and finally, a complete Lua script code is generated.
S3, loading preset 3D scenes and roles, creating an xLua virtual machine, serializing and binding control scripts of the 3D scenes and the roles into a stack of the xLua virtual machine, and starting the xLua virtual machine to execute executable codes.
In this embodiment, by developing the building blocks with logic semantics in the Unity engine, the 3D rendering effect is more optimized, and at the same time, the graphical programming is realized, the logic semantics corresponding to the built building blocks are converted into executable Lua script codes, and the Lua codes are executed by the xLua virtual machine to drive the 3D scene and the roles to display the output results of the codes, so that the building block programming results are more vivid, the generated executable codes are clearer and more understandable, and the overall scheme realizes the requirements of graphical building block programming, building block code generation and building block code execution.
The second embodiment of the invention is as follows:
in the first embodiment, the step S3 specifically includes the following steps:
s31, starting the Unity, loading a preset 3D scene and a preset role, and adding a C# control script for the 3D scene and the preset role.
The C# control script comprises a 3D scene loading, switching and unloading control script and a role action playing, displaying, hiding and role speaking bubble control script.
I.e. by binding some scripts controlling the 3D scene and the character, such as switching, loading etc. of the 3D scene and actions, speaking etc. of the character. The loading, switching and unloading control script of the 3D scene can be packaged into scene control, and can also comprise camera control, scene role control and the like, for example, the camera control can preset a plurality of visual angles to facilitate the adjustment of the mechanical energy of the visual angles of a user, and the scene role control can be used for enabling the roles to freely move in the scene by packaging navigation grids for path finding. The interactive effect of vivid and diversified scenes and roles is realized integrally.
S32, creating an xLua virtual machine, adding a LuaCallCSharp attribute for the C# control script, and injecting the attribute into a stack of the xLua virtual machine in a serialization manner.
S33, starting the xLua virtual machine to execute executable codes, and calling the C# control script to control the 3D scene and the role to execute corresponding representation results when the executable codes are executed to the stack bound with the C# control script.
In this embodiment, the Lua method and the c# method are bound by binding the c# control script of the 3D scene and the role into the stack of the xLua virtual machine, so that when the xLua virtual machine executes the Lua script code, the c# method bound with the xLua virtual machine can be called by calling the Lua method, that is, the logic semantics of the corresponding c# control script control 3D scene and the role execution building block are called.
Referring to fig. 2, a third embodiment of the present invention is as follows:
an xLua-based 3D scene and character driving terminal 1 includes a memory 2, a processor 3, and a computer program stored on the memory 2 and executable on the processor 3, the processor 3 implementing the steps of an xLua-based 3D scene and character driving method in one of the above-described first or second embodiments when the computer program is executed.
In summary, according to the 3D scene and role driving method and terminal based on xLua, building blocks with logic semantics are developed in the Unity engine, the logic semantics corresponding to the built building blocks are converted into executable Lua script codes, and the Lua codes are executed by the xLua virtual machine to drive the 3D scene and role to display the output result of the codes, so that the method and terminal have the following beneficial effects:
1. building blocks, 3D scenes and roles are developed by adopting a Unity engine, so that 3D rendering is more optimized;
2. configuring common semantics of programming into building blocks to make programming graphical;
3. for the built building blocks, generating complete executable lua script codes as non-pseudo codes;
4. the C# control script of the 3D scene and the character is bound to the stack of the xLua virtual machine, so that the C# method is called by executing Lua script codes through xLua, the logic semantics of the 3D scene and the character execution building block are controlled, the building block programming result is expressed more vividly, and the generated executable codes are clearer and easier to understand.
The foregoing description is only illustrative of the present invention and is not intended to limit the scope of the invention, and all equivalent changes made by the specification and drawings of the present invention, or direct or indirect application in the relevant art, are included in the scope of the present invention.

Claims (6)

1. An xLua-based 3D scene and character driving method, comprising the steps of:
s1, building blocks in Unity are created, and logic semantics used for programming are configured for the building blocks;
the step S1 specifically comprises the following steps:
s11, building the building blocks with different shapes or colors in the Unity by adopting a FGUI editor, and distinguishing the types of the building blocks;
s12, configuring corresponding logic semantics for the building blocks of different types;
s13, building a building block management list, and placing the building blocks with different shapes or colors in the building block management list in a classified manner;
s2, obtaining the built logic semantics corresponding to the building blocks and converting the logic semantics into executable codes, wherein the executable codes are Lua script codes;
the step S2 specifically comprises the following steps:
s21, prefabricating data nodes according to the logic principle of the C#;
s22, mapping the data nodes into the corresponding building blocks to generate corresponding graphical UI;
s23, acquiring logic semantics corresponding to the built building blocks, and triggering each data node to generate a Lua script fragment;
s24, graphically integrating the data nodes, acquiring the insertion depth of the corresponding data nodes according to the graphical combination relation, and finally generating the complete Lua script code;
s3, loading a preset 3D scene and a role, creating an xLua virtual machine, serializing and binding control scripts of the 3D scene and the role into a stack of the xLua virtual machine, and starting the xLua virtual machine to execute the executable code.
2. The xLua-based 3D scene and character driving method of claim 1, wherein the S3 specifically comprises the steps of:
s31, starting Unity, loading a preset 3D scene and a role, and adding a C# control script for the 3D scene and the role;
s32, creating an xLua virtual machine, adding a LuaCallCSharp attribute for the C# control script, and injecting the attribute into a stack of the xLua virtual machine in a serialization manner;
and S33, starting the xLua virtual machine to execute the executable code, and calling the C# control script to control the 3D scene and the character to execute corresponding expression results when the executable code is executed to the stack bound with the C# control script.
3. The xLua-based 3D scene and character driving method of claim 2, wherein the c# control script comprises a 3D scene loading, switching and unloading control script and character action play, display, concealment and character speaking bubble control script.
4. An xLua-based 3D scene and character driver terminal comprising a memory, a processor and a computer program stored on the memory and executable on the processor, said processor implementing the following steps when said computer program is executed:
s1, building blocks in Unity are created, and logic semantics used for programming are configured for the building blocks;
the step S1 specifically comprises the following steps:
s11, building the building blocks with different shapes or colors in the Unity by adopting a FGUI editor, and distinguishing the types of the building blocks;
s12, configuring corresponding logic semantics for the building blocks of different types;
s13, building a building block management list, and placing the building blocks with different shapes or colors in the building block management list in a classified manner;
s2, obtaining the built logic semantics corresponding to the building blocks and converting the logic semantics into executable codes, wherein the executable codes are Lua script codes;
the step S2 specifically comprises the following steps:
s21, prefabricating data nodes according to the logic principle of the C#;
s22, mapping the data nodes into the corresponding building blocks to generate corresponding graphical UI;
s23, acquiring logic semantics corresponding to the built building blocks, and triggering each data node to generate a Lua script fragment;
s24, graphically integrating the data nodes, acquiring the insertion depth of the corresponding data nodes according to the graphical combination relation, and finally generating the complete Lua script code;
s3, loading a preset 3D scene and a role, creating an xLua virtual machine, serializing and binding control scripts of the 3D scene and the role into a stack of the xLua virtual machine, and starting the xLua virtual machine to execute the executable code.
5. The xLua-based 3D scene and character driving terminal of claim 4, wherein S3 specifically comprises the steps of:
s31, starting Unity, loading a preset 3D scene and a role, and adding a C# control script for the 3D scene and the role;
s32, creating an xLua virtual machine, adding a LuaCallCSharp attribute for the C# control script, and injecting the attribute into a stack of the xLua virtual machine in a serialization manner;
and S33, starting the xLua virtual machine to execute the executable code, and calling the C# control script to control the 3D scene and the character to execute corresponding expression results when the executable code is executed to the stack bound with the C# control script.
6. The xLua-based 3D scene and character driver terminal of claim 5, wherein the c# control script comprises a 3D scene load, switch and unload control script and character action play, display, hide and character talk bubble control script.
CN202111032644.5A 2021-09-03 2021-09-03 3D scene and role driving method and terminal based on xLua Active CN113760260B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111032644.5A CN113760260B (en) 2021-09-03 2021-09-03 3D scene and role driving method and terminal based on xLua

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111032644.5A CN113760260B (en) 2021-09-03 2021-09-03 3D scene and role driving method and terminal based on xLua

Publications (2)

Publication Number Publication Date
CN113760260A CN113760260A (en) 2021-12-07
CN113760260B true CN113760260B (en) 2023-05-23

Family

ID=78792938

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111032644.5A Active CN113760260B (en) 2021-09-03 2021-09-03 3D scene and role driving method and terminal based on xLua

Country Status (1)

Country Link
CN (1) CN113760260B (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2016138595A1 (en) * 2015-03-04 2016-09-09 Rocketchicken Interactive Inc. Systems for rapid development and delivery of interactive content
WO2017066512A1 (en) * 2015-10-14 2017-04-20 Prime Software Systems, Inc. Visualizing the structure and execution of a program
CN109634592A (en) * 2018-12-29 2019-04-16 深圳点猫科技有限公司 Graphical Python programming exchange method, system and electronic equipment
CN109710261A (en) * 2018-12-29 2019-05-03 深圳点猫科技有限公司 A kind of method and electronic equipment that building blocks code is automatically converted to programming code
CN111179422A (en) * 2019-12-31 2020-05-19 深圳市优必选科技股份有限公司 Model construction method and device and terminal equipment
CN112363690A (en) * 2020-10-21 2021-02-12 杭州电魂网络科技股份有限公司 Universal visual editing method, device and medium for Unity3D game automation behavior
CN112506502A (en) * 2020-12-16 2021-03-16 深圳市优必选科技股份有限公司 Visual programming method, device, equipment and storage medium based on human-computer interaction
CN113238744A (en) * 2021-04-30 2021-08-10 湖南中医药高等专科学校 Graphical programming method based on flow chart structure

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2016138595A1 (en) * 2015-03-04 2016-09-09 Rocketchicken Interactive Inc. Systems for rapid development and delivery of interactive content
WO2017066512A1 (en) * 2015-10-14 2017-04-20 Prime Software Systems, Inc. Visualizing the structure and execution of a program
CN109634592A (en) * 2018-12-29 2019-04-16 深圳点猫科技有限公司 Graphical Python programming exchange method, system and electronic equipment
CN109710261A (en) * 2018-12-29 2019-05-03 深圳点猫科技有限公司 A kind of method and electronic equipment that building blocks code is automatically converted to programming code
CN111179422A (en) * 2019-12-31 2020-05-19 深圳市优必选科技股份有限公司 Model construction method and device and terminal equipment
CN112363690A (en) * 2020-10-21 2021-02-12 杭州电魂网络科技股份有限公司 Universal visual editing method, device and medium for Unity3D game automation behavior
CN112506502A (en) * 2020-12-16 2021-03-16 深圳市优必选科技股份有限公司 Visual programming method, device, equipment and storage medium based on human-computer interaction
CN113238744A (en) * 2021-04-30 2021-08-10 湖南中医药高等专科学校 Graphical programming method based on flow chart structure

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
杨昊冉申婧程图峰赖豪东陈杰,基于unity3D的虚拟现实电子积木设计与实现.电脑知识与技术.2021,17(24),全文. *

Also Published As

Publication number Publication date
CN113760260A (en) 2021-12-07

Similar Documents

Publication Publication Date Title
KR101863041B1 (en) Creation of playable scene with an authoring system
KR101530634B1 (en) An apparatus and method for authoring experience-based learning content
JP5237095B2 (en) Visual debugging system for 3D user interface programs
CN110262791B (en) Visual programming method and device, operator and readable storage medium
Fu et al. Putting AI in entertainment: An AI authoring tool for simulation and games
CN112669194B (en) Animation processing method, device, equipment and storage medium in virtual scene
US20230290032A1 (en) Physical special effect rendering method and apparatus, computer device, and storage medium
US20190114819A1 (en) Dimensional content surface rendering
CN113760260B (en) 3D scene and role driving method and terminal based on xLua
WO2021154101A1 (en) Software broker for assets managed with nested instancing
CN110554900B (en) Method, system, device and medium for presenting human-computer interface effect based on GPU
CN115120966A (en) Rendering method and device of fluid effect
CN115671735A (en) Object selection method and device in game and electronic equipment
CN113760261B (en) Graphical building block programming method and terminal based on FGUI
US20220366810A1 (en) Application onboarding tutorial system
Revie Designing a Data-Driven Renderer
KR100259951B1 (en) A method to generate a 3d animation using visual scripts
Alizadeh Design and Implementation of a Web-Based Editor Optimized for Online Gambling Games
Kamat et al. Interactive discrete-event simulation of construction processes in dynamic immersive 3D virtual worlds
CN110990100A (en) Method and device for processing node object in game scene
Brendel et al. Exploring the immediate mode GUI concept for graphical user interfaces in mixed reality applications
KR100289061B1 (en) Manager system for simulation tool of lotos
Kwong et al. Web-based tool for programming interactive 3D animations in terms of state-transition diagrams
CN118012407A (en) Data processing method, device, equipment and storage medium
CN117193746A (en) 3D application generation method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant