A data processing method, device, equipment and storage medium
By introducing debugging controls and run controls into the visual programming interface, the simulation screen is allowed to be played frame by frame or second by second, which solves the problem of low efficiency in identifying code program problems in the existing technology and enables rapid identification of problems in the code program.
Patent Information
- Application Number
- CN202410011141.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-03
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2044-01-03
AI Technical Summary
In the existing technology, users need to run and repeat playback multiple times to find problems when writing code programs, resulting in a waste of time and energy, and a lack of methods to quickly identify code program problems.
Provide a data processing method that includes a code block display area, debugging control and running control through a visual programming interface, allowing users to start the debugging program, run the code program, and play the simulation picture frame by frame or second by second through the debugging control to achieve targeted playback to quickly identify problems.
Through the cooperation of physical simulation and debugging controls, users can quickly identify problems in the code program, avoiding the need to play the simulation screen at one time and improving code debugging efficiency.
Smart Images

Figure CN118012407B
Abstract
Description
Technical Field
[0001] The present application relates to the field of computers, and in particular to a data processing method, device, equipment and storage medium. Background Art
[0002] With the continuous development and progress of programming technology, some graphical programming tools have appeared on the market. The core of these tools is to encapsulate the text programming language in code form into a code block. By combining and splicing code blocks of corresponding functions in a visual code editing interface, code programs can be generated simply and quickly.
[0003] After generating a code program, you can usually run the code program and generate a screen for the code program through the physics engine and rendering engine, so as to intuitively display the effect of the code program. The entire running process is run according to the code program written by the user. The user observes the simulation screen corresponding to the code program to judge whether the program he wrote meets expectations or whether there are defects. For example, the user wrote a program to control the robot's jumping, and it is expected that the robot will stay in the air for a period of time before landing. But in actual operation, the robot's jumping height and staying time are not in line with expectations. According to the current plan, the user may need to run the program multiple times or repeatedly play a certain clip, and try to find out the problem by observing the robot's trajectory and output results, which may take a lot of time and effort.
[0004] Therefore, there is an urgent need for a solution that can quickly identify problems in code programs. Summary of the invention
[0005] An embodiment of the present application provides a data processing method for quickly identifying problems in a code program.
[0006] In view of this, the present application provides a data processing method on the one hand, including: displaying a visual programming interface, the visual programming interface includes a code block display area, a first control and a second control, the code block display area includes at least one code block for generating a code program; in response to a first operation on the first control, starting a debugger for the code program; in response to a second operation on the second control, running the code program and displaying a first interface, the first interface including an initial simulation screen and a debug control display area, the debug control display area including at least one debug control, the at least one debug control being used to indicate a playback form of a simulation screen rendered based on the code program, the initial simulation screen being rendered based on the code program within a first time step, and the debug control display area being rendered based on the debugger; in response to a third operation on the at least one debug control, playing a simulation screen set on the first interface, the rendering time of each simulation screen in the simulation screen set being later than the rendering time of the initial simulation screen.
[0007] On the other hand, the present application provides a data processing device, including: a display module for displaying a visual programming interface, the visual programming interface including a code block display area, a first control, and a second control, the code block display area including at least one code block of a generated code program;
[0008] A processing module, configured to start a debugging program of the code program in response to a first operation on the first control;
[0009] The processing module is used to run the code program in response to a second operation on the second control;
[0010] The display module is used to display a first interface in response to a second operation on the second control, the first interface including an initial simulation screen and a debugging control display area, the debugging control display area including at least one debugging control, the at least one debugging control being used to indicate a playback form of a simulation screen rendered based on the code program, the initial simulation screen being rendered based on the code program within a first time step, and the debugging control display area being rendered based on the debugging program; in response to a third operation on the at least one debugging control, a simulation screen set is played on the first interface, the rendering time of each simulation screen in the simulation screen set being later than the rendering time of the initial simulation screen.
[0011] In one possible design, in another implementation of another aspect of the embodiment of the present application, the processing module is used to disable automatic simulation of the physics engine and enable deterministic physics settings in response to a second operation on the second control;
[0012] generating the code program based on the at least one code block conversion;
[0013] Run the code program and perform physical simulation according to the time step;
[0014] Rendering the virtual object in the code program based on the result of the physical simulation to obtain the initial simulation screen;
[0015] The display module is used to display the initial simulation screen on the first interface.
[0016] In one possible design, in another implementation of another aspect of the embodiment of the present application, the first interface also includes parameter information of the virtual object, and the parameter information includes current position information, speed information, and rotation angle of the virtual object.
[0017] In one possible design, in another implementation of another aspect of the embodiment of the present application, the processing module is used to create a user interface canvas, wherein the rendering mode of the user interface canvas is used to indicate that the debug control display area is displayed on the first interface;
[0018] Create a button object corresponding to at least one debug control in the debug control display area on the user interface screen;
[0019] The at least one debugging control is obtained by setting a click event for the button object based on the debugging program, and the click event is used to indicate an execution event after the at least one debugging control is selected.
[0020] In one possible design, in another implementation of another aspect of the embodiment of the present application, the at least one debug control includes a first debug control, a second debug control, a third debug control, and a fourth debug control;
[0021] The execution event of the first debugging control is to resume the running of the code program when the code program is in a suspended running state;
[0022] The execution event of the second debugging control is to suspend the running of the code program when the code program is in the running state;
[0023] The execution event of the third debugging control is to execute the physical simulation of the code program frame by frame when the code program is in a suspended running state;
[0024] The execution event of the fourth debugging control is to execute the physical simulation of the code program second by second when the code program is in a suspended running state.
[0025] In one possible design, in another implementation of another aspect of the embodiment of the present application, the processing module is used to resume running the code program in response to an operation on the first debugging control;
[0026] Run the code program to perform physical simulation in the second time step;
[0027] Rendering the virtual object in the code program based on the result of the physical simulation to obtain a first simulation picture;
[0028] The display module is used to display the first simulation picture on the first interface;
[0029] The processing module is used to run the code program and perform physical simulation in a third time step;
[0030] Rendering the virtual object in the code program based on the result of the physical simulation to obtain a second simulation picture;
[0031] The display module is used to display the second simulation picture on the first interface;
[0032] The process loops in this way until the code program is paused and the third simulation screen is displayed on the first interface, wherein the first simulation screen, the second simulation screen and the third simulation screen are included in the simulation screen set, and the third simulation screen is the last simulation screen in the time sequence of the simulation screen set.
[0033] In one possible design, in another implementation of another aspect of the embodiment of the present application, the processing module is used to suspend the execution of the code program in response to an operation on the second debugging control;
[0034] The display module is used to display the third simulation picture on the first interface.
[0035] In one possible design, in another implementation of another aspect of the embodiment of the present application, the processing module is used to resume running the code program in response to an operation on the third debugging control; run the code program to perform physical simulation within a second time step; render a virtual object in the code program based on a result of the physical simulation to obtain a first simulation screen;
[0036] The display module is used to display the first simulation screen on the first interface, wherein the first simulation screen serves as the simulation screen set.
[0037] In one possible design, in another implementation of another aspect of the embodiment of the present application, the processing module is used to resume running the code program in response to an operation on the fourth debugging control; run the code program to perform physical simulation within a second time step; render a virtual object in the code program based on a result of the physical simulation to obtain a first simulation screen;
[0038] The display module is used to display the first simulation picture on the first interface;
[0039] The processing module is used to run the code program and perform physical simulation in a third time step; based on the result of the physical simulation, the virtual object in the code program is rendered to obtain a second simulation picture;
[0040] The display module is used to display the second simulation screen on the first interface; and repeats this cycle until the running time reaches one second, pausing the running of the code program and displaying the fourth simulation screen on the first interface, wherein the first simulation screen, the second simulation screen and the fourth simulation screen are included in the simulation screen set, and the fourth simulation screen is the last simulation screen within the running time.
[0041] In one possible design, in another implementation of another aspect of the embodiment of the present application, the execution event corresponding to the first debugging control is called with a Pause() interface;
[0042] The execution event corresponding to the second debugging control is called by the Resume() interface;
[0043] The execution event corresponding to the third debugging control is called by the StepOneFrame() interface;
[0044] The execution event corresponding to the fourth debugging control is called using the StepOneSecond() interface.
[0045] In a possible design, in another implementation of another aspect of the embodiment of the present application, the first debug control and the second debug control are combined to correspond to a button object, and the corresponding execution event is called with TogglePauseOrResume();
[0046] The execution event corresponding to the third debugging control is called by the StepOneFrame() interface;
[0047] The execution event corresponding to the fourth debugging control is called using the StepOneSecond() interface.
[0048] In one possible design, in another implementation of another aspect of the embodiment of the present application, a target variable is set during the running of the code program, and the target variable is used to indicate whether the code program handles the pause state.
[0049] In one possible design, in another implementation of another aspect of the embodiment of the present application, the target variable is a Boolean variable.
[0050] Another aspect of the present application provides a computer device, including: a memory, a processor, and a bus system;
[0051] Wherein, the memory is used to store programs;
[0052] The processor is used to execute the program in the memory, and the processor is used to execute the above-mentioned methods according to the instructions in the program code;
[0053] The bus system is used to connect the memory and the processor so that the memory and the processor can communicate with each other.
[0054] Another aspect of the present application provides a computer-readable storage medium, in which instructions are stored. When the computer-readable storage medium is run on a computer, the computer is enabled to execute the above-mentioned methods.
[0055] Another aspect of the present application provides a computer program product or a computer program, the computer program product or the computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the methods provided by the above aspects.
[0056] It can be seen from the above technical solution that the embodiment of the present application has the following advantages: a debugging program is added to the physical simulation of the code program, so that the simulation screen rendered by the code program through physical simulation can be debugged accordingly according to the debugging control, avoiding the simulation screen can only be played once, thereby realizing targeted playback of the simulation screen, and then quickly identifying problems in the code program. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] Figure 1 A schematic diagram of an application architecture of a data processing method in an embodiment of the present application;
[0058] Figure 2 This is a schematic diagram of an embodiment of a data processing method in an embodiment of the present application;
[0059] Figure 3a This is a schematic diagram of an interface of a visual programming interface in an embodiment of the present application;
[0060] Figure 3b Another interface diagram of the visual programming interface in the embodiment of the present application;
[0061] Figure 3c A schematic diagram of an interface that displays a virtual environment, a simulation screen of a virtual object, and a debug control display area when a code program in an embodiment of the present application is running;
[0062] Figure 3d This is a schematic diagram of an interface of the debug control display area when the code program is running in the embodiment of the present application;
[0063] Figure 3e This is another interface schematic diagram of the debug control display area when the code program is running in the embodiment of the present application;
[0064] Figure 3f Another interface schematic diagram showing a virtual environment, a simulation screen of a virtual object, and a debug control display area when a code program in an embodiment of the present application is running;
[0065] Figure 3g Another interface schematic diagram showing a virtual environment, a simulation screen of a virtual object, and a debug control display area when a code program in an embodiment of the present application is running;
[0066] Figure 3h Another interface schematic diagram showing a virtual environment, a simulation screen of a virtual object, and a debug control display area when a code program in an embodiment of the present application is running;
[0067] Figure 3i Another interface schematic diagram showing a virtual environment, a simulation screen of a virtual object, and a debug control display area when a code program in an embodiment of the present application is running;
[0068] Figure 3j Another interface schematic diagram showing a virtual environment, a simulation screen of a virtual object, and a debug control display area when a code program in an embodiment of the present application is running;
[0069] Figure 4 It is a schematic diagram of the operation principle of the code program;
[0070] Figure 5 This is a timing diagram of the execution of the code program in the embodiment of the present application;
[0071] Figure 6 This is a timing diagram of the execution of the code program in the embodiment of the present application;
[0072] Figure 7 This is a schematic diagram of an embodiment of a data processing device in an embodiment of the present application;
[0073] Figure 8 This is another schematic diagram of an embodiment of a data processing device in an embodiment of the present application;
[0074] Fig. 9 FIG. 2 is a schematic diagram of another embodiment of a data processing device in an embodiment of the present application. DETAILED DESCRIPTION
[0075] An embodiment of the present application provides a data processing method for quickly identifying problems in a code program.
[0076] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein, for example. In addition, the terms "including" and "corresponding to" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0077] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program with a predetermined function, and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.
[0078] With the continuous development and progress of programming technology, a kind of graphical programming tools such as blockly and scratch have emerged on the market. The core of these tools is to encapsulate the text programming language in code form into a code block. By combining and splicing the code blocks of corresponding functions in the visual code editing interface, a code program can be generated simply and quickly. After the code program is generated, it can usually be run, and the code program is generated through the physical engine and rendering engine to intuitively display the effect of the code program. The entire running process is to run according to the code program written by the user. The user observes the simulation screen corresponding to the code program to judge whether the program he wrote meets the expectations or whether there are defects. For example, the user wrote a program to control the robot to jump, and it is expected that the robot will stay in the air for a period of time before landing. However, in actual operation, the height and stay time of the robot's jump are not in line with expectations. According to the current solution, the user may need to run the program multiple times or repeatedly play a certain clip, and try to find out the problem by observing the robot's trajectory and output results, which may take a lot of time and effort. Therefore, there is an urgent need for a solution that can quickly identify the problems of the code program.
[0079] In order to solve the above problems, the present application provides the following technical solutions: display a visual programming interface, the visual programming interface includes a code block display area, a first control and a second control, the code block display area includes at least one code block for generating a code program; in response to a first operation on the first control, start the debugger of the code program; in response to a second operation on the second control, run the code program and display a first interface, the first interface includes an initial simulation screen and a debug control display area, the debug control display area includes at least one debug control, the at least one debug control is used to indicate the playback form of the simulation screen rendered based on the code program, the initial simulation screen is based on the code program rendered in the first time step, the debug control display area is based on the debugger rendering; in response to a third operation on the at least one debug control, play a simulation screen set on the first interface, the rendering time of each simulation screen in the simulation screen set is later than the rendering time of the initial simulation screen. In this way, a debugger is added to the physical simulation of the code program, so that the simulation screen rendered by the code program through the physical simulation can be debugged accordingly according to the debugger, avoiding that the simulation screen can only be played once, thereby realizing targeted playback of the simulation screen, and then quickly identifying problems in the code program.
[0080] For ease of understanding, some terms in this application are explained below:
[0081] Physics simulation platform: A computer software or system that uses mathematical models and algorithms to simulate the movement and interaction of objects in the real world. These platforms usually provide a set of tools and interfaces that enable users to create, edit and run physical simulation experiments to study physical phenomena and laws in the real world, which can be applied to scientific research, education and training and other fields.
[0082] Game engines: used to create high-quality games, interactive virtual reality (VR), augmented reality (AR) and other graphical applications. Graphical programming tools: applications that add visual code editors to applications. Usually, code concepts such as variables, logical expressions, loops, etc. can be represented using snap-together graphic blocks. It allows users to program directly according to programming principles without having to pay attention to syntax details.
[0083] Virtual environment: A virtual environment is a virtual environment displayed (or provided) when an application is running on a terminal. The virtual environment can be a simulation of the real world, a semi-simulated and semi-fictitious virtual environment, or a purely fictitious virtual environment. The virtual environment can be any of a two-dimensional virtual environment, a 2.5-dimensional virtual environment, or a three-dimensional virtual environment. The embodiments of the present application do not limit the dimensions of the virtual environment. For example, the virtual environment may include the sky, land, ocean, etc. The land may include environmental elements such as deserts and cities, and users can control virtual objects to move in the virtual environment.
[0084] Virtual objects: refers to objects in a virtual environment. The virtual objects are fictitious objects used to simulate real objects or creatures. For example, people, animals, plants, oil drums, walls, stones, snowflakes, etc. displayed in a virtual environment. The virtual objects include virtual objects and virtual characters. Virtual objects are objects without life attributes. For example, virtual objects can be virtual buildings, virtual vehicles, virtual props, etc. Virtual characters are objects with life attributes. For example, virtual objects can be virtual people, virtual animals, etc.
[0085] The embodiments of the present application provide a data processing method, apparatus, device and storage medium for quickly identifying problems in code programs. The following describes exemplary applications of electronic devices provided by the embodiments of the present application. The electronic devices provided by the embodiments of the present application can be implemented as various types of user terminals or as servers.
[0086] The electronic device can quickly identify problems in the code program by running the data processing method provided in the embodiment of the present application.
[0087] The above scheme can be applied to many computer programming fields, including game development or animation scene development in the field of education. When the data processing method provided in the embodiment of the present application is used to help users develop games or animations, the method can be implemented as an independent online application and installed in the computer device or background server used by the user, so that the user can use the program to process animation data.
[0088] In this scenario, the user edits the code blocks in the application interface, and the computer device combines the code blocks to generate a corresponding code program. At this time, the code program can be used to represent the physical simulation operation of the virtual object in the virtual environment. When the code program is run, the virtual object will be physically simulated to obtain the corresponding physical simulation results, and then the physical simulation results will be rendered to generate a simulation screen and displayed to the user.
[0089] In an exemplary scenario, the data processing method can be applied to game development. For example, the operation of a certain game character can be edited accordingly through code blocks to obtain a code program for the game character, and then the code program is run on a physical simulation platform to obtain a simulation screen of the game character and display it.
[0090] Of course, in addition to being applied to the above-mentioned scenarios, the method provided in the embodiments of the present application can also be applied to other scenarios that require animation development or physical simulation, and the embodiments of the present application do not limit the specific application scenarios.
[0091] See also Figure 1 , Figure 1It is an optional architecture diagram under an application scenario of the data processing solution provided by the embodiment of the present application. In order to realize and support a data processing solution, the terminal device 100 is connected to the server 300 through the network 200, and the server 300 is connected to the database 400. The network 200 can be a wide area network or a local area network, or a combination of the two. The client for implementing the data processing solution is deployed on the terminal device 100, wherein the client can be run on the terminal device 100 in the form of a browser, or can be run on the terminal device 100 in the form of an independent application (application, APP), etc. The specific presentation form of the client is not limited here. The server 300 involved in this application can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (Content Delivery Network, CDN), and basic cloud computing services such as big data and artificial intelligence platforms. The terminal device 100 can be a smart phone, a tablet computer, a laptop, a PDA, a personal computer, a smart TV, a smart watch, a vehicle-mounted device, a wearable device, an intelligent voice interaction device, a smart home appliance, an aircraft, etc., but is not limited thereto. The terminal device 100 and the server 300 can be directly or indirectly connected through the network 200 by wired or wireless communication, and this application does not limit this. The number of servers 300 and terminal devices 100 is also not limited. The solution provided in this application can be completed independently by the terminal device 100, or by the server 300, or by the terminal device 100 and the server 300 in cooperation, and this application does not make specific limitations on this. Among them, the database 400, in short, can be regarded as an electronic file cabinet-a place for storing electronic files, and users can add, query, update, delete, and other operations on the data in the file. The so-called "database" is a collection of data that is stored together in a certain way, can be shared with multiple users, has as little redundancy as possible, and is independent of the application. Database Management System (DBMS) is a computer software system designed for managing databases. It generally has basic functions such as storage, interception, security, and backup.Database management systems can be classified according to the database models they support, such as relational, Extensible Markup Language (XML); or according to the types of computers they support, such as server clusters, mobile phones; or according to the query language used, such as Structured Query Language (SQL), XQuery; or according to performance impulse focus, such as maximum scale, maximum operating speed; or other classification methods. Regardless of the classification method used, some DBMSs can cross categories, for example, supporting multiple query languages at the same time. In the present application, database 400 can be used to store code programs. Of course, the storage location of the code program is not limited to the database. For example, it can also be stored in the terminal device 100, the blockchain or the distributed file system of the server 300.
[0092] It can be understood that the data processing method provided in the present application can be executed by the server 300; accordingly, the data processing device can be set in the server 300. Of course, the data processing method provided in the present application can also be executed by the terminal device 100; accordingly, the data processing device can be set in the terminal device 100. Similarly, the data processing method provided in the present application can also be executed by the terminal device 100 and the server 300 together; accordingly, the data processing device can be set in the terminal device 100 and the server 300. The embodiment of the present application does not impose any limitation on the device form for executing the data processing method.
[0093] In actual application, the user can access the web-side graphical programming tool through the terminal device 100, and through the terminal device 100, select code blocks from the optional code blocks provided in the visual programming interface of the web-side graphical programming tool to build a code block combination, thereby obtaining a set of code programs. Exemplarily, the user can use the mouse of the terminal device 100 to select the required code block in the code editing area in the visual programming interface of the graphical programming tool, and drag the selected code block to the code display area in the graphical programming tool interface; the user can select multiple code blocks from the code block editing area and drag them to the code block display area through multiple operations above, and the server 300 will accordingly construct the association relationship between the multiple code blocks according to the dragging order or the corresponding dragging position of the multiple code blocks dragged to the code block display area, so as to obtain a code block combination corresponding to a set of code programs.
[0094] It is understandable that in the specific implementation of this application, data related to code programs and debugging programs are involved. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.
[0095] Combined with the above introduction, the following describes the data processing method in this application from the product side, taking the application platform as a physical simulation platform as an example. Please refer to Figure 2 , an embodiment of the data processing method in the embodiment of the present application includes:
[0096] 201. Display a visual programming interface, wherein the visual programming interface includes a code block display area, a first control, and a second control. The code block display area includes at least one code block of a generated code program.
[0097] Optionally, the above-mentioned code block is a programming module with program commands formed by packaging program contents written in different program codes. It is understandable that the code block in the embodiment of the present application is a graphical representation of the abstraction of the programming language, specifically a block structure used to replace the code fragment. During use, in order to implement a certain program command, the selected code block can be displayed in the code block display area of the visual programming interface by selecting operations such as clicking or dragging.
[0098] In one implementation, the visual programming interface is a display interface for providing visual programming. Visual programming refers to a programming method that can be performed without using code, only by clicking or dragging code blocks. The application created by the code blocks can be used in the user device, which can be a relatively independent application (Application, APP), for example, a small game, a small program, etc. running in the user device.
[0099] Optionally, the visual programming interface may be an interface in a graphical programming tool on a web. A user may access the graphical programming tool on a web through a terminal device, and write a code program by building a combination of code blocks in a code block display area of the visual programming interface of the graphical programming tool on the web; or, a user may install a client of the graphical programming tool on a terminal device, and write a program by building a combination of code blocks in a code block display area of the client of the graphical programming tool.
[0100] In an exemplary embodiment, the visual programming interface of the graphical programming tool can be as follows: Figure 3aAs shown, the visual programming interface is displayed on the display of the terminal device 100, wherein the visual programming interface includes a code editing area, a code display area, a first control and a second control, wherein the first control is used to indicate starting the debugger of the code program, and the second control is used to indicate running the code program. Figure 3a In the scenario shown, the first control can be set as a control with a text label of "debug", and the second control can be set as an icon control with a click event of "run". The terminal device 100 displays a code combination obtained by combining the code blocks in the code display area in response to the selection and dragging operations of the mouse on the code blocks in the code editing area. Figure 3a As shown, click the "Movement" code block in the code editing area to get multiple code blocks under the "Movement" option, such as: move forward at 30% power; move forward at 30% power for 3 seconds; turn left, move forward at 30% power for 3 seconds; brake at 30% power until stationary; the robot dog's current motion state: motion direction; the robot dog's current X coordinate. Then click the two code blocks "move forward at 30% power for 3 seconds; turn left, move forward at 30% power for 3 seconds" and drag them into the code display area, and the code block combination "when starting to run, move forward at 30% power for 3 seconds; ask for red envelopes; turn left, move forward at 30% power for 3 seconds" will be generated.
[0101] 202. In response to a first operation on the first control, start a debugging program of the code program.
[0102] In this embodiment, a debugging program for debugging the code program is started by selecting the first control.
[0103] In an exemplary embodiment, Figure 3a Taking the visual programming interface shown as an example, when the first control is set to the "debug" option, you can click the "debug" option to make the code editing area of the visual programming interface appear with information. Figure 3b The "debug code" status is highlighted.
[0104] 203. In response to a second operation on the second control, the code program is run and the first interface is displayed, the first interface includes an initial simulation screen and a debug control display area, the debug control display area includes at least one debug control, the at least one debug control is used to indicate the playback form of the simulation screen rendered based on the code program, the initial simulation screen is rendered based on the code program within a first time step, and the debug control display area is rendered based on the debug program.
[0105] In this embodiment, the code program is run by selecting the second control, thereby switching from the visual programming interface to the virtual environment, and then the dynamic behavior of the virtual object described by the code program is rendered in the virtual environment.
[0106] In an exemplary embodiment, Figure 3a Taking the visual programming interface shown in the figure as an example, the second control is set to the "Run" icon control in the lower left corner. After selecting the "Run" icon control, the visual programming interface of the graphical programming tool will switch to the display interface of the virtual environment. Figure 3c As shown, Figure 3a The code blocks shown in the code display area are combined to form the code program logic: when the operation starts, the robot dog first moves forward at 30% of the power speed for 3 seconds; then plays the animation of asking for red envelopes; then turns left 15 degrees and moves forward at 30% of the power speed for 3 seconds. At this time, the virtual environment can be a city street scene, and the virtual object described by the code program is a robot dog. Therefore, the first interface will display the city street scene and the robot dog. At the same time, the first interface also includes a debugging control display area corresponding to the debugging program.
[0107] Optionally, in the present application, the debug control display area may be displayed as a debug panel, which is always displayed in the first interface. Figure 3c As shown, the debugging control may include debugging controls such as "continue running", "run 1 frame" and "run 1 second". At the same time, the debugging control display area may also display the specific frame number and specific simulation time during the running of the code program.
[0108] 204. In response to a third operation on the at least one debugging control, a simulation screen set is played on the first interface, wherein a rendering time of each simulation screen in the simulation screen set is later than a rendering time of the initial simulation screen.
[0109] In this embodiment, in one implementation, the at least one debug control in the debug display area includes a first debug control, a second debug control, a third debug control, and a fourth debug control;
[0110] The execution event of the first debugging control is to resume the running of the code program when the code program is in a suspended running state;
[0111] The execution event of the second debugging control is to suspend the running of the code program when the code program is in the running state;
[0112] The execution event of the third debugging control is to execute the physical simulation of the code program frame by frame when the code program is in a suspended running state;
[0113] The execution event of the fourth debugging control is to execute the physical simulation of the code program second by second when the code program is in a suspended running state.
[0114] It should be understood that the first debug control and the second debug control can be combined to correspond to one control button or can be separated and independently correspond to one control button. In an exemplary solution, the debug control display area can be as follows: Figure 3d As shown, the first debug control and the second debug control each independently correspond to a control button. In another exemplary embodiment, the debug control display area can be as follows Figure 3e As shown, the first debugging control and the second debugging control are combined to correspond to one control button. Figure 3e As shown, when the control button in the debug control display area is displayed as "Pause Running", clicking "Pause Running" will pause the running of the code program, and the control button will be displayed as "Continue Running"; clicking "Continue Running" will continue to run the code program, and the control button will be displayed as "Pause Running".
[0115] Based on the above settings of the debug control, the control effects of each debug control are described below.
[0116] 1. Click "Continue Running" to debug the control
[0117] When the user clicks the "Continue" button, the button text will change to "Pause" and the robot dog will start running according to the set program. Figure 3f As shown, the robot dog starts to move forward, and at the same time, the debug control display area starts to prompt in real time which frame is actually running. During the whole process, the robot dog will run according to the program logic written by the user.
[0118] 2. Click the "Pause Run" debug control
[0119] like Figure 3g As shown in the figure, when the user clicks the "Pause" button, the button text will be changed to "Continue Running", and the robot dog will immediately stop in the current state and remain motionless.
[0120] Optionally, the first interface is also used to display parameter information of the virtual object. For example, Figure 3g As shown, the current position, rotation, speed and other information of the robot dog.
[0121] 3. Click the "Run 1 Frame" debug control
[0122] like Figure 3hAs shown in the figure, after the user clicks the "Run 1 Frame" button, the robot dog will continue to run for 1 frame according to the code program, that is, from frame 58 to frame 59. When the time step is set to 0.02 seconds, the time of one frame will also be 0.02 seconds.
[0123] Optionally, the user can click the "Run 1 Frame" button multiple times, and the robot dog will move frame by frame. Figure 3i As shown in the figure, after 8 consecutive clicks, the code program will play 8 frames of simulation pictures in sequence. After 12 consecutive clicks, the code program will play 12 frames of simulation pictures in sequence. That is, from the 214th frame to the 222nd frame and the 234th frame. In this process, the user will be able to observe the motion state of the virtual object frame by frame.
[0124] 4. Click the "Run for 1 second" debug control
[0125] like Figure 3j As shown in the figure, after the user clicks the "Run 1 Second" button, the robot dog will continue to run for 1 second according to the code program. Assuming that the time step is set to 0.02 seconds, the running starts at the 400th frame, then after running for 1 second, the simulation screen of the 450th frame will be played.
[0126] Based on the above product description, the specific implementation of each part is explained below:
[0127] 1. To explain the operating principle of the code program, please refer to Figure 4 As shown:
[0128] First, click to start running. In this step, the user clicks the "Run" button on the visual programming interface to start the physical simulation process of the code block combination generated in the visual programming interface.
[0129] Then, disable the automatic simulation of the physics engine. This step is to ensure the determinism of the physics simulation. After disabling the automatic simulation function of the physics engine, the time step of the physics simulation can be manually controlled. For example, the time step can be set to 0.02 seconds or 0.01 seconds, or other values. There is no specific limitation here, as long as it meets the actual needs.
[0130] Then, enable the related settings of the deterministic physics module. This step is to ensure the consistency of physical simulation, so it is necessary to enable deterministic physical settings. For example, simulation time, fixed time step, fixed random number seed, etc. Among them, deterministic physical simulation is used to refer to the use of precise mathematical models and algorithms to describe physical laws and equations in physical simulation, and the use of high-precision calculation methods to calculate and predict the movement and interaction of objects, ensuring the accuracy and predictability of simulation results.
[0131] Simulation time: The concept of time in simulation time is not the same as real time. It is just a representation of time in computer simulation. For example, if the simulation time is 10 seconds and the sampling step is set to 0.1, 100 steps need to be executed. If the step is reduced, the number of sampling points will increase, and the actual execution time will increase. Generally, the simulation start time is set to 0, and the end time is selected according to different factors. In general, the time it takes to execute a simulation depends on many factors, including the complexity of the model, the choice of the solver and its step size, the speed of the computer clock, etc.
[0132] Time step: It is used to indicate the time interval between two adjacent simulation points on the time axis. Common physical simulation platforms usually discretize on the time axis according to the specified time step to simulate the dynamic behavior of virtual objects in the code program. The smaller the time step, the more accurate the simulation result, but the amount of calculation will also increase.
[0133] Then, each code block in the code block combination is converted into a one-to-one corresponding code. In the visual programming interface, the user writes a code program by code block programming, so when running the code program, the code block needs to be converted into an actual executable code.
[0134] Then, the code program is executed. The code program written by the user is run to control the movement and interaction of the virtual object (also called the game object). Figure 3a In the code block combination shown, the code program will control the robot dog to move. Similarly, other virtual objects can also be programmed to move and interact, and the specifics are not limited here.
[0135] During the running of the code program, the physical simulation process is a cyclic execution process, that is, the motion state of the virtual object described by the code program is rendered and displayed according to the time axis with the time step as the cycle. The specific steps of the cyclic execution can be as follows:
[0136] a. Each FixedUpdate advances the physical simulation by one time step. In each FixedUpdate method, a physical simulation is manually performed and calculated with a fixed time step (such as 0.02s). Among them, the FixedUpdate refers to an update scheme that performs physical simulation at a fixed time interval (which can also be understood as the time step in this application).
[0137] b. Render the motion effect of the game object. According to the results of the physical simulation, update the position, speed, rotation and other properties of the game object, and render the motion effect of the game object.
[0138] c. The interface displays the information of the game object. The interface displays the relevant information of the game object in real time, such as position, speed, rotation, etc.
[0139] d. Whether to end the simulation: Check whether the conditions for ending the simulation are met, such as reaching the scheduled time, completing a specific task, etc. If the conditions are met, jump out of the loop.
[0140] Finally, the final running results are output. After the simulation is completed, the final state and running results of the game objects are output for users to view and analyze.
[0141] Based on the above operating principle, it can be known that when the data processing method of the present application is not used, the code program cannot be paused during operation. However, the debugging program provided by the present application can pause the operation of the code program or run it as required.
[0142] The following is Figure 5 The running sequence of the code program provided by the present application is shown to illustrate the data processing method of the present application:
[0143] After the user clicks to start running through the visual programming interface of the graphical programming tool (such as Unity), the data processing device disables the automatic simulation of the physics engine and enables the deterministic physics setting. Then, each code block in the code block combination is converted into a one-to-one corresponding code.
[0144] During the running of the code program, the target variable is set, and the execution process of the loop physical simulation is modified according to the target variable. Specifically, when the target variable indicates that the code program is in a paused state, there is no need to advance the physical engine to perform physical simulation, and the virtual object described by the code program does not move; when the target variable indicates that the code program is in a non-paused state, the physical engine is advanced to perform physical simulation, and the virtual object described by the code program will move.
[0145] Based on the above rules, during the initialization of the code program, the target variable will be set to indicate that the code program is in a paused state. At this time, the first interface (which is used to display the virtual environment, the simulation screen of the virtual object and the debug control display area) will only display the simulation screen rendered in the first time step or only display the virtual image of the virtual object.
[0146] In the present application, the target variable can be set to different values to indicate different states. For example, taking game development as an example, when the value of the target variable is set to 1, the game loop (also referred to as the execution process of the cyclic physical simulation in this application, and the game loop refers to the main running loop of the game engine or program in game development. It is a continuously running loop responsible for processing player input, updating game status, and rendering graphics, so that the game can run at a certain frame rate and respond to player operations.) is in a paused state, and when the value of the target variable is 0, the game loop is in a running state. Alternatively, when the value of the target variable is set to true, the game loop is in a paused state, and when the value of the target variable is false, the game loop is in a non-paused state. In an optional implementation scheme, the target variable can be set to an isPaused Boolean variable, and its default value can be set to false. At the same time, it is set that under this default value, the code program is in a non-paused running state. Under this scheme, the code for setting the isPaused Boolean variable in the code program can be as follows: private bool isPaused=false. By setting the Boolean variable in the code program, it can be determined by the Boolean variable whether the code program is running.
[0147] When the cyclic physics simulation function based on the isPaused Boolean variable and the code program is a FixedUpdate function, the implementation code of the FixedUpdate function will be modified as follows:
[0148]
[0149] That is, when the target variable indicates that the code program is in a paused state, there is no need to advance the physics engine to perform physical simulation, and the virtual object described by the code program does not move; when the target variable indicates that the code program is in a non-paused state, the physics engine is advanced to perform physical simulation, and the virtual object described by the code program will move.
[0150] In this application, based on the addition of a debug control, the code program also provides different calling interfaces to implement the debug control. The following describes the debug control as "continue running", "pause running", "run 1 frame" and "run 1 second".
[0151] 1. In this application, the calling interface of "continue running" can be set to Resume(), and the calling interface of "pause running" can be set to Pause(). Similarly, the calling interface of the "run control" of the code program can also be set to the Play() interface. Among them, Play() is used to start the running of the entire game loop when the game is initialized. Pause() is used to pause the game loop during the execution of the game loop. Resume() is used to resume the game loop when the game loop is paused. Based on the description of the above interface, the corresponding code can be as follows:
[0152]
[0153]
[0154] That is, for each calling interface, a corresponding Boolean variable is set, and when the calling interface is running, its Boolean variable is set to the corresponding value. The Play() interface sets the target variable to indicate that the code program is in a non-paused state (i.e. isPaused = false), the Pause() interface sets the target variable to indicate that the code program is in a paused state (i.e. isPaused = true), and the Resume() interface sets the target variable to indicate that the code program is in a non-paused state (i.e. isPaused = false).
[0155] 2. In this application, the calling interface of "run 1 frame" can be set as StepOneFrame(). The function of StepOneFrame() is to execute one frame of physical simulation in the paused state of the game loop and realize the rendering of one frame of simulation picture. In an exemplary scheme, the specific implementation can be as follows:
[0156] First, isPaused is set to false to allow the physics simulation to execute. Then the yield returnnew WaitForFixedUpdate() statement is used to wait for a FixedUpdate to execute. While waiting, the physics simulation will execute for one frame. Finally, isPaused is set to true to resume the paused state of the game loop.
[0157] 3. In this application, the calling interface of "run for 1 second" can be set as StepOneSecond(). The function of StepOneSecond() is to perform one second of physical simulation in the paused state of the game loop and render all simulation images within one second. In an exemplary solution, the specific implementation can be as follows:
[0158] First, set isPaused to false to allow the physics simulation to execute. Then initialize a counter and a total number of frames. The total number of frames is equal to the number of frames in 1 second, which can be obtained by dividing 1 by fixedDeltaTime and rounding up (for example, assuming the time step is 0.02, the total number of frames in one second is 1 divided by 0.02, which equals 50). Use a while loop to execute the physics simulation until the counter reaches the total number of frames. In each loop, use the yield return newWaitForFixedUpdate() statement to wait for a FixedUpdate to execute. During the waiting process, the physics simulation will execute one frame. At the same time, increase the counter by 1. (In the case of a time step of 0.02, it will wait for 50 FixedUpdate executions). Finally, set isPaused to true to resume the paused state of the game loop.
[0159] Based on the above description, the code representation of StepOneSecond() and StepOneFrame() can be as follows:
[0160]
[0161]
[0162] Based on the above description, it can be obtained that in the data processing method provided by the present application, the running code of the code program can be expressed as follows:
[0163]
[0164]
[0165] 2. Generation of the debug control display area.
[0166] In one implementation of the present application, the specific implementation process of the debug control display area may be as follows:
[0167] 1. Create a user interface canvas (UI Canvas). In an exemplary solution, in Unity, create a new UI Canvas object to place the button objects and other UI elements corresponding to the debug control. Set the rendering mode of the Canvas to "Screen Space-Overlay" so that all UI elements in the debug control display area are always displayed on the first interface.
[0168] 2. Add button objects. In an exemplary solution, three new UI Button objects can be created under Canvas, which are used to trigger the Pause() / Resume(), StepOneFrame(), and StepOneSecond() methods respectively. Set a descriptive text label for each button, such as "Pause" / "Continue", "Run 1 Frame", and "Run 1 Second".
[0169] 3. Create a new script code. In an exemplary scenario, the script code can be named "SimulationControlPanel" (i.e., debug panel) and attached to the Canvas object (i.e., the script code is matched one-to-one with the button object). In this script, implement the following functions:
[0170] Define 4 public methods, corresponding to the Play(), TogglePauseOrResume(), StepOneFrame() and StepOneSecond() interfaces.
[0171] In these methods, call the corresponding methods in the code program class. Therefore, you need to create a reference to the code program class in the SimulationControlPanel script, set it as a public variable, and then drag the virtual object including the code program script to this variable in the Unity editor. Based on the above description, the script code of the debug panel can be as follows:
[0172]
[0173] 4. Add a click event for each button. In an exemplary solution, in the Unity editor, select each button and add a new event in the "On Click()" section of the "Button" component. Drag the Canvas object containing the "SimulationControlPanel" script to the "Object" field of the event and select the corresponding method (such as "Play()", "TogglePauseOrResume()", etc.) from the "Function" drop-down menu.
[0174] Based on the above description, it can be seen that the user's interaction on the debug panel will eventually call the control interface of the game loop (that is, the cyclic physical simulation process of the code program), and then control the execution of the entire game loop, including starting, pausing, resuming, advancing, etc. Figure 6 The running sequence diagram of the code program shown in the figure illustrates the data processing method of the present application:
[0175] The user clicks the Start Run button in the visual programming interface to start the game loop. The game loop begins to perform physical simulation.
[0176] The user can click the pause button (such as Figure 3d ) to pause the game loop. At this point, the physics simulation will stop executing, the objects in the scene will remain in their current static state, and the user can view relevant information.
[0177] In the paused state, the user clicks the resume button (such as Figure 3c ) to resume the game loop. The game loop will continue to perform the physics simulation, and the virtual objects in the scene will continue their previous movements.
[0178] In the paused state, the user clicks the "Run 1 Frame" button in the debug panel of the first interface to execute a frame of physical simulation and render a frame of simulation screen of the virtual object. This will help the user observe the movement and interaction of the virtual object running for 1 frame.
[0179] In the paused state, the user clicks the "Run 1 Second" button in the debug panel of the first interface to perform a one-second physical simulation and render the simulated image of the virtual object within one second. This will help the user observe the movement and interaction of the virtual object in 1 second (for example, 50 frames = 50*0.02 seconds).
[0180] Users can switch the state of the game loop at any time as needed, such as pause, resume, frame-by-frame execution, etc. This will help users more easily identify and solve problems in the program.
[0181] During the execution of the game loop, the interface will display relevant information of the game objects in real time, such as position, speed, rotation, etc. This helps users understand the execution status of the program and the movement of objects, so as to better identify and solve problems and improve development efficiency and program quality.
[0182] The data processing device in this application is described in detail below. Figure 7 , Figure 7 This is a schematic diagram of an embodiment of a data processing device in an embodiment of the present application. The data processing device 20 includes:
[0183] A display module 201 is used to display a visual programming interface, the visual programming interface includes a code block display area, a first control and a second control, the code block display area includes at least one code block of a generated code program;
[0184] A processing module 202 is used to start a debugging program of the code program in response to a first operation on the first control;
[0185] The processing module 202 is used to run the code program in response to a second operation on the second control;
[0186] The display module 201 is used to display a first interface in response to a second operation on the second control, the first interface including an initial simulation screen and a debug control display area, the debug control display area including at least one debug control, the at least one debug control being used to indicate the playback form of the simulation screen rendered based on the code program, the initial simulation screen being rendered based on the code program within a first time step, and the debug control display area being rendered based on the debug program; in response to a third operation on the at least one debug control, a simulation screen set is played on the first interface, the rendering time of each simulation screen in the simulation screen set being later than the rendering time of the initial simulation screen.
[0187] In an embodiment of the present application, a data processing device is provided. By using the above device, a debugging program is added to the physical simulation of the code program, so that the simulation screen rendered by the code program through the physical simulation can be debugged accordingly according to the debugging control, so as to avoid the simulation screen being played only once, thereby achieving targeted playback of the simulation screen, and then quickly identifying problems in the code program.
[0188] Optionally, in the above Figure 7 On the basis of the corresponding embodiment, in another embodiment of the data processing device 20 provided in the embodiment of the present application,
[0189] The processing module 202 is used to disable automatic simulation of the physical engine and enable deterministic physical settings in response to a second operation on the second control;
[0190] generating the code program based on the at least one code block conversion;
[0191] Run the code program and perform physical simulation according to the time step;
[0192] Rendering the virtual object in the code program based on the result of the physical simulation to obtain the initial simulation screen;
[0193] The display module 201 is used to display the initial simulation screen on the first interface.
[0194] In an embodiment of the present application, a data processing device is provided. With the above device, when the code program is initialized and run, only the physical simulation within the first time step is performed, and the corresponding initial simulation screen is rendered and generated, so that the code program is in a paused state during the initialization and run, thereby setting an initialization environment for the operation of the debug control, and then the simulation screen rendered by the code program through physical simulation is debugged according to the debug control, so as to avoid the simulation screen being played only once, thereby achieving targeted playback of the simulation screen, and then quickly identifying problems in the code program.
[0195] Optionally, in the above Figure 7 On the basis of the corresponding embodiment, in another embodiment of the data processing device 20 provided in the embodiment of the present application, the first interface also includes parameter information of the virtual object, and the parameter information includes the current position information, speed information and rotation angle of the virtual object.
[0196] In an embodiment of the present application, a data processing device is provided. By using the above device, during the debugging process, parameter information of a virtual object is displayed in real time, which can help users better identify the difference between the current situation of the virtual object and the preset situation, thereby more quickly determining the problem of the code program.
[0197] Optionally, in the above Figure 7 On the basis of the corresponding embodiment, in another embodiment of the data processing device 20 provided in the embodiment of the present application,
[0198] The processing module 202 is used to create a user interface canvas, wherein the rendering mode of the user interface canvas is used to indicate that the debug control display area is displayed on the first interface;
[0199] Create a button object corresponding to at least one debug control in the debug control display area on the user interface screen;
[0200] The at least one debugging control is obtained by setting a click event for the button object based on the debugging program, and the click event is used to indicate an execution event after the at least one debugging control is selected.
[0201] In an embodiment of the present application, a data processing device is provided. By using the above device, a button object of the user interface is matched one-to-one with a debug control in the debugger, thereby realizing the function of each debug control in the debug control display area.
[0202] Optionally, in the above Figure 7 On the basis of the corresponding embodiment, in another embodiment of the data processing device 20 provided in the embodiment of the present application,
[0203] The at least one debug control includes a first debug control, a second debug control, a third debug control, and a fourth debug control;
[0204] The execution event of the first debugging control is to resume the running of the code program when the code program is in a suspended running state;
[0205] The execution event of the second debugging control is to suspend the running of the code program when the code program is in the running state;
[0206] The execution event of the third debugging control is to execute the physical simulation of the code program frame by frame when the code program is in a suspended running state;
[0207] The execution event of the fourth debugging control is to execute the physical simulation of the code program second by second when the code program is in a suspended running state.
[0208] In an embodiment of the present application, a data processing device is provided. By using the above device, by setting four debugging controls of continue running, pause running, frame-by-frame running and second-by-second running, multiple debugging methods can be used to identify problems of the code program, thereby quickly identifying problems of the code program.
[0209] Optionally, in the above Figure 7 On the basis of the corresponding embodiment, in another embodiment of the data processing device 20 provided in the embodiment of the present application, the trajectory data of each positioning point also includes positioning speed information;
[0210] The processing module 202 is used to resume running the code program in response to an operation on the first debugging control;
[0211] Run the code program to perform physical simulation in the second time step;
[0212] Rendering the virtual object in the code program based on the result of the physical simulation to obtain a first simulation picture;
[0213] The display module 201 is used to display the first simulation picture on the first interface;
[0214] The processing module 202 is used to run the code program to perform physical simulation in a third time step;
[0215] Rendering the virtual object in the code program based on the result of the physical simulation to obtain a second simulation picture;
[0216] The display module 201 is used to display the second simulation picture on the first interface;
[0217] The process loops in this way until the code program is paused and the third simulation screen is displayed on the first interface, wherein the first simulation screen, the second simulation screen and the third simulation screen are included in the simulation screen set, and the third simulation screen is the last simulation screen in the time sequence of the simulation screen set.
[0218] In an embodiment of the present application, a data processing device is provided. With the above device, after responding to the continued running of the code program, the cyclic physical simulation process of the code program can be run to achieve continuous playback of the simulation screen in the first interface, so that the user can quickly play the part that does not need to be observed in detail, thereby speeding up the recognition speed.
[0219] Optionally, in the above Figure 7 On the basis of the corresponding embodiment, in another embodiment of the data processing device 20 provided by the embodiment of the present application, the processing module 202 is used to suspend the running of the code program in response to the operation of the second debugging control;
[0220] The display module 201 is used to display the third simulation picture on the first interface.
[0221] In an embodiment of the present application, a data processing device is provided. With the above device, after responding to the suspension of the running of the code program, the cyclic physical simulation process of the running of the code program can be suspended, so that the simulation screen can be paused in the first interface, so that the user can carefully observe the part that needs to be observed in detail, and at the same time obtain the parameter information of the virtual object in the current state, so as to improve the recognition accuracy of the code program.
[0222] Optionally, in the above Figure 7 On the basis of the corresponding embodiment, in another embodiment of the data processing device 20 provided in the embodiment of the present application,
[0223] The processing module 202 is used to resume the running of the code program in response to the operation of the third debugging control; run the code program and perform physical simulation in a second time step; render the virtual object in the code program based on the result of the physical simulation to obtain a first simulation screen;
[0224] The display module 201 is used to display the first simulation screen on the first interface, wherein the first simulation screen serves as the simulation screen set.
[0225] In an embodiment of the present application, a data processing device is provided. With the above device, after responding to the code program running frame by frame, only one frame of the physical simulation process of the code program can be run, so that only one frame of the simulation screen is played in the first interface, so that the user can carefully observe the part that needs to be observed in detail, and at the same time obtain the parameter information of the virtual object in the current state, so as to improve the recognition accuracy of the code program.
[0226] Optionally, in the above Figure 7 On the basis of the corresponding embodiment, in another embodiment of the data processing device 20 provided in the embodiment of the present application,
[0227] The processing module 202 is used to resume the running of the code program in response to the operation of the fourth debugging control; run the code program to perform physical simulation in a second time step; render the virtual object in the code program based on the result of the physical simulation to obtain a first simulation screen;
[0228] The display module 201 is used to display the first simulation picture on the first interface;
[0229] The processing module 202 is used to run the code program and perform physical simulation in a third time step; based on the result of the physical simulation, the virtual object in the code program is rendered to obtain a second simulation picture;
[0230] The display module 201 is used to display the second simulation screen on the first interface; and repeats this cycle until the running time reaches one second, pausing the running of the code program and displaying the fourth simulation screen on the first interface, wherein the first simulation screen, the second simulation screen and the fourth simulation screen are included in the simulation screen set, and the fourth simulation screen is the last simulation screen within the running time.
[0231] In an embodiment of the present application, a data processing device is provided. With the above device, after responding to the code program running second by second, only the physical simulation process of the code program within the running time of one second can be run, so that the simulation screen within the running time of one second can be played in the first interface, so that the user can carefully observe the part that needs to be observed in detail, and at the same time obtain the parameter information of the virtual object in the current state, so as to improve the recognition accuracy of the code program.
[0232] Optionally, in the above Figure 7 On the basis of the corresponding embodiment, in another embodiment of the data processing device 20 provided in the embodiment of the present application,
[0233] The execution event corresponding to the first debugging control is called by the Pause() interface;
[0234] The execution event corresponding to the second debugging control is called by the Resume() interface;
[0235] The execution event corresponding to the third debugging control is called by the StepOneFrame() interface;
[0236] The execution event corresponding to the fourth debugging control is called using the StepOneSecond() interface.
[0237] In an embodiment of the present application, a data processing device is provided. The above device is used to provide a calling interface in an application scenario, thereby increasing the feasibility of the solution.
[0238] Optionally, in the above Figure 7 On the basis of the corresponding embodiment, in another embodiment of the data processing device 20 provided in the embodiment of the present application,
[0239] The first debug control and the second debug control are combined to correspond to a button object, and the corresponding execution event is called by TogglePauseOrResume();
[0240] The execution event corresponding to the third debugging control is called by the StepOneFrame() interface;
[0241] The execution event corresponding to the fourth debugging control is called using the StepOneSecond() interface.
[0242] In the embodiment of the present application, a data processing device is provided. The above device is used to provide a calling interface in an application scenario, thereby increasing the feasibility of the solution. At the same time, the debugging controls for continuing and pausing operation are merged into one button object, which can reduce the size of the debugging control display area, thereby providing a more streamlined user interface, allowing users to better observe the simulation screen.
[0243] Optionally, in the above Figure 7 On the basis of the corresponding embodiment, in another embodiment of the data processing device 20 provided in the embodiment of the present application,
[0244] The target variable is set during the running of the code program, and the target variable is used to indicate whether the code program handles the pause state.
[0245] In an embodiment of the present application, a data processing device is provided. By using the above device, a target variable is used to implement the pause state determination of the code program, thereby simplifying the debugging code programming.
[0246] Optionally, in the above Figure 7On the basis of the corresponding embodiment, in another embodiment of the data processing device 20 provided in the embodiment of the present application, the target variable is a Boolean variable.
[0247] In an embodiment of the present application, a data processing device is provided. The device is used to provide a specific variable setting scheme, thereby increasing the feasibility of the scheme.
[0248] The data processing device provided in this application can be used in a server, see Figure 8 , Figure 8 : is a schematic diagram of a server structure provided in an embodiment of the present application. The server 300 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 322 (for example, one or more processors) and memory 332, and one or more storage media 330 (for example, one or more mass storage devices) storing application programs 342 or data 344. Among them, the memory 332 and the storage medium 330 can be short-term storage or permanent storage. The program stored in the storage medium 330 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the server. Furthermore, the central processing unit 322 can be configured to communicate with the storage medium 330 to execute a series of instruction operations in the storage medium 330 on the server 300.
[0249] The server 300 may also include one or more power supplies 326, one or more wired or wireless network interfaces 350, one or more input and output interfaces 358, and / or one or more operating systems 341, such as Windows Server 2000. TM , Mac OS X TM , Unix TM ,Linux TM , FreeBSD TM etc.
[0250] The steps performed by the data processing device in the above embodiment can be based on the Figure 8 The server structure shown.
[0251] The data processing device provided in this application can be used in terminal equipment, please refer to Fig. 9 For the sake of convenience, only the parts related to the embodiments of the present application are shown. For specific technical details not disclosed, please refer to the method part of the embodiments of the present application. In the embodiments of the present application, the terminal device is a smart phone as an example for explanation:
[0252] Fig. 9The block diagram shows a partial structure of a smart phone related to the terminal device provided in the embodiment of the present application. Fig. 9 The smart phone includes: a radio frequency (RF) circuit 410, a memory 420, an input unit 430, a display unit 440, a sensor 450, an audio circuit 460, a wireless fidelity (WiFi) module 470, a processor 480, and a power supply 490. Those skilled in the art will appreciate that Fig. 9 The structure of the smartphone shown in the figure does not constitute a limitation of the smartphone, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0253] Combine the following Fig. 9 A detailed introduction to the various components of a smartphone:
[0254] The RF circuit 410 can be used for receiving and sending signals during the process of sending and receiving information or making calls. In particular, after receiving the downlink information of the base station, it is sent to the processor 480 for processing; in addition, the designed uplink data is sent to the base station. Generally, the RF circuit 410 includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier (LNA), a duplexer, etc. In addition, the RF circuit 410 can also communicate with the network and other devices through wireless communication. The above-mentioned wireless communication can use any communication standard or protocol, including but not limited to the global system of mobile communication (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), long term evolution (LTE), email, short messaging service (SMS), etc.
[0255] The memory 420 can be used to store software programs and modules. The processor 480 executes various functional applications and data processing of the smartphone by running the software programs and modules stored in the memory 420. The memory 420 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the smartphone (such as audio data, a phone book, etc.), etc. In addition, the memory 420 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0256] The input unit 430 can be used to receive input digital or character information, and to generate key signal input related to the user settings and function control of the smart phone. Specifically, the input unit 430 may include a touch panel 431 and other input devices 432. The touch panel 431, also known as a touch screen, can collect the user's touch operation on or near it (such as the user's operation on the touch panel 431 or near the touch panel 431 using any suitable object or accessory such as a finger, stylus, etc.), and drive the corresponding connection device according to a pre-set program. Optionally, the touch panel 431 may include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into contact coordinates, and then sends it to the processor 480, and can receive and execute commands sent by the processor 480. In addition, the touch panel 431 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic waves. In addition to the touch panel 431, the input unit 430 may also include other input devices 432. Specifically, other input devices 432 may include but are not limited to one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, etc.
[0257] The display unit 440 can be used to display information input by the user or information provided to the user and various menus of the smartphone. The display unit 440 may include a display panel 441. Optionally, the display panel 441 may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), or the like. Further, the touch panel 431 may cover the display panel 441. When the touch panel 431 detects a touch operation on or near it, it is transmitted to the processor 480 to determine the type of touch event. Subsequently, the processor 480 provides a corresponding visual output on the display panel 441 according to the type of touch event. Although in Fig. 9 In the embodiment, the touch panel 431 and the display panel 441 are used as two independent components to implement the input and output functions of the smartphone, but in some embodiments, the touch panel 431 and the display panel 441 can be integrated to implement the input and output functions of the smartphone.
[0258] The smartphone may also include at least one sensor 450, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 441 according to the brightness of the ambient light, and the proximity sensor may turn off the display panel 441 and / or the backlight when the smartphone is moved to the ear. As a type of motion sensor, the accelerometer sensor can detect the magnitude of acceleration in all directions (generally three axes), and can detect the magnitude and direction of gravity when stationary. It can be used for applications that identify the posture of the smartphone (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; as for other sensors that can be configured in smartphones, such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc., they will not be repeated here.
[0259] The audio circuit 460, the speaker 461, and the microphone 462 can provide an audio interface between the user and the smartphone. The audio circuit 460 can transmit the received audio data to the speaker 461 after converting the received audio data into an electrical signal, which is converted into a sound signal for output; on the other hand, the microphone 462 converts the collected sound signal into an electrical signal, which is received by the audio circuit 460 and converted into audio data, and then the audio data is output to the processor 480 for processing, and then sent to another smartphone through the RF circuit 410, or the audio data is output to the memory 420 for further processing.
[0260] WiFi is a short-range wireless transmission technology. Smartphones can help users send and receive emails, browse web pages, and access streaming media through WiFi module 470, which provides users with wireless broadband Internet access. Fig. 9 A WiFi module 470 is shown, but it is understandable that it is not an essential component of the smartphone and can be omitted as needed without changing the essence of the invention.
[0261] Processor 480 is the control center of the smartphone, which uses various interfaces and lines to connect various parts of the entire smartphone, and executes various functions of the smartphone and processes data by running or executing software programs and / or modules stored in memory 420, and calling data stored in memory 420, thereby monitoring the smartphone as a whole. Optionally, processor 480 may include one or more processing units; optionally, processor 480 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into processor 480.
[0262] The smart phone also includes a power source 490 (such as a battery) for supplying power to various components. Optionally, the power source can be logically connected to the processor 480 through a power management system, thereby managing functions such as charging, discharging, and power consumption management through the power management system.
[0263] Although not shown, the smartphone may also include a camera, a Bluetooth module, etc., which will not be described in detail here.
[0264] The steps performed by the data processing device in the above embodiment can be based on the Fig. 9 The terminal device structure shown.
[0265] A computer-readable storage medium is also provided in an embodiment of the present application. The computer-readable storage medium stores a computer program, which, when executed on a computer, enables the computer to execute the methods described in the aforementioned embodiments.
[0266] The present application also provides a computer program product including a program, which, when executed on a computer, enables the computer to execute the methods described in the aforementioned embodiments.
[0267] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0268] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the unit is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0269] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0270] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0271] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method of each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.
[0272] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A data processing method, characterized in that: include: Displaying a visual programming interface, the visual programming interface comprising a code block display area, a first control, and a second control, the code block display area including at least one code block of a generated code program; In response to a first operation on the first control, starting a debugging program of the code program; In response to a second operation on the second control, disabling automatic simulation of the physics engine and enabling deterministic physics settings; generating the code program based on the at least one code block conversion; Running the code program and performing physical simulation at a first time step, wherein a target variable is set during the running of the code program, and the target variable is used to indicate whether the code program is in a paused state; Rendering the virtual objects in the code program based on the result of the physical simulation to obtain an initial simulation screen; Displaying the initial simulation screen on a first interface, wherein the first interface further includes a debugging control display area, wherein the debugging control display area includes at least one debugging control, wherein the at least one debugging control is used to indicate a playback form of the simulation screen rendered based on the code program, and the debugging control display area is rendered based on the debugging program; In response to a third operation on the at least one debugging control, a set of simulation pictures is played on the first interface, wherein a rendering time of each simulation picture in the set of simulation pictures is later than a rendering time of the initial simulation picture.
2. The method according to claim 1, characterized in that The first interface also includes parameter information of the virtual object, and the parameter information includes current position information, speed information, and rotation angle of the virtual object.
3. The method according to any one of claims 1 to 2, characterized in that The method further comprises: Creating a user interface canvas, wherein the rendering mode of the user interface canvas is used to indicate that the debug control display area is displayed in the first interface; Creating a button object corresponding to at least one debug control in the debug control display area on the user interface canvas; The at least one debugging control is obtained by setting a click event for the button object based on the debugging program, and the click event is used to indicate an execution event after the at least one debugging control is selected.
4. The method according to claim 3, characterized in that The at least one debug control includes a first debug control, a second debug control, a third debug control, and a fourth debug control; The execution event of the first debugging control is to resume the running of the code program when the code program is in a suspended running state; The execution event of the second debugging control is to suspend the running of the code program when the code program is in the running state; The execution event of the third debugging control is to execute the physical simulation of the code program frame by frame when the code program is in a suspended running state; The execution event of the fourth debugging control is to execute the physical simulation of the code program second by second when the code program is in a suspended running state.
5. The method according to claim 4, characterized in that In response to the third operation on the at least one debugging control, playing the simulation picture set on the first interface includes: In response to the operation on the first debugging control, resuming the execution of the code program; Running the code program to perform physical simulation in the second time step; Rendering the virtual object in the code program based on the result of the physical simulation to obtain a first simulation picture; Displaying the first simulation screen on the first interface; Running the code program to perform physical simulation in the third time step; Rendering the virtual object in the code program based on the result of the physical simulation to obtain a second simulation picture; Displaying the second simulation screen on the first interface; This cycle is repeated until the code program is paused and the third simulation screen is displayed on the first interface, wherein the first simulation screen, the second simulation screen and the third simulation screen are included in the simulation screen set, and the third simulation screen is the last simulation screen in the simulation screen set in chronological order.
6. The method according to claim 5, characterized in that The method further comprises: In response to an operation on the second debugging control, pausing the running of the code program; The third simulation screen is displayed on the first interface.
7. The method according to claim 4, characterized in that In response to the third operation on the at least one debugging control, playing the simulation picture set on the first interface includes: In response to the operation on the third debugging control, resuming the execution of the code program; Running the code program to perform physical simulation in the second time step; Rendering the virtual object in the code program based on the result of the physical simulation to obtain a first simulation picture; The first simulation screen is displayed on the first interface, wherein the first simulation screen serves as the simulation screen set.
8. The method according to claim 4, characterized in that In response to the third operation on the at least one debugging control, playing the simulation picture set on the first interface includes: In response to the operation on the fourth debugging control, resuming the execution of the code program; Running the code program to perform physical simulation in the second time step; Rendering the virtual object in the code program based on the result of the physical simulation to obtain a first simulation picture; Displaying the first simulation screen on the first interface; Running the code program to perform physical simulation in the third time step; Rendering the virtual object in the code program based on the result of the physical simulation to obtain a second simulation picture; Displaying the second simulation screen on the first interface; The code program is paused in this cycle until the running time reaches one second, and a fourth simulation screen is displayed on the first interface, wherein the first simulation screen, the second simulation screen and the fourth simulation screen are included in the simulation screen set, and the fourth simulation screen is the last simulation screen within the running time.
9. The method according to claim 4, characterized in that The execution event corresponding to the first debugging control is called by the Pause() interface; The execution event corresponding to the second debugging control is called by the Resume() interface; The execution event corresponding to the third debugging control is called by the StepOneFrame() interface; The execution event corresponding to the fourth debugging control is called using the StepOneSecond() interface.
10. The method according to claim 4, characterized in that The first debug control and the second debug control are combined to correspond to a button object, and the corresponding execution event is called by TogglePauseOrResume(); The execution event corresponding to the third debugging control is called by the StepOneFrame() interface; The execution event corresponding to the fourth debugging control is called using the StepOneSecond() interface.
11. A data processing device, characterized in that: include: A display module, for displaying a visual programming interface, wherein the visual programming interface comprises a code block display area, a first control, and a second control, wherein the code block display area comprises at least one code block of a generated code program; A processing module, configured to start a debugging program of the code program in response to a first operation on the first control; The processing module is used to disable automatic simulation of the physical engine and enable deterministic physical settings in response to a second operation on the second control; generate the code program based on the at least one code block conversion; run the code program and perform physical simulation at a first time step, wherein a target variable is set during the running of the code program, and the target variable is used to indicate whether the code program is in a paused state; render the virtual objects in the code program based on the result of the physical simulation to obtain an initial simulation screen; The display module is used to display the initial simulation screen on the first interface in response to a second operation on the second control, the first interface also including a debug control display area, the debug control display area including at least one debug control, the at least one debug control is used to indicate the playback form of the simulation screen rendered based on the code program, and the debug control display area is rendered based on the debug program; in response to a third operation on the at least one debug control, a simulation screen set is played on the first interface, and the rendering time of each simulation screen in the simulation screen set is later than the rendering time of the initial simulation screen.
12. The device according to claim 11, characterized in that The processing module is further used for: Creating a user interface canvas, wherein the rendering mode of the user interface canvas is used to indicate that the debug control display area is displayed in the first interface; Creating a button object corresponding to at least one debug control in the debug control display area on the user interface canvas; The at least one debugging control is obtained by setting a click event for the button object based on the debugging program, and the click event is used to indicate an execution event after the at least one debugging control is selected.
13. A computer device, characterized in that: include: Memory, processor, and bus system; Wherein, the memory is used to store programs; The processor is used to execute the program in the memory, and the processor is used to execute the method according to any one of claims 1 to 10 according to the instructions in the program code; The bus system is used to connect the memory and the processor so that the memory and the processor can communicate with each other.
14. A computer-readable storage medium, characterized in that: The method comprises instructions which, when executed on a computer, cause the computer to perform the method according to any one of claims 1 to 10.
15. A computer program product, characterized in that The computer program product includes computer instructions, which are stored in a computer-readable storage medium; a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the method according to any one of claims 1 to 10.
Citation Information
Patent Citations
Visual programming control device, programmable control apparatus and control method thereof, computer readable storage medium, and programming control system
CN111684414A
Graphical robot programming interaction system and method thereof
CN112698823A
Code debugging method and device, electronic equipment and storage medium
CN113626308A
Visual programming control apparatus, programming-controlled device and control method therefor, computer-readable storage medium, and programming control system
US20210208852A1
