Game engine system architecture for programming learning
By combining the game engine with the programming learning framework and using code logic to control the games developed by the game engine, the existing programming learning framework is solved, and the motivation and fun of learning are improved.
Patent Information
- Application Number
- CN202411902210.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-23
- Publication Date
- 2025-04-15
AI Technical Summary
The existing programming learning framework is difficult to learn and boring, making it difficult for users to maintain their motivation to learn.
It provides a game engine system architecture for programming learning, combining game engines with web programming platforms, controlling games developed by game engines through code logic, and increasing the fun of learning.
By combining the programming framework with the game engine, the fun of learning is increased and the motivation for users to learn is improved.
Smart Images

Figure CN119818950A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of programming learning platforms, and in particular relates to a game engine system architecture for programming learning. Background Art
[0002] The graphical learning framework is mainly based on Scrtach, which mainly uses building blocks in the native language that is easy for teenagers to understand to create animations or stories by dragging and dropping programming; the Python learning framework is mainly divided into question bank-type problem-solving learning, or drawing animations and games for teenagers to learn, but it is difficult for teenagers to learn; the C++ learning framework is mainly a C++ question bank, and students complete their learning by "brushing questions". Among the existing programming learning frameworks, except for graphical programming that allows teenagers to learn without knowing the code, other languages are still organized in code, and the effects and programming results they produce are relatively abstract, and the learning difficulty is high and boring, making it difficult for users to maintain learning motivation. Summary of the invention
[0003] The purpose of the present invention is to address the above-mentioned deficiencies in the prior art and provide a game engine system architecture for programming learning, so as to solve the problem that the existing programming learning framework is difficult to learn, relatively boring, and difficult for users to maintain learning motivation; users program in the programming framework to generate code, and control the game developed by the game engine through the logic of the code, thereby combining the programming framework with the game engine to increase the interest of learning and improve the user's learning motivation.
[0004] In order to achieve the above object, the technical solution adopted by the present invention is:
[0005] A game engine system architecture for programming learning, including:
[0006] Game engine, used to develop games into web packages, disable keyboard control events, and expose control interfaces and data return interfaces to the codeconnect system;
[0007] A web programming platform, used for editing the first control code of the game and running it in a web environment, and transmitting the first control code to a codeconnect system;
[0008] a codeconnect system, which converts the received first control code into a second control code in a code format supported by the game engine, and links the code execution logic of the second control code to the game engine;
[0009] The game engine controls the game character based on the code execution logic of the second control code, and transmits the execution result back to the web programming platform through the codeconnect system.
[0010] In some embodiments, the web programming platform includes a graphical programming module, a Python programming module, or / and a C++ programming module;
[0011] The graphical programming module compiles the first control code into a JS code segment using Scratch or Blocky technology and executes it in a web environment;
[0012] A Python programming module, using codemirror technology to edit the first control code on the web side, and using pyodide technology to embed the first control code into the web environment for execution;
[0013] The C++ programming module uses the codemirror technology to edit the first control code on the web side, and uses the Emscripten technology to compile the first control code and execute it in the web environment.
[0014] In some embodiments, the codeconnect system uses the WebSocket communication protocol, and the design of the communication protocol includes the following elements:
[0015] Connection establishment: The web programming platform connects to the codeconnect system through the WebSocket communication protocol for handshake and authentication;
[0016] Message format: Use JSON format to encapsulate the message content, including message type, method name, parameters and callback identifier;
[0017] Request message: the request sent by the web programming platform to the game engine;
[0018] Response message: the game engine’s response to the request;
[0019] Event message: event notification that the game engine actively sends to the web programming platform;
[0020] Error message: Error information that occurs during the communication process.
[0021] In some embodiments, the elements for communication between the game engine and the codeconnect system are set up as follows:
[0022] Message format: JSON format is used for data encapsulation, including message type, method name, parameters and callback identifier;
[0023] Request message: The request sent by the codeconnect system to the game engine, including method calls and data transmission;
[0024] Response message: the game engine's response to the codeconnect system request, including execution results or error information;
[0025] Event message: event notification sent by the game engine to the codeconnect system for real-time updates and status push;
[0026] Transmission mechanism: Use the SendMessage method provided by WebGL and the callback mechanism of the game engine to implement asynchronous message transmission.
[0027] In some embodiments, data serialization and deserialization are used to transmit data structures between the game engine and the codeconnect system, where:
[0028] Data serialization: The codeconnect system uses JSON.stringify to serialize data objects into JSON strings, and the game engine uses Json.FromJson to parse JSON strings into corresponding C# objects or other language objects;
[0029] Data deserialization:
[0030] The game engine uses Json.ToJson to serialize C# objects or other language objects into JSON strings, and the codeconnect system uses JSON.parse to parse JSON strings into JavaScript objects.
[0031] In some embodiments, the game engine exposes control methods, link methods, data methods, and notification methods to the codeconnect system through a control interface and a data return interface. The definition of each method type is as follows:
[0032] Control method: used to control game behavior;
[0033] Link method: used to establish links with other modules or services;
[0034] Data method: used to get or set game data;
[0035] Notification method: used to send real-time notifications in the game to the web programming platform.
[0036] In some embodiments, the codeconnect system uses a data synchronization mechanism, including:
[0037] Real-time data push: The game engine actively pushes data updates to the CodeConnect system, which then broadcasts them to all subscribed web programming platforms;
[0038] State cache: The web programming platform maintains a local state cache;
[0039] Conflict handling: Use optimistic locking or version control mechanism.
[0040] In some embodiments, a server-side module is also included, which receives learning data and progress information sent by the web programming platform through the codeconnect system, stores the collected data in a database, generates a progress report based on the stored data, and feeds back to the web programming platform through the codeconnect system.
[0041] In some embodiments, a security layer is also included, which performs permission control and data encryption.
[0042] The game engine system architecture for programming learning provided by the present invention has the following beneficial effects:
[0043] The game engine is combined with the web programming platform through the codeconnect system. Users generate code by programming in the programming framework and control the games developed by the game engine through the logic of the code. The programming framework is combined with the game engine to increase the fun of learning and improve the user's motivation to learn. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 The present invention is a framework diagram of a game engine system architecture for programming learning. DETAILED DESCRIPTION
[0045] In order to make the purpose, technical solutions and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with the accompanying drawings. The described embodiments should not be regarded as limiting the present invention. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present invention.
[0046] In the following description, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0047] If similar descriptions of "first\second\third" appear in the application documents, the following instructions are added. In the following description, the terms "first\second\third" involved are only used to distinguish similar objects and do not represent a specific order for the objects. It can be understood that "first\second\third" can be interchanged in a specific order or sequence where permitted, so that the embodiments of the present invention described herein can be implemented in an order other than that illustrated or described herein.
[0048] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which the present invention belongs. The terms used herein are only for the purpose of describing the embodiments of the present invention and are not intended to limit the present invention.
[0049] This embodiment provides a game engine system architecture for programming learning. Figure 1 This is a schematic diagram of a framework of a game engine system architecture for programming learning in the present invention, such as Figure 1 As shown, including:
[0050] Game engine, used to develop games into web packages, disable keyboard control events, and expose control interfaces and data return interfaces to the codeconnect system;
[0051] A web programming platform, used for editing the first control code of the game and running it in a web environment, and transmitting the first control code to a codeconnect system;
[0052] a codeconnect system, which converts the received first control code into a second control code in a code format supported by the game engine, and links the code execution logic of the second control code to the game engine;
[0053] The game engine controls the game character based on the code execution logic of the second control code, and transmits the execution result back to the web programming platform through the codeconnect system.
[0054] In an embodiment of the present invention, the game engine can use Unity, Phaser, Three.js, PlayCanvas, Cocos, etc., and the game in the game engine can be built based on the programming skills that the standard programming course requires students to master. The game is developed into a web-side package through the game engine so that the game can run in a web environment. Because the overall framework requires the game engine and the web programming platform to run in a container, keyboard control events are disabled to avoid snatching programming keyboard events. All control interfaces are exposed to the codeconnect system to complete a websocket interface. At the same time, the data interface is exposed to the codeconnect system, and the internal data is packaged and exposed, and also registered in the websocket. It is convenient for the codeconnect system to call the corresponding method through the control interface and call the corresponding data through the data interface.
[0055] In an embodiment of the present invention, after the game can run normally, the user can write the first control code through the programming framework provided by the web programming platform. The written first control code runs in the web environment and transmits the first control code to the codeconnect system. Since the programming framework of the web programming platform and the game engine belong to different programming languages, the codeconnect system needs to convert the first control code into a code format supported by the game engine to obtain the second control code, and then the codeconnect system links the code execution logic of the second control code to the game engine. The game engine controls the game character according to the code execution logic of the second control code, and transmits the execution result back to the web programming platform through the codeconnect system. In summary, the user generates code by programming in the programming framework, controls the game developed by the game engine through the logic of the code, combines the programming framework with the game engine, increases the fun of learning, and improves the user's learning motivation.
[0056] In some embodiments, the web programming platform includes a graphical programming module, a Python programming module, or / and a C++ programming module;
[0057] The graphical programming module compiles the first control code into a JS code segment using Scratch or Blocky technology and executes it in a web environment;
[0058] A Python programming module, using codemirror technology to edit the first control code on the web side, and using pyodide technology to embed the first control code into the web environment for execution;
[0059] The C++ programming module uses the codemirror technology to edit the first control code on the web side, and uses the Emscripten technology to compile the first control code and execute it in the web environment.
[0060] In the embodiment of the present invention, because Scratch or Blocky technology is essentially a drag-and-drop coding building block drawn by JS, after the user builds this building block, the actual operation must be mapped to a language, because it is run in the web, and the preferred language is js (javascript) language, so the graphical programming module can use Scratch or Blocky technology to compile the first control code into a JS code segment. Because python is to be placed in the front end to run and communicate with the web game framework, it is necessary to package the first control code edited by the Python programming module into a code that can be run in the web through pyodide technology, and pyodide technology is CPython and its scientific computing library compiled into WebAssembly. WebAssembly is a low-level bytecode format that runs efficiently in modern browsers, which can provide an execution speed close to native performance. Pyodide provides a bridging mechanism with JavaScript, allowing Python and JavaScript codes to call and communicate with each other. This interoperability allows developers to flexibly use Python in front-end projects for data processing, analysis and visualization, while using JavaScript for user interface and interactive design. Because C++ needs to be run on the front end to communicate with the web game framework, the first control code edited by the C++ programming module needs to be packaged into a code that can be run on the web through Emscripten technology. Em scripten compiles C++ code into WebAssembly, which is an efficient low-level bytecode format supported by modern browsers. WebAssembly provides near-native execution speed, allowing complex computing tasks to run efficiently in the browser. Emscripten supports seamless interaction between C++ and JavaScript. Developers can use C++ to provide high-performance computing modules and JavaScript to process user interfaces and interaction logic in front-end projects at the same time to achieve the best combination of functions.
[0061] In order to link the game engine with the web programming platform, in some embodiments, the codeconnect system uses the WebSocket communication protocol, and the design of the communication protocol includes the following elements:
[0062] Connection establishment: The web programming platform connects to the codeconnect system through the WebSocket communication protocol for handshake and authentication;
[0063] Message format: Use JSON format to encapsulate the message content, including message type, method name, parameters and callback identifier;
[0064] Request message: the request sent by the web programming platform to the game engine;
[0065] Response message: the game engine’s response to the request;
[0066] Event message: event notification that the game engine actively sends to the web programming platform;
[0067] Error message: Error information that occurs during the communication process.
[0068] In an embodiment of the present invention, the codeconnect system provides a unified interface standard and supports multiple programming languages such as JavaScript, Python (Pyodide) and C++ (Emscripten). Through standardized message formats and calling protocols, developers can easily switch and integrate between different languages to improve development efficiency and flexibility. The WebSocket communication protocol is adopted to achieve low-latency, two-way real-time communication. As an intermediary, the codeconnect system optimizes the message forwarding and processing mechanism, ensures the efficient flow of data between the client and the game engine, and supports large-scale concurrent connections. The codeconnect system has designed a plug-in architecture that allows developers to expand system functions according to needs. Including customized data processing plug-ins, logging plug-ins, third-party service integration plug-ins, etc., to enhance the flexibility and maintainability of the system.
[0069] In order to achieve two-way communication between the codeconnect system and the game engine, in some embodiments, the elements for communication between the game engine and the codeconnect system are set as follows:
[0070] Message format: JSON format is used for data encapsulation, including message type, method name, parameters and callback identifier;
[0071] Request message: The request sent by the codeconnect system to the game engine, including method calls and data transmission;
[0072] Response message: the game engine's response to the codeconnect system request, including execution results or error information;
[0073] Event message: event notification sent by the game engine to the codeconnect system for real-time updates and status push;
[0074] Transmission mechanism: Use the SendMessage method provided by WebGL and the callback mechanism of the game engine to implement asynchronous message transmission.
[0075] In order to efficiently transmit complex data structures between the codeconnect system and the game engine, in some embodiments, data serialization and deserialization are used to transmit data structures between the game engine and the codeconnect system, where:
[0076] Data serialization: The codeconnect system uses JSON.stringify to serialize data objects into JSON strings, and the game engine uses Json.FromJson to parse JSON strings into corresponding C# objects or other language objects;
[0077] Data deserialization:
[0078] The game engine uses Json.ToJson to serialize C# objects or other language objects into JSON strings, and the codeconnect system uses JSON.parse to parse JSON strings into JavaScript objects.
[0079] In the embodiments of the present invention, the traditional codeconnect system and the game engine communicate mostly by one-way message transmission, which makes it difficult to achieve complex interactions. The codeconnect system uses a custom two-way communication protocol to achieve real-time, two-way, and efficient data exchange between the codeconnect system and the game engine, significantly improving the interactive performance and flexibility, especially the flexibility of code control.
[0080] The game engine exposes the control method, link method, data method and notification method to the codeconnect system through a specific interface. In some embodiments, the game engine exposes the control method, link method, data method and notification method to the codeconnect system through a control interface and a data return interface. The definition of each method type is as follows:
[0081] Control method: used to control game behavior;
[0082] Link method: used to establish links with other modules or services;
[0083] Data method: used to get or set game data;
[0084] Notification method: used to send real-time notifications in the game to the web programming platform.
[0085] In an embodiment of the present invention, the codeconnect system supports multiple programming languages, and achieves compatibility and efficient execution with the Web environment through different technical means. Exemplary, JavaScript (the graphical programming module is ultimately generated as JavaScript by the code written by the user). Integration method: Run directly in the browser environment and communicate with the codeconnect system using the native WebSocket API. Execution logic: Call the methods exposed by the communication bridge by writing JavaScript code to process the responses and event notifications of the game engine. Python (Pyodide), integration method: Run Python code in the browser through Pyodide, and establish a WebSocket connection with the codeconnect system. Execution logic: Use Python scripts to call the methods of the communication bridge, and process the responses and event notifications from the game engine. C++ (Emscripten), integration method: Compile the C++ code into a WebAssembly module through Emscripten, run it in the browser and communicate with the communication bridge. Execution logic: The C++ code calls the encapsulated WebSocket interface for two-way communication with the game engine.
[0086] In order to realize an efficient data synchronization mechanism and ensure the consistency of the states between the game engine and the programming frameworks of the web programming platform, the codeconnect system adopts a data synchronization mechanism in some embodiments, including:
[0087] Real-time data push: The game engine actively pushes data updates to the CodeConnect system, which then broadcasts them to all subscribed web programming platforms;
[0088] State cache: The web programming platform maintains a local state cache;
[0089] Conflict handling: Use optimistic locking or version control mechanism.
[0090] In the embodiment of the present invention, the game engine actively pushes data updates to the codeconnect system, and the codeconnect system then broadcasts to all subscribed web programming platforms to achieve real-time data push. The web programming platform maintains the local state cache, reduces unnecessary data requests, and improves the response speed. Optimistic locking or version control mechanisms are used to prevent conflicts caused by concurrent data modifications.
[0091] In some embodiments, Figure 1As shown, it also includes a server-side module, which receives learning data and progress information sent by the web programming platform through the codeconnect system, stores the collected data in a database, generates a progress report based on the stored data, and feeds it back to the web programming platform through the codeconnect system.
[0092] In the embodiment of the present invention, the server-side module is responsible for collecting learning data and game progress from the web programming platform, analyzing and storing them. Its main functions include data collection: receiving learning data and progress information sent by the client through WebSocket. Data storage: storing the collected data in the database for subsequent query and analysis. Progress feedback: generating a progress report based on the stored data and feeding it back to the client, supporting personalized learning path recommendations. Among them, the progress report can be evaluated by the number of levels achieved, the number of codes in the program to solve the level, and the minimum path to solve the level.
[0093] In some embodiments, a security layer is also included, which performs permission control and data encryption.
[0094] In the embodiment of the present invention, a multi-level security mechanism is introduced to ensure data security and the legitimacy of interface calls during the communication process, including data encryption, identity authentication, permission control, prevention of cross-site scripting attacks (XSS), etc., to ensure the security and stability of the system.
[0095] It should be understood that "one embodiment" or "an embodiment" mentioned throughout the specification means that specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the present invention. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. It should be understood that in various embodiments of the present invention, the size of the serial number of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention. The serial numbers of the above-mentioned embodiments of the present invention are only for description and do not represent the advantages and disadvantages of the embodiments.
[0096] It should be noted that, in this article, the terms "include", "comprises" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, object or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, object or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, object or device including the element.
[0097] In the several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units 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 can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.
[0098] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units; 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 present embodiment.
[0099] In addition, all functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may be separately used as a unit, or two or more units may be integrated into one unit; the above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0100] A person of ordinary skill in the art can understand that: all or part of the steps of implementing the above-mentioned method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above-mentioned method embodiment; and the aforementioned storage medium includes: mobile storage devices, read-only memories (ROM, Read Only Memory), disks or optical disks, etc. Various media that can store program codes.
[0101] Alternatively, if the above-mentioned integrated unit of the present invention is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present invention can be essentially or partly reflected in the form of a software product, which is stored in a storage medium and includes several instructions for a controller to execute all or part of the methods described in various embodiments of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROMs, magnetic disks or optical disks.
[0102] Although the specific implementation of the invention is described in detail in conjunction with the drawings, it should not be understood as limiting the scope of protection of this patent. Within the scope described in the claims, various modifications and variations that can be made by those skilled in the art without creative work still fall within the scope of protection of this patent.
Claims
1. A game engine system architecture for programming learning, characterized in that: include: Game engine, used to develop games into web packages, disable keyboard control events, and expose control interfaces and data return interfaces to the codec connect system; A web programming platform, used for editing the first control code of the game and running it in a web environment, and transmitting the first control code to the codeconnect system; a codeconnect system, which converts the received first control code into a second control code in a code format supported by the game engine, and links the code execution logic of the second control code to the game engine; The game engine controls the game character based on the code execution logic of the second control code, and transmits the execution result back to the web programming platform through the codeconnect system.
2. A game engine system architecture for programming learning according to claim 1, characterized in that: The web programming platform includes a graphical programming module, a Python programming module or / and a C++ programming module; The graphical programming module compiles the first control code into a JS code segment using Scratch or Blocky technology and executes it in a web environment; A Python programming module, using codemirror technology to edit the first control code on the web side, and using pyodide technology to embed the first control code into the web environment for execution; The C++ programming module uses the codemirror technology to edit the first control code on the web side, and uses the Emscripten technology to compile the first control code and execute it in the web environment.
3. The game engine system architecture for programming learning according to claim 1, characterized in that: The codeconnect system uses the WebSocket communication protocol. The design of the communication protocol includes the following elements: Connection establishment: The web programming platform connects to the codeconnect system through the WebSocket communication protocol for handshake and authentication; Message format: Use JSON format to encapsulate the message content, including message type, method name, parameters and callback identifier; Request message: the request sent by the web programming platform to the game engine; Response message: the game engine’s response to the request; Event message: event notification that the game engine actively sends to the web programming platform; Error message: Error information that occurs during the communication process.
4. The game engine system architecture for programming learning according to claim 3, characterized in that: The elements required to communicate between the game engine and the codeconnect system are as follows: Message format: JSON format is used for data encapsulation, including message type, method name, parameters and callback identifier; Request message: The request sent by the codeconnect system to the game engine, including method calls and data transmission; Response message: the game engine's response to the codeconnect system request, including execution results or error information; Event message: event notification sent by the game engine to the codeconnect system for real-time updates and status push; Transmission mechanism: Use the SendMessage method provided by WebGL and the callback mechanism of the game engine to implement asynchronous message transmission.
5. The game engine system architecture for programming learning according to claim 4, characterized in that: The game engine and the codeconnect system use data serialization and deserialization to transmit data structures, where: Data serialization: The codeconnect system uses JSON.stringify to serialize data objects into JSON strings, and the game engine uses Json.FromJson to parse JSON strings into corresponding C# objects or other language objects; Data deserialization: The game engine uses Json.ToJson to serialize C# objects or other language objects into JSON strings, and the codeconnect system uses JSON.parse to parse JSON strings into JavaScript objects.
6. The game engine system architecture for programming learning according to claim 1, characterized in that: The game engine exposes the control method, link method, data method and notification method to the codeconnect system through the control interface and data return interface. The definition of each method type is as follows: Control method: used to control game behavior; Link method: used to establish links with other modules or services; Data method: used to get or set game data; Notification method: used to send real-time notifications in the game to the web programming platform.
7. The game engine system architecture for programming learning according to claim 1, characterized in that: The codeconnect system adopts a data synchronization mechanism, including: Real-time data push: The game engine actively pushes data updates to the codeconnect system, which then broadcasts them to all subscribed web programming platforms; State cache: The web programming platform maintains a local state cache; Conflict handling: Use optimistic locking or version control mechanism.
8. The game engine system architecture for programming learning according to claim 1, characterized in that: It also includes a server-side module, which receives learning data and progress information sent by the web programming platform through the codeconnect system, stores the collected data in a database, generates a progress report based on the stored data, and feeds it back to the web programming platform through the codeconnect system.
9. The game engine system architecture for programming learning according to claim 1, characterized in that: It also includes a security layer that performs permission control and data encryption.