Game testing method and related apparatus
Patent Information
- Application Number
- CN202111231952.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-21
- Publication Date
- 2026-09-22
- Estimated Expiration
- 2041-10-21
AI Technical Summary
[0002]当前,在对游戏进行测试时,需要针对每个游戏场景单独设计和开发相应的游戏测试逻辑,不仅需要投入大量的人力成本,而且通用性较差,无法快速覆盖对新场景的测试,也不适用于某些特定的游戏模式,导致测试效率十分低下
[0016]根据本申请实施例的一个方面,提供了一种电子设备,包括:一个或多个处理器;存储装置,用于存储一个或多个程序,当所述一个或多个程序被所述一个或多个处理器执行时,使得所述一个或多个处理器实现如上述实施例中所述的游戏测试方法。
Smart Images

Figure CN116010232B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of software testing technology, and more specifically, to a game testing method and related apparatus. Background Technology
[0002] Currently, when testing games, it is necessary to design and develop corresponding game testing logic separately for each game scenario. This not only requires a large investment of manpower, but also has poor versatility, cannot quickly cover the testing of new scenarios, and is not applicable to certain specific game modes, resulting in very low testing efficiency. Summary of the Invention
[0003] The embodiments of this application provide a game testing method and related apparatus, which can at least to some extent reduce testing costs and improve testing efficiency and versatility.
[0004] Other features and advantages of this application will become apparent from the following detailed description, or may be learned in part from practice of this application.
[0005] According to one aspect of the embodiments of this application, a game testing method is provided, the method comprising: recording the game during game runtime to obtain a mirror data packet corresponding to a data packet, wherein the data packet is received by the game from a server and the game responds according to the data packet; saving the mirror data packet to a local file; replaying the mirror data packet in the local file through the game so that the game responds according to the mirror data packet; and testing the game during the replay process.
[0006] According to one aspect of the embodiments of this application, a game testing apparatus is provided. The apparatus includes: a recording unit, configured to record the game during runtime to obtain a mirror data packet corresponding to a data packet, wherein the data packet is received by the game from a server, and the game responds according to the data packet; a saving unit, configured to save the mirror data packet to a local file; a playback unit, configured to play back the mirror data packet in the local file through the game, so that the game responds according to the mirror data packet; and a testing unit, configured to test the game during the playback process.
[0007] In some embodiments of this application, based on the foregoing scheme, the recording unit is configured to: record the game according to the received first administrator instruction during game runtime; before replaying the image data packet in the local file through the game, the playback unit is further configured to: read the local file according to the received second administrator instruction to obtain the image data packet.
[0008] In some embodiments of this application, based on the foregoing scheme, the storage unit is configured to: stop recording the game according to the received instructions from a third administrator, and save the image data packet to a local file.
[0009] In some embodiments of this application, based on the foregoing scheme, the playback unit is configured to: stop receiving data packets from the server according to the received second administrator instruction, and read the local file to obtain the mirror data packet.
[0010] In some embodiments of this application, based on the foregoing scheme, the data packet is a data packet under a specified protocol. Before replaying the mirror data packet in the local file through the game, the playback unit is further configured to: obtain the attribute field of the protocol object in the game as a first attribute field, and save the first attribute field to the local file; the playback unit is configured to: read the local file to obtain the first attribute field; obtain the attribute field of the current version of the game as a second attribute field; compare the first attribute field and the second attribute field to determine whether the second attribute field contains a newly added attribute field, wherein the newly added attribute field is an attribute field that is different from the first attribute field; when replaying the mirror data packet through the current version of the game, input the predetermined attribute value corresponding to the newly added attribute field into the current version of the game according to the fact that the second attribute field contains the newly added attribute field.
[0011] In some embodiments of this application, based on the foregoing scheme, the playback unit is configured to: obtain the attribute fields of the protocol object in the game through a reflection mechanism as the first attribute field; and obtain the attribute fields of the current version of the game through a reflection mechanism as the second attribute field.
[0012] In some embodiments of this application, based on the foregoing scheme, the storage unit is configured to: save the image data packet to memory; retrieve the image data packet from the memory and save the image data packet to a local file; before replaying the image data packet in the local file through the game, the playback unit is further configured to: read the local file into memory to obtain the image data packet.
[0013] In some embodiments of this application, based on the foregoing scheme, the storage unit is configured to: serialize the image data packet to save it to a local file; before replaying the image data packet in the local file through the game, the playback unit is further configured to: deserialize the local file to obtain the image data packet.
[0014] In some embodiments of this application, based on the foregoing scheme, the game is a game client or a game engine editor environment.
[0015] According to one aspect of the embodiments of this application, a computer-readable medium is provided having a computer program stored thereon, which, when executed by a processor, implements the game testing method as described in the above embodiments.
[0016] According to one aspect of the embodiments of this application, an electronic device is provided, including: one or more processors; and a storage device for storing one or more programs, which, when executed by the one or more processors, cause the one or more processors to implement the game testing method as described in the above embodiments.
[0017] In some embodiments of this application, the technical solutions provide that obtain and save the data packets received by the game in a mirrored manner during game runtime without affecting the normal operation of the game. After a game ends, the mirrored data packets are replayed through the game, and the game is tested during the replay process. Therefore, the technical solution of this application's embodiments records data packets from real games, and the testing is based on data packets in actual scenarios. This can accurately and precisely simulate real people for automated testing, significantly reducing manpower input and improving testing efficiency in scenarios requiring multiple real people for testing. At the same time, the entire solution does not require any modifications to the client or backend, and can quickly cover new scenario testing. In addition, this solution is applicable to game modes such as PVE that are not suitable for traditional testing methods, and it is simple to implement, highly versatile, and easy to use.
[0018] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description
[0019] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application. It is obvious that the drawings described below are merely some embodiments of this application, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort. In the drawings:
[0020] Figure 1 A schematic diagram of an exemplary system architecture to which the technical solutions of the embodiments of this application can be applied is shown; Figure 2 A flowchart of a game testing method according to an embodiment of this application is shown; Figure 3 An embodiment according to this application is shown. Figure 2 A flowchart detailing the steps preceding step 250 and step 210; Figure 4 An embodiment according to this application is shown. Figure 3 A flowchart detailing step 220 is provided. Figure 5 A flowchart illustrating an application game testing method according to an embodiment of this application is shown; Figure 6 A schematic diagram of a recording architecture according to an embodiment of this application is shown; Figure 7 A schematic diagram of a playback architecture according to an embodiment of this application is shown; Figure 8 An embodiment according to this application is shown. Figure 2 A flowchart detailing the steps preceding step 250 and the steps in step 250; Figure 9 A block diagram of a game testing apparatus according to an embodiment of this application is shown; Figure 10 A schematic diagram of the structure of a computer system suitable for implementing the electronic device of the present application is shown. Detailed Implementation
[0021] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided to make this application more comprehensive and complete, and to fully convey the concept of the exemplary embodiments to those skilled in the art.
[0022] Furthermore, the described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. Numerous specific details are provided in the following description to give a thorough understanding of embodiments of this application. However, those skilled in the art will recognize that the technical solutions of this application can be practiced without one or more of the specific details, or other methods, components, apparatuses, steps, etc., can be employed. In other instances, well-known methods, apparatuses, implementations, or operations are not shown or described in detail to avoid obscuring various aspects of this application.
[0023] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.
[0024] The flowcharts shown in the accompanying drawings are merely illustrative and do not necessarily include all content and operations / steps, nor do they necessarily have to be performed in the described order. For example, some operations / steps can be broken down, while others can be combined or partially combined; therefore, the actual execution order may change depending on the specific circumstances.
[0025] Game testing is an indispensable part of completing a game project. Whether it's a PC game or a mobile game, testing is necessary before it can be released. The following game testing solutions exist in relevant technologies: 1. Behavior Tree-Based AI (Artificial Intelligence): Developers design a complete set of AI behavior tree code, different from the game logic, which runs in the game background and synchronizes the AI's state information to the front end. This solution is only used on non-main character bots in a single game to interact with the main character and is not suitable for use on the main character.
[0026] This approach has at least the following drawbacks: (1) The implementation is complex, and the entire logic is independent of the game logic, requiring redesign and reimplementation.
[0027] (2) It runs in the background, independent of the client, and the client cannot use this framework.
[0028] (3) This framework is directly compiled into the version, and the cost of modification is very high.
[0029] 2. Coordinate-based Automation using GAutomator: This is a widely used in-game automation solution for FPS (First-person Shooter) games. Developed using the Unity automation component GAutomator, it sets the coordinates of the main character as they move, connecting these coordinates to form a path, and implementing combat and obstacle avoidance logic during movement. This solution requires secondary encapsulation of game interfaces, such as movement and obstacle avoidance, enemy detection, and shooting logic, into interfaces for GAutomator to call, thereby achieving in-game automation.
[0030] This approach has at least the following drawbacks: (1) The logic of walking and fighting must be custom developed and implemented, and it is difficult to refine the in-game operation.
[0031] (2) The execution efficiency is low and it is very different from the operation of real people, so it is not suitable for client performance testing.
[0032] (3) It is not conducive to the use of game modes such as PVE.
[0033] Therefore, this application first provides a game testing method. The game testing method provided by the embodiments of this application can overcome the above-mentioned defects. The game testing method provided by the embodiments of this application can not only perform more refined and accurate testing of the game implementation without the need for additional implementation of walking and combat logic, but also solves the problem that the coordinate point automatic scoring scheme is not suitable for PVE and other game modes. It has strong versatility. At the same time, the scheme is executed in the same way as real-person testing, and the testing effect can be comparable to real-person testing, making it suitable for client performance testing.
[0034] Figure 1 A schematic diagram of an exemplary system architecture to which the technical solutions of the embodiments of this application can be applied is shown.
[0035] like Figure 1 As shown, the system architecture may include mobile devices (such as...) Figure 1 The diagram shows a first mobile device 101, a second mobile device 102, and a third mobile device 103, a personal computer 104, and a cloud 105. Each mobile device is connected to the personal computer 104, and the personal computer 104 is connected to the cloud 105 via a communication link, enabling data transmission. In this embodiment, the mobile devices are the execution terminals for the game testing method provided in this application, and the mobile devices can be used by game developers or testers. The models of the mobile devices can be the same or different. When the game testing method provided in this application is applied... Figure 1 In the system architecture shown, a process can be as follows: First, the tester installs the client program of the game to be tested on at least one mobile device. This client program embeds program code capable of implementing the game testing method provided in this application embodiment. Next, the tester opens the game client program, enters a single game, and the client program records the game according to the embedded program code, obtains the data packets obtained by the client program during runtime in a mirror manner, and saves the data packets locally. Then, after the single game ends, the recording ends. Subsequently, the embedded program code enables the client program to replay the data packets. During this process, the client program is tested, and the test program on the personal computer 104 can obtain the test results sent by the mobile device. The personal computer 104 can display the test results. Finally, the personal computer 104 can also perform subsequent operations such as statistics and analysis on the test results reported by each mobile device.
[0036] In one embodiment of this application, after the tester enters a command to start recording in the game's client program, the client program begins recording; after the tester enters a command to start playback in the game's client program, the client program begins playback.
[0037] In one embodiment of this application, after a single game ends, the recording is also stopped by the client program according to the instruction to stop recording input by the tester.
[0038] In one embodiment of this application, each mobile device is connected to the personal computer 104 via WIFI or USB (Universal Serial Bus).
[0039] In one embodiment of this application, the data packets obtained by the client program are first saved to memory and then saved to a local file.
[0040] It should be understood that Figure 1 The number of mobile devices and personal computers shown is merely illustrative. Depending on the implementation requirements, any number of mobile devices and personal computers can be included. For example, personal computer 104 could be a computer cluster composed of multiple computers.
[0041] It should be noted that, Figure 1 The example shown is only one embodiment of this application, although in Figure 1 In this embodiment, the test results are sent from the mobile device to the personal computer 104. However, in other embodiments of this application, the corresponding test program can be directly installed on the mobile device, and the test results can be displayed directly on the mobile device through the test program's display interface. Figure 1 In this embodiment, the mobile device is a smartphone. However, in other embodiments of this application, the mobile device can also be a tablet computer, smartwatch, game console, or other types of terminal device. The mobile device can even be a laptop computer. Figure 1 In this embodiment, the test results are sent to the personal computer 104. However, in other embodiments of this application, the test results may also be sent to other types of terminal devices (such as servers), or even not sent at all, allowing the testers to observe the results directly. This application does not limit the scope of protection in any way, nor should it restrict the scope of protection of this application.
[0042] Furthermore, it is easy to understand that the game testing method provided in this application embodiment is generally executed by a mobile device, and correspondingly, the game testing device is generally located in the mobile device. However, in other embodiments of this application, fixed devices such as desktop computers may also have similar functions to mobile devices, thereby executing the game testing scheme provided in this application embodiment.
[0043] The test results obtained based on the game testing method provided in this application can be aggregated through a server. The server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. The terminal can be a smartphone, tablet, laptop, desktop computer, smart speaker, smartwatch, etc., but is not limited to these. The terminal and server can be directly or indirectly connected via wired or wireless communication, which is not limited herein.
[0044] This application's embodiments can be applied to cloud computing technology. Specifically, cloud computing technology can be used to collect test results obtained from testing games on various terminal devices. Cloud computing is a computing model that distributes computing tasks across a resource pool composed of a large number of computers, enabling various application systems to obtain computing power, storage space, and information services as needed. The network providing these resources is called the "cloud." From the user's perspective, the resources in the "cloud" are infinitely scalable, readily available, on-demand, expandable, and pay-as-you-go.
[0045] As a provider of fundamental cloud computing capabilities, a cloud resource pool (referred to as a cloud platform, generally called IaaS (Infrastructure as a Service)) platform is established. Various types of virtual resources are deployed in the resource pool for external customers to choose from. The cloud resource pool mainly includes: computing devices (virtualized machines containing operating systems), storage devices, and network devices.
[0046] Based on logical function, a PaaS (Platform as a Service) layer can be deployed on top of the IaaS (Infrastructure as a Service) layer, and a SaaS (Software as a Service) layer can be deployed on top of the PaaS layer. Alternatively, SaaS can be deployed directly on top of IaaS. PaaS is a platform for running software, such as databases and web containers. SaaS refers to various types of business software, such as web portals and bulk SMS senders. Generally speaking, SaaS and PaaS are upper layers compared to IaaS.
[0047] The implementation details of the technical solutions in the embodiments of this application are described in detail below: Figure 2 A flowchart of a game testing method according to an embodiment of this application is shown. This game testing method can be executed by a device with computing, storage, and display functions, such as... Figure 1 The mobile device shown. (Refer to...) Figure 2 As shown, this game testing method may include at least the following steps: In step 210, the game is recorded during runtime to obtain the mirror data packet corresponding to the data packet. The data packet is received by the game from the server, and the game responds based on the data packet.
[0048] The game mentioned here can be developed using various game engines, such as the Unity game engine. Unity is a cross-platform game engine that can be used to develop single-player games for Windows, macOS, and Linux platforms, as well as mobile games for iOS, Android, and other systems. The game's response based on data packets means that the game's execution flow, including screen loading and game object display, is based on data packets.
[0049] During game execution, testers can operate the game to enter specific game modes or game scenes, such as entering a specific game session, thereby recording the data packets obtained when the game interacts with the server.
[0050] In one embodiment of this application, the game is a game client or an editor environment for a game engine.
[0051] Specifically, when the game engine is Unity, the game can be played within the Unity editor environment. The game client can be a game application running on a mobile phone.
[0052] The server can be a game server, and the game can be any online game capable of interacting with the server. For example, based on the terminal on which the game is deployed, the game here can be a PC (Personal Computer) game or a mobile game; based on the game type, the game here can be an FPS (First-person Shooting) game, etc. The game can contain one or more game modes, such as a PVE (player versus environment) mode. Here, FPS games are first-person shooter games where shooting and operation are performed from the player's subjective perspective, offering a highly immersive experience; PVE is a game mode distinct from multiplayer (PVP) modes. PVE mode focuses on completing missions and levels, with each level having fixed completion conditions.
[0053] In one embodiment of this application, the game testing method is implemented through a plugin.
[0054] Specifically, a plugin can be installed on the terminal where the game to be tested is located, and the game testing method provided in this application embodiment can be executed through the plugin. In this application embodiment, the plugin can be easily deployed on various terminals that need to perform game testing, making it easy to apply to the testing of other games, greatly improving the versatility of the solution provided in this application embodiment.
[0055] A mirror data packet is a mirror image of the corresponding data packet; that is, a data packet and its corresponding mirror data packet are the same data packet.
[0056] A recording module can be set up in the game. When recording the game, the game continuously receives data packets from the server and simultaneously transmits the corresponding image data packets to the recording module.
[0057] Of course, in other embodiments of this application, the recording module may also be located outside the game and in other locations that can communicate with the game.
[0058] In step 220, the image data package is saved to a local file.
[0059] Local files are used to store image data packets and the raw data files used for replaying image data packets. Local files can be Bin files located in the local game directory, or other files that can be read through deserialization.
[0060] When the game is a PC game, local files can be stored on the hard drive.
[0061] In one embodiment of this application, the data packet is obtained by parsing the original data packet received by the game from the server.
[0062] The game and the server communicate using a specific network protocol. The raw data packets transmitted between them are encapsulated and therefore need to be parsed to obtain valid data packets. When replaying a local file containing mirrored data packets, there is no need to parse the raw data packets. A network module capable of parsing network protocol packets, which can be raw data packets, can be set up within the game.
[0063] Of course, in other embodiments of this application, the data packet can be the original data packet received by the game from the server. Since a network module can be configured in the game, even if the mirror data packet corresponding to the original data packet is saved to a local file, normal parsing of the local file can still be achieved.
[0064] In step 250, the game replays the mirror data packet in the local file so that the game responds based on the mirror data packet.
[0065] Replaying a game using a mirrored data packet refers to re-executing the game process based on the mirrored data packet.
[0066] Reading local files yields mirror data packets. As mentioned earlier, the game responds based on these packets, and since mirror data packets are identical to the original packets, the game can also respond based on them. Game responses can include actions such as walking and combat.
[0067] In one embodiment of this application, saving the image data packet to a local file includes: saving the image data packet to memory; retrieving the image data packet from memory and saving the image data packet to a local file; and before replaying the image data packet in the local file through the game, further including: reading the local file into memory to obtain the image data packet.
[0068] In this embodiment of the application, by using memory as an intermediary for saving and reading image data packets, the access speed of image data packets is greatly improved.
[0069] In one embodiment of this application, saving the image data packet to a local file includes: serializing the image data packet to save it to the local file; before playing back the image data packet in the local file through the game, the method further includes: deserializing the local file to obtain the image data packet.
[0070] In this embodiment of the application, the processing of image data packets is simplified by performing serialization and deserialization operations on the image data packets.
[0071] In step 260, the game is tested during the replay process.
[0072] The replay process is the running and operation process of the game. During the replay, various types of tests can be performed on the game, such as automated performance testing, automated smoke testing, and automated in-game logic function testing.
[0073] The time spent reading local files and replaying the image data package can be spaced out from the time the game is recorded. For example, the game can be recorded on the first day and the image data package can be replayed on the second day.
[0074] Figure 3 An embodiment according to this application is shown. Figure 2 A flowchart detailing the steps preceding step 250 and step 210. (See attached flowchart.) Figure 3 As shown, it includes the following steps: In step 210', the game is recorded during gameplay according to the first administrator instruction received.
[0075] Testers can trigger the game to record the game by entering the first administrator command in the game.
[0076] In step 230, the local file is read according to the received second administrator instruction to obtain the image data package.
[0077] Testers can trigger the game to read local files and perform operations based on the image data packet by entering the second administrator command in the game.
[0078] In one embodiment of this application, reading a local file to obtain a mirror data packet according to a received second administrator instruction includes: stopping receiving data packets from the server according to the received second administrator instruction, and reading a local file to obtain a mirror data packet.
[0079] Since the game replays the game based on the mirrored data packet after receiving it, continuing to receive data packets from the server at this time could cause game malfunctions. In this embodiment, by stopping the reception of data packets from the server before reading local files, the normal and orderly replay of the game is ensured.
[0080] Figure 4 An embodiment according to this application is shown. Figure 3 A flowchart detailing step 220 is provided. Please refer to the flowchart below. Figure 4 As shown, step 220 may specifically include the following steps: In step 220', according to the received third administrator instruction, the recording of the game is stopped and the image data package is saved to a local file.
[0081] Testers can trigger the end of game recording by entering a third-party administrator command in the game.
[0082] The first, second, and third administrator commands can be different. These administrator commands are GM (Game Master) commands, which can be entered through the game's user interface. For example, a game lobby can contain a chat box where GM commands can be entered. The game will then receive and automatically recognize and execute the corresponding actions based on the GM commands.
[0083] GM commands are debugging commands implemented in the game client code, used to create conditions required for testing, such as quickly adding bots, quickly increasing gold coins, or turning certain debugging switches on or off. GM commands are instructions that only game administrators can understand and input, and both game developers and game testers are also game administrators. In this embodiment, by triggering operations such as recording and stopping game recording and replaying local files according to GM commands, the game can be tested more flexibly without affecting its functionality. Furthermore, since ordinary people cannot obtain GM commands, the security of using these functions is also guaranteed.
[0084] Although the above embodiments use GM commands to trigger operations such as recording and stopping game recording, and replaying local files, these operations can also be triggered using various strategies based on pre-set programs, or by combining GM commands with programs. For example, game recording can be triggered at a specified time, stopped after a specified recording duration, and automatically replayed from local files after recording ends.
[0085] In one embodiment of this application, recording the game during gameplay includes: recording the game before the start of a game according to a first administrator instruction received; saving the mirror data packet to a local file includes: stopping the game recording and saving the mirror data packet to a local file when the game ends.
[0086] Specifically, in PVE mode, a game session can be considered a level within the game. A matchmaking system can be implemented, allowing multiple players to enter a single game together. In this embodiment, recording games on a session-by-session basis ensures flexibility in game testing.
[0087] Although in the above embodiments, saving the image data packet to a local file is performed after game recording has stopped, in other embodiments of this application, the image data packet can be saved in other ways. For example, it can be saved whenever an image data packet is acquired, or whenever the number of acquired image data packets reaches a specified number, or whenever the size of the acquired image data packets reaches a specified file size, etc.
[0088] Figure 5 A flowchart illustrating an application game testing method according to an embodiment of this application is shown. Figure 5 As shown, the specific steps may include: 1. Start the game.
[0089] The testers opened the game's client program.
[0090] 2. Start recording according to the GM's instructions.
[0091] The game's client program initiates the recording process based on GM instructions.
[0092] 3. Enter a single game.
[0093] Enter a single game through in-game matchmaking. At this time, the network module will receive data packets and transmit a copy of the data packets to the recording module.
[0094] 4. In-game battles.
[0095] Once the game enters a single round, the game proceeds normally. At this point, because the recording module transmits data packets via mirroring, it will not affect the execution of the game's main thread.
[0096] 5. Exit the game.
[0097] The game is over, exit.
[0098] 6. End recording according to GM instructions.
[0099] Enter the GM command again, and the game client program will stop the recording process according to the GM command. The recording module will automatically save the data packet to the local bin file.
[0100] 7. Replay the bin file according to the GM command.
[0101] Replaying the data packets in the bin file will restart the game from the initial steps of entering the game.
[0102] 8. End.
[0103] Figure 6A schematic diagram of a recording architecture according to an embodiment of this application is shown. Please refer to... Figure 6 As shown, first, the game client's main thread runs. Entering the Tick event within the main thread via GameNetClient.Tick, the game client's network module continuously listens for protocol events. Next, it receives the GM command to start the recording process via RecordState.Record. Then, it receives protocol packets from the server via GameNetClient.OnDataReceived. After receiving the protocol packets from the server, it parses them to obtain protocol data (packData). Simultaneously, it allocates memory via RecordManager.Record, saves the protocol data (packData) into a memory array, and then saves this memory data to a bin file (a file located locally on the phone). The bin file can then be replayed. During this process, since the protocol data is only forwarded twice, the game's main thread can still continue processing protocol packets, so the recording process does not affect the game's main thread.
[0104] Figure 7 A schematic diagram of a playback architecture according to an embodiment of this application is shown. Please see below. Figure 7 As shown, replay is also implemented on the client side. During the main thread of the game client, its network module continuously listens for protocol events. When the replay function is enabled using the GM command via RecordState.Replay, the game client's network module stops receiving protocol packets from the server. Simultaneously, the game client reads the bin file saved during the recording phase using RecordManager.TickReplay, loads the protocol data into memory, and then continuously inserts this protocol data into the main thread's ticks, simulating the process of the game client receiving protocol packets from the server and calling protocol response events. In this way, the originally recorded protocol packets can be completely replayed on the game client.
[0105] Figure 8 An embodiment according to this application is shown. Figure 2 A flowchart detailing the steps preceding step 250 and the specifics of step 250. Figure 8 In this embodiment, the data packet is a data packet under a specified protocol. This protocol is a communication method implemented for data interaction and communication between the game client and the backend server. Information such as the user's movement location, weapons and equipment, health, and survival status is transmitted within the protocol. Figure 8 As shown, the following steps may be included: In step 240, the attribute field of the protocol object in the game is obtained as the first attribute field, and the first attribute field is saved to a local file.
[0106] In other embodiments of this application, the first attribute field may also be saved to other locations.
[0107] Figure 2 Step 250 in the embodiment may specifically include the following steps: In step 251, the local file is read to obtain the first attribute field.
[0108] Since the first attribute field is saved to a local file, it can be obtained by reading the local file. The first attribute field can be a type of attribute field that includes multiple attribute fields.
[0109] In step 252, the attribute fields of the current version of the game are obtained and used as the second attribute field.
[0110] In one embodiment of this application, obtaining the attribute field of a protocol object in the game as a first attribute field includes: obtaining the attribute field of the protocol object in the game through a reflection mechanism as a first attribute field; obtaining the attribute field of the current version of the game as a second attribute field includes: obtaining the attribute field of the current version of the game through a reflection mechanism as a second attribute field.
[0111] The second attribute field is similar to the first attribute field and can also include multiple attribute fields, which may include the first attribute field.
[0112] Specifically, property fields can be obtained using the reflection mechanism provided by the C# language. Reflection is a technical framework within the C# programming language that allows the acquisition of information such as interfaces, classes, methods, fields, and properties within program code. It also enables the dynamic creation of instances of classes and the execution of their methods. This embodiment of the application obtains object properties using the reflection mechanism.
[0113] In step 253, the first attribute field and the second attribute field are compared to determine whether the second attribute field contains a newly added attribute field, wherein the newly added attribute field is an attribute field that is different from the first attribute field.
[0114] The predefined attribute value for a newly added attribute field can be 0, or it can be any other attribute value that does not affect game testing.
[0115] In step 254, when replaying the image data packet using the current version of the game, the predetermined attribute value corresponding to the newly added attribute field is input into the current version of the game, based on the fact that the second attribute field contains a newly added attribute field.
[0116] When the second attribute field does not contain the newly added attribute field, there is no need to input the predefined attribute value corresponding to the newly added attribute field into the current version of the game, that is, there is no need to execute step 254.
[0117] The current version of the game may differ from the version used during game recording; for example, the protocol may change, and protocol fields may also change. In this case, if playback is performed solely based on local files, it can easily lead to client freezes or crashes due to protocol parsing errors. In this embodiment, before replaying the mirror data packet, it is determined whether the attribute fields of the current version of the game contain any new fields. If the attribute fields of the current version of the game contain new fields, the corresponding attribute values are transmitted to the current version of the game. This avoids parsing failures caused by game version issues, expands the application scenarios of the overall solution, and improves the compatibility of the solution.
[0118] In one embodiment of this application, before reading the local file and obtaining the first attribute field, the method further includes: obtaining the first version number of the game when the game was recorded and the second version number of the current version of the game; determining whether the first version number and the second version number are consistent, wherein if the first version number and the second version number are inconsistent, the step of reading the local file to obtain the first attribute field and the subsequent steps are performed.
[0119] The game's version number can be obtained from the local logs. The first version number of the game can be saved to a local file when the game is recorded. Of course, in other embodiments of this application, the first version number of the game can also be saved to other locations at other times.
[0120] Since there may be many attribute fields, acquiring and comparing these fields is computationally intensive. In this embodiment, before acquiring the first and second attribute fields, it is first determined whether the version number of the current game version matches the version number of the game during recording. Only if they do not match is the attribute field acquired from the local file and the current game version, and then compared. Therefore, if the version number of the current game version matches the version number of the game during recording, the acquisition and comparison of attribute fields can be skipped directly, which improves computational efficiency and saves computational overhead to a certain extent.
[0121] In summary, the game testing method provided in this application can be applied to Unity-based mobile game projects and produces the following effects: (1) To realize the simulation of real human operation in the mobile phone environment, which can reduce the manpower input in scenarios that require multiple real human testers; (2) It can perform automated testing of real-person smoke in-game scenes and client performance testing, thereby improving testing efficiency; (3) Quickly cover new scenario testing without making any modifications to the client and backend; (4) Applicable to game modes such as PVE, with a wider testing scope and higher efficiency; (5) Currently, in the client performance test and daily smoke test scenarios of the Chinese version of Call of Duty Mobile, it can save at least 6 people per day per version.
[0122] The following describes an embodiment of the apparatus described in this application, which can be used to execute the game testing method described above. For details not disclosed in the apparatus embodiments of this application, please refer to the embodiments of the game testing method described above.
[0123] Figure 9 A block diagram of a game testing apparatus according to an embodiment of this application is shown.
[0124] Reference Figure 9 As shown, a game testing apparatus 900 according to an embodiment of this application includes: a recording unit 910, a saving unit 920, a playback unit 930, and a testing unit 940.
[0125] The recording unit 910 is used to record the game during gameplay to obtain a mirror data packet corresponding to the data packet, wherein the data packet is received by the game from the server and the game responds according to the data packet; the saving unit 920 is used to save the mirror data packet to a local file; the playback unit 930 is used to play back the mirror data packet in the local file through the game so that the game responds according to the mirror data packet; and the testing unit 940 is used to test the game during the playback process.
[0126] In some embodiments of this application, based on the foregoing scheme, the recording unit 910 is configured to: record the game according to the first administrator instruction received during game runtime; before replaying the image data packet in the local file through the game, the playback unit 930 is further configured to: read the local file according to the second administrator instruction received to obtain the image data packet.
[0127] In some embodiments of this application, based on the aforementioned scheme, the storage unit 920 is configured to: stop recording the game according to the received third administrator instruction, and save the image data packet to a local file.
[0128] In some embodiments of this application, based on the foregoing scheme, the playback unit 930 is configured to: stop receiving data packets from the server according to the received second administrator instruction, and read the local file to obtain the mirror data packet.
[0129] In some embodiments of this application, based on the foregoing scheme, the data packet is a data packet under a specified protocol. Before replaying the mirror data packet in the local file through the game, the playback unit 930 is further configured to: obtain the attribute field of the protocol object in the game as a first attribute field, and save the first attribute field to the local file; the playback unit 930 is configured to: read the local file to obtain the first attribute field; obtain the attribute field of the current version of the game as a second attribute field; compare the first attribute field and the second attribute field to determine whether the second attribute field contains a newly added attribute field, wherein the newly added attribute field is an attribute field that is different from the first attribute field; when replaying the mirror data packet through the current version of the game, input the predetermined attribute value corresponding to the newly added attribute field into the current version of the game according to the fact that the second attribute field contains the newly added attribute field.
[0130] In some embodiments of this application, based on the foregoing scheme, the playback unit 930 is configured to: obtain the attribute fields of the protocol object in the game through a reflection mechanism as the first attribute field; and obtain the attribute fields of the current version of the game through a reflection mechanism as the second attribute field.
[0131] In some embodiments of this application, based on the foregoing scheme, the storage unit 920 is configured to: save the image data packet to memory; retrieve the image data packet from the memory and save the image data packet to a local file; before replaying the image data packet in the local file through the game, the playback unit 930 is further configured to: read the local file into memory to obtain the image data packet.
[0132] In some embodiments of this application, based on the foregoing scheme, the storage unit 920 is configured to: serialize the image data packet to save it to a local file; before replaying the image data packet in the local file through the game, the playback unit 930 is further configured to: deserialize the local file to obtain the image data packet.
[0133] In some embodiments of this application, based on the foregoing scheme, the game is a game client or a game engine editor environment.
[0134] Figure 10A schematic diagram of the structure of a computer system suitable for implementing the electronic device of the present application is shown.
[0135] It should be noted that, Figure 10 The computer system 1000 of the electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0136] like Figure 10 As shown, the computer system 1000 includes a Central Processing Unit (CPU) 1001, which can perform various appropriate actions and processes based on programs stored in Read-Only Memory (ROM) 1002 or programs loaded from storage portion 1008 into Random Access Memory (RAM) 1003, such as performing the methods described in the above embodiments. Various programs and data required for system operation are also stored in RAM 1003. The CPU 1001, ROM 1002, and RAM 1003 are interconnected via bus 1004. An Input / Output (I / O) interface 1005 is also connected to bus 1004.
[0137] The following components are connected to I / O interface 1005: an input section 1006 including a keyboard, mouse, etc.; an output section 1007 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 1008 including a hard disk, etc.; and a communication section 1009 including a network interface card such as a LAN (Local Area Network) card, modem, etc. The communication section 1009 performs communication processing via a network such as the Internet. A drive 1010 is also connected to I / O interface 1005 as needed. Removable media 1011, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., are installed on drive 1010 as needed so that computer programs read from them can be installed into storage section 1008 as needed.
[0138] Specifically, according to embodiments of this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 1009, and / or installed from removable medium 1011. When the computer program is executed by central processing unit (CPU) 1001, it performs various functions defined in the system of this application.
[0139] It should be noted that the computer-readable medium shown in the embodiments of this application can be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), flash memory, optical fiber, portable compact disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such transmitted data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to wireless, wired, etc., or any suitable combination thereof.
[0140] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. Each block in a flowchart or block diagram may represent a module, segment, or portion of code, which contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0141] The units described in the embodiments of this application can be implemented in software or hardware, and the described units can also be located in a processor. The names of these units do not necessarily limit the specific unit itself.
[0142] In one aspect, this application also provides a computer-readable medium, which may be included in the electronic device described in the above embodiments; or it may exist independently and not assembled into the electronic device. The computer-readable medium carries one or more programs, which, when executed by the electronic device, cause the electronic device to perform the methods described in the above embodiments.
[0143] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to the embodiments of this application, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0144] Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, touch terminal, or network device, etc.) to execute the methods according to the embodiments of this application.
[0145] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the embodiments disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein.
[0146] The data collection and processing plan outlined in this application must be implemented in strict accordance with the requirements of relevant national laws and regulations, obtaining the informed consent or separate consent of the data subject (or having a legal basis as stipulated by the relevant national laws and regulations), and conducting subsequent data use and processing within the scope authorized by laws and regulations and the data subject.
[0147] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.
Claims
1. A game testing method, characterized in that, The game testing method is implemented through a plugin, and the method includes: During game runtime, the game is recorded. The network module of the game client transmits a mirror data packet corresponding to the data packet to the recording module. The data packet is received by the network module from the server. The game responds according to the data packet. The recording module saves the image data packet to a local file; the step of saving the image data packet to a local file via the recording module includes: saving the image data packet to memory; retrieving the image data packet from memory and saving the image data packet to a local file; The attribute fields of the protocol object in the game are obtained through reflection, and used as the first attribute field. The first attribute field is then saved to the local file. The game replays the mirror data packet in the local file, simulating the process of a game client receiving a server protocol packet, so that the game responds according to the mirror data packet. The replaying of the mirror data packet in the local file by the game includes: reading the local file to obtain the first attribute field; obtaining the attribute field of the current version of the game through reflection, as the second attribute field; comparing the first attribute field and the second attribute field to determine whether the second attribute field contains a newly added attribute field, wherein the newly added attribute field is an attribute field different from the first attribute field; when replaying the mirror data packet through the current version of the game, based on the presence of the newly added attribute field in the second attribute field, inputting a predetermined attribute value corresponding to the newly added attribute field into the current version of the game. The game was tested during the replay.
2. The game testing method according to claim 1, characterized in that, The recording of the game during gameplay includes: The game is recorded during runtime based on the first administrator's instructions received. Before replaying the mirror data packet in the local file through the game, the method further includes: The local file is read according to the received instructions from the second administrator to obtain the image data package.
3. The game testing method according to claim 2, characterized in that, The step of saving the image data packet to a local file through the recording module includes: Upon receiving instructions from the third administrator, stop recording the game and save the image data package to a local file.
4. The game testing method according to claim 2, characterized in that, The step of reading the local file according to the received second administrator instruction to obtain the image data package includes: According to the received second administrator instruction, stop receiving data packets from the server and read the local file to obtain the image data packet.
5. The game testing method according to claim 1, characterized in that, Before replaying the mirror data packet in the local file through the game, the method further includes: The local file is read into memory to obtain the image data package.
6. The game testing method according to claim 1, characterized in that, The step of saving the image data packet to a local file through the recording module includes: The image data packet is serialized and saved to a local file; Before replaying the mirror data packet in the local file through the game, the method further includes: The local file is deserialized to obtain the image data packet.
7. The game testing method according to any one of claims 1-6, characterized in that, The game refers to a game client or a game engine editor environment.
8. A game testing device, characterized in that, The device is implemented via a plug-in approach, and the device includes: The recording unit is used to record the game during gameplay. The game client's network module transmits a mirrored data packet corresponding to the data packet to the recording module. The data packet is received by the network module from the server, and the game responds based on the data packet. A storage unit is configured to save the image data packet to a local file via the recording module; the storage unit is configured to: save the image data packet to memory; retrieve the image data packet from memory and save the image data packet to a local file; The replay unit is used to: obtain the attribute field of the protocol object in the game through a reflection mechanism, use it as the first attribute field, and save the first attribute field to the local file; replay the image data packet in the local file through the game to simulate the process of the game client receiving the server protocol packet, so that the game responds according to the image data packet; The playback unit is configured to: read the local file to obtain the first attribute field; obtain the attribute field of the current version of the game through a reflection mechanism as the second attribute field; compare the first attribute field and the second attribute field to determine whether the second attribute field contains a newly added attribute field, wherein the newly added attribute field is an attribute field that is different from the first attribute field; when playing back the mirror data packet through the current version of the game, input the predetermined attribute value corresponding to the newly added attribute field into the current version of the game based on the fact that the second attribute field contains the newly added attribute field; The testing unit is used to test the game during playback.
9. A computer-readable medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the game testing method as described in any one of claims 1 to 7.
10. An electronic device, characterized in that, include: One or more processors; A storage device for storing one or more programs, which, when executed by one or more processors, cause the one or more processors to implement the game testing method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Test method and device, computer readable storage medium and computer device
CN110221983A
Game protocol testing method and device, electronic equipment and storage medium
CN111309620A