Game running method, device, storage medium and electronic device
By receiving game loading requests on electronic devices and initializing game controllers written based on the original operating system code, loading game configuration resources, the memory leak problem caused by Webview components is solved, and the rendering and fluency of the application is improved.
Patent Information
- Application Number
- CN202110477663.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-04-29
- Publication Date
- 2025-04-01
- Estimated Expiration
- 2041-04-29
AI Technical Summary
In the prior art, there is a memory leak when an application interacts with a web page through a Webview component, which affects the rendering and fluency of the application on an electronic device.
By receiving game loading requests, the game controller written based on the original code of the electronic device operating system is initialized, the system components of the game controller load game configuration resources, and the game is run based on game configuration resources.
Optimizes the compatibility of the application loading game and improves the rendering and fluency of the application on electronic devices.
Smart Images

Figure CN113117340B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a game running method, device, storage medium and electronic device. Background Art
[0002] With the continuous development of electronic devices, applications running on electronic devices are emerging in an endless stream. At present, applications running on electronic devices can usually be developed through a hybrid development mode. When an application in the hybrid mode is running, it usually involves communication issues between the native system and the web page.
[0003] In the prior art, the Webview component is mainly used to implement functions such as web page request, page loading, rendering, and page interaction on the native system. However, in actual use, there is a memory leakage problem when the application interacts with the web page through the Webview component, which affects the rendering and smoothness of the application on the electronic device. Summary of the invention
[0004] The embodiments of the present application provide a game running method, device, storage medium and electronic device, which can optimize the compatibility of application loading games and improve the rendering and fluency of application on electronic devices. The technical solution is as follows:
[0005] In a first aspect, an embodiment of the present application provides a game running method, comprising:
[0006] Receiving a game loading request and initializing a game controller corresponding to the game loading request; wherein the game controller is written based on the original code of the operating system of the electronic device;
[0007] Loading a game configuration resource corresponding to the game loading request based on a system component of the game controller;
[0008] The game is run based on the game configuration resources.
[0009] In a second aspect, an embodiment of the present application provides a game running device, the device comprising:
[0010] A receiving module, used for receiving a game loading request and initializing a game controller corresponding to the game loading request; wherein the game controller is written based on the original code of the operating system of the electronic device;
[0011] A loading module, used for loading the game configuration resource corresponding to the game loading request based on the system component of the game controller;
[0012] A running module is used to run the game based on the game configuration resources.
[0013] In a third aspect, an embodiment of the present application provides a computer storage medium, wherein the computer storage medium stores a plurality of instructions, wherein the instructions are suitable for being loaded by a processor and executing the above-mentioned method steps.
[0014] In a fourth aspect, an embodiment of the present application provides an electronic device, comprising: a memory and a processor; wherein the memory stores a computer program, and the computer program is suitable for being loaded by the processor and executing the above-mentioned method steps.
[0015] The beneficial effects brought about by the technical solutions provided by some embodiments of the present application include at least:
[0016] When the above-mentioned game running method, device, storage medium and electronic device are working, a game loading request is received, and a game controller corresponding to the game loading request is initialized, wherein the game controller is written based on the original code of the operating system of the electronic device, and the game configuration resources corresponding to the game loading request are loaded based on the system components of the game controller, and the game is run based on the game configuration resources. In the embodiment of the present application, the game controller is written through the original code of the operating system of the electronic device, and then the game configuration resources are loaded through the system components of the game controller, and finally the game is run based on the game configuration resources, rather than running the game through a third-party unified fixed controller and components, so as to optimize the compatibility of the interaction of each component in the process of loading and running the game by the application, and improve the rendering and fluency of the application on the electronic device. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0018] Figure 1 is a schematic diagram of a network architecture of a game running system provided in an embodiment of the present application;
[0019] Figure 2 It is an interactive schematic diagram of a game running method provided in an embodiment of the present application;
[0020] Figure 3 is another interactive schematic diagram of a game running method provided by an embodiment of the present application;
[0021] Figure 4 This is a schematic diagram of a loading request provided in an embodiment of the present application;
[0022] Figure 5 It is a schematic diagram of a corresponding relationship provided in an embodiment of the present application;
[0023] Figure 6 This is a schematic diagram of a backup path storage provided by an embodiment of the present application;
[0024] Figure 7 This is a reporting schematic diagram provided in an embodiment of the present application;
[0025] Figure 8 This is a schematic diagram of instruction acquisition provided by an embodiment of the present application;
[0026] Fig. 9 This is a schematic diagram of a game display provided by an embodiment of the present application;
[0027] Fig.10 This is a default page schematic diagram provided in an embodiment of the present application;
[0028] Fig.11 It is a structural schematic diagram of a game running device provided in an embodiment of the present application;
[0029] Fig.12 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0030] In order to make the objectives, technical solutions and advantages of the present application more clear, the embodiments of the present application will be further described in detail below with reference to the accompanying drawings.
[0031] When the following description is designed with drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Instead, they are only examples of devices and methods consistent with some aspects of the present application as detailed in the attached claims.
[0032] In the description of this application, it should be understood that the terms "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. For those of ordinary skill in the art, the specific meanings of the above terms in this application can be understood according to specific circumstances. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the previously associated objects are in an "or" relationship.
[0033] The present application is described in detail below with reference to specific embodiments.
[0034] Figure 1An exemplary system architecture 100 that can be applied to the game running method of the present application is shown.
[0035] like Figure 1 As shown, the system architecture 100 may include a user 101, a processor 102, a game controller 103, a system component 104, and a game component 105. Among them, the system architecture 100 can be applied to various practical application scenarios. For example, when the system architecture 100 is applied to an online enlightenment teaching system, the user 101 may be a teacher or student participating in online enlightenment teaching, and the processor 102 may be responsible for reading various instructions triggered by the user 101, decoding and executing instructions, and the final execution of information processing and program operation. The game controller 103 may be, but is not limited to, a controller for managing the display of the game interface on the screen of the electronic device, acting as a coordinator between the game interface and the electronic device application (for example, but not limited to the enlightenment teaching application) data model. The system component 104 is a component in the game controller 103 that may be, but is not limited to, used to load game configuration resources and display game running scenes. The game controller 103 may be formed by a combination of the system component 104 and a variety of components with other functions. The game component 105 may be, but is not limited to, a component for controlling game logic. The game component 105 may be a component outside the game controller 103 , and the game controller 103 may interact through the system component 104 .
[0036] Exemplarily, during online enlightenment teaching, processor 102 receives a game loading request triggered by user 101 (for example but not limited to Student A), and then processor 102 controls game controller 103 to perform initialization processing, and loads game configuration resources corresponding to the game loading request through system component 104 of game controller 103, and then receives game logic determined by game component 105 through system component 104, and finally displays the game running scene corresponding to the game logic on the screen of the electronic device through system component 104, and shows it to user 101.
[0037] The processor 102 may be hardware or software. When the processor 102 is hardware, it may be a core component such as a central processing unit (CPU) or a modem (MODEM) used for computing and controlling the core of an electronic device. When the processor 102 is software, it may be implemented as multiple software or software modules (for example, for controlling processing services), or it may be implemented as a single software or software module, which is not specifically limited here.
[0038] The game controller 103 may be hardware or software. When the game controller 103 is hardware, it may be a control accessory for managing a game interface in an electronic device. When the game controller 103 is software, it may be implemented as multiple software or software modules (for example, for controlling services), or as a single software or software module, which is not specifically limited here.
[0039] The system component 104 may be hardware or software. When the system component 104 is hardware, it may be a loading and displaying accessory in the game controller 103 for loading game configuration resources and displaying game running scenes. When the system component 104 is software, it may be implemented as multiple software or software modules (for example, for loading and displaying services), or it may be implemented as a single software or software module, which is not specifically limited here.
[0040] The game component 105 can be hardware or software. When the game component 105 is hardware, it can be a control accessory in an electronic device for controlling game logic, etc. When the game component 105 is software, it can be implemented as multiple software or software modules (for example, for controlling services), or it can be implemented as a single software or software module, which is not specifically limited here.
[0041] Data can be exchanged between user 101 and processor 102, processor 102 and game controller 103, game controller 103 and system component 104, and system component 104 and game component 105 through a network. The network can be used to provide a medium for a communication link between data transmissions. The network may include various types of wired communication links or wireless communication links, for example: wired communication links include optical fibers, twisted pairs, or coaxial cables; wireless communication links include Bluetooth communication links, Wireless-Fidelity (Wi-Fi) communication links, or microwave communication links, etc.
[0042] It should be understood that Figure 1The number of users 101, processor 102, game controller 103, system components 104 and game components 105 in are only schematic. According to the implementation needs, it can be any number of users 101, processor 102, game controller 103, system components 104 and game components 105, and all support distributed cluster deployment. Processor 102, game controller 103, system components 104 and game components 105 can be some components in electronic equipment, and electronic equipment can be hardware or software. When the electronic equipment is hardware, it can be various electronic equipment with the log processing ability of the present application, including but not limited to smart phone, tablet computer, laptop portable computer and desktop computer etc. When the electronic equipment is software, it can be implemented as multiple software or software modules (for example: used to provide business processing services), or it can be implemented as single software or software module, which is not specifically limited here.
[0043] In the following method embodiments, the execution subject may be an electronic device or a processor. For the sake of convenience, only the execution subject of each step is introduced as an electronic device.
[0044] The following will be combined with the attached Figures 2 to 3 , the game running method provided in the embodiment of the present application is introduced in detail.
[0045] See also Figure 2 , provides an interactive schematic diagram of a game running method according to an embodiment of the present application. The method may include the following steps:
[0046] S201: Receive a game loading request, and initialize a game controller corresponding to the game loading request.
[0047] Generally, users can use enlightenment applications on electronic devices for enlightenment teaching. The teaching methods on enlightenment applications can be mainly divided into video teaching and game teaching. Video teaching can refer to users learning knowledge through audio and video playback of enlightenment applications (such as but not limited to live broadcasts of real people, playback of recorded lessons), etc., during which users do not need to actively interact with the enlightenment application. Game teaching can refer to users interacting with the enlightenment application through buttons, voice or body movements in the game teaching session, and then the enlightenment application determines the game logic according to the various instructions triggered by the user, and displays the corresponding game running scenes (such as but not limited to reward animations and reading and writing assessments, etc.) to enrich users' knowledge learning.
[0048] After the user selects game teaching, the electronic device receives a game loading request. The game loading request may refer to a request generated by the user through the operation of a keyboard, mouse, or screen in the electronic device in order to trigger the loading of the game teaching method. For example, in the process of enlightenment teaching, in order to complete the game teaching business of pinyin literacy, student A can click the loading button with his finger, and then the electronic device detects the interactive operation of student A, and then obtains the game loading request corresponding to the game teaching business, and completes the loading of the game teaching business based on the game loading request. In a possible embodiment, the electronic device can also receive the game loading request automatically generated by the electronic device according to a pre-set wake-up method (such as but not limited to a timing method, etc.), which helps the electronic device to receive a variety of game loading requests and improve the user experience.
[0049] After receiving the game loading request, the electronic device can initialize the game controller corresponding to the game loading request. The game controller can be a controller for managing the display of the game interface on the screen of the electronic device, acting as a coordinator between the game interface and the data model of the electronic device application (for example, but not limited to the enlightenment teaching application), such as: UIViewController view controller, UINavigationController view controller, etc. The electronic device can pre-set the corresponding game controller according to the type of game platform, such as: cocos platform game controller, Unity 3D platform game controller, etc. In a possible embodiment, the electronic device can generate a game controller set based on at least two game controllers, and then after receiving the game loading request, the electronic device can query the game controller corresponding to the game loading request in the game controller set, and finally load and run the game through the corresponding game controller, which helps the electronic device to quickly and accurately determine the corresponding game controller. After the electronic device determines the corresponding game controller, it needs to initialize the game controller by assigning the variables in the game controller to the default value, setting the control to the default state, etc. For example, the electronic device sets the view hierarchy of the game controller to 3 layers, sets the relationship and nodes between the game controller and other controllers, and determines the return mode of the game controller. In the present application, the electronic device performs a game teaching and initializes a game controller. If the game teaching is interrupted due to other factors (for example, but not limited to the electronic device needing to switch to a call service, etc.), the electronic device can reserve the initialization running state of the game controller (for example, but not limited to retaining a preset time or uploading to a backup server, etc.), which helps the electronic device to quickly continue the game teaching.
[0050] The operating system of an electronic device can refer to a computer program that manages computer hardware and software resources, such as Apple operating system, Android operating system and Hongmeng operating system. The original code can refer to the programming language for writing the operating system. Different operating systems can be written in different programming languages. For example, the Apple operating system is mainly written by Swift programming language, OC programming language, C programming language and C++ programming language, etc. The kernel of the Android operating system is written by Linux programming language, library files are written by C and C++ programming languages, and applications are written by Java programming language. In this application, the game controller is written based on the original code of the operating system of the electronic device. For example, if the electronic device is an Apple operating system, the game controller is written by the original code of the Apple operating system (such as but not limited to Swift, OC, etc.), and if the electronic device is an Android operating system, the game controller is written by the original code of the Android operating system (such as but not limited to Linux, Java, etc.). Since the versions of the same application program of different operating systems are also different, the game controllers corresponding to the same application program on different operating systems are also different.
[0051] There is a corresponding relationship between the game loading request and the game controller, and the electronic device can determine the corresponding game controller according to the controller identifier, and the controller identifier can be an identifier used by the electronic device to identify the game controller corresponding to the game loading request. For example: the electronic device can parse the game loading request and determine that the corresponding controller identifier is 1, and then the electronic device can traverse the game controller A with the controller identifier of 1 in the predefined and stored game controller database.
[0052] The embodiment of the present application uses the original code of the operating system of the electronic device to write the game controller, while the prior art uses a third-party unified fixed controller. Compared with the prior art, the game controller in the present application is written based on the original code of the operating system of the electronic device, so there will be no compatibility problems in the interactive process of the application of the electronic device calling the game controller, thereby improving the rendering and smoothness of the application on the electronic device. At the same time, by customizing the game controller, there is no need to attach other unnecessary functions and plug-ins, etc., thereby improving the operating efficiency of the electronic device.
[0053] S202: Loading a game configuration resource corresponding to the game loading request based on a system component of the game controller.
[0054] Generally, after initializing the game controller corresponding to the game loading request, the electronic device can load the game configuration resources. The game configuration resources can refer to data resources such as pictures, audio and video, library files and game installation packages used to perform game teaching services. The electronic device can run the game only after loading the game configuration resources. The electronic device first needs to download the game configuration resources to the local storage space. For example, the electronic device can receive a download instruction from the user, parse the download instruction to determine the Internet Protocol (IP) address of the corresponding resource server. The resource server can be a server used to store game configuration resources. After the electronic device issues a download request to the IP address, it can download the game configuration resources from the resource server to the local storage space.
[0055] In the present application, the electronic device loads the game configuration resources through the system component of the game controller. The system component may refer to a component mainly used to load data resources and display data resources, such as the Webview browser component in the Android operating system, the WKWebView browser component in the Apple operating system, etc. The system component is similar in function to the third-party browser component (such as but not limited to Webview and WKWebView) in the prior art, but the system component is a component owned by the game controller, that is, the system component is written based on the original code of the operating system of the electronic device, just like the game controller. Compared with the prior art in which electronic devices load and display data resources through a third-party fixed and unique component, the system component in the present application can solve the incompatibility problem when the third-party browser component interacts with the operating system of the electronic device, and effectively improve the loading efficiency.
[0056] Due to the variety of game types, game platforms, and game versions, the electronic device needs to accurately load the game configuration resources corresponding to the game loading request, that is, in this application, there is a corresponding relationship between the game loading request and the game configuration resources. The power station equipment can determine the corresponding game configuration resources through the resource identifier, and the resource identifier can be an identifier used by the electronic device to identify the game configuration resources corresponding to the game loading request. For example: the electronic device parses the game loading request, determines that the corresponding resource identifier is 3, and then the electronic device can traverse the cocos game installation package, adptor.js file configuration file, pictures, audio and video and other data resources with a resource identifier of 3 in the pre-defined and stored game configuration resource database. The electronic device can also obtain the path information of the game configuration resource in the local storage space, and then directly load the game configuration resource corresponding to the path information, which helps to enrich the way in which the electronic device loads the game configuration resources and quickly and accurately loads the corresponding game configuration resources. In a possible embodiment, the electronic device can load the game configuration resources in segments. For example, the electronic device can decompose the game configuration resources into 5 sub-resources, and then the electronic device simultaneously loads the 5 sub-resources through the system components of the game controller, and then combines the 5 sub-resources in the order of decomposition to obtain the completed game configuration resources, which helps to improve the loading efficiency of the system components.
[0057] S203: Run the game based on the game configuration resources.
[0058] Generally, after the electronic device loads the game configuration resources corresponding to the game loading request based on the system components of the game controller, it needs to run the game based on the game configuration resources. Running the game can mean that the electronic device responds to different game logics through different control instructions of the user, and displays the game running scenes corresponding to different game logics, etc. For example: in the game teaching link of enlightenment teaching, the electronic device displays animal images, and then prompts the user to say the name of the animal in the animal picture through voice, and then collects the answering voice for judging whether the user answers correctly. If the answer is correct, the electronic device can display a reward animation, and if the answer is wrong, the electronic device can display an explanation animation, etc., wherein the reward animation and the explanation animation both belong to the game configuration resources.
[0059] In a possible embodiment, the electronic device can also detect the game status of the running game, and the game status can refer to the form of the game, and can include information such as game progress, game type, and user account. The electronic device can periodically report the detected game status to the monitoring server. When the game teaching link is closed, stopped, restarted, interrupted, or timed out, the electronic device can receive the instruction information from the monitoring server, and then quickly and accurately resume the game teaching link to ensure that the user can continue the game teaching and improve the user experience.
[0060] It can be seen from the above content that a game loading request is received, and a game controller corresponding to the game loading request is initialized, wherein the game controller is written based on the original code of the operating system of the electronic device, and the game configuration resources corresponding to the game loading request are loaded based on the system components of the game controller, and the game is run based on the game configuration resources. In the embodiment of the present application, the game controller is written through the original code of the operating system of the electronic device, and then the game configuration resources are loaded through the system components of the game controller, and finally the game is run based on the game configuration resources, rather than running the game through a third-party unified fixed controller and component, so as to optimize the compatibility of the interaction of each component in the process of loading and running the game by the application, and improve the rendering and fluency of the application on the electronic device.
[0061] See also Figure 3 , another interactive schematic diagram of a game running method is provided for an embodiment of the present application. The game running method may include the following steps:
[0062] S301: Receive a game loading request.
[0063] Generally, a game loading request may refer to a request generated by a user through the operation of a keyboard, mouse, or screen in an electronic device in order to trigger the loading of a game teaching method. For example, in the process of introductory teaching, in order to complete the game teaching service of pinyin literacy, student A may click the loading button with his finger, and then the electronic device detects the interactive operation of student A, and then obtains the game loading request corresponding to the game teaching service, and completes the loading of the game teaching service based on the game loading request. Figure 4As shown, the user can enter the game loading interface corresponding to the game teaching link by first determining the corresponding game teaching link. The user can click the "Confirm Loading" button on the electronic device display screen, and then the electronic device can receive the game loading request. At the same time, the electronic device can also display the loading progress information in real time (for example, but not limited to the loading progress is 80%, and it is loading desperately). In a possible embodiment, the electronic device can also receive the game loading request automatically generated by the electronic device according to a pre-set wake-up method (for example, but not limited to a timing method, etc.), which helps the electronic device to receive a variety of game loading requests and improve the user experience. For example: the electronic device can collect the user's voice, and then use a voice recognition algorithm to detect whether the collected voice contains a wake-up keyword (for example, but not limited to "start the game"), and if it is determined to be included, the business response of the game loading request is triggered.
[0064] S302: Parse the game loading request, determine the game type, obtain game configuration information corresponding to the game type, and initialize the game controller corresponding to the game loading request based on the game configuration information.
[0065] Generally, game types can be divided by corresponding course types (such as but not limited to the first unit course of English class or the first grade course of Chinese class, etc.), game platform types (such as but not limited to cocos game platform or Unity 3D game platform, etc.) or game content (such as but not limited to role-playing, action, simulation or strategy, etc.). After receiving a game loading request, the electronic device can parse the game loading request to determine the game type. For example, the electronic device receives a game loading request A triggered by student A, parses the header file of the game loading request A, and obtains a game type identifier of 2. Then the electronic device can determine that the game type with the game type identifier of 2 is an English oral assessment teaching game. Then the electronic device can obtain the game configuration information corresponding to the game type, and initialize the game controller corresponding to the game loading request based on the game configuration information. For example, the electronic device determines that the controller identifier carried in the game configuration information is 2, then determines that the loaded game controller is a cocos game controller, and then uses the init function to initialize the game controller through the callback method (such as but not limited to asynchronous callback), memory space (such as but not limited to 500K) and display method (such as but not limited to gradient display) carried in the game configuration information. As Figure 5As shown, it is a schematic diagram showing the correspondence between the game type, the game configuration information and the game controller. Different game types correspond to different game configuration information, and different game configuration information can correspond to the same game controller. For example: game type 1 corresponds to game configuration information 1, game type 2 corresponds to game configuration information 2, game type 3 corresponds to game configuration information 3, and game type 4 corresponds to game configuration information 4. Game configuration information 1 and game configuration information 2 correspond to cocos game controllers, and game configuration information 3 and game configuration information 4 correspond to Unity 3D game controllers, etc.
[0066] S303: Determine a game resource path based on the game loading request, and query whether there is a game configuration resource corresponding to the game resource path in the local storage space.
[0067] Generally, after the electronic device initializes the game controller corresponding to the game loading request based on the game configuration information, it can determine the game resource path carried in the game loading request by parsing the game loading request, for example: the electronic device parses the game loading request D and determines that the game resource path is C:\Users\Public\Desktop\resource. Then the electronic device can also query whether there is a game configuration resource corresponding to the game resource path in the local storage space to ensure that the game configuration resource does exist, thereby ensuring the normal progress of game teaching. For example: the electronic device can read the storage state (such as but not limited to the stored state and the unstored state, etc.) of the storage space corresponding to the game resource path C:\Users\Public\Desktop\resource. If it is a stored state, the electronic device can further read the file header of the file corresponding to the game resource path, obtain the occupied space, game version, content type and other information, and compare and detect it with the pre-entered verification information, and determine in detail whether the game configuration resource corresponds to the game loading request.
[0068] S304: If so, send the game resource path to the game controller.
[0069] Generally, if the electronic device searches for game configuration resources corresponding to the game resource path in the local storage space, the game resource path is sent to the game controller, for example, the electronic device determines that the game resource path is C:\Users\Public\Desktop\resource, and then sends C:\Users\Public\Desktop\resource to the game controller. The game controller can be a controller for managing the display of the game interface on the screen of the electronic device, acting as a coordinator between the game interface and the data model of the electronic device application (such as but not limited to the enlightenment teaching application), and the game controller is written based on the original code of the operating system of the electronic device.
[0070] S305: If the local storage space does not contain the game configuration resource corresponding to the game resource path, determine a backup network resource path.
[0071] Generally, if the electronic device searches the local storage space and finds that the game configuration resources corresponding to the game resource path do not exist, then a backup network resource path can be determined. The backup network resource path may refer to a backup path used by the electronic device to download game configuration resources. The number of network resource paths is not limited, and the priorities of multiple backup network resource paths are also set. The electronic device can first determine the backup network resource path with the highest priority. For example: the electronic device defaults to downloading game configuration resources from resource server 1 (for example, but not limited to the corresponding IP of 192.163.101.1), then the electronic device sets a backup network resource path (for example, but not limited to the IP of 192.183.65.100), and then downloads the game configuration resources from resource server 2 corresponding to the backup network resource path, which helps the electronic device to download game configuration resources completely and stably. Figure 6 As shown, the electronic device can set multiple backup network resource paths. For example, the electronic device can pre-set the highest priority backup network resource path 1 (IP address is 192.101.10.1), the second priority backup network resource path 2 (IP address is 192.151.100.2) and the third priority backup network resource path 3 (IP address is 192.78.168.3) in the database, etc. The electronic device can determine the backup network resource paths in order according to the priority.
[0072] S306: Download the game configuration resource through the backup network resource path, and store it in the storage space corresponding to the game resource path.
[0073] Generally, after the electronic device determines the backup network resource path, it can download the game configuration resource through the backup network resource path. For example, the electronic device can send a verification message (such as but not limited to account password and transmission method, etc.) to the resource server 2 corresponding to the backup network resource path (such as but not limited to IP 192.183.65.100), and then receive a response message from the resource server 2. Then the electronic device parses the response message, and after determining that the verification is successful, it sends a download request again, and finally receives the game configuration resource in response to the download request from the resource server 2. The electronic device can then store the game configuration resource in the storage space corresponding to the game resource path, which helps the electronic device ensure the integrity of the game configuration resource and can run the game quickly and normally.
[0074] S307: Load the game configuration resource corresponding to the game resource path through the system component, and determine the loading result of the game configuration resource.
[0075] Generally, a system component may refer to a component mainly used to load data resources and display data resources. The system component is a component in the game controller, that is, the system component and the game controller are both written based on the original code of the operating system of the electronic device. After the electronic device sends the game resource path to the game controller, the game configuration resources corresponding to the game resource path can be loaded through the system component. For example, the electronic device determines that the game resource path is C:\Users\Public\Desktop\resource, and then loads the data resources on the game resource path C:\Users\Public\Desktop\resource through the system component. In a possible embodiment, the electronic device can load through the system component in a segmented loading manner. The electronic device can also allocate a corresponding number of threads according to the data volume of the data resource, and load in a multi-threaded manner. For example, if the electronic device determines that the data volume of the data resource is 100M, 10 threads can be allocated for loading. If the electronic device determines that the data volume of the data resource is 10M, 1 thread can be allocated for loading. Then the electronic device can determine the loading result of the game configuration resource (for example but not limited to loading success and loading failure, etc.) by detecting the loading time or counting the amount of loaded data.
[0076] S308: If the game configuration resource fails to load, the loading result is reported through the system component.
[0077] Generally, if the electronic device determines that the loading of the game configuration resources has failed, for example, the electronic device determines that the loading time (for example, but not limited to 30 minutes) exceeds a preset time threshold (for example, but not limited to 1 minute), then the electronic device determines that the loading of the game configuration resources has failed. The electronic device can then report the loading result through the system component. For example, the electronic device can first collect failure-related information (for example, but not limited to loading time, error coding information, abnormal message information, the original target triggered by the error, and the level segment of the error, etc.). The failure-related information can refer to possible related information of the loading failure, which helps the user analyze the cause of the failure, and then report the failure-related information through the system component. Figure 7 As shown, the electronic device can collect failure-related information and display it on the loading failure interface through the system component, for example: the loading time is 10 minutes, the error code information is 401, the abnormal message information is the network connection failure, the original target of the error trigger is the communication component, the error level segment is 3, etc.
[0078] S309: If the game configuration resource is loaded successfully, a bridge protocol is established between the system component and the game component.
[0079] Generally, if the electronic device determines that the game configuration resource is loaded successfully, a bridge protocol is established between the system component and the game component. The game component may refer to a component for controlling the game logic, and the game component is called by the game controller through the bridge to control the game logic, for example: the cocos game component generated by the cocos game installation package in the game configuration resource loaded by the electronic device, and the game component is also controlled by the game controller, but the game component may be a component generated by the front-end technology, rather than a component generated by the original code of the operating system of the electronic device like the system component. The bridge protocol may refer to a communication mechanism for data transmission between Native applications and Web web applications, for example: the electronic device uses Jsbridge technology to implement the bridge protocol. Since different bridge protocols need to be established for electronic devices to handle different services, the electronic device can pre-define a variety of bridge protocols for handling various services, generate a bridge protocol set, and after the electronic device determines that the game configuration resource is loaded successfully, query the bridge protocol set for handling the communication service between the system component and the game component, and then use the determined bridge protocol to establish a communication connection.
[0080] S310: Acquire a game control instruction through the game controller, and send the game control instruction to the game component based on the bridging protocol through the system component.
[0081] Generally, after the electronic device establishes a bridge protocol with the game component through the system component, the electronic device may need to send the acquired game control instructions to the game component. For example: the electronic device may receive the game control instructions from the user, and then send them to the game controller, the game controller then sends the game control instructions to the system component, and finally the system component sends the game control instructions to the game component based on the bridge protocol. For example: the electronic device may convert the data format of the game control instructions (for example, but not limited to determining the third animal among five animals) through the system component, generate an information object in a preset format (for example, but not limited to Json data format), and then send the information object to the game component through the bridge protocol. The game component may then convert the data format of the information object into a dictionary format, and determine the specific key information in the game control instructions (for example, but not limited to determining the third animal among five animals) through the keyword retrieval characteristics of the dictionary data format, etc., which helps the electronic device to quickly and accurately transmit data. Figure 8 As shown, the electronic device can set buttons on the game display interface to obtain game control instructions through the game controller. For example, the user can click the "up, down, left, right" buttons on the electronic device display screen to trigger and pass the game control instructions, put the possible digital answers above into the formula below, and then the electronic device sends the game control instructions to the game controller.
[0082] S311. Receive, through the system component based on the bridging protocol, a response instruction from the game component in response to the game control instruction, and display the game configuration resources through the system component based on the response instruction.
[0083] Generally, after the electronic device sends the game control instruction to the game component through the system component based on the bridge protocol, the game component needs to respond to the game instruction, generate the corresponding game logic, and generate a response instruction in a preset format based on the game logic. Then the game component sends the response instruction to the system component through the bridge protocol. The system component then parses the response instruction and determines the game logic. Since the game logic contains instruction information instructing the system component to load the corresponding game configuration resources, the system component can load the corresponding game configuration resources and display them to the user to ensure the normal operation of the game. Fig. 9As shown, after the electronic device receives a response instruction from the game component in response to the game control instruction based on the bridging protocol through the system component, the response instruction may be a conversation between two characters. The electronic device then determines the corresponding game configuration resources (such as but not limited to the third part of the audio and video resources) among the loaded game configuration resources, and then displays the third part of the audio and video resources as a conversation between the two characters through the system component. The electronic device continuously displays the corresponding game configuration resources through the system component to perform game teaching.
[0084] S312. Receive, through the system component, a game end instruction from the game component based on the bridging protocol, and release the game controller, the system component, and the game component based on the game end instruction.
[0085] Generally, after the electronic device displays the game configuration resources through the system component based on the response instruction, it can continue to control the game logic through the game component, then send the game logic to the system component through the bridge protocol, and then display the corresponding game configuration resources through the system component until the game ends. For example: the electronic device can determine the progress of the game through the game component. When it detects that the game progress has reached 100%, it can be determined that the current game teaching session has ended, and a game end instruction can be generated through the game component, and then the game end instruction can be sent to the system component using the bridge protocol. After the electronic device receives the game end instruction through the system component, it can stop displaying the corresponding game configuration resources through the system component, stop processing various logic instructions of the game business through the game controller, and stop generating the game logic through the game component. Then, after receiving the game end instruction through the system component, the electronic device can release the game controller, the system component and the game component by sending a release instruction, set the variables in the game controller, the system component and the game component to empty, and release all occupied memory. Fig.10 As shown, after the game end instruction of the electronic device releases the game controller, the system component and the game component, the scene selection page can be entered by default. For example, the user can start the next game teaching session by clicking on the selection areas such as "Game Scene 2, Game Scene 3, Game Scene 4" on the display screen of the electronic device, and reinitialize the game controller, the system component and the game component.
[0086] When the scheme of the embodiment of the present application is executed, a game loading request is received, and a game controller corresponding to the game loading request is initialized, wherein the game controller is written based on the original code of the operating system of the electronic device, and the game configuration resources corresponding to the game loading request are loaded based on the system components of the game controller, and the game is run based on the game configuration resources. The embodiment of the present application writes the game controller through the original code of the operating system of the electronic device, and then loads the game configuration resources through the system components of the game controller, and finally runs the game based on the game configuration resources, rather than running the game through a third-party unified fixed controller and components, so as to optimize the compatibility of the interaction of each component in the process of loading and running the game by the application, and improve the rendering and fluency of the application on the electronic device.
[0087] The following are device embodiments of the present application, which can be used to execute the method embodiments of the present application. For details not disclosed in the device embodiments of the present application, please refer to the method embodiments of the present application.
[0088] See also Fig.11 , which shows a schematic diagram of the structure of a game running device provided by an exemplary embodiment of the present application, hereinafter referred to as running device 11. Running device 11 can be implemented as all or part of the terminal through software, hardware or a combination of both. It includes:
[0089] The receiving module 1101 is used to receive a game loading request and initialize a game controller corresponding to the game loading request; wherein the game controller is written based on the original code of the operating system of the electronic device;
[0090] A loading module 1102, configured to load a game configuration resource corresponding to the game loading request based on a system component of the game controller;
[0091] The running module 1103 is used to run the game based on the game configuration resources.
[0092] In a possible embodiment, the receiving module 1101 includes:
[0093] A parsing unit, used to parse the game loading request and determine the game type;
[0094] The first acquisition unit is used to acquire game configuration information corresponding to the game type, and initialize the game controller corresponding to the game loading request based on the game configuration information.
[0095] In a possible embodiment, the loading module 1102 includes:
[0096] A determination unit, configured to determine a game resource path based on the game loading request;
[0097] A query unit, used for querying whether there is a game configuration resource corresponding to the game resource path in the local storage space;
[0098] The sending unit is used to send the game resource path to the game controller if it exists, and load the game configuration resource corresponding to the game resource path through the system component.
[0099] In a possible embodiment, the operating device 11 further includes:
[0100] A first determination module, configured to determine a backup network resource path if the local storage space does not contain the game configuration resource corresponding to the game resource path;
[0101] A download module, used to download the game configuration resource through the backup network resource path and store it in a storage space corresponding to the game resource path;
[0102] The second loading module is used to load the game configuration resources corresponding to the game resource path through the system component.
[0103] In a possible embodiment, the operating device 11 further includes:
[0104] A second determination module is used to determine the loading result of the game configuration resource;
[0105] A reporting module, configured to report the loading result through the system component if the loading of the game configuration resource fails;
[0106] A bridge module is used to establish a bridge protocol with the game component through the system component if the game configuration resource is loaded successfully; wherein the game component is called by the game controller through the bridge to control the game logic.
[0107] In a possible embodiment, the operation module 1103 includes:
[0108] an acquisition unit, configured to acquire a game control instruction through the game controller, and send the game control instruction to the game component through the system component based on the bridge protocol;
[0109] A second receiving unit, configured to receive, through the system component based on the bridge protocol, a response instruction from the game component in response to the game control instruction;
[0110] A display unit is used to display the game configuration resource through the system component based on the response instruction.
[0111] In a possible embodiment, the operating device 11 further includes:
[0112] A second receiving module, configured to receive a game ending instruction from the game component based on the bridge protocol through the system component;
[0113] A release module is used to release the game controller, the system component and the game component based on the game end instruction.
[0114] The embodiments of this application and Figures 2 to 3 The method embodiments are based on the same concept, and the technical effects they bring are also the same. The specific process can be referred to Figures 2 to 3 The description of the method embodiment will not be repeated here.
[0115] The device 11 can be a field-programmable gate array (FPGA), a dedicated integrated chip, a system on chip (SoC), a central processor unit (CPU), a network processor (NP), a digital signal processing circuit, a microcontroller unit (MCU), and a programmable logic device (PLD) or other integrated chips.
[0116] When the scheme of the embodiment of the present application is executed, a game loading request is received, and a game controller corresponding to the game loading request is initialized, wherein the game controller is written based on the original code of the operating system of the electronic device, and the game configuration resources corresponding to the game loading request are loaded based on the system components of the game controller, and the game is run based on the game configuration resources. The embodiment of the present application writes the game controller through the original code of the operating system of the electronic device, and then loads the game configuration resources through the system components of the game controller, and finally runs the game based on the game configuration resources, rather than running the game through a third-party unified fixed controller and components, so as to optimize the compatibility of the interaction of each component in the process of loading and running the game by the application, and improve the rendering and fluency of the application on the electronic device.
[0117] The present application also provides a computer storage medium, which can store multiple instructions, which are suitable for being loaded by a processor and executing the above method steps. The specific execution process can be seen in Figure 2 or Figure 3 The specific description of the illustrated embodiment will not be repeated here.
[0118] The present application also provides a computer program product, which stores at least one instruction, and the at least one instruction is loaded and executed by the processor to implement the template control method described in the above embodiments.
[0119] See also Fig.12 , is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Fig.12 As shown, the electronic device 12 may include: at least one processor 1201 , at least one network interface 1204 , a user interface 1203 , a memory 1205 , and at least one communication bus 1202 .
[0120] The communication bus 1202 is used to realize the connection and communication between these components.
[0121] The user interface 1203 may include a display screen (Display) and a camera (Camera), and the optional user interface 1203 may also include a standard wired interface and a wireless interface.
[0122] The network interface 1204 may optionally include a standard wired interface or a wireless interface (such as a WI-FI interface).
[0123] Among them, the processor 1201 may include one or more processing cores. The processor 1201 uses various interfaces and lines to connect various parts in the entire terminal 1200, and executes various functions and processes data of the terminal 500 by running or executing instructions, programs, code sets or instruction sets stored in the memory 1205, and calling data stored in the memory 1205. Optionally, the processor 1201 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The processor 1201 can integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing the content to be displayed on the display screen; the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 1201, and it can be implemented separately through a chip.
[0124] Among them, the memory 1205 may include a random access memory (Random Access Memory, RAM) and may also include a read-only memory (Read-Only Memory). Optionally, the memory 1205 includes a non-transitory computer-readable storage medium. The memory 1205 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 1205 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area may store data involved in the above-mentioned various method embodiments, etc. The memory 1205 may also be optionally at least one storage device located away from the aforementioned processor 1201. As Fig.12 As shown, the memory 1205 as a computer storage medium may include an operating system, a network communication module, a user interface module, and a game running application.
[0125] exist Fig.12 In the electronic device 1200 shown, the user interface 1203 is mainly used to provide an input interface for the user and obtain data input by the user; and the processor 1201 can be used to call the game running application stored in the memory 1205 and specifically perform the following operations:
[0126] Receiving a game loading request and initializing a game controller corresponding to the game loading request; wherein the game controller is written based on the original code of the operating system of the electronic device;
[0127] Loading a game configuration resource corresponding to the game loading request based on a system component of the game controller;
[0128] The game is run based on the game configuration resources.
[0129] In one embodiment, when the processor 1201 executes the initialization of the game controller corresponding to the game loading request, specifically:
[0130] Parsing the game loading request to determine the game type;
[0131] Obtain game configuration information corresponding to the game type, and initialize a game controller corresponding to the game loading request based on the game configuration information.
[0132] In one embodiment, when the processor 1201 executes the system component based on the game controller to load the game configuration resource corresponding to the game loading request, it specifically executes:
[0133] Determine a game resource path based on the game loading request;
[0134] Querying the local storage space to determine whether there is a game configuration resource corresponding to the game resource path;
[0135] If so, the game resource path is sent to the game controller, and the game configuration resource corresponding to the game resource path is loaded through the system component.
[0136] In one embodiment, the processor 1201 executes the application program and is further configured to execute:
[0137] If the local storage space does not contain the game configuration resource corresponding to the game resource path, determining a backup network resource path;
[0138] Downloading the game configuration resource through the backup network resource path and storing it in the storage space corresponding to the game resource path;
[0139] The game configuration resource corresponding to the game resource path is loaded through the system component.
[0140] In one embodiment, after the processor 1201 executes the system component based on the game controller to load the game configuration resource corresponding to the game loading request, it is further configured to execute:
[0141] Determine the loading result of the game configuration resource;
[0142] If the game configuration resource fails to load, reporting the loading result through the system component;
[0143] If the game configuration resource is loaded successfully, a bridge protocol is established between the system component and the game component; wherein the game component is called by the game controller through the bridge to control the game logic.
[0144] In one embodiment, when the processor 1201 executes the running of the game based on the game configuration resources, it specifically executes:
[0145] Acquiring a game control instruction through the game controller, and sending the game control instruction to the game component based on the bridge protocol through the system component;
[0146] receiving, by the system component based on the bridge protocol, a response instruction from the game component in response to the game control instruction;
[0147] The game configuration resource is displayed by the system component based on the response instruction.
[0148] In one embodiment, after executing the running of the game based on the game configuration resources, the processor 1201 is further configured to execute:
[0149] Receiving, by the system component, a game ending instruction from the game component based on the bridge protocol;
[0150] The game controller, the system components, and the game components are released based on the game end instruction.
[0151] The technical concept and Figure 2 or Figure 3 The technical concept is the same as that of Figure 2 or Figure 3 The method embodiments are not described in detail here.
[0152] In an embodiment of the present application, a game loading request is received, and a game controller corresponding to the game loading request is initialized, wherein the game controller is written based on the original code of the operating system of the electronic device, and the game configuration resources corresponding to the game loading request are loaded based on the system components of the game controller, and the game is run based on the game configuration resources. In an embodiment of the present application, a game controller is written using the original code of the operating system of the electronic device, and then the game configuration resources are loaded through the system components of the game controller, and finally the game is run based on the game configuration resources, rather than running the game through a third-party unified fixed controller and component, thereby optimizing the compatibility of the interaction of the components during the application loading and running of the game, and improving the rendering and fluency of the application on the electronic device.
[0153] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing related hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The storage medium can be a disk, an optical disk, a read-only storage memory, or a random access memory, etc.
[0154] The above disclosure is only the preferred embodiment of the present application, which certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.
Claims
1. A game running method, characterized in that: Applied to electronic equipment, the method comprises: Receive a game loading request, and initialize a game controller corresponding to the game loading request; wherein the game controller is written based on the original code of the operating system of the electronic device; the game controller is a physical control accessory in the electronic device for managing a game interface; the original code is used to represent a programming language for writing the operating system; The game configuration resource corresponding to the game loading request is loaded based on the system component in the game controller; wherein the system component is written based on the original code of the operating system of the electronic device; the system component is a physical loading display accessory in the electronic device for loading the game configuration resource and displaying the game running scene corresponding to the game configuration resource; The game is run based on the game configuration resources to display the game running scene corresponding to the game configuration resources.
2. The method according to claim 1, characterized in that: The initializing the game controller corresponding to the game loading request includes: Parsing the game loading request to determine the game type; Obtain game configuration information corresponding to the game type, and initialize a game controller corresponding to the game loading request based on the game configuration information.
3. The method according to claim 1, characterized in that The loading of the game configuration resource corresponding to the game loading request based on the system component in the game controller includes: Determine a game resource path based on the game loading request; Querying the local storage space to determine whether there is a game configuration resource corresponding to the game resource path; If so, the game resource path is sent to the game controller, and the game configuration resource corresponding to the game resource path is loaded through the system component.
4. The method according to claim 3, characterized in that The method further comprises: If the local storage space does not contain the game configuration resource corresponding to the game resource path, determining a backup network resource path; Downloading the game configuration resource through the backup network resource path and storing it in the storage space corresponding to the game resource path; The game configuration resource corresponding to the game resource path is loaded through the system component.
5. The method according to claim 3, characterized in that: After the game configuration resource corresponding to the game loading request is loaded based on the system component in the game controller, the method further includes: Determine the loading result of the game configuration resource; If the game configuration resource fails to load, reporting the loading result through the system component; If the game configuration resource is loaded successfully, a bridge protocol is established between the system component and the game component; wherein the game component is called by the game controller through the bridge to control the game logic.
6. The method according to claim 5, characterized in that The running of the game based on the game configuration resource to display the game running scene corresponding to the game configuration resource includes: Acquiring a game control instruction through the game controller, and sending the game control instruction to the game component based on the bridge protocol through the system component; receiving, by the system component based on the bridge protocol, a response instruction from the game component in response to the game control instruction; Based on the response instruction, the game running scene corresponding to the game configuration resource is displayed through the system component.
7. The method according to claim 5, characterized in that After running the game based on the game configuration resource to display the game running scene corresponding to the game configuration resource, the method further includes: Receiving, by the system component, a game ending instruction from the game component based on the bridge protocol; The game controller, the system components, and the game components are released based on the game end instruction.
8. A game running device, characterized in that: include: A receiving module, used for receiving a game loading request and initializing a game controller corresponding to the game loading request; wherein the game controller is written based on the original code of the operating system of the electronic device; the game controller is a physical control accessory in the electronic device for managing the game interface; the original code is used to represent the programming language for writing the operating system; A loading module, used to load the game configuration resource corresponding to the game loading request based on the system component in the game controller; wherein the system component is written based on the original code of the operating system of the electronic device; the system component is a physical loading display accessory in the electronic device for loading the game configuration resource and displaying the game running scene corresponding to the game configuration resource; A running module is used to run the game based on the game configuration resources to display the game running scene corresponding to the game configuration resources.
9. A computer storage medium, characterized in that: The computer storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor and executing the method steps as claimed in any one of claims 1 to 7.
10. An electronic device, characterized in that: include: A memory and a processor; wherein the memory stores a computer program, and the computer program is suitable for being loaded by the processor and executing the method steps as claimed in any one of claims 1 to 7.
Citation Information
Patent Citations
Method and device for operating game client
CN104780164A
Web access method and device
CN104951326A
Webpage game loading method and device
CN110209973A
Automatic generation of suggested mini-games for cloud-gaming based on recorded gameplay
CN110523079A