Detailed Description
Aiming at the problems existing when the mobile phone game is transplanted to the intelligent television for running in the background technology, the embodiments of the application provide a game running speed adjusting technical scheme, which realizes effective control of the running speed of the mobile phone game running on the intelligent television, so that a user can autonomously adjust the game running speed according to the running condition of the mobile phone game on the intelligent television, thereby better experiencing the game.
In order to enable those skilled in the art to better understand the present application, the following description will make clear and complete descriptions of the technical solutions according to the embodiments of the present application with reference to the accompanying drawings.
In some of the flows described in the description of the application, the claims, and the figures described above, a number of operations occurring in a particular order are included, and the operations may be performed out of order or concurrently with respect to the order in which they occur. The sequence numbers of operations such as 101, 102, etc. are merely used to distinguish between the various operations, and the sequence numbers themselves do not represent any order of execution. In addition, the flows may include more or fewer operations, and the operations may be performed sequentially or in parallel. It should be noted that, the descriptions of "first" and "second" herein are used to distinguish different messages, devices, modules, etc., and do not represent a sequence, and are not limited to the "first" and the "second" being different types. The term "or/and" in the present application is merely an association relationship describing the association object, which means that three relationships may exist, for example: a and/or B are three cases that A can exist alone, A and B exist together and B exists alone; the character "/" in the present application generally indicates that the front and rear associated objects are an "or" relationship. It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a product or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such product or system. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a commodity or system comprising such elements. Furthermore, the embodiments described below are only some, but not all, of the embodiments of the present application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
Before describing the technical solutions provided by the embodiments of the present application, the terms and terms related to the embodiments of the present application will be described.
Game engine: referring to some already written editable electronic game systems or some interactive real-time image applications, it is mainly the development of electronic games that provides the various tools required to write the game program in order to make it easier and faster for the development of the game program without starting from scratch. Currently, a relatively large number of game engines including a Unity3D engine, a cos2D engine, a Creation engine, a urea engine, etc. are utilized, and most of the game engines support a plurality of operating system platforms, such as Linux systems, iOS systems, microsoft Windows systems, and Android systems (i.e., android systems). In general, the game engine may comprise the following systems: rendering engines (including two-dimensional or three-dimensional image engines), physics engines, collision detection systems, sound effects, script engines, computer animations, artificial intelligence, network engines, and scene management, among others. In the above description, the core of the cocos2d engine is written in C++, and provides three programming language interfaces of C++, lua, javaScript, and cross-platform support of iOS, android and other smart phones, windows, mac and other desktop operating systems.
An API (Application Programming Interface, application programming interface, or application programming interface) is a number of predefined functions that are designed to provide applications and developers the ability to access a set of routines based on certain software or hardware without having to access source code or understand the details of the internal operating mechanisms.
A thread, which refers to a sequential flow of execution in a process, is understood to be a subtask that runs independently in the process. A process refers to a running activity of a program with a certain independent function with respect to a certain data set. In one process there is at least one thread, for example: the qq.exe runtime has many threads running at the same time, such as a buddy video thread, a download file thread, a transfer data thread, a send expression thread, etc. For applications such as gaming applications, an application is made up of one or more cooperating processes.
A main thread, which is a thread created when an application is started, is understood as an entry of an application.
The supplementary explanation here is: the application relates to a mobile phone game developed for a mobile phone in the context of the application, and the mobile phone game can be transplanted to an intelligent television to run through a certain technical means. The "game" and the "mobile game" are both "electronic games", and only different expressions are adopted in different scenes.
The following describes in detail the technical solutions provided by the embodiments of the present application with reference to the accompanying drawings.
Fig. 1 is a flowchart of a game running speed adjusting method according to an embodiment of the application. The execution main body of the method is an intelligent television, and a mobile game is run on the intelligent television. As shown in fig. 1, the game running speed adjusting method includes the steps of:
101. acquiring a speed adjustment parameter input by a user for the running speed of a game running on the intelligent television;
102. determining a timer thread of the game engine;
103. and adjusting the running speed of the game based on the timer thread and the speed adjustment parameter.
In 101, the game is a mobile phone game that was originally developed specifically for mobile phones and is transplanted to a smart tv. When the mobile game is transplanted to the smart television, in some embodiments, a recoding mode can be adopted, specifically, the game interface and the operation implementation mode are recoded so that the mobile game is compatible with the smart television. However, if the mobile phone game is transplanted by adopting the recoding mode, in order to realize that the mobile phone game is compatible with smart televisions of different manufacturers, the game interface and the control implementation mode are recoded aiming at the smart televisions of different manufacturers, which definitely has the problems that a large amount of research and development cost is required to be input for transplanting the mobile phone game to the smart television, the transplanting efficiency is lower, and the like. In order to avoid some problems of implementing mobile game migration by recoding in the above example, in other embodiments, a method of writing a focus control program and loading the focus control program into the smart tv may be used to implement mobile game migration, that is, when implementing mobile game migration onto the smart tv, loading an application program of mobile game and a corresponding focus control program into the smart tv together. Here, the focus control program is a general program which can enable the mobile phone game to be compatible with intelligent televisions of different manufacturers, and can enable the point touch operation mode of the mobile phone game to be compatible with key operation of a television remote controller. After the application program and the focus control program of the mobile phone game are installed on the intelligent television, a game player can control the mobile phone game on the intelligent television to be opened and closed and operate an operable object in a game interface of the mobile phone game through a remote control device (such as a television remote controller) of the remote control intelligent television; the operable object refers to an object that can be operated by a game to a home, for example, a functional element (such as a speed bar (or a speed button) for adjusting a speed of running the game, a mailbox key, a shop button, etc.), a game character, a game prop, etc., which are not limited herein. Compared with the intelligent televisions of different manufacturers, different compatible programs are required to be developed, the research and development investment of game developers can be greatly reduced through the focus control program, and the rapid migration of the mobile phone game to the intelligent televisions of different manufacturers is accelerated. The specific control of the mobile game on the smart television by using the focus control program can be found in the prior art, and is not specifically limited herein.
In this embodiment, the smart television is conveniently loaded with an application program of a mobile phone game and a corresponding focus control program, so that a user can control the mobile phone game on the smart television through a remote control device adapted to the smart television. For example, if the user wants to play a mobile game on the smart television for entertainment after working and learning, a function key, which is matched with the smart television, on the television remote controller and used for starting the mobile game on the smart television can be triggered, and then the television remote controller can form a corresponding starting instruction based on the operation triggered by the user and send the corresponding starting instruction to the smart television, so that the smart television starts the corresponding mobile game on the smart television according to the starting instruction. In the process of starting the corresponding mobile phone game, the intelligent television can initialize the own operating system, and then execute a game program loading task based on the game identifier carried in the starting instruction to start the corresponding mobile phone game; wherein the following operations may be performed, but are not limited to, when starting the cell phone game: look up game master threads, load game interface UI data, load rendering program code, load governor code, load event program code, and so forth. After the mobile game is started, a user can operate an operable object in a game interface of the mobile game running on the smart television through the television remote controller, so that the mobile game is played for entertainment. Based on this, before the step 101, the method provided in this embodiment may further include:
100. responding to a starting operation triggered by a user through remote control equipment matched with the intelligent television, and starting the game; wherein, upon starting the game, at least one of the following operations is performed: searching a main thread of a game and loading relevant program codes of the game; the associated program code includes at least one of: game interface program code, pacing program code, rendering program code, event program code.
Further, in the process of playing the mobile phone game running on the smart television, the user can also operate a speed doubling button on a game interface through the television remote controller according to the requirement of the user on the running speed of the game and/or the current running smoothness of the game, so as to adjust the running speed of the game to a proper speed doubling. And in the specific adjustment, the intelligent television responds to the speed adjustment operation triggered by the user through the television remote controller to acquire the adjustment double speed of the user for the running speed input of the running mobile phone game on the intelligent television, and the adjustment double speed provides data support for the game running speed adjustment method provided by the embodiment. Based on this, in a specific implementation technical solution, the step 101 "obtaining the speed adjustment parameter input by the user for the running speed of the running game on the smart tv" may specifically include:
and responding to the operation triggered by the user through the remote control device matched with the intelligent television, and acquiring the speed adjustment parameter input by the user for the running speed of the running game on the intelligent television.
In particular, the remote control device may be, but is not limited to, a television remote control adapted to a smart television. After triggering a function key for adjusting the running speed of the mobile phone game on the intelligent television, the remote control device can form a corresponding adjusting instruction according to the operation triggered by the user and send the adjusting instruction to the intelligent television; the adjustment instruction carries a speed adjustment parameter input by a user through remote control equipment, and the intelligent television can acquire the speed adjustment parameter input by the user aiming at the running speed of the running game on the intelligent television based on the received adjustment instruction; the speed adjustment parameter may refer to an adjustment speed of a user input for an operation speed of an ongoing game on the smart tv, for example, the adjustment speed may be 0.5X, 1.0X, 1.25X, 2.0X, and the like. When the user inputs the speed adjustment parameters, the user can flexibly select an input mode according to actual conditions, for example, if a double-speed button is arranged on a game interface of a mobile game running on the smart television, the user can operate the double-speed button through remote control equipment to select an appropriate double speed from a plurality of displayed double speeds; for another example, if the game interface of the mobile game running on the smart television has a double-speed input box, the user may trigger the double-speed input box through the remote control device, so that the game interface displays a corresponding numeric keyboard, and then click the corresponding numeric element on the numeric keyboard through the remote control device to input a proper double speed in the double-speed input box.
After acquiring the speed adjustment parameter input by the user for the running speed of the game running on the smart television, if the game running speed is to be adjusted to the speed adjustment parameter input by the user, for example, the game running speed is adjusted to be 0.5 times of the normal running speed, it is generally necessary to acquire the running time information of the game thread in some way, and then adjust the game running speed according to the time. If the game is allowed to get faster or slower than the real time, the game running speed can be increased or decreased. In the technical solution provided in this embodiment, the framework of the mobile phone game transplanted to the smart television is, but not limited to: the cosos2d framework, the framework of the game is also equivalent to the game engine, that is, the game engine of the mobile phone game transplanted to the smart television in this embodiment is, but not limited to: cosos2d engine. The cosos2d frame is provided with a Scheduler class, which is a timer thread for managing a game engine, and is a core class under the cosos2d frame, and is mainly used for controlling refresh scene operation required by triggering each frame of a game and user-defined update operation. The game thread runtime information can be obtained by obtaining a game thread runtime API in the Scheduler. Based on this, in 102, when determining the timer thread caused by the game, the original Scheduler class for managing the game engine may be obtained by searching the thread information of the game engine, the original Scheduler class is used as a base class, a new Scheduler class is created by adopting a parameter data manner of inheriting the base class (i.e. a new timer thread is created), and then the acquired game thread time API in the new Scheduler class is reconstructed based on the acquired speed adjustment parameter, so as to achieve the purpose of adjusting the game running speed.
That is, in a specific implementation, the above 102 "determining the timer thread of the game engine" may specifically include:
1021. searching the thread information of the game engine to obtain a target object for managing the game engine based on the searching result;
1022. the timer thread is created based on the parameter data of the target object.
In 1021, the object for managing the game engine refers to an original Scheduler class for managing the game engine, where the time value output by the thread runtime API is the real system time of the smart tv operating system. Because different game engines often have different threads, when the thread information of the game engine is searched, the thread information of the game engine can be searched based on the category to which the game engine belongs, so that a target object for managing the game engine is obtained based on a search result; that is, the "searching for the thread information of the game engine" in 1021 may be implemented by the following steps:
10211. determining a category to which the game engine belongs;
10212. and searching the thread information of the game engine according to the category.
In particular, the game engine belongs to the category of cosos2d. In order to increase the search rate to increase the efficiency of game running speed adjustment, the purpose of searching the thread information of the game engine in this embodiment is to: to obtain the target object (i.e. Scheduler class, also called timer thread) for managing the game engine, the Scheduler class is a core class of the game engine, so that only the core thread of the game engine can be searched based on the determined class of the game engine, so as to achieve the purpose of quickly searching and obtaining the target object for managing the game engine. In the foregoing, the core thread caused by the game may include, but is not limited to, a rendering thread, a timer thread, a physical collision thread, an event thread, and the like, which are not limited herein. The specific description of some core threads illustrated above may be referred to in the prior art, and will not be described in detail herein.
In the above 1022, after the target object is obtained, the inheritance characteristics of the programming language class used by the game engine can be facilitated, and the target object is used as a base class, so as to create a new timer thread by inheriting the parameter data of the target object. For example, assuming that the programming language used by the game engine is c++, a timer thread may be newly created to inherit the parameter data of the target object by using the inheritance characteristics of the c++ class. For a specific implementation of newly creating a timer thread by utilizing the inheritance characteristics of the c++ class, reference may be made to the prior art, and details are not described herein.
The newly created timer thread is created by taking the target object as the base class, and inherits the parameter data of the target object, therefore, the newly created timer thread also comprises a thread running time API for acquiring a game engine, the API is a predefined function, that is, the thread running time API for acquiring the game can be understood as a time acquisition function, that is, the newly created timer thread in 102 comprises a time acquisition function for acquiring the thread running time of the game engine, at this time, the time acquired by the time acquisition function is generally the real system time of the intelligent television operating system, and in order to realize the adjustment of the running speed of the game according to the user requirement, the time value output by the time acquisition function can be reconstructed based on the speed adjustment parameter acquired in 101 so as to modify the time value output by the time acquisition function, so that the time value output by the time acquisition function after reconstruction is faster or slower than the real system time of the intelligent television operating system; and then, feeding back the time value output by the reconstructed time acquisition function to the game main thread, and setting the running time of each thread of the game engine to the time value output by the reconstructed time acquisition function, so that the running time of each thread of the game engine is faster or slower than the real system time of the intelligent television operating system, and the purpose of adjusting the running speed of the game can be achieved. That is, in a specific implementation, the step 103 of adjusting the running speed of the game based on the timer thread and the speed adjustment parameter may specifically include:
1031. reconstructing a time acquisition function in the timer thread based on the speed adjustment parameter;
1032. and feeding back the time value output by the time acquisition function after reconstruction to a main thread of the game so as to set the thread running time of the game engine to the time value output by the time acquisition function after reconstruction through the main thread.
In the implementation, on the basis of determining the time parameter used for representing the acquired real system time of the intelligent television operating system in the time acquisition function, the product value of the time parameter and the speed adjustment parameter is used as the output value of the time acquisition function, so that the time acquisition function in the timer thread is reconstructed, and the time value output by the reconstructed time acquisition function is faster or slower than the real system time of the intelligent television operating system. For example, if the speed adjustment parameter is 1.5 times of the speed, the time value output by the time acquisition function which is reconstructed at this time is 1.5 times of the real system time of the current intelligent television operating system, so that after the time value output by the time acquisition function which is reconstructed is further fed back to the game main thread, the thread running time of the game engine can be set to be 1.5 times of the real system time of the intelligent television operating system through the game main thread, and the running time of each thread of the game engine is faster than the real system time of the intelligent television, so that the running speed can be adjusted. For example, taking a rendering thread of a game engine as an example, if the running time of the rendering thread caused by the game is the real system time of the smart television, if 4 times of refreshing is executed every second, after the rendering thread time is 1.5 times of the real system time of the smart television after the adjustment, the refreshing times executed every second will be correspondingly increased, for example, the refreshing times are changed to 6 times (1.5 times 4) times per second.
Based on the foregoing, in one possible technical solution, 1031 "reconstruct the time acquisition function in the timer thread based on the speed adjustment parameter" may be implemented by:
10311. determining a time parameter in the time acquisition function; the time parameter is used for representing the acquired operating system time of the intelligent television;
10312. and taking the product value of the time parameter and the speed adjustment parameter as the time value output by the time acquisition function.
In the above description, the operation of the smart tv may be, but is not limited to, an Android system (i.e., android system) iOS system, a Windows system, and the like. As a preferred example, the operating system of the smart television in this embodiment is an Android system.
In summary, according to the technical scheme provided by the embodiment, on the basis of obtaining the speed adjustment parameter input by the user for the running speed of the running game on the smart television, the running speed of the game is adjusted by determining the timer thread of the game engine and based on the timer thread and the speed adjustment parameter. The method realizes the game speed adjustment on the intelligent television in a timer thread mode, and the scheme is simple to realize, high in speed adjustment efficiency and capable of improving the game experience of the user. The game running speed scheme can be compatible with all mobile games which are transplanted to the intelligent television by taking the cocos2d as a game engine, and the research and development cost for regulating the running speed of the mobile games transplanted to the intelligent television is reduced.
The above-described game running speed adjustment technical solution can be simply summarized as a flow structure as shown in fig. 2: namely, the intelligent television responds to the starting operation triggered by a user through the remote control equipment, initializes an operating system and starts a corresponding game program; during the starting process of the game program, searching the game main line program, loading relevant program codes (such as rendering program codes and speed regulating program codes) of the game, and the like, after the game program is started, a user can continue to operate the game through the remote control device. Further, when the user triggers an adjustment operation for adjusting the running speed of the game through the remote control device according to the running speed condition of the currently operated game, the intelligent television can respond to the adjustment operation triggered by the user to start adjusting the running speed of the game by times according to the adjustment input by the user. Specifically, in the process of adjusting the running speed of the game, the intelligent television firstly determines the category to which the game engine belongs, searches the core thread API of the game engine based on the category to which the game engine belongs, and newly creates a Scheduler class to inherit the original Scheduler of the game engine based on the search result; then, reconstructing the acquired game thread running time API in the newly created Scheduler class to modify the time value output by the acquired game thread running time API; if the modification is successful, the time value fed back to the main thread by the API for acquiring the running time of the game thread is modified into the product value of the system time and the speed adjustment, so that the game running speed adjustment is completed; otherwise, if the modification fails, the step of determining the category to which the game engine belongs is returned to be executed.
Fig. 3 is a schematic diagram showing a structure of a game running speed adjusting system according to an embodiment of the present application. As shown in fig. 3, the system includes: a remote control device 100 and a smart television device 200; wherein,,
the remote control device 100 is configured to send a speed adjustment instruction to the adapted smart television device according to an operation triggered by a user; the speed adjustment instruction carries a speed adjustment parameter input by the user for the running speed of the running game on the intelligent television.
The smart television device 200 is configured to receive the speed adjustment instruction, and obtain a speed adjustment parameter input by a user for an operation speed of a game being operated on the smart television from the speed adjustment instruction; determining a timer thread of the game engine; and adjusting the running speed of the game based on the timer thread and the speed adjustment parameter.
In particular, the remote control device 100 is, but not limited to, a television remote control adapted to the smart television device 200. The communication mode between the remote control device 100 and the smart television device 200 may be a wireless communication mode, and the wireless communication mode may be, but is not limited to, an ethernet, zigBee, a wireless communication mode based on a mobile network, and the like; the network system of the mobile network may be any one of 2G (GSM), 2.5G (GPRS), 3G (WCDMA, TD-SCDMA, UTMS), 4G (LTE), 4g+ (lte+), 5G, wiMax, etc., but not limited thereto.
Further, the game is a mobile phone game transplanted to the smart television; the operating system of the smart television may be, but is not limited to, an iOS system, a Windows system, an Android system (i.e., an Android system), and the like. As a preferred example, the operating system of the smart television in this embodiment is an Android system.
What needs to be explained here is: the game running speed adjustment provided in the foregoing embodiments may implement the technical solutions described in the foregoing method embodiments, and the specific implementation principles of each device, module or unit may refer to the corresponding content in the foregoing corresponding method embodiments, which is not repeated herein.
Fig. 4 is a block diagram showing a structure of a game running speed adjusting apparatus according to an embodiment of the present application. As shown in fig. 4, the game running speed adjusting device includes: an acquisition module 31, a determination module 32 and an adjustment module 33; wherein,,
an obtaining module 31, configured to obtain a speed adjustment parameter input by a user for a running speed of a game running on the smart tv;
a determining module 32 for determining a timer thread of the game engine;
an adjustment module 33, configured to adjust the running speed of the game based on the timer thread and the speed adjustment parameter.
Further, the determining module 32, when used for determining a timer thread of the game engine, is specifically configured to: searching the thread information of the game engine to obtain a target object for managing the game engine based on the searching result; the timer thread is created based on the parameter data of the target object.
Further, the determining module 32 is configured to, in use for searching for thread information of the game engine, specifically: determining a category to which the game engine belongs; and searching the thread information of the game engine according to the category.
Further, the timer thread includes a time acquisition function for acquiring a thread running time of the game engine; accordingly, the adjustment module 33 is specifically configured to, when adjusting the running speed of the game based on the timer thread and the speed adjustment parameter: reconstructing a time acquisition function in the timer thread based on the speed adjustment parameter; and feeding back the time value output by the time acquisition function after reconstruction to a main thread of the game so as to set the thread running time of the game engine to the time value output by the time acquisition function after reconstruction through the main thread.
Further, the adjustment module 33, when configured to reconstruct the time acquisition function in the timer thread based on the speed adjustment parameter, is specifically configured to: determining a time parameter in the time acquisition function; the time parameter is used for representing the acquired operating system time of the intelligent television; and taking the product value of the time parameter and the speed adjustment parameter as the time value output by the time acquisition function.
Further, the game is a mobile phone game transplanted to the smart television; the operating system of the intelligent television is an android system.
Further, the acquiring module 31, when configured to acquire a speed adjustment parameter input by a user for a running speed of a game running on the smart tv, is specifically configured to: and responding to the operation triggered by the user through the remote control device matched with the intelligent television, and acquiring the speed adjustment parameter input by the user for the running speed of the running game on the intelligent television.
What needs to be explained here is: the game running speed adjusting device provided in the foregoing embodiment may implement the technical solution described in the foregoing embodiment of the game running speed adjusting method shown in fig. 1, and the specific implementation principle of each module or unit may refer to the corresponding content in the foregoing embodiment of the game running speed adjusting method shown in fig. 1, which is not repeated herein.
Fig. 5 shows a schematic structural diagram of an intelligent television device according to an embodiment of the present application. The smart television device includes a processor 52 and a memory 51. Wherein the memory 51 is configured to store one or more computer instructions; the processor 52 is coupled to the memory 51 for one or more computer instructions (e.g., computer instructions implementing data storage logic) for implementing the steps of the various game play speed adjustment method embodiments described above.
The memory 51 may be implemented by any type of volatile or non-volatile memory device or combination thereof, such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disk.
Further, as shown in fig. 5, the electronic device further includes: communication component 53, display 54, power component 55, audio component 56, and other components. Only part of the components are schematically shown in fig. 5, which does not mean that the smart tv apparatus only comprises the components shown in fig. 5.
Yet another embodiment of the application provides a computer program product (not shown in the drawings of the specification). The computer program product comprises a computer program or instructions which, when executed by a processor, cause the processor to carry out the steps of the method embodiments described above.
Accordingly, embodiments of the present application also provide a computer-readable storage medium storing a computer program which, when executed by a computer, is capable of implementing the method steps or functions provided by the above embodiments.
From the above description of the embodiments, it will be apparent to those skilled in the art that the embodiments may be implemented by means of software plus necessary general hardware platforms, or of course may be implemented by means of hardware. Based on this understanding, the foregoing technical solution may be embodied essentially or in a part contributing to the prior art in the form of a software product, which may be stored in a computer readable storage medium, such as ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method described in the respective embodiments or some parts of the embodiments.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present application, and are not limiting; although the application has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present application.