Game environment sound generation method and device, storage medium and computer device
Patent Information
- Application Number
- CN202611134030.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-29
- Publication Date
- 2026-10-23
AI Technical Summary
[0003]有鉴于此,本申请提供一种游戏环境声的生成方法、装置、存储介质以及计算机设备,主要目的在于解决现有游戏环境声的生成准确性以及有效性差的问题
本申请提供了一种游戏环境声的生成方法、装置、存储介质以及计算机设备,与现有技术相比,本申请实施例通过构建游戏角色在游戏环境中的声笼,所述声笼用于表征声音在所述游戏环境中的有效传播范围;以所述声笼的中心点确定多个方向的边界终点,并基于所述边界终点进行音频碰撞检测,确定碰撞物理材质;基于所述碰撞物理材质提取出的吸声系数以及探测方向进行材质吸声聚合,得到声音渲染参数,并基于所述声音渲染参数生成游戏环境声,实现声音伴玩家角色移动而渲染,满足不同方向环境对声音吸收的需求,提高声音在环境中的综合传播效果,从而提高游戏环境声音的逼真效果。
Smart Images

Figure CN122955191A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of game development technology, and in particular to a method, apparatus, storage medium, and computer device for generating game ambient sound. Background Technology
[0002] In game development, players in virtual game scenes acquire ambient sound through surrounding acoustic recognition. Currently, methods for acquiring game ambient sound typically involve dynamically adjusting environmental sound absorption parameters based on the degree of enclosure and boundary materials of the space where the character is located to generate ambient sounds with different effects. However, relying solely on enclosure and dynamic boundary material adjustments cannot meet the need for real-time assessment of the surrounding environment's sound absorption when players move, turn, or enter caves, indoor spaces, or semi-open spaces. Furthermore, it cannot avoid the situation where environmental judgment is one-sided due to using only unidirectional detection, resulting in inconsistent sound parameters and affecting the realism of the sound, thus significantly reducing the accuracy and effectiveness of game ambient sound generation. Summary of the Invention
[0003] In view of this, this application provides a method, apparatus, storage medium, and computer device for generating game ambient sounds, with the main objective of solving the problems of poor accuracy and effectiveness in the generation of existing game ambient sounds.
[0004] According to one aspect of this application, a method for generating game ambient sound is provided, comprising: Construct a sound cage for a game character in a game environment, wherein the sound cage is used to characterize the effective propagation range of sound in the game environment; The center point of the acoustic cage is used to determine the boundary endpoints in multiple directions, and audio collision detection is performed based on the boundary endpoints to determine the collision physical material. Based on the sound absorption coefficient extracted from the collision physical material and the detection direction, the material sound absorption is aggregated to obtain sound rendering parameters, and game ambient sound is generated based on the sound rendering parameters.
[0005] Furthermore, the construction of the sound cage for the game character in the game environment includes: The head-related position point of the game character is determined based on a preset distance range; Using the horizontal direction of the camera as a reference, the local direction is converted into the world direction of the game environment. The local direction includes the horizontal layer direction, the diagonal upper layer direction, the high elevation angle layer direction, and the diagonal lower layer direction. The acoustic cage is constructed based on the head-associated location point and the world direction.
[0006] Furthermore, determining the boundary endpoints in multiple directions using the center point of the acoustic cage includes: Starting from the center point, voxel and / or scene boundary detection is performed along the world direction; If the voxel and / or the scene boundary are detected, the boundary endpoint is determined based on the hit voxel and / or the hit scene boundary. If the voxel and / or the scene boundary are not detected, the maximum detection distance is determined as the boundary endpoint.
[0007] Furthermore, the audio collision detection based on the boundary endpoint, and the determination of the collision physical material, includes: When the center point is valid, collision detection is performed starting from the boundary endpoint and according to the target direction and the first distance. When a collider is detected, the collision physical material of the collider is queried.
[0008] Furthermore, the method also includes: If the distance between the colliding object and the center point is less than a preset distance threshold, then collision detection is performed according to the target direction and the second distance to re-detect the colliding object.
[0009] Furthermore, the sound rendering parameters obtained by combining the sound absorption coefficient extracted from the collision physical material and the detection direction include: Read the sound absorption coefficient of the physical material of the collision, which is used to characterize the sound absorption ability of different materials in the collision body; Based on the world direction, multiple detection directions are determined, and the spatial openness is converted for the collision distances corresponding to the multiple detection directions to obtain the spatial openness percentage. Sound rendering parameters are generated based on the percentage of spatial openness and the detection direction.
[0010] Furthermore, generating game ambient sound based on the sound rendering parameters includes: The sound rendering component is invoked, and game ambient sounds corresponding to the sound rendering parameters in different directions are generated based on the sound rendering component.
[0011] According to another aspect of this application, a device for generating ambient sound in a game is provided, comprising: A building component is used to construct a sound cage for a game character in a game environment, wherein the sound cage is used to characterize the effective propagation range of sound in the game environment; The determination module is used to determine the boundary endpoints in multiple directions based on the center point of the acoustic cage, and to perform audio collision detection based on the boundary endpoints to determine the collision physical material. The generation module is used to aggregate the sound absorption coefficients extracted from the collision physical material and the detection direction to obtain sound rendering parameters, and generate game ambient sound based on the sound rendering parameters.
[0012] Furthermore, the construction module is specifically used to determine the head-related position point of the game character based on a preset distance range; using the horizontal direction of the camera as a reference, converting the local direction into the world direction of the game environment, the local direction including the horizontal layer direction, the diagonal upper layer direction, the high elevation angle layer direction, and the diagonal lower layer direction; and constructing the sound cage based on the head-related position point and the world direction.
[0013] Furthermore, the determining module is specifically used to perform voxel and / or scene boundary detection along the world direction starting from the center point; if the voxel and / or the scene boundary is detected, the boundary endpoint is determined based on the hit voxel and / or the hit scene boundary; if the voxel and / or the scene boundary is not detected, the maximum detection distance is determined as the boundary endpoint.
[0014] Furthermore, the determining module is specifically used to perform collision detection starting from the boundary endpoint and according to the target direction and the first distance when the center point is valid; when a collider is detected, the collision physical material of the collider is queried.
[0015] Furthermore, the determining module is also used to perform collision detection according to the target direction and the second distance if the distance between the colliding object and the center point is less than a preset distance threshold, so as to re-detect the colliding object.
[0016] Furthermore, the generation module is specifically used to read the sound absorption coefficient in the collision physical material, the sound absorption coefficient being used to characterize the sound absorption capability of different material collision bodies; determine multiple detection directions based on the world direction, and perform spatial openness conversion on the collision distances corresponding to the multiple detection directions to obtain a spatial openness percentage; and generate sound rendering parameters based on the spatial openness percentage and the detection directions.
[0017] Furthermore, the generation module is specifically used to invoke the sound rendering component and generate game ambient sounds corresponding to the sound rendering parameters in different directions based on the sound rendering component.
[0018] According to another aspect of this application, a storage medium is provided, wherein at least one executable instruction is stored therein, the executable instruction causing a processor to perform an operation corresponding to the above-described method for generating game ambient sounds.
[0019] According to another aspect of this application, a computer device is provided, comprising: a processor, a memory, a communication interface, and a communication bus, wherein the processor, the memory, and the communication interface communicate with each other through the communication bus; The memory is used to store at least one executable instruction, which causes the processor to perform the operation corresponding to the above-described method for generating game ambient sounds.
[0020] By employing the above technical solutions, the technical solutions provided in the embodiments of this application have at least the following advantages: This application provides a method, apparatus, storage medium, and computer device for generating game ambient sound. Compared with the prior art, the embodiments of this application construct a sound cage for the game character in the game environment, the sound cage being used to characterize the effective propagation range of sound in the game environment; determine boundary endpoints in multiple directions based on the center point of the sound cage, and perform audio collision detection based on the boundary endpoints to determine the collision physical material; perform material sound absorption aggregation based on the sound absorption coefficient extracted from the collision physical material and the detection direction to obtain sound rendering parameters, and generate game ambient sound based on the sound rendering parameters, realizing that the sound is rendered along with the player character's movement, meeting the needs of sound absorption in different directions of the environment, improving the overall propagation effect of sound in the environment, thereby improving the realism of the game ambient sound.
[0021] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, the following are specific embodiments of this application. Attached Figure Description
[0022] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the scope of this application. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings: Figure 1 A flowchart illustrating a method for generating game ambient sound according to an embodiment of this application is shown; Figure 2 This illustration shows a block diagram of a device for generating ambient sound in a game, according to an embodiment of this application. Figure 3 A schematic diagram of the structure of a computer device provided in an embodiment of this application is shown. Detailed Implementation
[0023] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
[0024] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0025] This application provides a method for generating game ambient sound, such as... Figure 1 As shown, the method includes: 101. Construct the sound cage of game characters in the game environment.
[0026] In this embodiment, the current execution terminal, as the entity responsible for generating game environment sound, can be a game operating terminal, such as a mobile phone or handheld game console, or a game server, such as a cloud server; this embodiment does not impose specific limitations. Furthermore, the game in this embodiment is applicable to massively multiplayer online games, offline single-player games, etc. Game characters refer to virtual objects that can be manipulated by game players in the game, including but not limited to human-shaped characters, animal-shaped characters, and various scene object-shaped characters; this embodiment does not impose specific limitations. The game environment can be an environment created from various spaces or scenes, including but not limited to indoor spaces, semi-open spaces, caves, towns, forests, etc.; this embodiment does not impose specific limitations.
[0027] It should be noted that a sound cage is used to characterize the effective propagation range of sound in the game environment. It can be constructed based on the position of the game character in the scene. Different game characters can each construct a corresponding sound cage, which is updated as the game character moves, so as to constrain the propagation of sound within an effective sound absorption range.
[0028] In another embodiment of this application, for further definition and explanation, the step of constructing the sound cage of the game character in the game environment includes: The head-related position point of the game character is determined based on a preset distance range; Using the camera's horizontal direction as a reference, the local orientation is converted to the world orientation of the game environment; The acoustic cage is constructed based on the head-associated location point and the world direction.
[0029] To ensure effective sound absorption within a specific range and to allow the sound to change with the movement of the game character, thereby enhancing sound realism, the sound cage is constructed by first determining the head-related position point of the game character. Specifically, the center of the sound cage is created using the vicinity of the game character's head. The preset distance range can be set based on the size of the game character's model, such as any distance between 0 cm and 50 cm. Correspondingly, starting from the head, the determined head-related position point can be any position point extending outwards from the head, ears, visual camera, or listening point within the preset distance range; this is not specifically limited in this embodiment. In a specific example, when determining the head-related position point, a position point on the top of the head can be determined by offsetting the capsule's half-height vertically upwards from the world position of the controlled character's capsule component; this is not specifically limited in this embodiment either.
[0030] Furthermore, when constructing the sound cage, the game character's horizontal perspective is converted. That is, using the camera's horizontal direction as a reference, the local orientation is converted to the world orientation of the game environment. This results in a sound cage centered on the character's listening position, encompassing a 24-directional detection range that rotates with the character's horizontal perspective. This includes horizontal, upward, high-angle, and downward directions. The horizontal direction comprises eight directions, covering approximately 29 degrees left and right in front, 61 degrees left and right in front, 119 degrees left and right behind, and 151 degrees left and right behind relative to the viewing angle. The upward direction comprises eight directions, adding approximately 26 degrees of elevation to the above horizontal directions. The high-angle direction comprises four directions, covering four oblique directions with an elevation angle of approximately 42 degrees: left front, right front, left rear, and right rear. The downward direction comprises four directions, covering four oblique directions with a depression angle of approximately 42 degrees: left front, right front, left rear, and right rear. This covers the character's front, back, left, right, side rear, upward, and downward directions. Furthermore, the world orientation of the game environment refers to the globally fixed coordinate axis reference during game time, with the scene mesh center at the origin (0,0,0). It is unaffected by character or model rotation, and the world position and orientation of all objects are referenced to the fixed axis of the world orientation. Therefore, converting the local orientation to the world orientation ensures that the constructed sound cage does not follow camera pitch or roll changes. Finally, the sound cage is constructed based on the head-related position point and the world orientation. That is, starting from the head-related position point, it can be extended in the world orientation to obtain an enclosure used for sound absorption judgment.
[0031] 102. Determine the boundary endpoints in multiple directions based on the center point of the acoustic cage, and perform audio collision detection based on the boundary endpoints to determine the physical material of the collision.
[0032] In this embodiment, after constructing the sound cage corresponding to the game character, the boundary endpoints in multiple directions are determined using the center point of the sound cage. The center point of the sound cage can be the center position calculated in three-dimensional space with the sound cage as the reference point. These multiple directions can represent all world directions within the game environment. Then, the boundary endpoints at a preset propagation distance are detected using ray detection. Preferably, the preset propagation distance is 2000 cm, but this embodiment does not impose a specific limitation. Furthermore, spectral collision detection is performed according to the determined boundary endpoints. This can be done using an audio environment collision detection component. When an audio collision is detected, it indicates the presence of a collider affecting sound propagation. Therefore, the collision physical material of the collider is obtained through a query method.
[0033] In another embodiment of this application, for further definition and explanation, the step of determining the boundary endpoints in multiple directions using the center point of the acoustic cage includes: Starting from the center point, voxel and / or scene boundary detection is performed along the world direction; If the voxel and / or the scene boundary are detected, the boundary endpoint is determined based on the hit voxel and / or the hit scene boundary. If the voxel and / or the scene boundary are not detected, the maximum detection distance is determined as the boundary endpoint.
[0034] To assess the sound propagation effect from multiple directions and avoid the biased nature of sound propagation in the environment, when determining the boundary endpoints in multiple directions, the center point of the sound cage is first used as the starting point, and voxel and / or scene boundary detection is performed along the world direction. This detection can be performed using the ray detection component of the world query subsystem, while simultaneously setting the detection range, such as within 2000 cm.
[0035] In one specific embodiment, if the voxel and / or the scene boundary are detected, it indicates that sound propagation within the detection range is affected by the voxel or scene boundary. Therefore, the boundary endpoint is determined based on the detected voxel and / or the detected scene boundary. Conversely, if the voxel and / or the scene boundary are not detected, it indicates that sound propagation within the detection range is not affected by the voxel or scene boundary. Therefore, the maximum detection distance is determined as the boundary endpoint. In this case, the maximum detection distance can be set based on different game scenarios, and this application embodiment does not impose specific limitations.
[0036] It should be noted that after determining the boundary endpoint, information such as direction, endpoint, distance from center to endpoint, and whether it is blocked by the boundary is recorded according to the direction number. For the direction of the boundary endpoint that has been detected, the straight-line connectivity judgment of the world query subsystem can also be used to check whether there is a straight-line connection between the hit boundary point and the player character position in the voxel space, and the judgment result is recorded as the boundary connectivity.
[0037] In another embodiment of this application, for further definition and explanation, the step of performing audio collision detection based on the boundary endpoint to determine the collision physical material includes: When the center point is valid, collision detection is performed starting from the boundary endpoint and according to the target direction and the first distance. When a collider is detected, the collision physical material of the collider is queried.
[0038] To achieve sound absorption detection and improve the realism of sound propagation, the audio collision detection process first determines whether the center point of the sound cage is valid. This can be determined by checking the existence of the center point or whether it enters other scene object models; this embodiment does not specify a particular method. Furthermore, when the center point is valid, a short-range extended detection is performed starting from the boundary endpoint. This involves collision detection based on the target direction and a first distance. The target direction can be the same as the direction of the detection boundary endpoint, and the first distance, as a short-range detection requirement, can be set to 100 centimeters to initiate an asynchronous linear detection.
[0039] In one specific embodiment, when a collider is detected, it indicates the presence of an object that can absorb sound; therefore, the physical material of the collider can be queried.
[0040] In another embodiment of this application, for further definition and explanation, the steps also include: If the distance between the colliding object and the center point is less than a preset distance threshold, then collision detection is performed according to the target direction and the second distance to re-detect the colliding object.
[0041] To improve the stability of material sampling when players are close to walls, caves, or narrow spaces, thereby enhancing the realism of sound propagation, a distance threshold is preset as the basis for extending the distance. That is, when the distance between the colliding object and the center point is less than this preset distance threshold, it indicates that the distance is too close, and collision detection is performed according to the extended second distance. At this time, the second distance can be set to 500 cm or 1000 cm, which is greater than the first distance. This application embodiment does not make specific limitations.
[0042] In another embodiment of this application, if no collider is detected, it indicates that there is no material that effectively absorbs sound in this target direction. Therefore, collision detection can be performed in the next direction further away or the detection can be terminated. This embodiment of the application does not make specific limitations.
[0043] 103. Based on the sound absorption coefficient extracted from the collision physical material and the detection direction, perform material sound absorption aggregation to obtain sound rendering parameters, and generate game ambient sound based on the sound rendering parameters.
[0044] In this embodiment, since materials in the physical world can characterize the properties of objects, such as hardness and brightness, different materials have different effects on sound propagation and absorption. Therefore, to make the sound effects in the game environment more realistic, the sound absorption coefficient is extracted according to the physical materials of the collision, as the sound absorption contribution of sound propagation in this direction. Furthermore, material sound absorption aggregation is performed based on the sound absorption coefficient and the detection direction. Here, the detection direction can be the effective direction of the detected colliding object, and can be multiple or just one; this embodiment does not specifically limit this. The sound rendering parameters obtained after material sound absorption aggregation are used to characterize the relevant parameters for rendering sound in different directions, including but not limited to volume gain, stereo spread, distance attenuation, and sound source orientation, to generate the final game environment sound based on the sound rendering parameters.
[0045] In another embodiment of this application, for further definition and explanation, the step of performing material sound absorption aggregation based on the sound absorption coefficient extracted from the collision physical material and the detection direction to obtain sound rendering parameters includes: Read the sound absorption coefficient of the physical material involved in the collision; Based on the world direction, multiple detection directions are determined, and the spatial openness is converted for the collision distances corresponding to the multiple detection directions to obtain the spatial openness percentage. Sound rendering parameters are generated based on the percentage of spatial openness and the detection direction.
[0046] To meet the sound absorption requirements of different materials and ensure realistic sound propagation, the sound absorption coefficient of the colliding physical materials is read. This sound absorption coefficient characterizes the sound absorption capacity of different colliding materials. The sound absorption coefficient is derived from the sound absorption coefficient field corresponding to the colliding physical material in the audio material configuration table and can be written during physical material generation or initialization. Therefore, different walls, stone walls, wood, fabric, and other boundaries can be configured with different sound absorption capacities. Furthermore, the detection direction can be determined based on the world direction. This can be done by determining the direction of the detected colliding object within the world direction; this embodiment does not impose specific limitations. Next, the spatial openness is converted from the collision distances corresponding to multiple detection directions to obtain a spatial openness percentage. This can be done based on the Sabine reverberation formula, the conversion of distances in real-world environments such as rooms, or by calling conversion components in game engines, such as the UE series game engine, to perform parameter conversion and obtain a spatial openness percentage; this embodiment does not impose specific limitations.
[0047] In one specific embodiment, the environment component can periodically update spatial audio information, such as triggering an update every 0.2 seconds. After calling the sound cage through the game blueprint and performing the corresponding collision detection, it is grouped according to the left, right, front, back, up, down and other directions to determine the detection direction. The distance of each direction is converted into a percentage of spatial openness, and the corresponding physical material is retained.
[0048] It should be noted that after obtaining the percentage of spatial openness, sound rendering parameters are generated by combining the detection direction. That is, the sound absorption coefficients of the physical materials extracted after effective extended collision detection are averaged to generate sound rendering parameters.
[0049] In a specific example, when generating sound rendering parameters based on the detection directions, specifically for the six detection directions (left, right, front, back, up, and down), the spatial openness of these six directions can be averaged and multiplied by a distance weight to obtain the overall spatial size parameter. The smaller openness among the left, right, front, back, and up directions is selected, and the range of 15 to 100 is mapped to 0 to 100 to obtain the front reflection delay parameter. This ensures that the earlier the reflection is, the more pronounced the muffled sound is, especially in narrower spaces. Based on the openness of the left and right sides and the front and back directions, reflected sound images and ambient sound images are calculated separately. The more enclosed the lateral areas, the more concentrated the reflections and ambient sound distribution in the corresponding directions. The base width is calculated based on the larger value of the left and right openness, and the reflection width is calculated by combining the openness of the left and right, front and back directions and the type of obstruction, making reflections wider in open spaces and narrower in enclosed spaces. Calculate the absolute values of the differences in left-right, front-back, and vertical openness, and take the smaller value as the spatial orientation difference parameter to suppress abrupt sound image jumps caused by spatial imbalances. Finally, read the physical material type for each hit direction, assign weights to different materials, and calculate the average to obtain the material absorption parameter. Combine the above parameters into the sound rendering parameters.
[0050] In another embodiment of this application, for further definition and explanation, the step of generating game ambient sound based on the sound rendering parameters includes: The sound rendering component is invoked, and game ambient sounds corresponding to the sound rendering parameters in different directions are generated based on the sound rendering component.
[0051] To ensure realistic sound generation, the sound rendering component is first invoked during rendering to control the generation of game ambient sounds in conjunction with sound rendering parameters. At this stage, the rendering of game ambient sounds is only written to the sound rendering parameters when the values relative to the last saved sound rendering parameters change. Furthermore, reflection effect resources on the spatial reflection bus are set through an audio intermediate component to produce realistic sound effects such as reverberation during rendering. Additionally, during sound rendering, for different materials, higher sound absorption coefficients result in stronger high-frequency attenuation and ambient muffled sound; smaller overall space dimensions result in shorter early reflection delays, narrower reflection widths, and a stronger sense of spatial immersion. When the space is relatively open or has minimal directional differences, a wider reflection distribution and weaker muffled sound processing can be used to create a continuous transition between outdoor, semi-open spaces, and cave interiors.
[0052] In a specific example, when a player controls their character to enter a cave from an open outdoor space, there are no collisions within 2000 cm in most directions outdoors, so the corresponding sound rendering parameters are 0. After entering the cave, collisions gradually occur from the sides, above, and diagonally behind the cave walls or ceiling. The sound absorption coefficients of materials such as stone are read, and the average sound rendering parameters are calculated. As the number of effective collision directions increases, the rendered audio is enhanced with high-frequency attenuation and environmental muffled sound, thus creating a continuous sound transition from open to enclosed space.
[0053] This application provides a method for generating game environment sound. Compared with the prior art, this application constructs a sound cage for the game character in the game environment, the sound cage being used to characterize the effective propagation range of sound in the game environment; determines boundary endpoints in multiple directions based on the center point of the sound cage, and performs audio collision detection based on the boundary endpoints to determine the collision physical material; performs material sound absorption aggregation based on the sound absorption coefficient extracted from the collision physical material and the detection direction to obtain sound rendering parameters, and generates game environment sound based on the sound rendering parameters, realizing that the sound is rendered along with the player character's movement, meeting the needs of sound absorption in different directions of the environment, improving the overall propagation effect of sound in the environment, thereby improving the realism of the game environment sound.
[0054] Furthermore, as a response to the above Figure 1 The implementation of the method shown in this application provides a device for generating game ambient sound, such as... Figure 2 As shown, the device includes: Component 21 is used to construct the sound cage of a game character in the game environment, wherein the sound cage is used to characterize the effective propagation range of sound in the game environment; The determination module 22 is used to determine the boundary endpoints in multiple directions based on the center point of the acoustic cage, and to perform audio collision detection based on the boundary endpoints to determine the collision physical material. The generation module 23 is used to aggregate the sound absorption coefficient extracted from the collision physical material and the detection direction to obtain sound rendering parameters, and generate game ambient sound based on the sound rendering parameters.
[0055] Furthermore, the construction module is specifically used to determine the head-related position point of the game character based on a preset distance range; using the horizontal direction of the camera as a reference, converting the local direction into the world direction of the game environment, the local direction including the horizontal layer direction, the diagonal upper layer direction, the high elevation angle layer direction, and the diagonal lower layer direction; and constructing the sound cage based on the head-related position point and the world direction.
[0056] Furthermore, the determining module is specifically used to perform voxel and / or scene boundary detection along the world direction starting from the center point; if the voxel and / or the scene boundary is detected, the boundary endpoint is determined based on the hit voxel and / or the hit scene boundary; if the voxel and / or the scene boundary is not detected, the maximum detection distance is determined as the boundary endpoint.
[0057] Furthermore, the determining module is specifically used to perform collision detection starting from the boundary endpoint and according to the target direction and the first distance when the center point is valid; when a collider is detected, the collision physical material of the collider is queried.
[0058] Furthermore, the determining module is also used to perform collision detection according to the target direction and the second distance if the distance between the colliding object and the center point is less than a preset distance threshold, so as to re-detect the colliding object.
[0059] Furthermore, the generation module is specifically used to read the sound absorption coefficient in the collision physical material, the sound absorption coefficient being used to characterize the sound absorption capability of different material collision bodies; determine multiple detection directions based on the world direction, and perform spatial openness conversion on the collision distances corresponding to the multiple detection directions to obtain a spatial openness percentage; and generate sound rendering parameters based on the spatial openness percentage and the detection directions.
[0060] Furthermore, the generation module is specifically used to invoke the sound rendering component and generate game ambient sounds corresponding to the sound rendering parameters in different directions based on the sound rendering component.
[0061] This application provides a device for generating game environment sound. Compared with the prior art, this application constructs a sound cage for a game character in the game environment, the sound cage being used to characterize the effective propagation range of sound in the game environment; it determines boundary endpoints in multiple directions based on the center point of the sound cage, and performs audio collision detection based on the boundary endpoints to determine the collision physical material; it performs material sound absorption aggregation based on the sound absorption coefficient extracted from the collision physical material and the detection direction to obtain sound rendering parameters, and generates game environment sound based on the sound rendering parameters, realizing that the sound is rendered along with the player character's movement, meeting the sound absorption needs of different directional environments, improving the overall propagation effect of sound in the environment, and thus improving the realism of the game environment sound.
[0062] According to one embodiment of this application, a storage medium is provided, the storage medium storing at least one executable instruction that can execute the game ambient sound generation method in any of the above method embodiments.
[0063] Figure 3The diagram shows a structural schematic of a computer device according to one embodiment of the present application. The specific embodiments of the present application do not limit the specific implementation of the computer device.
[0064] like Figure 3 As shown, the computer device may include: a processor 302, a communications interface 304, a memory 306, and a communications bus 308.
[0065] The processor 302, communication interface 304, and memory 306 communicate with each other via communication bus 308.
[0066] Communication interface 304 is used to communicate with other network elements such as clients or other servers.
[0067] The processor 302 is used to execute program 310, specifically the relevant steps in the above-described embodiment of the method for generating game ambient sounds.
[0068] Specifically, program 310 may include program code that includes computer operation instructions.
[0069] Processor 302 may be a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of this application. The computer device includes one or more processors, which may be processors of the same type, such as one or more CPUs; or they may be processors of different types, such as one or more CPUs and one or more ASICs.
[0070] Memory 306 is used to store program 310. Memory 306 may include high-speed RAM memory, and may also include non-volatile memory, such as at least one disk storage device.
[0071] Specifically, program 310 can be used to cause processor 302 to perform the following operations: Construct a sound cage for a game character in a game environment, wherein the sound cage is used to characterize the effective propagation range of sound in the game environment; The center point of the acoustic cage is used to determine the boundary endpoints in multiple directions, and audio collision detection is performed based on the boundary endpoints to determine the collision physical material. Based on the sound absorption coefficient extracted from the collision physical material and the detection direction, the material sound absorption is aggregated to obtain sound rendering parameters, and game ambient sound is generated based on the sound rendering parameters.
[0072] Obviously, those skilled in the art should understand that the modules or steps of this application described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. Optionally, they can be implemented using computer-executable program code, thereby storing them in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those presented here, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, this application is not limited to any particular combination of hardware and software.
[0073] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application.
Claims
1. A method for generating ambient sound in a game, characterized in that, include: Construct a sound cage for a game character in a game environment, wherein the sound cage is used to characterize the effective propagation range of sound in the game environment; The center point of the acoustic cage is used to determine the boundary endpoints in multiple directions, and audio collision detection is performed based on the boundary endpoints to determine the collision physical material. Based on the sound absorption coefficient extracted from the collision physical material and the detection direction, the material sound absorption is aggregated to obtain sound rendering parameters, and game ambient sound is generated based on the sound rendering parameters.
2. The method according to claim 1, characterized in that, The construction of the sound cage for the game character in the game environment includes: The head-related position point of the game character is determined based on a preset distance range; Using the horizontal direction of the camera as a reference, the local direction is converted into the world direction of the game environment. The local direction includes the horizontal layer direction, the diagonal upper layer direction, the high elevation angle layer direction, and the diagonal lower layer direction. The acoustic cage is constructed based on the head-associated location point and the world direction.
3. The method according to claim 2, characterized in that, The determination of boundary endpoints in multiple directions using the center point of the acoustic cage includes: Starting from the center point, voxel and / or scene boundary detection is performed along the world direction; If the voxel and / or the scene boundary are detected, the boundary endpoint is determined based on the hit voxel and / or the hit scene boundary. If the voxel and / or the scene boundary are not detected, the maximum detection distance is determined as the boundary endpoint.
4. The method according to claim 3, characterized in that, The audio collision detection based on the boundary endpoint, and the determination of the collision physical material, includes: When the center point is valid, collision detection is performed starting from the boundary endpoint and according to the target direction and the first distance. When a collider is detected, the collision physical material of the collider is queried.
5. The method according to claim 4, characterized in that, The method further includes: If the distance between the colliding object and the center point is less than a preset distance threshold, then collision detection is performed according to the target direction and the second distance to re-detect the colliding object.
6. The method according to claim 1, characterized in that, The sound rendering parameters obtained by combining the sound absorption coefficient extracted from the collision physical material and the detection direction include: Read the sound absorption coefficient of the physical material of the collision, which is used to characterize the sound absorption ability of different materials in the collision body; Based on the world direction, multiple detection directions are determined, and the spatial openness is converted for the collision distances corresponding to the multiple detection directions to obtain the spatial openness percentage. Sound rendering parameters are generated based on the percentage of spatial openness and the detection direction.
7. The method according to any one of claims 1-6, characterized in that, The generation of game ambient sound based on the sound rendering parameters includes: The sound rendering component is invoked, and game ambient sounds corresponding to the sound rendering parameters in different directions are generated based on the sound rendering component.
8. A device for generating ambient sound in a game, characterized in that, include: A building component is used to construct a sound cage for a game character in a game environment, wherein the sound cage is used to characterize the effective propagation range of sound in the game environment; The determination module is used to determine the boundary endpoints in multiple directions based on the center point of the acoustic cage, and to perform audio collision detection based on the boundary endpoints to determine the collision physical material. The generation module is used to aggregate the sound absorption coefficients extracted from the collision physical material and the detection direction to obtain sound rendering parameters, and generate game ambient sound based on the sound rendering parameters.
9. A computer-readable storage medium having a computer program / instructions stored thereon, characterized in that, When the computer program / instructions are executed by the processor, they implement the steps of the method of claim 1.
10. A computer device, comprising a memory, a processor, and a computer program stored in the memory, characterized in that, The processor executes the computer program to implement the steps of the method of claim 1.