Game processing method and device, computer equipment and computer readable storage medium
By determining the listener's position based on the virtual camera's visual ray and target virtual object, the method ensures accurate sound reception, addressing the inconsistency issue and enhancing the gaming experience.
Patent Information
- Application Number
- CN202411214834.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-30
- Publication Date
- 2024-12-13
AI Technical Summary
Existing game technologies fix the listener position to the virtual camera or master virtual object, leading to inconsistent sound reception that does not adapt to complex game situations, affecting the user's immersive experience.
A game processing method that determines the target position of the listener in the virtual scene by considering the visual ray of the virtual camera and the object position of the target virtual object, adjusting the listener to this position to accurately receive and process sound events, ensuring sound consistency with the game screen and target virtual object.
Enhances the gaming experience by adapting the listener position to diverse game scenarios, accurately obtaining and playing sounds that are highly adapted to the game screen and target virtual object, thereby improving sound consistency and immersion.
Smart Images

Figure CN119113504A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of game technology, and in particular to a game processing method, device, computer equipment and computer-readable storage medium. Background Art
[0002] With the development of the Internet, a large number of different types of games have emerged to meet the daily entertainment needs of users. When the game is running, the virtual scene of the game can be obtained according to the game installation package, and then listeners can be configured in the virtual scene. By playing the sound received by the listener in the virtual scene, the user can have an immersive feeling.
[0003] At present, most games bind the listener to the virtual camera or the master virtual object, so that the sound that the user can hear is the sound received when the listener is at the position of the virtual camera or the master virtual object. If the listener is bound to the master virtual object, the listener will always receive the sound near the master virtual object. Even if the master virtual object moves to a position that cannot be observed by the virtual camera, the user can still hear the sound near the master virtual object. If the listener is bound to the virtual camera, the listener will always receive the sound near the virtual camera, and the sound received by the listener will not change with the movement of the master virtual object. It can be seen that the fixed listener deployment position cannot adapt to complex and diverse game situations, affecting the user's gaming experience. Summary of the invention
[0004] The embodiments of the present application provide a game processing method, apparatus, computer device and computer-readable storage medium, which simultaneously consider the position parameters of the virtual camera and the target virtual object, so that the listener deployment position can adapt to complex and diverse game situations, and can more accurately obtain more sounds that need to be heard, so as to play game sounds that are highly adapted to the game screen and the target virtual object, thereby enhancing the user's gaming experience.
[0005] The present application embodiment provides a game processing method, including: Obtaining the visual ray of the virtual camera and the object position of the target virtual object in the virtual scene; Determining a target position of a listener in the virtual scene according to the visual ray and the object position; The listener is adjusted to the target position so that the listener receives and processes the sound events in the virtual scene at the target position.
[0006] Accordingly, an embodiment of the present application further provides a game processing device, the game processing device comprising: A data acquisition unit, used for acquiring visual rays of a virtual camera and an object position of a target virtual object in a virtual scene; a position determination unit, configured to determine a target position of a listener in the virtual scene according to the visual ray and the object position; A position adjustment unit is used to adjust the listener to the target position so that the listener receives and processes the sound events in the virtual scene at the target position.
[0007] Correspondingly, an embodiment of the present application also provides a computer device, including a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program implements any step of the game processing method when executed by the processor.
[0008] Correspondingly, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, any step of the game processing method is implemented.
[0009] The embodiment of the present application provides a game processing method, device, computer equipment and computer-readable storage medium, which determines the target position of the listener in the virtual scene according to the visual ray of the virtual camera and the object position of the target virtual object, and then adjusts the listener to the target position so that the listener receives and processes the sound events in the virtual scene at the target position. When determining the target position of the listener, the embodiment of the present application can make the listener located in the center of the game screen taken by the virtual camera by combining the visual ray of the virtual camera, ensuring that the sound received by the listener is consistent with the game screen; by combining the object position of the target virtual object, the listener can be relatively close to the target virtual object, retaining the sound details near the target virtual object. The embodiment of the present application takes into account the position parameters of the virtual camera and the target virtual object at the same time, so that the listener deployment position can adapt to complex and diverse game situations, and can more accurately obtain more sounds that need to be heard, so as to play game sounds that are highly adapted to the game screen and the target virtual object, and enhance the user's gaming experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0011] Figure 1 It is a scene diagram of the game processing system provided in an embodiment of the present application.
[0012] Figure 2 This is a diagram of how listeners are deployed.
[0013] Figure 3 A graphical user interface diagram.
[0014] Figure 4 is another graphical user interface diagram.
[0015] Figure 5 It is a flowchart of the game processing method provided in an embodiment of the present application.
[0016] Figure 6 It is a schematic diagram of an application scenario of the game processing method provided in an embodiment of the present application.
[0017] Figure 7 This is another application scenario schematic diagram of the game processing method provided in an embodiment of the present application.
[0018] Figure 8 This is another application scenario schematic diagram of the game processing method provided in an embodiment of the present application.
[0019] Fig. 9 This is another application scenario schematic diagram of the game processing method provided in an embodiment of the present application.
[0020] Fig.10 This is another application scenario schematic diagram of the game processing method provided in an embodiment of the present application.
[0021] Fig.11 This is another application scenario schematic diagram of the game processing method provided in an embodiment of the present application.
[0022] Fig.12 This is another application scenario schematic diagram of the game processing method provided in an embodiment of the present application.
[0023] Fig.13 This is another application scenario schematic diagram of the game processing method provided in an embodiment of the present application.
[0024] Fig.14 It is a structural schematic diagram of a game processing device provided in an embodiment of the present application.
[0025] Fig.15 It is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0026] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present application. At the same time, in the description of the embodiments of the present application, the terms "first", "second", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more features. In the description of the embodiments of the present application, the meaning of "multiple" is two or more, unless otherwise clearly and specifically defined.
[0027] The embodiments of the present application provide a game processing method, device, computer equipment and computer-readable storage medium. Specifically, the game processing method provided in the embodiments of the present application can be executed by a computer device. Among them, the computer device can be a terminal or a server. The terminal can be a terminal device such as a smart phone, a tablet computer, a laptop computer, a touch screen, a game console, a personal computer (PC, Personal Computer), a personal digital assistant (PDA, Personal Digital Assistant), etc. The terminal can also include a client, which can be a game application client, a browser client carrying a game program, or an instant messaging client. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and basic cloud computing services such as big data and artificial intelligence platforms.
[0028] For example, when the game processing method is run on a terminal device, the terminal device stores a game application and is used to present a game screen and / or play a game sound. The terminal device is used to interact with a user through a graphical user interface, for example, by downloading and installing a game application through the terminal device and running it. The terminal device may provide a graphical user interface to a user in a variety of ways, for example, it may be rendered and displayed on a display screen of a terminal device, or a graphical user interface may be presented through a holographic projection. For example, the terminal device may include a touch display screen and a processor, the touch display screen is used to present a graphical user interface and receive an operation instruction generated by a user acting on the graphical user interface, the graphical user interface displays a game screen, and the processor is used to run the game, generate a graphical user interface, generate a game sound, respond to an operation instruction, and control the display of the graphical user interface on the touch display screen, control the playback of game sounds, etc.
[0029] For example, when the game processing method is run on a server, it can be a cloud game. Cloud gaming refers to a gaming method based on cloud computing. In the operation mode of cloud gaming, the operating body of the game application and the game screen presentation body and / or the game sound playback body are separated, and the storage and operation of the game processing method are completed on the cloud gaming server. The game screen presentation and / or game sound playback are completed on the client of the cloud gaming. The cloud gaming client is mainly used for receiving and sending game data, presenting the game screen, and playing the game sound. For example, the cloud gaming client can be a display device with data transmission function close to the user side, such as a mobile terminal, a TV, a computer, a handheld computer, a personal digital assistant, etc. However, the device for processing game data is a cloud gaming server in the cloud. When playing the game, the user operates the cloud gaming client to send an operation instruction to the cloud gaming server. The cloud gaming server runs the game according to the operation instruction, encodes and compresses the game screen and / or game sound and other data, and returns it to the cloud gaming client through the network. Finally, the cloud gaming client decodes and outputs the game screen and / or plays the game sound.
[0030] See also Figure 1 , Figure 1 A scenario diagram of a game processing system provided for an embodiment of the present application. The system may include at least one terminal, at least one server, at least one database, and a network. The terminal held by the user can be connected to the servers of different games through the network. The terminal is any device with computing hardware that can support and execute software products corresponding to the game. In addition, when the system includes multiple terminals, multiple servers, and multiple networks, different terminals can be connected to each other through different networks and different servers. The network can be a wireless network or a wired network, such as a wireless network such as a wireless local area network (WLAN), a local area network (LAN), a cellular network, a 2G network, a 3G network, a 4G network, a 5G network, etc. In addition, different terminals can also use their own Bluetooth network or hotspot network to connect to other terminals or to servers, etc. For example, multiple users can be online through different terminals and connected and synchronized with each other through appropriate networks to support multi-player games. In addition, the system may include multiple databases, multiple databases are coupled to different servers, and information related to the game environment can be continuously stored in the database when different users are online for multi-player games.
[0031] The embodiment of the present application provides a game processing method, which can be executed by a terminal or a server. The embodiment of the present application takes the execution of the game processing method by the terminal as an example for explanation. Among them, the terminal may include a touch display screen, an audio circuit and a processor (of course, the terminal may also use peripherals such as a mouse and a keyboard as input devices, and use peripherals such as a speaker and a headset as output devices, and only the touch display screen and the audio circuit are used as examples for explanation here), the touch display screen is used to present a graphical user interface and receive operation instructions generated by the user acting on the graphical user interface, and the audio circuit is used to generate and play game sounds. When the user operates the graphical user interface through the touch display screen, the graphical user interface can control the local content of the terminal by responding to the received operation instructions, and can also control the content of the opposite server by responding to the received operation instructions. For example, the operation instructions generated by the user acting on the graphical user interface include instructions for starting a game application, and the processor is configured to start the game application after receiving the instructions for starting the game application provided by the user. In addition, the processor is configured to render and draw a graphical user interface associated with the game on the touch display screen. The touch display screen is a multi-touch sensitive screen that can sense touch or sliding operations performed simultaneously on multiple points on the screen. The user uses a finger to perform a touch operation on the graphical user interface. When the graphical user interface detects the touch operation, it controls different virtual objects in the graphical user interface of the game to perform actions corresponding to the touch operation. For example, the game can be any of casual games, action games, role-playing games, strategy games, sports games, puzzle games, etc. Among them, the game may include a virtual scene of the game drawn on the graphical user interface. In addition, the virtual scene of the game may include one or more virtual objects controlled by the user (or player), such as virtual characters. In addition, the virtual scene of the game may also include one or more obstacles, such as railings, gullies, walls, etc., to limit the movement of virtual objects, for example, limiting the movement of one or more objects to a specific area within the virtual scene. Optionally, the virtual scene of the game also includes one or more elements, such as skills, scores, character health status, energy, etc., to provide help to the player, provide virtual services, increase the score related to the player's performance, etc. In addition, the graphical user interface may also present one or more indicators to provide indication information to the player. For example, the game may include a virtual object controlled by the player and one or more other virtual objects (such as an enemy character). In one embodiment, one or more other virtual objects are controlled by other players of the game. For example, one or more other virtual objects may be controlled by a computer, such as a robot using an artificial intelligence (AI) algorithm, to achieve a human-machine battle mode. For example, a virtual object may have various skills or abilities that a game player may use to achieve a goal. For example, a virtual object may have one or more weapons, props, tools, etc. that may be used to eliminate other objects from the game.Such skills or abilities can be activated by a game player using one of a plurality of preset touch operations with a touch display screen of a terminal. The processor can be configured to present a corresponding game screen in response to an operation instruction generated by a user's touch operation.
[0032] It should be noted that Figure 1 The scene diagram of the game processing system shown is only an example. The game processing system and scene described in the embodiment of the present application are intended to more clearly illustrate the technical solution of the embodiment of the present application, and do not constitute a limitation on the technical solution provided in the embodiment of the present application. Ordinary technicians in this field can know that with the emergence of new business scenarios, the technical solution provided in the embodiment of the present application is also applicable to similar technical problems.
[0033] The embodiment of the present application provides a game processing method, which can be executed by a terminal or a server. The embodiment of the present application takes the execution of the game processing method by the terminal as an example for explanation, and the graphical user interface and the game sound can be displayed by the terminal. The graphical user interface can display the game screen obtained by shooting the virtual scene (or it can be called a virtual world, game scene, etc.) by a virtual camera. The graphical user interface can present the entire virtual scene, or only a part of the virtual scene. The virtual scene includes multiple static virtual objects, specifically including the ground, mountains, stones, vegetation, buildings, etc. When the virtual scene is relatively large, only the partial content of the virtual scene is displayed on the graphical user interface of the terminal during the game. Optionally, the virtual scene contains a game character, and the game character can be a game character controlled by a player, or an NPC (non-player character), which is not limited by the embodiment of the present application.
[0034] In the embodiment of the present application, the virtual scene is a virtual environment displayed (or provided) when the application is running on the terminal. The virtual environment can be a simulation environment of the real world, a semi-simulation and semi-fictitious three-dimensional environment, or a purely fictitious three-dimensional environment. The virtual environment is used for a game between at least two virtual characters. The virtual scene may include one or more virtual characters, and a virtual character (or hero) refers to an active object in the virtual environment. A virtual character refers to a virtual object in the game that a user or player controls through a terminal.
[0035] In the embodiment of the present application, a listener is configured in a virtual scene. The listener refers to an object that receives sound in the virtual scene, that is, the listener is used to receive and process sound events in the virtual scene. In actual application, the listener may also be referred to as an audio receiving source, an audio receiver, etc., all of which are used to receive and process sound events in the virtual scene. By playing the sound received by the listener in the virtual scene, the user can have an immersive feeling. At present, most games bind the listener to a virtual camera or a master virtual object, so that the sound that the user can hear is the sound obtained by processing the sound event received when the listener is at the position of the virtual camera or the master virtual object. In the following embodiments, for ease of description, the sound obtained by the listener after processing the sound event it receives is referred to as the sound received by the listener.
[0036] If the listener is bound to the master virtual object, the listener will always receive the sound near the master virtual object. Figure 2 As shown in (a), there are four sound-emitting bodies A, B, C, and D within the observation range of the virtual camera, among which A and B sound-emitting bodies are located near the master virtual object. If the listener is bound to the master virtual object, that is, the listener is configured on the master virtual object, then the listener can receive the sounds of A and B sound-emitting bodies. Since C and D sound-emitting bodies are within the observation range of the virtual camera but far away from the master virtual object, the user can see C and D sound-emitting bodies in the game screen but cannot hear the sounds from C and D sound-emitting bodies, resulting in a sense of disconnection. Therefore, even when the master virtual object moves to a position that cannot be observed by the virtual camera, that is, when the game screen captured by the virtual camera does not include the master virtual object, the user can still hear the sounds near the master virtual object. Figure 3 As shown, the game screen displayed by the graphical user interface 310 does not include the main virtual object, but the user can hear the sounds near the main virtual object.
[0037] If the listener is bound to a virtual camera, the listener will always receive sounds near the virtual camera. Figure 2 As shown in (b), there are four sound sources A, B, C, and D within the observation range of the virtual camera. Among them, sound source C is located near the virtual camera. If the listener is bound to the virtual camera, that is, the listener is configured on the virtual camera, the listener can receive the sound of sound source C. Since sound sources A, B, and D are within the observation range of the virtual camera but far away from the virtual camera, the user can see sound sources A, B, and D in the game screen, but cannot hear the sound from them. In addition, the sound received by the listener will not change with the movement of the main virtual object. Figure 4As shown, the master virtual object 410 can move freely in the virtual scene, but the sound received by the listener is always the sound near the virtual camera, which has nothing to do with the movement of the master virtual object 410.
[0038] It can be seen that the fixed listener deployment position cannot adapt to complex and diverse game situations, affecting the user's gaming experience. Based on this problem, the embodiments of the present application provide a game processing method, device, computer equipment and computer-readable storage medium, while considering the position parameters of the virtual camera and the target virtual object, so that the listener deployment position can adapt to complex and diverse game situations, and can more accurately obtain more sounds that need to be heard, so as to play game sounds that are highly adapted to the game screen and the target virtual object, and enhance the user's gaming experience. The following is a detailed description. It should be noted that the description order of the following embodiments is not intended to limit the preferred order of the embodiments. Although the logical order is shown in the flow chart, in some cases, the steps shown or described may be performed in an order different from that shown in the accompanying drawings.
[0039] See also Figure 5 , Figure 5 A flowchart of a game processing method provided in an embodiment of the present application is shown. The specific process of the game processing method may be steps 110 to 130 as follows.
[0040] Step 110: Obtain the visual ray of the virtual camera and the object position of the target virtual object in the virtual scene.
[0041] The virtual camera is used to shoot the virtual scene to obtain the game screen, and the game screen can be displayed in the graphical user interface for users (or players) to watch. By changing the position of the virtual camera in the virtual scene, the virtual camera can shoot the virtual scene at different positions, thereby obtaining different game screens. The visual ray of the virtual camera can be any ray within the visual range of the virtual camera, and the visual ray radiates outward from the virtual camera. Optionally, the visual ray of the virtual camera is the visual center ray of the virtual camera, passing through the visual focus of the virtual camera; or, the visual range of the virtual camera is a visual range with a certain angle, and the visual ray of the virtual camera is any ray on the edge of the visual range of the virtual camera.
[0042] The target virtual object can be a master virtual object or a designated virtual object, which is not limited in the embodiments of the present application. The master virtual object refers to a virtual object controlled by the current user, that is, a virtual object controlled by the local user. The designated virtual object can be any virtual object specified by the current user in the virtual scene. The virtual object can be a virtual object controlled by other users or an NPC. For example, the current user specifies that the target virtual object is a friendly virtual object belonging to the same camp as the master virtual object, and the virtual camera can be controlled to be deployed near the friendly virtual object to present the friendly virtual object and its nearby virtual environment.
[0043] Step 120: Determine the target position of the listener in the virtual scene according to the visual ray and the object position.
[0044] In the embodiment of the present application, the listener is not fixedly bound to the virtual camera or the target virtual object, but the deployment position of the listener is determined in the virtual scene in combination with the position parameters of the virtual camera and the target virtual object, so that the position of the listener can adapt to the position change of the virtual camera or the target virtual object. Based on this, the embodiment of the present application determines the target position of the listener in the virtual scene according to the visual ray of the virtual camera and the object position of the target virtual object. For other descriptions of the calculation process of the target position, please refer to the following embodiment, which will not be repeated here.
[0045] Step 130: Adjust the listener to the target position so that the listener receives and processes the sound events in the virtual scene at the target position.
[0046] After determining the target position of the listener in the virtual scene, the listener can be adjusted to the target position. According to the sound events in the virtual scene received when the listener is at the target position, the game sound for playing can be generated after processing, for example, the sound events received by the listener are processed by audio mixing or volume adjustment. Among them, the sound events in the virtual scene received when the listener is at the target position can be sound events generated by a sound-emitting body within the audible range of the listener when the listener is at the target position. The audible range of the listener is the area formed in the virtual scene with the target position as the center. Optionally, the audible range can be preset, or it can be determined according to the target distance between the virtual camera and the listener, and the embodiment of the present application does not limit this. Optionally, the audible range can be a circular area, a rectangular area, a triangular area, etc., and the embodiment of the present application does not limit this. For other introductions to the audible range, please refer to the following embodiments, which will not be repeated here.
[0047] In some embodiments, to ensure the accuracy and real-time nature of the listener's target position, step 110 includes: in response to a position change of the virtual camera or the target virtual object, or in response to the generation of a frame of game screen, obtaining the visual ray of the virtual camera and the object position of the target virtual object.
[0048] In the embodiment of the present application, when the position of the virtual camera or the target virtual object changes, the target position of the listener can be updated in real time in response to the position change of the virtual camera or the target virtual object. Alternatively, for each frame of the game screen, in response to the generation of a frame of the game screen, the calculation of the target position of the listener is triggered, that is, step 110 is triggered and executed from step 110; or, for each frame of the game screen, it is determined whether the position of the virtual camera or the target virtual object has changed relative to the previous frame of the game screen, and when the position of the virtual camera or the target virtual object has changed, the target position of the listener is updated in response to the position change of the virtual camera or the target virtual object. In other words, the triggering frequency of the target position calculation of the listener can be the same as the frame rate of the game, and each generated frame of the game screen will trigger a calculation of the target position. Among them, for each frame of the game screen, when the position of the virtual camera or the target virtual object has not changed relative to the previous frame of the game screen, the target position of the listener can be not calculated, that is, the above step 110 is not triggered, because the listener does not need to be moved at this time; the target position of the listener can also be calculated again, but at this time, there is no position change of the virtual camera and the target virtual object, so there is no need to update the target position of the listener.
[0049] Optionally, the position change of the virtual camera includes a coordinate position change and / or an orientation position change, which can be determined according to the actual settings for the virtual camera in the game. For example, if the orientation of the virtual camera is set to be fixed in the actual application, the position change of the virtual camera includes a coordinate position change; if the orientation and coordinates of the virtual camera are set to be changeable in the actual application, the position change of the virtual camera includes a coordinate position change and an orientation position change.
[0050] In summary, the game processing method provided by the embodiment of the present application determines the target position of the listener in the virtual scene according to the visual ray of the virtual camera and the object position of the target virtual object, and then adjusts the listener to the target position so that the listener receives and processes the sound events in the virtual scene at the target position. When determining the target position of the listener, the embodiment of the present application can make the listener located in the center of the game screen taken by the virtual camera by combining the visual ray of the virtual camera, ensuring that the sound received by the listener is consistent with the game screen; by combining the object position of the target virtual object, the listener can be relatively close to the target virtual object, retaining the sound details near the target virtual object. The embodiment of the present application takes into account the position parameters of the virtual camera and the target virtual object at the same time, so that the listener deployment position can adapt to complex and diverse game situations, and can more accurately obtain more sounds that need to be heard, so as to play game sounds that are highly adapted to the game screen and the target virtual object, and enhance the user's gaming experience.
[0051] In some embodiments, step 110 includes: determining a candidate deployment plane for the listener according to the object position of the target virtual object; and using the intersection position of the visual ray of the virtual camera and the candidate deployment plane as the target position of the listener in the virtual scene.
[0052] The vertical distance between the candidate deployment plane and the target virtual object is equal to zero, and the vertical distance between the candidate deployment plane and the virtual camera is greater than zero. In other words, the candidate deployment plane passes through the target virtual object, but the candidate deployment plane does not pass through the virtual camera.
[0053] Optionally, a coordinate system can be established with the object position of the target virtual object as the origin, so that the candidate deployment plane is a coordinate plane in the coordinate system. In practical applications, the dimension of the coordinate system can be determined according to the dimension of the virtual scene. For example, if the virtual scene is two-dimensional, the coordinate system is a two-dimensional coordinate system; if the virtual scene is three-dimensional, the coordinate system is a three-dimensional coordinate system. Based on this, taking the coordinate system as a three-dimensional coordinate system, or a spatial coordinate system as an example, the above-mentioned determination of the candidate deployment plane of the listener according to the object position of the target virtual object includes: taking the object position of the target virtual object as the origin and the horizontal direction of the target virtual object facing the virtual camera as a coordinate axis, establishing an object coordinate system; taking at least one coordinate plane in the object coordinate system as the candidate deployment plane of the listener. Among them, the horizontal direction of the target virtual object facing the virtual camera refers to the horizontal direction in the virtual scene.
[0054] For example, Figure 6As shown, the origin O refers to the object position of the target virtual object in the virtual scene, the horizontal direction of the target virtual object facing the virtual camera is the X-axis, the direction perpendicular to the X-axis on the horizontal plane passing through the origin O is the Y-axis, and the direction perpendicular to the X-axis on the vertical plane passing through the origin O is the Z-axis, and the spatial coordinate system XYZO is established. Figure 6 As shown, the spatial coordinate system XYZO includes three coordinate planes, which are divided into eight partitions. Since the virtual camera usually observes the virtual scene from an oblique perspective, and the X-axis is the direction in which the main virtual object faces the virtual camera, the virtual camera is usually located in the Ith partition or the IVth partition. When the virtual camera has a left-right offset relative to the target virtual object, in different orientations, taking the visual ray of the virtual camera as the visual center ray of the virtual camera as an example, the partition where the intersection of the virtual camera's visual center and the coordinate plane is located is also different. For example, Figure 7 As shown in (a) in FIG, when the virtual camera is offset to the right relative to the target virtual object, from the perspective of the front view, the intersection position of the visual center of the virtual camera and the coordinate plane of the spatial coordinate system is in the first partition; Figure 7 As shown in (b) in FIG, when the virtual camera is offset to the left relative to the target virtual object, from the perspective of the front view, the intersection position of the visual center of the virtual camera and the coordinate plane of the spatial coordinate system is in the fourth partition. Figure 6 As shown, since the virtual camera may pass through the coordinate plane XOZ, the coordinate plane XOY and / or the coordinate plane ZOY in the spatial coordinate system XYZO can be used as candidate deployment planes for the listener.
[0055] The candidate deployment plane may be one deployment plane or multiple deployment planes, which is not limited in the embodiments of the present application. In the case where the candidate deployment plane is one deployment plane, the intersection position of the virtual camera's visual ray and the candidate deployment plane may be directly used as the listener's target position. In the case where the candidate deployment plane is multiple deployment planes, the intersection position of the virtual camera's visual ray and one of the candidate deployment planes may be used as the listener's target position. Of course, in the case where the candidate deployment plane is multiple deployment planes, the listener's target position may also be determined by combining the intersection positions of the virtual camera's visual ray and multiple candidate deployment planes. For example, the listener's target position is the geometric center of the intersection position of the virtual camera's visual ray and multiple candidate deployment planes.
[0056] Taking the intersection position of the visual ray of the virtual camera and one of the candidate deployment planes as the deployment position of the listener as an example, optionally, the above-mentioned using the intersection position of the visual ray of the virtual camera and the candidate deployment plane as the target position of the listener in the virtual scene includes: using the intersection position of the visual ray of the virtual camera and the target deployment plane as the target position of the listener in the virtual scene. The target deployment plane is the deployment plane that intersects the visual ray of the virtual camera for the first time among the candidate deployment planes.
[0057] It should be understood that the visual ray of the virtual camera is a ray, and the candidate deployment plane is an assumed plane, so the ray drawn from the visual range can penetrate the candidate deployment plane, that is, the ray drawn from the visual range will intersect with multiple candidate deployment planes. In the embodiment of the present application, the first intersection position of the visual ray of the virtual camera and the candidate deployment plane is used as the target position of the listener. Assuming that the target deployment plane is the deployment plane that intersects the visual ray of the virtual camera for the first time among the candidate deployment planes, the intersection position of the visual ray of the virtual camera and the target deployment plane is used as the target position of the listener. In this way, the distance between the listener and the virtual camera and the target virtual object can be within an appropriate range, neither too close to the target virtual object and too far away from the virtual camera, nor too close to the virtual camera and too far away from the target virtual object.
[0058] For example, taking the visual ray of the virtual camera as the visual center ray as an example, based on Figure 6 The spatial coordinate system XYZO shown, the candidate deployment planes include the coordinate plane XOY and the coordinate plane ZOY, such as Figure 8 As shown in (a) in , the visual center ray of the virtual camera intersects the coordinate plane XOY in the candidate deployment plane for the first time, and the intersection position of the visual center ray of the virtual camera and the coordinate plane XOY is taken as the target position of the listener; Figure 8 As shown in (b), when the visual center ray of the virtual camera intersects the coordinate plane ZOY in the candidate deployment plane for the first time, the intersection position of the visual center ray of the virtual camera and the coordinate plane ZOY is used as the target position of the listener. It should be understood that Figure 8 for Figure 6 Side view (right view) of the spatial coordinate system XYZO shown.
[0059] In the above example, whether the visual ray of the virtual camera intersects with the coordinate plane XOY or the coordinate plane ZOY is related to the height of the virtual camera relative to the target virtual object. For example, taking the visual ray of the virtual camera as the visual center ray, Fig. 9As shown, assuming that the angle between the visual center ray of the virtual camera and the horizontal plane remains unchanged, such as maintaining a 45° angle, or it can be said that the visual center ray of the virtual camera at different positions is a parallel ray, then, Fig.10 As shown in (a), if the height of the virtual camera relative to the target virtual object increases, the visual center ray of the virtual camera intersects with the coordinate plane ZOY; Fig.10 As shown in (b) in FIG. 8 , if the height of the virtual camera relative to the target virtual object decreases, the visual center ray of the virtual camera intersects with the coordinate plane XOY.
[0060] In some embodiments, the above step 130 further includes: step 140, determining the audible range of the listener in the virtual scene according to the target distance between the virtual camera and the listener, so that the listener can receive and process sound events within the audible range at the target position.
[0061] After determining the target position of the listener in the virtual scene, the listener can be deployed to the target position. Furthermore, it is necessary to configure the audible range of the listener in the virtual scene to determine the source sound source of the game sound being played, and then the listener receives the sound events generated by the sound source within the audible range to form a playable game sound. Among them, the sound source refers to an object in the game that can generate sound events. Optionally, the sound source includes but is not limited to virtual characters, virtual elements, etc. in the game. The virtual character can be a character controlled by the player, or it can be an NPC, etc. Virtual elements can be, for example, virtual weapons, game skills, etc.
[0062] The embodiment of the present application determines the audible range of the listener according to the target distance between the virtual camera and the listener. That is, the audible range of the listener is determined according to the distance between the virtual camera and the target position of the listener. Among them, the center of the audible range refers to the target position of the listener in the virtual scene, and the radius of the audible range is determined according to the target distance between the virtual camera and the listener. Optionally, the audible range can be a two-dimensional circular area, so that the target position of the listener is the center of the audible range, that is, the center of the audible range is realized as the center of the circle; it can also be a three-dimensional spherical area, so that the target position of the listener is the center of the audible range, that is, the center of the audible range is realized as the center of the sphere. The embodiment of the present application does not limit the dimension of the audible range. In practical applications, it can be determined in combination with the dimension of the virtual scene. For example, if the virtual scene is two-dimensional, the audible range of the listener is a two-dimensional circular area; if the virtual scene is three-dimensional, the audible range of the listener is a three-dimensional spherical area.
[0063] In some embodiments, the above step 140 includes: if the target distance between the virtual camera and the listener is within a preset range, determining the audible range of the listener in the virtual scene according to the target distance; if the target distance between the virtual camera and the listener exceeds the preset range, determining the audible range of the listener in the virtual scene according to the target distance and the compensation coefficient.
[0064] In the embodiment of the present application, the target position of the listener in the virtual scene is used as the center of the audible range, and the radius of the audible range is determined according to the distance between the virtual camera and the listener (i.e., the target distance). In order to adapt to the change in auditory effect caused by the virtual camera being zoomed in or out, the embodiment of the present application corrects the target distance to obtain an audible range that better fits the game situation.
[0065] Based on this, the embodiment of the present application is configured with a preset range. After the listener is configured to the target position determined in the above step 110, the target distance between the virtual camera and the listener is obtained, and the radius of the audible range is determined based on the comparison between the target distance and the preset range. The embodiment of the present application does not limit the upper and lower thresholds of the preset range, and can be set in combination with actual game requirements. For example, the upper threshold of the preset range is set to 25, 28, 30 or 32 yards, and the lower threshold of the preset range is set to 10, 12, 15 or 18 yards.
[0066] If the target distance between the virtual camera and the listener is within the preset range, that is, if the target distance is greater than the lower threshold of the preset range and less than the upper threshold of the preset range, the target distance can be directly used as the radius of the audible range. Fig.11 As shown, with the target distance between the virtual camera and the listener as the radius and the target position of the listener in the virtual scene as the center, a three-dimensional audible range can be obtained, that is, the audible range is a spherical range, and the audible range is tangent to the virtual camera.
[0067] If the target distance between the virtual camera and the listener exceeds the preset range, that is, if the target distance is less than the lower threshold of the preset range or greater than the upper threshold of the preset range, the radius of the audible range is determined according to the target distance and the compensation coefficient. For example, the radius of the audible range is obtained by multiplying the target distance by the compensation coefficient. The value of the compensation coefficient can be greater than 1, thereby increasing the target distance to obtain the radius of the audible range; the value of the compensation coefficient can also be less than 1, thereby reducing the target distance to obtain the radius of the audible range.
[0068] It should be understood that in the embodiment of the present application, a compensation coefficient can also be set for the case where the target distance between the virtual camera and the listener is within a preset range. In this case, the compensation coefficient takes a value of 1, or it can be said to be 100%, so that the radius of the audible range is obtained by multiplying the target distance by the compensation coefficient. The radius of the audible range is still equal to the target distance.
[0069] like Fig.12 As shown in (a), when the virtual camera is pulled away, if the target distance between the virtual camera and the listener is used as the radius of the audible range, the sound that the listener can receive will be greatly increased, and it is even possible to receive the sound from the entire virtual scene. This will make the game sound noisy and inconsistent with the real situation. Therefore, in some embodiments, if the target distance between the virtual camera and the listener exceeds the preset range, the audible range of the listener in the virtual scene is determined according to the target distance and the compensation coefficient, including: if the target distance between the virtual camera and the listener is greater than the upper limit threshold of the preset range, the audible range of the listener in the virtual scene is determined according to the target distance and the first compensation coefficient, and the first compensation coefficient is a positive number less than 1.
[0070] If the target distance is greater than the upper threshold of the preset range and the virtual camera is zoomed out, the audible range needs to be limited, so a first compensation coefficient with a value less than 1 is set, and the radius of the audible range is determined according to the target distance between the virtual camera and the listener and the first compensation coefficient. Fig.12 As shown in (a), based on the target distance and the first compensation coefficient, the radius of the audible range is obtained. When the radius is smaller than the target distance, the virtual camera is no longer tangent to the audible range, but is located outside the audible range. Optionally, there is a negative correlation between the first compensation coefficient and the target distance, that is, the larger the target distance, the smaller the first compensation coefficient. Optionally, after the target distance is greater than the upper limit threshold of the preset range, based on the continuous increase of the target distance, the first compensation coefficient can be continuously changed. For example, even if the target distance increases only slightly, the first compensation coefficient will decrease accordingly to provide feedback to the change of the target distance; or, the first compensation coefficient can be discretely changed. For example, there are multiple target distance segments preset, each target distance segment corresponds to a first compensation coefficient, and when the change of the target distance does not exceed the current segment, the first compensation coefficient remains unchanged.
[0071] Optionally, in order to avoid the audible range being too small and not suitable for long-distance and large game scenarios, a minimum compensation coefficient can be set. Based on this, if the target distance between the virtual camera and the listener is greater than the upper threshold of the preset range, the audible range of the listener in the virtual scene is determined according to the target distance and the first compensation coefficient, including: if the target distance between the virtual camera and the listener is greater than the upper threshold of the preset range, and the target distance is greater than the preset maximum threshold, the audible range of the listener in the virtual scene is determined according to the maximum threshold and the preset minimum compensation coefficient. Among them, the maximum threshold is greater than the upper threshold, for example, the upper threshold of the preset range is 30 yards, and the maximum threshold is 35 yards; the minimum compensation coefficient is the compensation coefficient with the smallest value in the first compensation coefficient, for example, the minimum compensation coefficient is 0.8, or the minimum compensation coefficient is 80%, and the value of the first compensation coefficient is between 80% and 100% (including 80%).
[0072] like Fig.12 As shown in (b), when the virtual camera is zoomed in, if the target distance between the virtual camera and the listener is used as the radius of the audible range, the sound that the listener can receive will be greatly reduced, and it is even possible that no sound in the virtual scene will be received. This will cause the game sound to be missing and inconsistent with the real situation. Therefore, in some embodiments, if the target distance between the virtual camera and the listener exceeds the preset range, the audible range of the listener in the virtual scene is determined according to the target distance and the compensation coefficient, including: if the target distance between the virtual camera and the listener is less than the lower limit threshold of the preset range, the audible range of the listener in the virtual scene is determined according to the target distance and the second compensation coefficient, and the second compensation coefficient is a positive number greater than 1.
[0073] If the target distance is less than the lower limit threshold of the preset range, the virtual camera is zoomed in, and the audible range needs to be expanded, so a second compensation coefficient with a value greater than 1 is set, and the radius of the audible range is determined according to the target distance between the virtual camera and the listener and the second compensation coefficient. Fig.12As shown in (b), based on the target distance and combined with the second compensation coefficient, the radius of the audible range is obtained. When the radius is greater than the target distance, the virtual camera is no longer tangent to the audible range, but is located within the audible range. Optionally, the second compensation coefficient is negatively correlated with the target distance, that is, the smaller the target distance, the larger the second compensation coefficient. Optionally, after the target distance is less than the lower limit threshold of the preset range, based on the continuous decrease of the target distance, the second compensation coefficient can be continuously changed. For example, even if the target distance is only slightly reduced, the second compensation coefficient will increase accordingly to provide feedback to the change of the target distance; or, the second compensation coefficient can be discretely changed. For example, there are multiple target distance segments preset, each target distance segment corresponds to a second compensation coefficient, and when the change of the target distance does not exceed the current segment, the second compensation coefficient remains unchanged.
[0074] Optionally, in order to avoid the audible range being too large and not suitable for close-range and tiny game scenarios, a maximum compensation coefficient can be set. Based on this, if the target distance between the virtual camera and the listener is less than the lower threshold of the preset range, the audible range of the listener in the virtual scene is determined according to the target distance and the second compensation coefficient, including: if the target distance between the virtual camera and the listener is less than the lower threshold of the preset range, and the target distance is less than the preset minimum threshold, the audible range of the listener in the virtual scene is determined according to the minimum threshold and the preset maximum compensation coefficient. Among them, the minimum threshold is less than the lower threshold, for example, the lower threshold of the preset range is 15 yards, and the minimum threshold is 20 yards; the maximum compensation coefficient is the compensation coefficient with the largest value among the second compensation coefficients, for example, the maximum compensation coefficient is 1.3, or the maximum compensation coefficient is 130%, and the value of the second compensation coefficient is between 100% and 130% (including 130%).
[0075] The embodiment of the present application can also set a compensation coefficient separately for some game situations. At this time, regardless of whether the target distance between the virtual camera and the listener exceeds the preset range, the radius of the audible range is obtained based on the target distance combined with the preset third compensation coefficient. Based on this, in some embodiments, the above step 140 includes: if the target virtual object is in a preset state, the audible range of the listener in the virtual scene is determined according to the target distance between the virtual camera and the listener, and the preset third compensation coefficient. Among them, the preset state includes but is not limited to: the target virtual object is in a specific area, such as in a monster channel, etc.; the target virtual object experiences a specific event, such as performing a battle, etc. In response to the target virtual object being in a preset state, there is no need to compare the target distance and the preset range, but directly determine the radius of the audible range according to the target distance and the third compensation coefficient. Optionally, different third compensation coefficients can be set for different preset states, which can be determined according to actual game requirements.
[0076] Below, a specific example is used to introduce and explain the method for calculating the radius of the audible range provided in the embodiment of the present application.
[0077] like Fig.13 As shown, different compensation coefficients can be set for different scenes and events in the game. The upper threshold of the preset range is the maximum distance to start compensation. When the target distance between the virtual camera and the target virtual object is greater than the upper threshold of the preset range, the compensation coefficient is offset, and the compensation coefficient is gradually reduced as the target distance increases. Until the target distance between the virtual camera and the target virtual object is greater than the preset maximum threshold, the compensation coefficient is no longer reduced, and the minimum compensation coefficient is fixed. The lower threshold of the preset range is the minimum distance to start compensation. When the target distance between the virtual camera and the target virtual object is less than the lower threshold of the preset range, the compensation coefficient is offset, and the compensation coefficient is gradually increased as the target distance decreases. Until the target distance is less than the preset minimum threshold, the compensation coefficient is no longer increased, and the maximum compensation coefficient is fixed.
[0078] like Fig.13 As shown, the upper threshold of the preset range is 30 yards, the preset maximum threshold is 35 yards, and the minimum compensation coefficient is 80%. When the distance between the virtual camera and the target virtual object is within the preset range, the compensation coefficient is 100%, and the radius of the audible range is equal to the target distance (target distance * 100%); then the virtual camera gradually moves away from the listener, and when the target distance is greater than 30 yards, the compensation coefficient gradually decreases from 100%; until the target distance is equal to 35 yards, the minimum compensation coefficient reaches 80%, and the radius of the audible range is equal to 28 yards (35 yards * 80%); when the target distance is greater than 35 yards, the compensation coefficient is no longer reduced, and the product of the maximum threshold and the minimum compensation coefficient is fixedly used as the radius of the audible range, that is, the radius of the audible range is fixed to 28 yards.
[0079] like Fig.13 As shown, the lower threshold of the preset range is 15 yards, the preset minimum threshold is 10 yards, and the maximum compensation coefficient is 130%. When the distance between the virtual camera and the target virtual object is within the preset range, the compensation coefficient is 100%, and the radius of the audible range is equal to the target distance (target distance * 100%); then the virtual camera gradually approaches the listener, and when the target distance is less than 15 yards, the compensation coefficient gradually increases from 100%; until the target distance is equal to 10 yards, the maximum compensation coefficient is 130%, and the radius of the audible range is equal to 13 yards (10 yards * 130%); when the target distance is less than 10 yards, the compensation coefficient will no longer increase, and the product of the minimum threshold and the maximum compensation coefficient will be fixed as the radius of the audible range, that is, the radius of the audible range is fixed to 13 yards.
[0080] like Fig.13 As shown, a third compensation coefficient can also be set for certain game situations, that is, Fig.13 When the game scenario is triggered, that is, when the target virtual object described in the above embodiment is in a preset state, if a hand-filled compensation coefficient is preset, other restrictions are ignored and the radius of the audible range is directly determined according to the target distance and the hand-filled compensation coefficient. For example, the upper / lower threshold of the preset range, the preset maximum / minimum threshold, the minimum compensation coefficient / maximum compensation coefficient and other restrictions are ignored. Until the game scenario ends, that is, until the target virtual object leaves the preset state.
[0081] It should be understood that the embodiment of the present application only takes the target distance multiplied by the compensation coefficient to obtain the radius of the audible range as an example, which does not constitute a limitation on the embodiment of the present application. In practical applications, the radius of the audible range can also be obtained by adding the target distance and the compensation coefficient, and so on. For example, for a target distance greater than an upper threshold value of a preset range, a compensation coefficient with a negative value can be set, so that the target distance and the compensation coefficient can be added to achieve the purpose of narrowing the audible range; for a target distance less than a lower threshold value of a preset range, a compensation coefficient with a positive value can be set, so that the target distance and the compensation coefficient can be added to achieve the purpose of increasing the audible range.
[0082] In order to facilitate better implementation of the game processing method provided in the embodiment of the present application, the embodiment of the present application also provides a game processing device based on the above game processing method. The meanings of the terms are the same as those in the above game processing method, and the specific implementation details can refer to the description in the method embodiment.
[0083] See also Fig.14 , Fig.14 A schematic diagram of the structure of a game processing device provided in an embodiment of the present application, the device comprising: The data acquisition unit 1410 is used to acquire the visual ray of the virtual camera and the object position of the target virtual object in the virtual scene; A position determination unit 1420, configured to determine a target position of the listener in the virtual scene according to the visual ray and the object position; The position adjustment unit 1430 is used to adjust the listener to the target position so that the listener receives and processes the sound events in the virtual scene at the target position.
[0084] In some embodiments, the position determination unit 1420 is further used to: determine a candidate deployment plane for the listener based on the object position; the vertical distance between the candidate deployment plane and the target virtual object is equal to zero, and the vertical distance between the candidate deployment plane and the virtual camera is greater than zero; and use the intersection position of the visual ray and the candidate deployment plane as the target position of the listener in the virtual scene.
[0085] In some embodiments, the position determination unit 1420 is further used to: establish an object coordinate system with the object position as the origin and the horizontal direction of the target virtual object facing the virtual camera as a coordinate axis; and use at least one coordinate plane in the object coordinate system as a candidate deployment plane for the listener.
[0086] In some embodiments, the position determination unit 1420 is further used to: use the intersection position of the visual ray and the target deployment plane as the target position, and the target deployment plane is the deployment plane among the candidate deployment planes that intersects with the visual ray for the first time.
[0087] In some embodiments, the game processing device also includes a range determination unit, which is used to determine the audible range of the listener in the virtual scene based on the target distance between the virtual camera and the listener, so that the listener can receive and process sound events within the audible range at the target position.
[0088] In some embodiments, the game processing device also includes a range determination unit, which is used to: if the target distance between the virtual camera and the listener is within a preset range, determine the audible range of the listener in the virtual scene according to the target distance; if the target distance between the virtual camera and the listener exceeds the preset range, determine the audible range of the listener in the virtual scene according to the target distance and a compensation coefficient.
[0089] In some embodiments, the game processing device also includes a range determination unit, which is used to: if the target distance between the virtual camera and the listener is greater than an upper limit threshold of the preset range, determine the audible range of the listener in the virtual scene based on the target distance and a first compensation coefficient, and the first compensation coefficient is a positive number less than 1.
[0090] In some embodiments, the game processing device also includes a range determination unit, which is used to: if the target distance between the virtual camera and the listener is greater than the upper limit threshold of the preset range, and the target distance is greater than the preset maximum threshold, then determine the audible range of the listener in the virtual scene according to the maximum threshold and a preset minimum compensation coefficient; wherein the maximum threshold is greater than the upper limit threshold; and the minimum compensation coefficient is the compensation coefficient with the smallest value among the first compensation coefficients.
[0091] In some embodiments, the game processing device also includes a range determination unit, which is used to: if the target distance between the virtual camera and the listener is less than the lower limit threshold of the preset range, determine the audible range of the listener in the virtual scene according to the target distance and a second compensation coefficient, and the second compensation coefficient is a positive number greater than 1.
[0092] In some embodiments, the game processing device also includes a range determination unit, which is used to: if the target distance between the virtual camera and the listener is less than the lower limit threshold of the preset range, and the target distance is less than the preset minimum threshold, then determine the audible range of the listener in the virtual scene according to the minimum threshold and a preset maximum compensation coefficient; wherein the minimum threshold is less than the lower limit threshold; and the maximum compensation coefficient is the compensation coefficient with the largest value among the second compensation coefficients.
[0093] In some embodiments, the game processing device also includes a range determination unit, which is used to: if the target virtual object is in a preset state, determine the audible range of the listener in the virtual scene based on the target distance between the virtual camera and the listener, and a preset third compensation coefficient.
[0094] In some embodiments, the data acquisition unit 1410 is further used to: obtain the visual ray of the virtual camera and the object position of the target virtual object in response to a position change of the virtual camera or the target virtual object, or in response to the generation of a frame of game screen.
[0095] The embodiment of the present application discloses a game processing device, which determines the target position of the listener in the virtual scene according to the visual ray of the virtual camera and the object position of the target virtual object through a position determination unit, and then adjusts the listener to the target position through a position adjustment unit, so that the listener receives and processes the sound events in the virtual scene at the target position. When determining the target position of the listener, the embodiment of the present application can make the listener located in the center of the game screen taken by the virtual camera by combining the visual ray of the virtual camera, ensuring that the sound received by the listener is consistent with the game screen; by combining the object position of the target virtual object, the listener can be relatively close to the target virtual object, retaining the sound details near the target virtual object. The embodiment of the present application takes into account the position parameters of the virtual camera and the target virtual object at the same time, so that the listener deployment position can adapt to complex and diverse game situations, and can more accurately obtain more sounds that need to be heard, so as to play game sounds that are highly adapted to the game screen and the target virtual object, and enhance the user's gaming experience.
[0096] Accordingly, the embodiment of the present application also provides a computer device, which may be a terminal or a server, and the terminal may be a smart phone, a tablet computer, a laptop computer, a touch screen, a game console, a personal computer (PC), a personal digital assistant (PDA), or other terminal devices. Fig.15 As shown, Fig.15 A schematic diagram of the structure of a computer device provided in an embodiment of the present application. The computer device 1500 includes a processor 1501 having one or more processing cores, a memory 1502 having one or more computer-readable storage media, and a computer program stored in the memory 1502 and executable on the processor. The processor 1501 is electrically connected to the memory 1502. Those skilled in the art will appreciate that the computer device structure shown in the figure does not constitute a limitation on the computer device, and may include more or fewer components than shown, or combine certain components, or arrange components differently.
[0097] Processor 1501 is the control center of computer device 1500. It uses various interfaces and lines to connect various parts of the entire computer device 1500, executes various functions of computer device 1500 and processes data by running or loading software programs and / or modules stored in memory 1502, and calling data stored in memory 1502, thereby monitoring computer device 1500 as a whole.
[0098] In the embodiment of the present application, the processor 1501 in the computer device 1500 will load instructions corresponding to the processes of one or more application programs into the memory 1502 according to the following steps, and the processor 1501 will run the application programs stored in the memory 1502 to implement various functions: Obtaining the visual ray of the virtual camera and the object position of the target virtual object in the virtual scene; Determining a target position of a listener in the virtual scene according to the visual ray and the object position; The listener is adjusted to the target position so that the listener receives and processes the sound events in the virtual scene at the target position.
[0099] In some embodiments, determining the target position of the listener in the virtual scene according to the visual ray and the object position includes: Determine a candidate deployment plane of the listener according to the object position; a vertical distance between the candidate deployment plane and the target virtual object is equal to zero, and a vertical distance between the candidate deployment plane and the virtual camera is greater than zero; The intersection position of the visual ray and the candidate deployment plane is used as the target position of the listener in the virtual scene.
[0100] In some embodiments, determining the candidate deployment plane of the listener according to the object position includes: Establishing an object coordinate system with the object position as the origin and the horizontal direction of the target virtual object facing the virtual camera as a coordinate axis; At least one coordinate plane in the object coordinate system is used as a candidate deployment plane of the listener.
[0101] In some embodiments, using the intersection position of the visual ray and the candidate deployment plane as the target position of the listener in the virtual scene includes: The intersection position of the visual ray and the target deployment plane is used as the target position, and the target deployment plane is the deployment plane that intersects the visual ray for the first time among the candidate deployment planes.
[0102] In some embodiments, after adjusting the listener to the target position, the method further includes: The audible range of the listener in the virtual scene is determined according to the target distance between the virtual camera and the listener, so that the listener receives and processes sound events within the audible range at the target position.
[0103] In some embodiments, determining the audible range of the listener in the virtual scene according to the target distance between the virtual camera and the listener includes: If the target distance between the virtual camera and the listener is within a preset range, determining the audible range of the listener in the virtual scene according to the target distance; If the target distance between the virtual camera and the listener exceeds the preset range, the audible range of the listener in the virtual scene is determined according to the target distance and the compensation coefficient.
[0104] In some embodiments, if the target distance between the virtual camera and the listener exceeds the preset range, determining the audible range of the listener in the virtual scene according to the target distance and the compensation coefficient includes: If the target distance between the virtual camera and the listener is greater than the upper threshold of the preset range, the audible range of the listener in the virtual scene is determined according to the target distance and a first compensation coefficient, where the first compensation coefficient is a positive number less than 1.
[0105] In some embodiments, if the target distance between the virtual camera and the listener is greater than an upper threshold of the preset range, determining the audible range of the listener in the virtual scene according to the target distance and the first compensation coefficient includes: If the target distance between the virtual camera and the listener is greater than the upper threshold of the preset range, and the target distance is greater than a preset maximum threshold, determining the audible range of the listener in the virtual scene according to the maximum threshold and a preset minimum compensation coefficient; Among them, the maximum threshold is greater than the upper threshold; the minimum compensation coefficient is the compensation coefficient with the smallest value among the first compensation coefficients.
[0106] In some embodiments, if the target distance between the virtual camera and the listener exceeds the preset range, determining the audible range of the listener in the virtual scene according to the target distance and the compensation coefficient includes: If the target distance between the virtual camera and the listener is less than the lower limit threshold of the preset range, the audible range of the listener in the virtual scene is determined according to the target distance and a second compensation coefficient, where the second compensation coefficient is a positive number greater than 1.
[0107] In some embodiments, if the target distance between the virtual camera and the listener is less than the lower limit threshold of the preset range, determining the audible range of the listener in the virtual scene according to the target distance and the second compensation coefficient includes: If the target distance between the virtual camera and the listener is less than the lower limit threshold of the preset range, and the target distance is less than the preset minimum threshold, determining the audible range of the listener in the virtual scene according to the minimum threshold and the preset maximum compensation coefficient; Among them, the minimum threshold is smaller than the lower limit threshold; the maximum compensation coefficient is the compensation coefficient with the largest value among the second compensation coefficients.
[0108] In some embodiments, determining the audible range of the listener in the virtual scene according to the target distance between the virtual camera and the listener includes: If the target virtual object is in a preset state, the audible range of the listener in the virtual scene is determined according to the target distance between the virtual camera and the listener and a preset third compensation coefficient.
[0109] In some embodiments, obtaining the visual ray of the virtual camera and the object position of the target virtual object includes: In response to a position change of the virtual camera or the target virtual object, or in response to the generation of a frame of game screen, the visual ray of the virtual camera and the object position of the target virtual object are obtained.
[0110] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0111] Optional, such as Fig.15 As shown, the computer device 1500 further includes: a touch screen 1503, a radio frequency circuit 1504, an audio circuit 1505, an input unit 1506, and a power supply 1507. The processor 1501 is electrically connected to the touch screen 1503, the radio frequency circuit 1504, the audio circuit 1505, the input unit 1506, and the power supply 1507, respectively. Those skilled in the art can understand that Fig.15 The computer device structure shown in the figure does not constitute a limitation on the computer device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0112] The touch display screen 1503 can be used to display a graphical user interface and receive operation instructions generated by the user acting on the graphical user interface. The touch display screen 1503 may include a display panel and a touch panel. Among them, the display panel can be used to display information input by the user or information provided to the user and various graphical user interfaces of the computer device, which can be composed of graphics, text, icons, videos and any combination thereof. Optionally, the display panel can be configured in the form of a liquid crystal display (LCD, Liquid Crystal Display), an organic light-emitting diode (OLED, Organic Light-Emitting Diode), etc. The touch panel can be used to collect the user's touch operations on or near it (such as the user's operation on the touch panel or near the touch panel using any suitable object or accessory such as a finger, stylus, etc.), and generate corresponding operation instructions, and the operation instructions execute the corresponding program. Optionally, the touch panel may include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into the touch point coordinates, and then sends it to the processor 1501, and can receive the command sent by the processor 1501 and execute it. The touch panel can cover the display panel. When the touch panel detects a touch operation on or near it, it is transmitted to the processor 1501 to determine the type of touch event, and then the processor 1501 provides a corresponding visual output on the display panel according to the type of touch event. In an embodiment of the present application, the touch panel and the display panel can be integrated into the touch display screen 1503 to realize the input and output functions. However, in some embodiments, the touch panel and the touch panel can be used as two independent components to realize the input and output functions. That is, the touch display screen 1503 can also be used as a part of the input unit 1506 to realize the input function.
[0113] In the embodiment of the present application, the processor 1501 executes the game application to generate a graphical user interface on the touch screen 1503. The touch screen 1503 is used to present the graphical user interface and receive operation instructions generated by the user acting on the graphical user interface.
[0114] The radio frequency circuit 1504 may be used to send and receive radio frequency signals, so as to establish wireless communication with a network device or other computer device through wireless communication, and to send and receive signals between the network device or other computer device.
[0115] The audio circuit 1505 can be used to provide an audio interface between the user and the computer device through a speaker and a microphone. The audio circuit 1505 can transmit the electrical signal converted from the received audio data to the speaker, which is converted into a sound signal for output; on the other hand, the microphone converts the collected sound signal into an electrical signal, which is received by the audio circuit 1505 and converted into audio data, and then the audio data is output to the processor 1501 for processing, and then sent to another computer device through the radio frequency circuit 1504, or the audio data is output to the memory 1502 for further processing. The audio circuit 1505 may also include an earphone jack to provide communication between an external headset and the computer device.
[0116] The input unit 1506 may be configured to receive input numbers, character information, or user feature information (eg, fingerprint, iris, facial information, etc.), and generate keyboard, mouse, joystick, optical, or trackball signal inputs related to user settings and function control.
[0117] The power supply 1507 is used to supply power to various components of the computer device 1500. Optionally, the power supply 1507 can be logically connected to the processor 1501 through a power management system, so that the power management system can manage charging, discharging, and power consumption. The power supply 1507 can also include one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0118] although Fig.15 Not shown, the computer device 1500 may also include a camera, a sensor, a wireless fidelity module, a Bluetooth module, etc., which will not be described in detail here.
[0119] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0120] As can be seen from the above, the computer device provided by this embodiment determines the target position of the listener in the virtual scene according to the visual ray of the virtual camera and the object position of the target virtual object, and then adjusts the listener to the target position so that the listener receives and processes the sound events in the virtual scene at the target position. When determining the target position of the listener, the embodiment of the present application can make the listener located in the center of the game screen taken by the virtual camera by combining the visual ray of the virtual camera, ensuring that the sound received by the listener is consistent with the game screen; by combining the object position of the target virtual object, the listener can be relatively close to the target virtual object, retaining the sound details near the target virtual object. The embodiment of the present application takes into account the position parameters of the virtual camera and the target virtual object at the same time, so that the listener deployment position can adapt to complex and diverse game situations, and can more accurately obtain more sounds that need to be heard, so as to play game sounds that are highly adapted to the game screen and the target virtual object, and enhance the user's gaming experience.
[0121] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0122] To this end, an embodiment of the present application provides a computer-readable storage medium, in which multiple computer programs are stored, and the computer program can be loaded by a processor to execute the steps in any game processing method provided in the embodiment of the present application. For example, the computer program can execute the following steps: Obtaining the visual ray of the virtual camera and the object position of the target virtual object in the virtual scene; Determining a target position of a listener in the virtual scene according to the visual ray and the object position; The listener is adjusted to the target position so that the listener receives and processes the sound events in the virtual scene at the target position.
[0123] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0124] The storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0125] The computer program stored in the storage medium can determine the target position of the listener in the virtual scene according to the visual ray of the virtual camera and the object position of the target virtual object, and then adjust the listener to the target position so that the listener receives and processes the sound events in the virtual scene at the target position. When determining the target position of the listener, the embodiment of the present application can make the listener located in the center of the game screen taken by the virtual camera by combining the visual ray of the virtual camera, ensuring that the sound received by the listener is consistent with the game screen; by combining the object position of the target virtual object, the listener can be relatively close to the target virtual object, retaining the sound details near the target virtual object. The embodiment of the present application takes into account the position parameters of the virtual camera and the target virtual object at the same time, so that the listener deployment position can adapt to complex and diverse game situations, and can more accurately obtain more sounds that need to be heard, so as to play game sounds that are highly adapted to the game screen and the target virtual object, and enhance the user's gaming experience.
[0126] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0127] The above is a detailed introduction to a game processing method, device, computer equipment and computer-readable storage medium provided in the embodiments of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the technical solution and its core idea of the present application. Ordinary technicians in this field should understand that they can still modify the technical solutions recorded in the aforementioned embodiments, or replace some of the technical features therein with equivalents; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A game processing method, characterized in that: include: Obtaining the visual ray of the virtual camera and the object position of the target virtual object in the virtual scene; Determining a target position of a listener in the virtual scene according to the visual ray and the object position; The listener is adjusted to the target position so that the listener receives and processes the sound events in the virtual scene at the target position.
2. The game processing method according to claim 1, characterized in that: Determining the target position of the listener in the virtual scene according to the visual ray and the object position includes: Determine a candidate deployment plane of the listener according to the object position; a vertical distance between the candidate deployment plane and the target virtual object is equal to zero, and a vertical distance between the candidate deployment plane and the virtual camera is greater than zero; The intersection position of the visual ray and the candidate deployment plane is used as the target position of the listener in the virtual scene.
3. The game processing method according to claim 2, characterized in that: The determining the candidate deployment plane of the listener according to the object position includes: Establishing an object coordinate system with the object position as the origin and the horizontal direction of the target virtual object facing the virtual camera as a coordinate axis; At least one coordinate plane in the object coordinate system is used as a candidate deployment plane of the listener.
4. The game processing method according to claim 2, characterized in that: The step of using the intersection position of the visual ray and the candidate deployment plane as the target position of the listener in the virtual scene includes: The intersection position of the visual ray and the target deployment plane is used as the target position, and the target deployment plane is the deployment plane that intersects the visual ray for the first time among the candidate deployment planes.
5. The game processing method according to claim 1, characterized in that: After adjusting the listener to the target position, the method further includes: The audible range of the listener in the virtual scene is determined according to the target distance between the virtual camera and the listener, so that the listener receives and processes sound events within the audible range at the target position.
6. The game processing method according to claim 5, characterized in that: The step of determining the audible range of the listener in the virtual scene according to the target distance between the virtual camera and the listener includes: If the target distance between the virtual camera and the listener is within a preset range, determining the audible range of the listener in the virtual scene according to the target distance; If the target distance between the virtual camera and the listener exceeds the preset range, the audible range of the listener in the virtual scene is determined according to the target distance and the compensation coefficient.
7. The game processing method according to claim 6, characterized in that: If the target distance between the virtual camera and the listener exceeds the preset range, determining the audible range of the listener in the virtual scene according to the target distance and the compensation coefficient, comprises: If the target distance between the virtual camera and the listener is greater than the upper threshold of the preset range, the audible range of the listener in the virtual scene is determined according to the target distance and a first compensation coefficient, where the first compensation coefficient is a positive number less than 1.
8. The game processing method according to claim 7, characterized in that: If the target distance between the virtual camera and the listener is greater than the upper threshold of the preset range, determining the audible range of the listener in the virtual scene according to the target distance and the first compensation coefficient, comprising: If the target distance between the virtual camera and the listener is greater than the upper threshold of the preset range, and the target distance is greater than a preset maximum threshold, determining the audible range of the listener in the virtual scene according to the maximum threshold and a preset minimum compensation coefficient; Among them, the maximum threshold is greater than the upper limit threshold; the minimum compensation coefficient is the compensation coefficient with the smallest value among the first compensation coefficients.
9. The game processing method according to claim 6, characterized in that: If the target distance between the virtual camera and the listener exceeds the preset range, determining the audible range of the listener in the virtual scene according to the target distance and the compensation coefficient, comprises: If the target distance between the virtual camera and the listener is less than the lower limit threshold of the preset range, the audible range of the listener in the virtual scene is determined according to the target distance and a second compensation coefficient, where the second compensation coefficient is a positive number greater than 1.
10. The game processing method according to claim 9, characterized in that: If the target distance between the virtual camera and the listener is less than the lower limit threshold of the preset range, determining the audible range of the listener in the virtual scene according to the target distance and the second compensation coefficient, comprising: If the target distance between the virtual camera and the listener is less than the lower limit threshold of the preset range, and the target distance is less than the preset minimum threshold, determining the audible range of the listener in the virtual scene according to the minimum threshold and the preset maximum compensation coefficient; Among them, the minimum threshold is smaller than the lower limit threshold; the maximum compensation coefficient is the compensation coefficient with the largest value among the second compensation coefficients.
11. The game processing method according to claim 5, characterized in that: The step of determining the audible range of the listener in the virtual scene according to the target distance between the virtual camera and the listener includes: If the target virtual object is in a preset state, the audible range of the listener in the virtual scene is determined according to the target distance between the virtual camera and the listener and a preset third compensation coefficient.
12. The game processing method according to any one of claims 1 to 11, characterized in that: The obtaining of the visual ray of the virtual camera and the object position of the target virtual object comprises: In response to a position change of the virtual camera or the target virtual object, or in response to the generation of a frame of game screen, the visual ray of the virtual camera and the object position of the target virtual object are obtained.
13. A game processing device, characterized in that: include: A data acquisition unit, used for acquiring visual rays of a virtual camera and an object position of a target virtual object in a virtual scene; a position determination unit, configured to determine a target position of a listener in the virtual scene according to the visual ray and the object position; A position adjustment unit is used to adjust the listener to the target position so that the listener receives and processes the sound events in the virtual scene at the target position.
14. A computer device, characterized in that: It comprises a processor and a memory, wherein the memory stores a plurality of instructions; the processor loads instructions from the memory to execute the steps in the game processing method as claimed in any one of claims 1 to 12.
15. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor to execute the steps in the game processing method according to any one of claims 1 to 12.
