Mobile game recording and replaying method, system, terminal and medium

By acquiring and processing user input data from mobile devices, low-latency recording and playback of mobile games on different devices is achieved, which solves device compatibility and latency problems in the existing technology and improves the efficiency of automated testing.

CN114003490BActive Publication Date: 2024-08-23SHANGHAI JIAOTONG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111183210.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-11
Publication Date
2024-08-23
Estimated Expiration
2041-10-11

AI Technical Summary

Technical Problem

Existing technology makes it difficult to achieve low-latency recording and playback of mobile games on different devices and system versions, especially games based on self-rendering components. Traditional methods have compatibility issues and high latency.

Method used

By obtaining the basic information of the device and user input data, the touch screen input data is filtered and processed, converted into absolute coordinates, and adapted according to the device orientation and resolution, using the same aspect ratio and uniform/non-uniform scaling time mechanism to generate Adapted input events enable low-latency replay on different devices.

Benefits of technology

It achieves low-latency recording and playback on devices with the same aspect ratio, is suitable for mobile games, improves the automation of compatibility testing and stress testing, and saves labor costs and time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114003490B
    Figure CN114003490B
Patent Text Reader

Abstract

The present invention provides a method and system for recording and replaying mobile games, which obtains basic information of a recording device and user input data of a recording device node; processes touch screen input data in the user input data, obtains screen coordinates in the current direction, generates corresponding input events and writes corresponding files to generate non-adapted user input data, and completes recording user operations; adopts the same aspect ratio adaptation mechanism, uniform scaling time mechanism, and non-uniform scaling time mechanism to respectively generate adapted user input description files, selectively rewrites input events in the user input description files into the replay device node, and the replay device reads data from the replay device node to implement replay operations. The present invention also provides a corresponding terminal and medium. The present invention realizes the recording and replay of low-latency mobile games, and further realizes the high automation of compatibility testing and stress testing of mobile games, saving labor costs and time costs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of mobile application software (App), and in particular to a low-latency mobile game recording and replaying method, system, terminal and medium. Background Art

[0002] With the popularity of smart terminals, the mobile game market has also ushered in a booming development. Different types of mobile games have sprung up like mushrooms after a rain, with billions of downloads. Mobile games have become one of the mainstream leisure and entertainment methods for people. At the same time, the customization of the Android system by major mobile phone manufacturers has caused widespread differences between different brands, different models and different system versions. In order to provide a good user experience, mobile games need to undergo compatibility testing to ensure that the game can run normally on different brands, different models and different system versions. In addition, for games, front-end stress testing is also essential to simulate high-speed user input to ensure the stability of important indicators such as FPS. There are a lot of repeated operations in these tests. Traditional manual testing requires a lot of manpower and time, and can no longer meet the requirements of rapid version iteration.

[0003] Some existing academic research and solutions for recording and replaying mobile applications, such as SARA (Self-ReplayAugmented Record and Replay for Android in Industrial Cases) and RANDR (Record and Replay for Android Apps via Targeted Runtime Instrumentation), are based on the Android framework and implement recording and replaying by intercepting user input at the Android framework layer. However, mobile games are basically based on self-rendering components, so these recording and replay solutions based on the Android framework layer are not suitable for mobile games.

[0004] After searching, we found:

[0005] The Chinese invention patent "Mobile Application Automated Testing Device and Method" with authorization announcement number CN104407980B simply obtains coordinates through getevent without any conversion, which will cause replay failure on devices with different resolutions.

[0006] The Chinese invention patent "Application Testing Method, Device and System" with authorization announcement number CN104866414B has solved the problem of playback on devices with different resolutions to a certain extent through image recognition, but screenshots need to be analyzed and compared during the recording and playback process, which may cause higher latency.

[0007] The Chinese invention patent "An automatic testing method for Android device software" with authorization announcement number CN102841845B records user input by obtaining the horizontal and vertical coordinates of the user input by covering a transparent View on the interface. However, this is a capability provided by the Android application layer framework and is not suitable for mobile games that use self-rendering components. In addition, this method can only be recorded and replayed on the same device. Summary of the invention

[0008] In view of the above-mentioned deficiencies in the prior art, the present invention provides a mobile game recording and replaying method, system, terminal and medium, which can complete the recording of game operations on a device and realize low-latency replay operations on devices of the same size.

[0009] According to one aspect of the present invention, a mobile game recording and replaying method is provided, comprising:

[0010] Get basic information of recording device;

[0011] Get the user input data of the recording device node;

[0012] Based on the user input data, screen touch input data in the user input data is filtered out, and the touch input data is processed according to the basic information of the recording device to obtain original data of the user touch input;

[0013] According to the original data input by the user through the touch screen, the absolute coordinates relative to the touch point are acquired, and the absolute coordinates relative to the touch point are converted into screen coordinates in a default direction;

[0014] Convert the screen coordinates in the default direction according to the actual direction of the recording device to obtain the screen coordinates in the current direction;

[0015] Generate corresponding input events using the screen coordinates in the current direction and write them into corresponding files to generate unadapted user input data, thereby recording user operations;

[0016] Adapting the unadapted user input data to a playback device with a different resolution but the same aspect ratio by using a same aspect ratio adaptation mechanism;

[0017] Using a uniform scaling time mechanism to control the playback speed of the unadapted user input data;

[0018] Using a non-uniform scaling time mechanism to control the replay time interval of the non-adapted user input data;

[0019] According to the basic information of the playback device and user needs, an adapted user input description file generated after corresponding processing of the non-adapted user input data is obtained, and the input events in the user input description file are selectively rewritten into the playback device node as needed. The playback device reads data from the playback device node to replay user operations.

[0020] Preferably, the basic information of the recording device includes: the height and width of the device display screen and the type of multi-touch protocol supported by the device.

[0021] Preferably, the user input data of the recording device node is obtained through an adb shell getevent command; wherein the obtained user input data includes: a timestamp of generating the user input data, recording device node information, event type, event code and event value.

[0022] Preferably, the original data of the user's touch screen input obtained according to the basic information of the recording device includes:

[0023] The basic information of the recording device includes: the type of multi-touch protocol supported by the device;

[0024] The obtained original data of the user's touch screen input includes:

[0025] For devices supporting the TypeA protocol, the user touch screen input raw data includes: the X-axis coordinate value of the center point of the ellipse shape of the touch point, the Y-axis coordinate value of the center point of the ellipse shape of the touch point, the pressure value of the current touch area and the length value of the long axis of the touch point, and the timestamp of the event occurrence;

[0026] For devices that support the TypeB protocol, the user touch screen input raw data includes: the X-axis coordinate value of the center point of the touch point ellipse shape, the Y-axis coordinate value of the center point of the touch point ellipse shape, the pressure value of the current touch area, the length value of the long axis of the touch point, the touch point marking data, and the timestamp of the event.

[0027] Preferably, the screen coordinates in the default direction are the screen coordinates in the default direction required by MotionEvent.

[0028] Preferably, generating a corresponding input event using the screen coordinates in the current direction and writing it into a corresponding file includes:

[0029] Using the screen coordinates in the current direction, the corresponding MotionEvent is generated and written into the corresponding json file; for devices that support the TypeA protocol, the MotionEvent is directly written into the file; for devices that support the TypeB protocol, the MotionEvent is separated into data of different touch points according to the touch point identification data, and finally the separated MotionEvent is divided into several parts and written into the file.

[0030] Preferably, the step of selectively rewriting the input events in the user input description file into the playback device node as required comprises:

[0031] The minitouch command is used to selectively rewrite the MotionEvent in the user input description file into the playback device node.

[0032] Preferably, the default direction is a bottom-down direction.

[0033] Preferably, the same aspect ratio adaptation mechanism includes:

[0034] Get the four coordinates of the touch point of the playback device and record them as xmin, xmax, ymin, ymax respectively;

[0035] Obtain the screen height and width from the basic information of the recording device, and record them as width and height respectively;

[0036] Get the screen coordinates of the current direction and record them as (x, y);

[0037] but:

[0038] Get the horizontal coordinate of the playback device:

[0039] X=x*(xmax-xmin+1) / width+xmin;

[0040] Get the vertical coordinate of the playback device:

[0041] Y=y*(ymax-ymin+1) / height+ymin.

[0042] Preferably, the uniform scaling time mechanism comprises:

[0043] Allows the user to input a time scaling parameter;

[0044] Obtaining a timestamp of the user input data generated from the user input data of the recording device node, and multiplying the timestamp by the time scaling factor to obtain a new timestamp;

[0045] Events are sent according to the new timestamp to control the replay speed of the data.

[0046] Preferably, the non-uniform scaling time mechanism comprises:

[0047] Different operations are distinguished by identifying the touch instructions of the events, and the time intervals between different operations are controlled by changing the timestamps of the touch instructions, while the relative time intervals between input events within one operation remain unchanged.

[0048] According to another aspect of the present invention, a mobile game recording and replaying system is provided, comprising:

[0049] A basic information acquisition module, which acquires basic information of the recording device and user input data of the recording device node;

[0050] A touch screen input data acquisition module, which filters out the touch screen input data from the user input data based on the user input data, and processes the touch screen input data according to the basic information of the recording device to obtain the original data of the user touch screen input;

[0051] A module for recording user operations, which obtains the absolute coordinates relative to the touch point according to the original data of the user's touch screen input, and converts the absolute coordinates relative to the touch point into screen coordinates in a default direction; converts the screen coordinates in the default direction according to the direction of the recording device to obtain the screen coordinates in the current direction; generates corresponding input events using the screen coordinates in the current direction and writes them into corresponding files to generate non-adapted user input data, thereby recording user operations;

[0052] Data adaptation module, which uses the same aspect ratio adaptation mechanism to adapt the unadapted user input data to playback devices with different resolutions but the same aspect ratio; uses a uniform scaling time mechanism to control the playback speed of the unadapted user input data; and uses a non-uniform scaling time mechanism to control the playback time interval of the unadapted user input data;

[0053] A replay user operation module obtains an adapted user input description file generated by correspondingly processing the non-adapted user input data according to the basic information of the replay device and user needs, and selectively rewrites the input events in the user input description file into the replay device node as needed. The replay device reads data from the replay device node to realize the replay of user operations.

[0054] According to a third aspect of the present invention, there is provided a terminal comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor can be used to execute any of the above-mentioned methods or to run the above-mentioned system when executing the program.

[0055] According to a fourth aspect of the present invention, there is provided a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, can be used to execute any of the above methods, or to run the above system.

[0056] Due to the adoption of the above technical solution, the present invention has at least one of the following beneficial effects compared with the prior art:

[0057] The mobile game recording and replaying method, system, terminal and medium provided by the present invention is a technical solution for intercepting user input at the system kernel level to realize recording and replaying, which is not only applicable to general mobile applications, but also to mobile games.

[0058] The mobile game recording and replaying method, system, terminal and medium provided by the present invention have the ability to record and replay on devices with the same aspect ratio and control the replay speed according to user input.

[0059] The mobile game recording and replaying method, system, terminal and medium provided by the present invention can realize the recording and replay of low-latency mobile games, thereby realizing high automation of compatibility testing and stress testing of mobile games, thereby greatly saving labor costs and time costs. BRIEF DESCRIPTION OF THE DRAWINGS

[0060] Other features, objects and advantages of the present invention will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:

[0061] Figure 1 This is a workflow diagram of a mobile game recording and replaying method in one embodiment of the present invention.

[0062] Figure 2 This is a workflow diagram of a mobile game recording and replaying method in a preferred embodiment of the present invention.

[0063] Figure 3 Schematic diagram of the components of a mobile game recording and replay system in one embodiment of the present invention. DETAILED DESCRIPTION

[0064] The following is a detailed description of the embodiments of the present invention: This embodiment is implemented on the premise of the technical solution of the present invention, and a detailed implementation method and a specific operation process are given. It should be pointed out that for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present invention, which all belong to the protection scope of the present invention.

[0065] Figure 1 A flowchart of a mobile game recording and replaying method provided in accordance with an embodiment of the present invention.

[0066] like Figure 1 As shown, the mobile game recording and replaying method provided by this embodiment may include the following steps:

[0067] S100, obtaining basic information of the recording device;

[0068] S200, obtaining user input data of a recording device node;

[0069] S300, based on the user input data, filtering out the touch screen input data in the user input data, and processing the touch screen input data according to the basic information of the recording device to obtain the original data of the user touch screen input;

[0070] S400, acquiring the absolute coordinates relative to the touch point according to the original data input by the user through the touch screen, and converting the absolute coordinates relative to the touch point into the screen coordinates in the default direction;

[0071] S500, converting the screen coordinates in the default direction according to the actual direction of the recording device to obtain the screen coordinates in the current direction;

[0072] S600, using the screen coordinates in the current direction to generate a corresponding input event and write it into a corresponding file to generate unadapted user input data, thereby recording the user operation;

[0073] S700, using the same aspect ratio adaptation mechanism, adapts the unadapted user input data to a playback device with a different resolution but the same aspect ratio;

[0074] S800, uses a uniform scaling time mechanism to control the playback speed of unadapted user input data;

[0075] S900, adopting a non-uniform scaling time mechanism to control the playback time interval of the unadapted user input data;

[0076] SX00, according to the basic information of the playback device and user needs, obtains the adapted user input description file generated by corresponding processing of the unadapted user input data, and selectively rewrites the input events in the user input description file into the playback device node as needed. The playback device reads data from the playback device node to replay user operations.

[0077] In this embodiment, the order of steps S100 to S200 and S700 to S900 is not limited.

[0078] In S100 of this embodiment, as a preferred embodiment, the basic information of the recording device includes: the height and width of the device display screen and the type of multi-touch protocol supported by the device.

[0079] In S200 of this embodiment, as a preferred embodiment, the user input data of the recording device node is obtained through the adbshell getevent command; wherein the obtained user input data includes: the timestamp of generating the user input data, the recording device node information, the event type, the event code and the value of the event.

[0080] In S300 of this embodiment, as a preferred embodiment, the original data of the user's touch screen input is obtained according to the basic information of the recording device, including:

[0081] Basic information about the recording device, including: the type of multi-touch protocol supported by the device;

[0082] The original data of user touch screen input is obtained, including:

[0083] For devices that support the TypeA protocol, the raw data input by the user on the touch screen includes: the X-axis coordinate value of the center point of the ellipse shape of the touch point, the Y-axis coordinate value of the center point of the ellipse shape of the touch point, the pressure value of the current touch area, the length value of the long axis of the touch point, and the timestamp of the event occurrence;

[0084] For devices that support the Type B protocol, the original data input by the user on the touch screen includes: the X-axis coordinate value of the center point of the ellipse shape of the touch point, the Y-axis coordinate value of the center point of the ellipse shape of the touch point, the pressure value of the current touch area, the length value of the long axis of the touch point, the touch point marking data, and the timestamp of the event.

[0085] In the preferred embodiment, the touch point is described as an ellipse under the Linux system.

[0086] In S400 of this embodiment, as a preferred embodiment, the screen coordinates in the default direction are the screen coordinates in the default direction required by the MotionEvent.

[0087] In S400 of this embodiment, as a preferred embodiment, the default direction is the bottom-down direction.

[0088] In S600 of this embodiment, as a preferred embodiment, the corresponding input event is generated using the screen coordinates in the current direction and written into the corresponding file, including:

[0089] Use the screen coordinates in the current direction to generate the corresponding MotionEvent and write it into the corresponding json file; for devices that support the TypeA protocol, write the MotionEvent directly to the file; for devices that support the TypeB protocol, separate the MotionEvent into data of different touch points according to the touch point identification data, and finally divide the separated MotionEvent into several parts and write them into the file.

[0090] In the preferred embodiment, the json file is used to record the input event MotionEvent adjusted according to the screen direction.

[0091] In S700 of this embodiment, as a preferred embodiment, the same aspect ratio adaptation mechanism includes:

[0092] Get the four-point coordinates of the touch point of the playback device and record them as xmin, xmax, ymin, ymax respectively;

[0093] Get the screen height and width from the basic information of the recording device and record them as width and height respectively;

[0094] Get the screen coordinates of the current direction and record them as (x, y);

[0095] but:

[0096] Get the horizontal coordinate of the playback device:

[0097] X=x*(xmax-xmin+1) / width+xmin;

[0098] Get the vertical coordinate of the playback device:

[0099] Y=y*(ymax-ymin+1) / height+ymin.

[0100] In S800 of this embodiment, as a preferred embodiment, the uniform scaling time mechanism includes:

[0101] Allows the user to input a time scaling parameter;

[0102] Obtain the timestamp of the user input data generated in the user input data of the recording device node, and multiply it by the time scaling factor to obtain a new timestamp;

[0103] Send events based on new timestamps to control the speed at which data is replayed.

[0104] In S900 of this embodiment, as a preferred embodiment, the non-uniform scaling time mechanism includes:

[0105] Different operations are distinguished by identifying the touch instructions of the events, and the time intervals between different operations are controlled by changing the timestamps of the touch instructions, while the relative time intervals between input events within one operation remain unchanged.

[0106] In this preferred embodiment, the touch command (touch action) may include: one ACTION_DOWN, one ACTION_UP and several ACTION_MOVE; each of which has a timestamp. By changing the timestamp of ACTION_DOWN, the time interval between different actions can be controlled; by changing the timestamps of ACTION_MOVE and ACTION_UP, the time to complete an action can be controlled to remain unchanged.

[0107] In SX00 of this embodiment, as a preferred embodiment, the selective input event in the user input description file is rewritten into the playback device node as needed, including:

[0108] Use the minitouch command to selectively rewrite the MotionEvent in the user input description file into the playback device node.

[0109] In the preferred embodiment, the three adaptation files are selectively rewritten as needed. In some embodiments of the present invention, in response to the user's touch screen input, the selected adaptation file is written into a device node.

[0110] Figure 2 A flowchart of a mobile game recording and replaying method provided for a preferred embodiment of the present invention.

[0111] like Figure 2 As shown, the mobile game recording and replaying method provided by the preferred embodiment includes two parts: recording and replaying; wherein:

[0112] The recording part includes the following steps:

[0113] S1, obtaining basic information of the recording device (such as a mobile phone recording user input), such as the height and width of the device display screen and the type of multi-touch protocol supported by the device;

[0114] S2, obtain the user input data of the recording device node through the adb shell getevent command. The structure of the user input data is as follows: [1264.453489] / dev / input / event0:0001 0074 00000001, where [1264.453489] is the timestamp of generating the user input data, / dev / input / event0 is the recording device node, 0001, 0074 and 00000001 are all hexadecimal numbers, representing the event type, event code and event value respectively;

[0115] S3, filtering out the touch screen input data of the user input data obtained in S2, and then parsing and converting the data according to the type of multi-touch protocol supported by the recording device obtained in S1 to obtain the original data of the user touch screen input; wherein:

[0116] For devices that support the TypeA protocol, it is necessary to obtain the data of BS_MTPOSITION_X, ABS_MT_POSITION_Y, ABS_MT_PRESSURE, and ABS_MT_TOUCH_MAJOR mentioned in Table 1 and the timestamp of the event occurrence;

[0117] For devices that support the Type B protocol, in addition to obtaining the data of ABS_MTPOSITION_X, ABS_MT_POSITION_Y, ABS_MT_PRESSURE, and ABS_MT_TOUCH_MAJOR, it is also necessary to obtain ABS_MT_TRACKING_ID to identify each touch point. When the user performs multi-finger operation, each finger corresponds to an ABS_MT_TRACKING_ID, and the timestamp of the event also needs to be obtained;

[0118] S4, converting the absolute coordinates ABS_MTPOSITION_X and ABS_MT_POSITION_Y relative to the touch element (ie, the touch point) obtained in S3 into screen coordinates required by a more advanced MotionEvent;

[0119] S5, converting the default coordinates (i.e., bottom downward) obtained in S4 according to the direction of the recording device (such as a mobile phone) to obtain the horizontal coordinate and the vertical coordinate of the MotionEvent in the current direction;

[0120] S6, using the coordinates converted in S5 to generate the corresponding MotionEvent and write it into a file to generate unadapted user input data;

[0121] The replay part includes the following steps:

[0122] S7, using the same aspect ratio adaptation mechanism to adapt the unadapted user input data to a playback device with a different resolution but the same aspect ratio (e.g., a smartphone device);

[0123] S8, adopts a uniform scaling time mechanism to control the playback speed of the unadapted user input data;

[0124] S9, adopts a non-uniform scaling time mechanism to control the replay interval of the unadapted user input data;

[0125] S10, according to the basic information of the playback device and the needs of the user, read the adapted user input description file generated by the corresponding processing of the non-adapted user input data obtained in S6 in S7, S8 and S9, use minitouch to rewrite the MotionEvent into the playback device node, and the playback device will read the data from the playback device node to replay the user operation.

[0126] All current smart phones support multi-touch, and Android is based on the Linux system. The Linux system supports two multi-touch protocols based on hardware differences, namely the TypeA protocol that does not distinguish between touch points and the TypeB protocol that distinguishes between touch points. The difference between the two is that the TypeA protocol will pass all original data to the receiver, while the TypeB protocol will update the data of each touch point separately. In this preferred embodiment, the meaning of the parameters describing the user's touch screen input in the involved protocols is shown in Table 1 below.

[0127] Table 1 Multi-touch protocol parameter explanation

[0128] Parameter Type describe ABS_MT_POSITION_X X-axis coordinate value of the center point of the ellipse shape of the touch point ABS_MT_POSITION_Y Y-axis coordinate value of the center point of the ellipse shape of the touch point ABS_MT_PRESSURE The current touch area pressure, in arbitrary units ABS_MT_TOUCH_MAJOR The length of the long axis of the touch point ABS_MT_TRACKING_ID Mark a touch point

[0129] Therefore, in S1 of the preferred embodiment, as a preferred embodiment, firstly, the four-point coordinates of the touch element (i.e., the touch point) of the mobile phone are obtained through adb shellgetevent-p, which are recorded as xmin, xmax, ymin, ymax, respectively, and the height and width of the mobile phone screen are recorded as width and height, and the ABS_MTPOSITION_X obtained in S3 is recorded as x, and the ABS_MT_POSITION_Y is recorded as y. Then the horizontal coordinate based on the screen can be converted by (x-xmin)*width / (xmax-xmin+1), and the vertical coordinate based on the screen can be converted by (y-ymin)*height / (ymax-ymin+1).

[0130] Today's smartphones all support automatic flipping, and most mobile games require horizontal screen operation. However, for the same point on the display, the coordinates of the MotionEvent are not the same when the smartphone is facing up, down, left, or right.

[0131] Therefore, in S5 of the preferred embodiment, as a preferred embodiment, it is first necessary to obtain the width and height of the mobile phone screen, which are recorded as width and height. In the default state, the horizontal coordinate of MotionEvent is marked as x and the vertical coordinate is marked as y. When the left side of the mobile phone is downward, the horizontal coordinate is converted to y, and the vertical coordinate is converted to width-x. When the upper side of the mobile phone is downward, the horizontal coordinate is converted to width-x, and the vertical coordinate is converted to height-y. When the right side of the mobile phone is downward, the horizontal coordinate is converted to height-y, and the vertical coordinate is converted to x.

[0132] In S6 of the preferred embodiment, as a preferred embodiment, MotionEvent is processed according to the multi-touch protocol type supported by the device obtained in S1. For the TypeA protocol, since different touch points are not distinguished, MotionEvent is directly written into the file, while the TypeB protocol supports distinguishing different touch points, so the data of different touch points are separated according to ABS_MT_TRACKING_ID, and finally the separated MotionEvent is divided into several parts and written into the file.

[0133] Due to the fragmentation of Android smartphones, various screen sizes emerge in an endless stream, but for aesthetic and user experience considerations, most smartphones follow several mainstream aspect ratios, such as 16:9, 19:9 and 20:9, etc. The present invention implements a same aspect ratio adaptation mechanism, which can record on one device and replay on smartphone devices with different resolutions but the same aspect ratio.

[0134] Therefore, in S7 of the preferred embodiment, as a preferred embodiment, the coordinates of the four points of the touch element (i.e., the touch point) of the playback device obtained by the aspect ratio adaptation mechanism are recorded as xmin, xmax, ymin, and ymax, the screen height and width of the recording mobile phone are recorded as width and height, and the coordinates of the MotionEvent obtained by conversion in S5 are recorded as x and y. The horizontal coordinate based on the playback device can be obtained by converting x*(xmax-xmin+1) / width+xmin, and the vertical coordinate can be obtained by converting y*(ymax-ymin+1) / height+ymin.

[0135] For mobile games, the stability of FPS under high-frequency operations is an important indicator to ensure user experience, so front-end stress testing is required. At the same time, mobile games often have very complex operations that need to be completed at high speed, which is difficult for testers to reproduce. The present invention can control the replay speed through a uniform time scaling mechanism.

[0136] Therefore, in S8 of the preferred embodiment, as a preferred embodiment, the uniform time scaling mechanism supports the user to input a time scaling parameter, multiplies the timestamp obtained in S2 by the time scaling factor to obtain a new timestamp, and sends events according to this timestamp during playback, thereby achieving the effect of controlling the overall playback speed.

[0137] This preferred embodiment not only supports speed scaling at the MotionEvent level, but also implements a non-uniform scaling time mechanism to support speed scaling at the operation action level, for example, it can control the time interval between two operations of clicking a page after a slide. There are many types of MotionEvent in the Android system, and a touch screen operation will generate an event stream containing multiple MotionEvents. Under normal circumstances, the event stream will start with an ACTION_DOWN event, contain multiple ACTION_MOVE events in the middle, and end with an ACTION_UP event.

[0138] Therefore, in S9 of the preferred embodiment, as a preferred embodiment, the non-uniform scaling time mechanism distinguishes different operations by identifying ACTION_DOWN and ACTION_UP, and controls the time interval between actions by changing the timestamp, while the relative time interval between MotionEvents within an action remains unchanged. Due to the fragmentation of Android smartphones, there are large differences in hardware between different devices, and the response time to user touch screen operations is also different. In order to record on one device and replay on different devices, the time interval of operations is controlled to be compatible with the time of different devices. For devices with poor hardware, the time interval between operations is extended to avoid replay failure.

[0139] Figure 3 A schematic diagram of the components of a mobile game recording and replay system provided in one embodiment of the present invention.

[0140] like Figure 3 As shown, the mobile game recording and replaying system provided by this embodiment may include the following modules:

[0141] A basic information acquisition module, which acquires basic information of the recording device and user input data of the recording device node;

[0142] A touch screen input data acquisition module, which filters out the touch screen input data from the user input data based on the user input data, and processes the touch screen input data according to the basic information of the recording device to obtain the original data of the user's touch screen input;

[0143] A module for recording user operations, which obtains the absolute coordinates relative to the touch point according to the original data input by the user on the touch screen, and converts the absolute coordinates relative to the touch point into the screen coordinates in the default direction; converts the screen coordinates in the default direction according to the direction of the recording device to obtain the screen coordinates in the current direction; generates the corresponding input events using the screen coordinates in the current direction and writes them into a file to generate the non-adapted user input data, thereby recording the user operation;

[0144] Data adaptation module, which uses the same aspect ratio adaptation mechanism to adapt the unadapted user input data to playback devices with different resolutions but the same aspect ratio; uses a uniform scaling time mechanism to control the playback speed of the unadapted user input data; and uses a non-uniform scaling time mechanism to control the playback time interval of the unadapted user input data;

[0145] The replay user operation module obtains the adapted user input description file generated by corresponding processing of the non-adapted user input data according to the basic information of the replay device and user needs, rewrites the input events in the user input description file into the replay device node, and the replay device reads data from the replay device node to realize the replay of user operations.

[0146] It should be noted that the steps in the method provided by the present invention can be implemented by using corresponding modules, devices, units, etc. in the system. Those skilled in the art can refer to the technical solution of the method to realize the composition of the system, that is, the embodiments in the method can be understood as preferred examples for constructing the system, which will not be elaborated here.

[0147] An embodiment of the present invention provides a terminal, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it can be used to execute any method in the above embodiments of the present invention, or to run any system in the above embodiments.

[0148] An embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon. When the program is executed by a processor, it can be used to execute any method in the above embodiments of the present invention, or to run any system in the above embodiments.

[0149] In the above two embodiments, optionally, the memory is used to store programs; the memory may include volatile memory (English: volatile memory), such as random-access memory (English: random-access memory, abbreviated: RAM), such as static random-access memory (English: static random-access memory, abbreviated: SRAM), double data rate synchronous dynamic random access memory (English: Double Data Rate Synchronous Dynamic RandomAccess Memory, abbreviated: DDR SDRAM), etc.; the memory may also include non-volatile memory (English: non-volatile memory), such as flash memory (English: flash memory). The memory is used to store computer programs (such as applications, functional modules, etc. that implement the above methods), computer instructions, etc., and the above computer programs, computer instructions, etc. can be partitioned and stored in one or more memories. And the above computer programs, computer instructions, data, etc. can be called by the processor.

[0150] The above-mentioned computer programs, computer instructions, etc. may be stored in one or more memories in partitions, and the above-mentioned computer programs, computer instructions, data, etc. may be called by a processor.

[0151] The processor is used to execute the computer program stored in the memory to implement the various steps in the method involved in the above embodiment. For details, please refer to the relevant description in the above method embodiment.

[0152] The processor and the memory may be independent structures or integrated structures. When the processor and the memory are independent structures, the memory and the processor may be coupled and connected via a bus.

[0153] The mobile game recording and replaying method, system, terminal and medium provided by the above-mentioned embodiments of the present invention intercept the user input of the device node of the Linux input subsystem on one device, convert it into a higher-level MotionEvent, and finally replay the user operation on a different device. That is, it is possible to record game operations on one device and automatically replay these operations on different devices, thereby realizing the recording and replay of low-latency mobile games, and further realizing the high automation of compatibility testing and stress testing of mobile games, which greatly saves labor costs and time costs.

[0154] Those skilled in the art know that, in addition to implementing the system and its various devices provided by the present invention in a purely computer-readable program code, the system and its various devices provided by the present invention can be made to implement the same functions in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers by logically programming the method steps. Therefore, the system and its various devices provided by the present invention can be considered as a hardware component, and the devices for implementing various functions included therein can also be considered as structures within the hardware component; the devices for implementing various functions can also be considered as both software modules for implementing the method and structures within the hardware component.

[0155] The above describes the specific embodiments of the present invention. It should be understood that the present invention is not limited to the above specific embodiments, and those skilled in the art may make various modifications or variations within the scope of the claims, which do not affect the essence of the present invention.

Claims

1. A mobile game recording and replaying method, characterized in that: include: Get basic information of recording device; Get the user input data of the recording device node; Based on the user input data, screen touch input data in the user input data is filtered out, and the touch input data is processed according to the basic information of the recording device to obtain original data of the user touch input; According to the original data input by the user through the touch screen, the absolute coordinates relative to the touch point are acquired, and the absolute coordinates relative to the touch point are converted into screen coordinates in a default direction; Convert the screen coordinates in the default direction according to the actual direction of the recording device to obtain the screen coordinates in the current direction; Generate corresponding input events using the screen coordinates in the current direction and write them into corresponding files to generate unadapted user input data, thereby recording user operations; Adapting the unadapted user input data to a playback device with a different resolution but the same aspect ratio by using a same aspect ratio adaptation mechanism; Using a uniform scaling time mechanism to control the playback speed of the unadapted user input data; Using a non-uniform scaling time mechanism to control the replay time interval of the non-adapted user input data; According to the basic information of the playback device and the user's needs, an adapted user input description file generated by correspondingly processing the unadapted user input data is obtained, and the input events in the user input description file are selectively rewritten into the playback device node as needed, and the playback device reads data from the playback device node to achieve replay of the user operation; The same aspect ratio adaptation mechanism includes: Get the four coordinates of the touch point of the playback device and record them as xmin, xmax, ymin, ymax respectively; Obtain the screen height and width from the basic information of the recording device, and record them as width and height respectively; Get the screen coordinates of the current direction and record them as (x, y); but: Get the horizontal coordinate of the playback device: X=x*(xmax-xmin+1) / width+xmin; Get the vertical coordinate of the playback device: Y=y*(ymax-ymin+1) / height+ymin; The uniform scaling time mechanism comprises: Allows the user to input a time scaling parameter; Obtaining a timestamp of the user input data generated from the user input data of the recording device node, and multiplying the timestamp by the time scaling parameter to obtain a new timestamp; Sending events according to the new timestamp to control the replay speed of the data; The non-uniform scaling time mechanism comprises: Different operations are distinguished by identifying the touch instructions of the events, and the time intervals between different operations are controlled by changing the timestamps of the touch instructions, while the relative time intervals between input events within one operation remain unchanged.

2. The mobile game recording and replaying method according to claim 1, characterized in that: The basic information of the recording device includes: the height and width of the device display screen and the type of multi-touch protocol supported by the device.

3. The mobile game recording and replaying method according to claim 1, characterized in that: The user input data of the recording device node is obtained through the adb shell getevent command; wherein the obtained user input data includes: a timestamp of generating the user input data, recording device node information, event type, event code and event value.

4. The mobile game recording and replaying method according to claim 1, characterized in that: The original data of the user's touch screen input obtained according to the basic information of the recording device includes: The basic information of the recording device includes: the type of multi-touch protocol supported by the device; The obtained original data of the user's touch screen input includes: For devices supporting the TypeA protocol, the user touch screen input raw data includes: the X-axis coordinate value of the center point of the ellipse shape of the touch point, the Y-axis coordinate value of the center point of the ellipse shape of the touch point, the pressure value of the current touch area and the length value of the long axis of the touch point, and the timestamp of the event occurrence; For devices that support the TypeB protocol, the user touch screen input raw data includes: the X-axis coordinate value of the center point of the touch point ellipse shape, the Y-axis coordinate value of the center point of the touch point ellipse shape, the pressure value of the current touch area, the length value of the long axis of the touch point, the touch point marking data, and the timestamp of the event.

5. The mobile game recording and replaying method according to claim 1, characterized in that: The screen coordinates in the default direction are the screen coordinates in the default direction required by MotionEvent; Generate a corresponding input event using the screen coordinates in the current direction and write it into a corresponding file, including: generate a corresponding MotionEvent using the screen coordinates in the current direction and write it into a corresponding json file; wherein, for a device supporting the TypeA protocol, directly write the MotionEvent into a file; for a device supporting the TypeB protocol, separate the MotionEvent into data of different touch points according to the touch point marking data, and finally divide the separated MotionEvent into several parts and write them into a file; The step of selectively rewriting the input event in the user input description file into the replay device node as required comprises: selectively rewriting the MotionEvent in the user input description file into the replay device node using a minitouch instruction.

6. The mobile game recording and replaying method according to claim 1, characterized in that: The default direction is the bottom-down direction.

7. A mobile game recording and replaying system, characterized in that: include: A basic information acquisition module, which acquires basic information of the recording device and user input data of the recording device node; A touch screen input data acquisition module, which filters out the touch screen input data from the user input data based on the user input data, and processes the touch screen input data according to the basic information of the recording device to obtain the original data of the user touch screen input; A recording user operation module, which obtains the absolute coordinates relative to the touch point according to the original data input by the user on the touch screen, and converts the absolute coordinates relative to the touch point into screen coordinates in a default direction; converts the screen coordinates in the default direction according to the direction of the recording device to obtain the screen coordinates in the current direction; Generate corresponding input events using the screen coordinates in the current direction and write them into corresponding files to generate unadapted user input data, thereby recording user operations; A data adaptation module, which uses the same aspect ratio adaptation mechanism to adapt the unadapted user input data to a playback device with different resolution but the same aspect ratio; A uniform scaling time mechanism is used to control the playback speed of the data that is not adapted to the user input; a non-uniform scaling time mechanism is used to control the playback time interval of the data that is not adapted to the user input; A replay user operation module, which obtains an adapted user input description file generated by correspondingly processing the unadapted user input data according to the basic information of the replay device and the user's needs, and selectively rewrites the input events in the user input description file into the replay device node as needed, and the replay device reads data from the replay device node to realize the replay user operation; The same aspect ratio adaptation mechanism includes: Get the four coordinates of the touch point of the playback device and record them as xmin, xmax, ymin, ymax respectively; Obtain the screen height and width from the basic information of the recording device, and record them as width and height respectively; Get the screen coordinates of the current direction and record them as (x, y); but: Get the horizontal coordinate of the playback device: X=x*(xmax-xmin+1) / width+xmin; Get the vertical coordinate of the playback device: Y=y*(ymax-ymin+1) / height+ymin; The uniform scaling time mechanism comprises: Allows the user to input a time scaling parameter; Obtaining a timestamp of the user input data generated from the user input data of the recording device node, and multiplying the timestamp by the time scaling parameter to obtain a new timestamp; Sending events according to the new timestamp to control the replay speed of the data; The non-uniform scaling time mechanism comprises: Different operations are distinguished by identifying the touch instructions of the events, and the time intervals between different operations are controlled by changing the timestamps of the touch instructions, while the relative time intervals between input events within one operation remain unchanged.

8. A terminal comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, it can be used to execute the method described in any one of claims 1 to 6, or to run the system described in claim 7.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, it can be used to execute the method described in any one of claims 1 to 6, or to run the system described in claim 7.