Water environment sound effect playing method and device, electronic equipment and storage medium
By placing multiple sound objects in the water body area in the game, and controlling sound effects according to the wind direction and character location, the problem of unrealistic water effects in the existing technology in the existing technology has improved the immersion of the game.
Patent Information
- Application Number
- CN202411351159.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-26
- Publication Date
- 2025-01-28
AI Technical Summary
Existing gaming technology is difficult to create real sound effects in water environments, resulting in players not being able to get a better immersive experience.
通过在水体区域中放置多个发声对象,并根据游戏场景中的风向数据和受控虚拟角色的场景位置,确定目标发声对象的波动数据,从而控制播放预设的水体环境声效。
提高了水体环境声效的逼真感,使玩家能够从听觉上感受游戏场景中的气象状态,提升了用户的沉浸体验。
Smart Images

Figure CN119367750A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of game technology, and in particular to a method, device, electronic equipment and storage medium for playing water environment sound effects. Background Art
[0002] As an important module of game audio, ambient sound can bring players an immersive experience. The ambient audio design of existing games usually determines the location of ambient sound based on the player's position, which makes it difficult to create a real natural ambient audio for players and cannot bring users a better immersive experience. Summary of the invention
[0003] In view of this, the purpose of the present invention is to provide a method, device, electronic device and storage medium for playing water environment sound effects, so as to enhance the realism of water environment sound effects, create a more realistic atmosphere in virtual scenes, and enable players to have a more immersive gaming experience.
[0004] In a first aspect, an embodiment of the present invention provides a method for playing water environment sound effects, the method comprising: placing multiple sound-emitting objects in a water area; wherein the sound-emitting objects are hidden and displayed in a game scene; obtaining wind direction data in the game scene and a scene position of a controlled virtual character; wherein the wind direction data is used to indicate: the wind direction in the game scene; based on the wind direction data and the scene position, determining a target sound-emitting object from multiple sound-emitting objects; obtaining fluctuation data of the target sound-emitting object, and based on the fluctuation data, controlling the playback of a preset water environment sound effect.
[0005] In the second aspect, an embodiment of the present invention also provides a device for playing water environment sound effects, including a first placement module for placing multiple sound objects in a water area; wherein the sound objects are hidden and displayed in a game scene; a first acquisition module for acquiring wind direction data in the game scene and a scene position of a controlled virtual character; wherein the wind direction data is used to indicate: the wind direction in the game scene; a first determination module for determining a target sound object from multiple sound objects based on the wind direction data and the scene position; and a first control module for acquiring fluctuation data of the target sound object, and controlling the playback of a preset water environment sound effect based on the fluctuation data.
[0006] In a third aspect, an embodiment of the present invention provides an electronic device, including a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the above-mentioned method for playing water environment sound effects.
[0007] In a fourth aspect, an embodiment of the present invention provides a machine-readable storage medium, which stores machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions prompt the processor to implement the above-mentioned method for playing the water environment sound effect.
[0008] The embodiments of the present invention bring the following beneficial effects:
[0009] The above-mentioned method, device, electronic device and storage medium for playing water environment sound effects, the method includes: placing multiple sound-emitting objects in a water area; wherein the sound-emitting objects are hidden and displayed in a game scene; obtaining wind direction data in the game scene and the scene position of a controlled virtual character; wherein the wind direction data is used to indicate: the wind direction in the game scene; based on the wind direction data and the scene position, determining a target sound-emitting object from multiple sound-emitting objects; obtaining fluctuation data of the target sound-emitting object, and based on the fluctuation data, controlling the playback of a preset water environment sound effect.
[0010] In this method, by obtaining the wind direction data in the game scene and the scene position of the controlled virtual character, the target sound object is determined from multiple sound objects placed in the water area, and then the preset water environment sound effect is controlled to be played according to the fluctuation data of these target sound objects. In this method, the playback of the water environment sound effect is affected by the wind direction in the game scene and the scene position of the controlled virtual character, so that the player can feel the meteorological state in the game scene from the auditory sense, improve the realism of the water environment sound effect, and enhance the user's immersive experience.
[0011] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention are realized and obtained by the structures particularly pointed out in the description, claims and drawings.
[0012] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without paying any creative work.
[0014] Figure 1 A flow chart of a method for playing water environment sound effects provided by an embodiment of the present invention;
[0015] Figure 2 A schematic diagram of an operation for controlling the movement of a sound-emitting object provided by an embodiment of the present invention;
[0016] Figure 3 A schematic diagram of the structure of a device for playing water environment sound effects provided by an embodiment of the present invention;
[0017] Figure 4 A schematic structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0018] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0019] Based on this, the present invention provides a method, device, electronic device and storage medium for playing water environment sound effects, which can be applied to the performance scene of water environment sound effects.
[0020] To facilitate understanding of this embodiment, a method for playing water environment sound effects disclosed in an embodiment of the present invention is first introduced in detail. A graphical user interface can be provided through a terminal device, and the graphical user interface displays a scene screen of a game scene. The game scene includes a controlled virtual character and a water area. The controlled virtual character is an object controlled by the terminal device. The water area is a scene area covered by water in the game. The water area can refer to an ocean, a lake, a pool, etc. in the game scene. Figure 1 As shown, the method includes:
[0021] Step S102: placing a plurality of sound-generating objects in the water area; wherein the sound-generating objects are hidden and displayed in the game scene;
[0022] Multiple sound objects are placed in the water area. The sound objects are scene objects that can interact with game elements in the game scene. The sound objects placed in the water area can be used to simulate the movement of waves. For example, the sound objects can interact with the wind element in the game scene. When the wind blows, the sound objects in the water area can perform periodic ups and downs on the surface of the water with the waves.
[0023] A sound object can be created through a game engine, such as a Game object model object created through the Unity engine. The shape of the sound object can be set to a sphere shape. When placing a sound object in a water area, multiple sound objects can be placed at equal intervals. It should be noted that the sound object needs to be hidden in the game scene.
[0024] Step S104, obtaining wind direction data in the game scene and the scene position of the controlled virtual character; wherein the wind direction data is used to indicate: the wind direction in the game scene;
[0025] The above wind direction data is used to indicate: the wind direction in the game scene. Specifically, the wind direction data can be a wind direction vector that characterizes the wind direction in the game scene. Here, a wind direction vector is set in advance for the wind direction in the game scene, and the wind direction vector is a unit vector, and the wind direction vector characterizes the wind direction in the game scene. For example, a coordinate system is established in the game scene to mark the unique position and direction information of the game elements in the game scene in the game world, and the wind direction vector (1, 0, 0) is set to represent the north wind, that is, the wind direction flowing from north to south; the wind direction vector (0, 0, 1) is set to represent the north wind, that is, the wind direction flowing from south to north; the wind direction vector (0, 0, -1) is set to represent the east wind, that is, the wind direction flowing from east to west; the wind direction vector (0, 0, 1) is set to represent the westerly wind, that is, the wind direction flowing from west to east.
[0026] In this step, the wind direction data corresponding to each moment in the game scene and the scene position of the controlled virtual character are obtained in real time.
[0027] Step S106: determining a target sound-emitting object from a plurality of sound-emitting objects based on the wind direction data and the scene position;
[0028] Considering that in the real world, wind direction will have an impact on the sound of water bodies. For example, in the real world, if the waves move with the wind, the direction of the wind is the same as the direction of the wave movement, which will strengthen the movement of the waves and increase the amplitude of the waves, making it easier to produce sound. For waves moving against the wind, the direction of the wind is opposite to the direction of the wave movement, which will hinder the movement of the waves, making the amplitude of the waves very small or even disappearing, resulting in very little sound or no sound. Here, it can be simply understood that when the waves move with the wind, the water area will make wave sounds, and when the waves move against the wind, the water area will not make wave sounds.
[0029] Based on this, it is necessary to count the sound objects that can be used to control the triggering of water environment sound effects and determine them as target sound objects, so as to control the playback of water environment sound effects according to the fluctuation amplitudes corresponding to these target sound objects. Specifically, according to the wind direction data, the interference of sound objects that move against the wind and will not be used to trigger the sound of waves can be removed from multiple sound objects to obtain candidate sound objects, and then, according to the scene position of the controlled virtual character, the target sound object that can be used to control the triggering of water environment sound effects is determined from the candidate sound objects, and the target sound object can contain multiple.
[0030] In this method, the sound object used to control the playback of water environment sound effects is determined according to the wind direction in the game scene and the scene position of the controlled virtual character. The wind direction is used as a factor to control the playback of water environment sound effects, so that players can feel the meteorological conditions in the game scene through hearing.
[0031] Step S108: Acquire the fluctuation data of the target sound-emitting object, and control the playing of the preset water environment sound effect based on the fluctuation data.
[0032] The above-mentioned water body environmental sound effect is a pre-recorded wave sound, that is, the sound generated by the wave movement on the surface of the water body. It can be understood that when the wind blows, the water surface can fluctuate periodically with the wind on the surface of the water body to form waves, and the periodic fluctuations of the waves will interact with the water body, the surrounding air, and other objects that may be in contact, thereby generating sound. The fluctuation trajectory corresponding to the periodic fluctuations can be represented by a sine curve. Here, the motion trajectory of the fluctuations of the water surface waves can be obtained, and the fluctuation amplitude of the fluctuations of the waves at a certain moment can be determined by the fluctuation trajectory. According to the fluctuation amplitude of the fluctuations of the waves, the preset water body environmental sound effect is controlled to be played. Specifically, the larger the fluctuation amplitude, the easier it is for the water body to emit wave sounds.
[0033] In this step, the fluctuation data of the target sound-emitting object is obtained. The fluctuation data can represent the ups and downs of the waves. The fluctuation data includes a sinusoidal fluctuation curve, that is, the target sound-emitting object fluctuates up and down like a sine curve. If the target sound-emitting object includes multiple sound-emitting objects, each sound-emitting object has its own fluctuation data. The fluctuation data corresponding to each target sound-emitting object is obtained, and the playback of the preset water environment sound effect is controlled according to the fluctuation amplitude corresponding to these fluctuation data at the current moment.
[0034] The above-mentioned method for playing water body environment sound effects is to place multiple sound objects in the water body area; wherein the sound objects are hidden and displayed in the game scene; obtain the wind direction data in the game scene and the scene position of the controlled virtual character; wherein the wind direction data is used to indicate: the wind direction in the game scene; based on the wind direction data and the scene position, determine the target sound object from multiple sound objects; obtain the fluctuation data of the target sound object, and control the playback of the preset water body environment sound effect based on the fluctuation data. In this method, by obtaining the wind direction data in the game scene and the scene position of the controlled virtual character, the target sound object is determined from the multiple sound objects placed in the water body area, and then the preset water body environment sound effect is controlled to be played according to the fluctuation data of these target sound objects. In this method, the playback of the water body environment sound effect is affected by the wind direction in the game scene and the scene position of the controlled virtual character, so that the player can feel the meteorological state in the game scene from the auditory sense, which improves the realism of the water body environment sound effect and improves the user's immersive experience.
[0035] In one embodiment, a first specified distance is preset between the placement positions of each sound-emitting object.
[0036] That is to say, the multiple sound-emitting objects in the water area are placed at equal intervals, and the placement positions of the sound-emitting objects are spaced apart by a first specified distance.
[0037] Furthermore, the game scene also includes a scene model. If the placement position of the sound-emitting object is located inside the scene model, the sound-emitting object is controlled to move in a preset direction so that the center position of the sound-emitting object is located at the edge of the scene model.
[0038] The edge of the scene model may be the boundary line between the scene model and the water area. The center position may be the geometric center of the sound object. That is, when multiple sound objects are placed at equal intervals in the water area, if the placement position of the sound object is exactly inside the scene model in the game scene, in this case, the sound object is controlled to move in a preset direction so that the center position of the sound object is located at the boundary line between the scene model and the water area.
[0039] In one method, the movement process of the sound object is: the sound object is controlled to move from the placement position of the sound object as the starting point of the movement, in a direction perpendicular to the edge boundary line between the scene model and the water area, toward the edge boundary line until the center position of the sound object is located on the edge boundary line. If there are multiple edge boundary lines between the scene model and the water area, the movement direction of the sound object can be perpendicular to any edge boundary line.
[0040] For example, Figure 2As shown, the sound object is in the shape of a sphere, and the game scene includes a coast model. The coast model has two edge boundaries with the water area, including a right edge boundary line and an upper edge boundary line. If the sound objects are placed at equal intervals in the water area, the placement position of the sound object A happens to be located inside the coast model. At this time, the sound object A can be controlled to move from the placement position of the sound object A as the starting point of movement, and move toward the right edge boundary line in a direction perpendicular to the right edge boundary line between the coast model and the water area, so that the center of the sound object A is located on the right edge boundary line. Of course, the sound object A can also be controlled to move from the placement position of the sound object A as the starting point of movement, and move toward the upper edge boundary line in a direction perpendicular to the upper edge boundary line between the coast model and the water area, so that the center of the sound object A is located on the upper edge boundary line.
[0041] The following embodiments provide implementation methods for determining a target sound emitting object.
[0042] Based on wind direction data, sound-emitting objects that move against the wind direction are removed from multiple sound-emitting objects to obtain alternative sound-emitting objects; a first sound-emitting object that is closest to the scene position and other sound-emitting objects in a designated area corresponding to the first sound-emitting object are determined from the alternative sound-emitting objects; the first sound-emitting object and other sound-emitting objects in the designated area are determined as target sound-emitting objects.
[0043] The designated area corresponding to the above-mentioned first sound object may be an area near the first sound object. For example, when the sound objects are placed in the water area at equal intervals of the first specified distance, the designated area may be a circular area with the first sound object as the center and the first specified distance as the radius.
[0044] Here, first, based on the wind direction data, the sound-emitting objects moving against the wind direction are removed from multiple sound-emitting objects to obtain alternative sound-emitting objects. Then, the first sound-emitting object closest to the scene position of the controlled virtual character and other sound-emitting objects in the designated area corresponding to the first sound-emitting object are determined from the alternative sound-emitting objects. Finally, the first sound-emitting object and other sound-emitting objects in the designated area are determined as target sound-emitting objects.
[0045] In one method, the method for determining alternative sound objects is: obtain the wind direction vector in the downwind direction data at the current moment, and the displacement vector after the sound object moves in a preset direction, determine the product of the displacement vector and the wind direction vector corresponding to the sound object, and determine the sound object corresponding to a negative number as the sound object moving against the wind direction, remove the sound object moving against the wind direction from multiple sound objects, and obtain alternative sound objects.
[0046] That is to say, the wind direction vector in the downwind direction data at the current moment is obtained, and the sound objects whose placement positions are located inside the scene model are determined. For each of these sound objects, the displacement vector of the sound object after moving in the preset direction is obtained according to the placement position of the sound object and the position of the sound object moving to the edge of the scene model in the preset direction. The displacement vector of the sound object is vector-multiplied with the wind direction vector. When the product result is a negative number, it means that the moving direction of the sound object is opposite to the wind direction vector at this time, and it is determined that the sound object belongs to the sound object moving against the wind. Finally, the sound object moving against the wind is removed from the multiple sound objects in the water area to obtain the alternative sound object.
[0047] Furthermore, the scene position of the controlled virtual character at the current moment is obtained, each candidate sound object is traversed, the distance between each candidate sound object and the scene position is determined, and the first sound object closest to the scene position is determined from the candidate sound objects.
[0048] Further, a designated area corresponding to the first sound object is determined, and other sound objects in the designated area are determined from the candidate sound objects. Specifically, if a first designated distance is preset between the placement positions of each sound object, the designated area is a circular area with the first sound object as the center and the first designated distance as the radius. The candidate sound objects other than the first sound object in the designated area are determined as other sound objects.
[0049] Finally, the first sound-emitting object and other sound-emitting objects are determined as target sound-emitting objects.
[0050] In this method, the target sound object used to control the playback of water environment sound effects is determined according to the wind direction in the game scene and the scene position of the controlled virtual character, so that the wind direction is used as a factor to control the playback of water environment sound effects, linking wind and water so that players can feel the auditory effects of their interaction.
[0051] In one method, the fluctuation data of the target sound object can be obtained by:
[0052] The fluctuation frequency of the target sound object is determined, and a sinusoidal fluctuation curve of the target sound object is generated based on the fluctuation frequency, time parameter, pi parameter and fluctuation adjustment parameter, and the sinusoidal fluctuation curve is determined as the fluctuation data of the target sound object.
[0053] The fluctuation frequency of the target sound object can be understood as the frequency of the target sound object rising and falling on the water surface. When there are multiple target sound objects, the fluctuation frequency corresponding to each target sound object may be different. The time parameter is the time when the game scene runs on the terminal device that displays the game scene. The pi parameter is the pi value. The fluctuation adjustment parameter is a constant used to limit the fluctuation angle range of the target sound object. The sinusoidal fluctuation curve can be represented by a sine function.
[0054] That is to say, the fluctuation data of the target sound object can be set as a sinusoidal fluctuation curve, that is, a curve represented by the Mathf.Sin function. The sinusoidal fluctuation curve can more accurately simulate the ups and downs of waves. Here, the fluctuation frequency of the target sound object is determined, and the sinusoidal fluctuation curve of the target sound object is generated according to the fluctuation frequency, time parameters and pi parameters, and the sinusoidal fluctuation curve is determined as the fluctuation data of the target sound object. In a specific implementation method, this embodiment can provide a sinusoidal fluctuation curve formula for a target sound object, namely:
[0055] Mathf.Sin(2*Mathf.PI*f*Time.time);
[0056] Among them, Mathf.Sin() is a sine curve function, the output range of which is a floating point number between -1 and +1; f is the fluctuation frequency of the aforementioned target sound object; 2 is the aforementioned fluctuation adjustment parameter; Mathf.PI is the aforementioned pi value; Time.time is the aforementioned time parameter.
[0057] In one implementation, if a first specified distance is preset between the placement positions of each sound-emitting object; the designated area corresponding to the first sound-emitting object includes: a circular area with the first sound-emitting object as the center and the first specified distance as the radius; then the method for determining the fluctuation frequency of the target sound-emitting object is: based on the first specified distance, the distance between the scene position of the target sound-emitting object and the scene position of the first sound-emitting object and the preset periodic parameters, determine the fluctuation frequency of the target sound-emitting object.
[0058] That is to say, the fluctuation frequency of the target sound object is related to the first specified distance, the distance between the target sound object and the first sound object, and the preset period parameter. In a specific implementation, this embodiment can provide a calculation formula for the fluctuation frequency, that is, f = (R / L) * (1 / T); wherein f is the fluctuation frequency of the target sound object; R is the distance between the scene position of the target sound object and the scene position of the first sound object; and T is the period parameter.
[0059] In one method, if there are multiple target sound-emitting objects, it is necessary to calculate the fluctuation data of each target sound-emitting object, and control the playback of the preset water environment sound effect according to the fluctuation data corresponding to each target sound-emitting object.
[0060] Taking the fluctuation data as a sinusoidal fluctuation curve as an example, if there are multiple target sound objects, for each target sound object, the fluctuation amplitude corresponding to the sinusoidal fluctuation curve of the target sound object is obtained; based on the fluctuation amplitude corresponding to the sinusoidal fluctuation curves of multiple target sound objects, the playback of the preset water environment sound effect is controlled.
[0061] It can be understood that the sinusoidal wave curve is a curve that changes with time. The above-mentioned fluctuation amplitude is the amplitude of the fluctuation corresponding to the sinusoidal wave curve at a certain moment, that is, the amplitude of the waveform leaving the equilibrium position (ie, the origin).
[0062] It can be understood that if the fluctuation amplitude of the sinusoidal fluctuation curve of the target sound-emitting object at that moment is larger, it means that the water body is more likely to emit the sound of waves at that moment.
[0063] Here, if there are multiple target sound objects, for each target sound object, the fluctuation amplitude corresponding to the sinusoidal fluctuation curve of the target sound object at the current moment is obtained, and the playback of the preset water environment sound effect is controlled according to the fluctuation amplitudes of the multiple target sound objects.
[0064] In one method, multiple fluctuation amplitudes are added and superimposed to obtain a first processing result; in response to the first processing result being greater than a preset amplitude threshold, the playing of water environment sound effects is triggered.
[0065] Here, the sinusoidal wave curve can be represented by the sinusoidal curve function Mathf.Sin(). The fluctuation amplitude is a floating point number between -1 and +1. The fluctuation amplitudes of the sinusoidal wave curves of all target sound-emitting objects at the current moment can be summed up to obtain a first processing result. When the first processing result is greater than the preset amplitude threshold, it means that the amplitude of the wave is large enough, and at this time, the water environment sound effect is triggered.
[0066] Here, the playback position of the water environment sound effect may be the position of the first sound emitting object.
[0067] That is, the water environment sound effect can be played at the position of the target sound object closest to the scene position of the controlled virtual character. Playing the water environment sound effect at this position allows the player to perceive the direction of the sound.
[0068] In one method, wind strength data in a game scene is obtained; wherein the wind strength has a corresponding relationship with a preset sound effect type of a water environment sound effect; based on the corresponding relationship, a first sound effect type of a water environment sound effect corresponding to the wind strength is determined, and the playing of the water environment sound effect of the first sound effect type is controlled.
[0069] Here, you can pre-set multiple wind intensity levels for the game scene, such as breeze, moderate wind, and strong wind. Each intensity level corresponds to a water environment sound effect of a sound effect type.
[0070] Obtain wind strength data in the game scene, determine the sound effect type of the water environment sound effect corresponding to the wind strength based on the correspondence between the current wind strength and the preset sound effect type of the water environment sound effect, and when the water environment sound effect is triggered, control the playing of the water environment sound effect of this sound effect type in the game scene.
[0071] In this method, the sound effects of the water environment sound effects are determined by the wind direction and wind strength, connecting the wind and water so that players can feel the auditory effects of the interaction between them.
[0072] Corresponding to the above method embodiment, see Figure 3 A schematic diagram of a device for playing water environment sound effects is shown, wherein a game scene includes a controlled virtual character and a water area; the device includes:
[0073] The first placement module 302 is used to place a plurality of sound-generating objects in the water area; wherein the sound-generating objects are hidden and displayed in the game scene;
[0074] The first acquisition module 304 is used to acquire wind direction data in the game scene and the scene position of the controlled virtual character; wherein the wind direction data is used to indicate: the wind direction in the game scene;
[0075] A first determination module 306, configured to determine a target sound-emitting object from a plurality of sound-emitting objects based on wind direction data and scene position;
[0076] The first control module 308 is used to obtain the fluctuation data of the target sound-emitting object, and control the playing of the preset water environment sound effect based on the fluctuation data.
[0077] In this method, by obtaining the wind direction data in the game scene and the scene position of the controlled virtual character, the target sound object is determined from the multiple sound objects placed in the water area, and then the preset water environment sound effect is controlled to be played according to the fluctuation data of these target sound objects. In this method, by obtaining the wind direction data in the game scene and the scene position of the controlled virtual character, the target sound object is determined from the multiple sound objects placed in the water area, and then the preset water environment sound effect is controlled to be played according to the fluctuation data of these target sound objects. In this method, the playback of the water environment sound effect is affected by the wind direction in the game scene and the scene position of the controlled virtual character, so that the player can feel the meteorological state in the game scene from the auditory sense, improve the realism of the water environment sound effect, and improve the user's immersive experience. It allows players to feel the meteorological state in the game scene from the auditory sense, improves the realism of the water environment sound effect, and improves the user's immersive experience.
[0078] A first specified distance is preset between the placement positions of each of the multiple sound-emitting objects.
[0079] The above-mentioned game scene also includes a scene model, and the above-mentioned device includes a first moving module, which is used to control the sound-emitting object to move in a preset direction if the placement position of the sound-emitting object is located inside the scene model, so that the center position of the sound-emitting object is located at the edge of the scene model.
[0080] The above-mentioned first determination module is used to remove the sound-emitting objects moving against the wind direction from multiple sound-emitting objects based on wind direction data to obtain alternative sound-emitting objects; determine the first sound-emitting object closest to the scene position and other sound-emitting objects in the designated area corresponding to the first sound-emitting object from the alternative sound-emitting objects; and determine the first sound-emitting object and other sound-emitting objects in the designated area as target sound-emitting objects.
[0081] The above-mentioned device includes a first removal module, which is used to obtain the wind direction vector in the downwind direction data at the current moment, and the displacement vector after the sound-emitting object moves in a preset direction; determine the product result of the displacement vector and the wind direction vector corresponding to the sound-emitting object, and determine the sound-emitting object corresponding to a negative number as the sound-emitting object moving against the wind direction; remove the sound-emitting object moving against the wind direction from multiple sound-emitting objects to obtain alternative sound-emitting objects.
[0082] A first designated distance is preset between the placement positions of each of the above-mentioned sound-emitting objects; the designated area corresponding to the first sound-emitting object includes: a circular area with the first sound-emitting object as the center and the first designated distance as the radius.
[0083] The above-mentioned device includes a second determination module, which is used to determine the fluctuation frequency of the target sound object; based on the fluctuation frequency, time parameter, pi parameter and fluctuation adjustment parameter, a sinusoidal fluctuation curve of the target sound object is generated, and the sinusoidal fluctuation curve is determined as the fluctuation data of the target sound object.
[0084] A first specified distance is preset between the placement positions of each of the multiple sound-emitting objects mentioned above; the designated area corresponding to the first sound-emitting object includes: a circular area with the first sound-emitting object as the center and the first specified distance as the radius; the above-mentioned device includes a third determination module, which is used to determine the fluctuation frequency based on the first specified distance, the distance between the scene position of the target sound-emitting object and the scene position of the first sound-emitting object, and the preset periodic parameters.
[0085] The fluctuation data of the target sound object includes: a sinusoidal fluctuation curve; the first control module is also used to obtain the fluctuation amplitude corresponding to the sinusoidal fluctuation curve of the target sound object at the current moment for each target sound object if there are multiple target sound objects; based on the fluctuation amplitudes corresponding to the sinusoidal fluctuation curves of multiple target sound objects, control the playback of preset water environment sound effects.
[0086] The above-mentioned device also includes a first trigger module, which is also used to superimpose multiple fluctuation amplitudes to obtain a first processing result; in response to the first processing result being greater than a preset amplitude threshold, triggering the playing of water environment sound effects.
[0087] The above device also includes a second control module, which is also used to control the playing of water environment sound effects at the position of the first sound-emitting object.
[0088] The above-mentioned first control module is also used to obtain wind strength data in the game scene; wherein the wind strength has a corresponding relationship with the sound effect type of the preset water environment sound effect; based on the corresponding relationship, the first sound effect type of the water environment sound effect corresponding to the wind strength is determined, and the playing of the water environment sound effect of the first sound effect type is controlled.
[0089] This embodiment also provides an electronic device, including a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the above-mentioned method for playing water environment sound effects. The electronic device can be a server or a terminal device.
[0090] See also Figure 4 As shown, the electronic device includes a processor 100 and a memory 101, wherein the memory 101 stores machine executable instructions that can be executed by the processor 100, and the processor 100 executes the machine executable instructions to implement the above-mentioned method for playing water environment sound effects.
[0091] Further, Figure 4The electronic device shown also includes a bus 102 and a communication interface 103, and the processor 100, the communication interface 103 and the memory 101 are connected through the bus 102. Among them, the memory 101 may include a high-speed random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk storage. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 103 (which can be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. can be used. The bus 102 can be an ISA bus, a PCI bus or an EISA bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 4 Only one bidirectional arrow is used in the diagram, but it does not mean that there is only one bus or one type of bus. The processor 100 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 100. The above processor 100 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present invention can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiments of the present invention can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module may be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 101, and the processor 100 reads the information in the memory 101 and completes the steps of the method of the above embodiment in combination with its hardware.
[0092] The processor in the above-mentioned electronic device can implement the following operations of the above-mentioned water environment sound effect playback method by executing machine executable instructions: placing multiple sound-emitting objects in the water area; wherein the sound-emitting objects are hidden and displayed in the game scene; obtaining wind direction data in the game scene and the scene position of the controlled virtual character; wherein the wind direction data is used to indicate: the wind direction in the game scene; based on the wind direction data and the scene position, determining the target sound-emitting object from multiple sound-emitting objects; obtaining fluctuation data of the target sound-emitting object, and based on the fluctuation data, controlling the playback of the preset water environment sound effect.
[0093] In this method, by obtaining the wind direction data in the game scene and the scene position of the controlled virtual character, the target sound object is determined from the multiple sound objects placed in the water area, and then the preset water environment sound effect is controlled to be played according to the fluctuation data of these target sound objects. In this method, by obtaining the wind direction data in the game scene and the scene position of the controlled virtual character, the target sound object is determined from the multiple sound objects placed in the water area, and then the preset water environment sound effect is controlled to be played according to the fluctuation data of these target sound objects. In this method, the playback of the water environment sound effect is affected by the wind direction in the game scene and the scene position of the controlled virtual character, so that the player can feel the meteorological state in the game scene from the auditory sense, improve the realism of the water environment sound effect, and improve the user's immersive experience. It allows players to feel the meteorological state in the game scene from the auditory sense, improves the realism of the water environment sound effect, and improves the user's immersive experience.
[0094] A first specified distance is preset between the placement positions of each of the multiple sound-emitting objects.
[0095] The above-mentioned game scene also includes a scene model. The processor in the above-mentioned electronic device can implement the following operations of the above-mentioned water environment sound effect playing method by executing machine executable instructions: if the placement position of the sound object is located inside the scene model, the sound object is controlled to move in a preset direction so that the center position of the sound object is located at the edge of the scene model.
[0096] The processor in the above-mentioned electronic device can implement the following operations of the above-mentioned water environment sound effect playback method by executing machine executable instructions: based on wind direction data, remove the sound objects moving against the wind direction from multiple sound objects to obtain alternative sound objects; determine the first sound object closest to the scene position from the alternative sound objects, and other sound objects in the designated area corresponding to the first sound object; determine the first sound object and other sound objects in the designated area as target sound objects.
[0097] The processor in the above-mentioned electronic device can implement the following operations of the above-mentioned method for playing water environment sound effects by executing machine executable instructions: obtaining the wind direction vector in the downwind direction data at the current moment, and the displacement vector after the sound object moves in a preset direction; determining the product result of the displacement vector and the wind direction vector corresponding to the sound object, and determining the sound object corresponding to a negative number as the sound object moving against the wind direction; removing the sound object moving against the wind direction from multiple sound objects to obtain alternative sound objects.
[0098] A first designated distance is preset between the placement positions of each of the above-mentioned sound-emitting objects; the designated area corresponding to the first sound-emitting object includes: a circular area with the first sound-emitting object as the center and the first designated distance as the radius.
[0099] The processor in the above-mentioned electronic device can implement the following operations of the above-mentioned water environment sound effect playback method by executing machine executable instructions: determining the fluctuation frequency of the target sound object; generating a sinusoidal fluctuation curve of the target sound object based on the fluctuation frequency, time parameters, pi parameters and fluctuation adjustment parameters, and determining the sinusoidal fluctuation curve as the fluctuation data of the target sound object.
[0100] A first specified distance is preset between the placement positions of each of the multiple sound objects mentioned above; the designated area corresponding to the first sound object includes: a circular area with the first sound object as the center and the first specified distance as the radius; the processor in the above electronic device, by executing machine executable instructions, can implement the following operations of the above-mentioned water environment sound effect playback method: determine the fluctuation frequency based on the first specified distance, the distance between the scene position of the target sound object and the scene position of the first sound object, and the preset periodic parameters.
[0101] The fluctuation data of the above-mentioned target sound-emitting object includes: a sinusoidal fluctuation curve; the processor in the above-mentioned electronic device, by executing machine-executable instructions, can implement the following operations of the above-mentioned water environment sound effect playback method: if there are multiple target sound-emitting objects, for each target sound-emitting object, obtain the fluctuation amplitude corresponding to the sinusoidal fluctuation curve of the target sound-emitting object at the current moment; based on the fluctuation amplitudes corresponding to the sinusoidal fluctuation curves of multiple target sound-emitting objects, control the playback of preset water environment sound effects.
[0102] The processor in the above-mentioned electronic device can implement the following operations of the above-mentioned water environment sound effect playback method by executing machine executable instructions: superimposing multiple fluctuation amplitudes to obtain a first processing result; in response to the first processing result being greater than a preset amplitude threshold, triggering the playback of the water environment sound effect.
[0103] The processor in the above-mentioned electronic device can implement the following operations of the above-mentioned method for playing water environment sound effects by executing machine executable instructions: controlling the playing of water environment sound effects at the position of the first sound-emitting object.
[0104] This embodiment also provides a machine-readable storage medium, which stores machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions prompt the processor to implement the display control method of the above-mentioned game object.
[0105] The machine executable instructions stored in the above-mentioned machine-readable storage medium can be executed to implement the following operations in the above-mentioned method for playing water environment sound effects: placing multiple sound-emitting objects in the water area; wherein the sound-emitting objects are hidden and displayed in the game scene; obtaining wind direction data in the game scene and the scene position of the controlled virtual character; wherein the wind direction data is used to indicate: the wind direction in the game scene; based on the wind direction data and the scene position, determining the target sound-emitting object from multiple sound-emitting objects; obtaining the fluctuation data of the target sound-emitting object, and based on the fluctuation data, controlling the playback of the preset water environment sound effect.
[0106] In this method, by obtaining the wind direction data in the game scene and the scene position of the controlled virtual character, the target sound object is determined from the multiple sound objects placed in the water area, and then the preset water environment sound effect is controlled to be played according to the fluctuation data of these target sound objects. In this method, by obtaining the wind direction data in the game scene and the scene position of the controlled virtual character, the target sound object is determined from the multiple sound objects placed in the water area, and then the preset water environment sound effect is controlled to be played according to the fluctuation data of these target sound objects. In this method, the playback of the water environment sound effect is affected by the wind direction in the game scene and the scene position of the controlled virtual character, so that the player can feel the meteorological state in the game scene from the auditory sense, improve the realism of the water environment sound effect, and improve the user's immersive experience. It allows players to feel the meteorological state in the game scene from the auditory sense, improves the realism of the water environment sound effect, and improves the user's immersive experience.
[0107] A first specified distance is preset between the placement positions of each of the multiple sound-emitting objects.
[0108] The above-mentioned game scene also includes a scene model. The machine-executable instructions stored in the above-mentioned machine-readable storage medium can be executed to implement the following operations in the above-mentioned water environment sound effect playback method: if the placement position of the sound object is located inside the scene model, the sound object is controlled to move in a preset direction so that the center position of the sound object is located at the edge of the scene model.
[0109] The machine executable instructions stored in the above-mentioned machine-readable storage medium can be executed to implement the following operations in the above-mentioned method for playing water environment sound effects: based on wind direction data, remove the sound objects moving against the wind direction from multiple sound objects to obtain alternative sound objects; determine the first sound object closest to the scene position from the alternative sound objects, and other sound objects in the designated area corresponding to the first sound object; determine the first sound object and other sound objects in the designated area as target sound objects.
[0110] The machine executable instructions stored in the above-mentioned machine-readable storage medium can be executed to implement the following operations in the above-mentioned method for playing water environment sound effects: obtain the wind direction vector in the downwind direction data at the current moment, and the displacement vector after the sound object moves in a preset direction; determine the product result of the displacement vector and the wind direction vector corresponding to the sound object, and determine the sound object corresponding to a negative number as the sound object moving against the wind direction; remove the sound object moving against the wind direction from multiple sound objects to obtain alternative sound objects.
[0111] A first designated distance is preset between the placement positions of each of the above-mentioned sound-emitting objects; the designated area corresponding to the first sound-emitting object includes: a circular area with the first sound-emitting object as the center and the first designated distance as the radius.
[0112] The machine executable instructions stored in the above-mentioned machine-readable storage medium can be executed to implement the following operations in the above-mentioned method for playing water environment sound effects: determining the fluctuation frequency of the target sound object; generating a sinusoidal fluctuation curve of the target sound object based on the fluctuation frequency, time parameters, pi parameters and fluctuation adjustment parameters, and determining the sinusoidal fluctuation curve as the fluctuation data of the target sound object.
[0113] A first specified distance is preset between the placement positions of each of the multiple sound objects mentioned above; the designated area corresponding to the first sound object includes: a circular area with the first sound object as the center and the first specified distance as the radius; the machine executable instructions stored in the above-mentioned machine-readable storage medium can implement the following operations in the above-mentioned water environment sound effect playback method by executing the machine executable instructions: determine the fluctuation frequency based on the first specified distance, the distance between the scene position of the target sound object and the scene position of the first sound object, and the preset periodic parameters.
[0114] The fluctuation data of the above-mentioned target sound-emitting object includes: a sinusoidal fluctuation curve; the machine executable instructions stored in the above-mentioned machine-readable storage medium, and by executing the machine executable instructions, the following operations in the above-mentioned water environment sound effect playback method can be implemented: if the target sound-emitting object includes multiple, for each target sound-emitting object, obtain the fluctuation amplitude corresponding to the sinusoidal fluctuation curve of the target sound-emitting object at the current moment; based on the fluctuation amplitudes corresponding to the sinusoidal fluctuation curves of multiple target sound-emitting objects, control the playback of the preset water environment sound effect.
[0115] The machine executable instructions stored in the above-mentioned machine-readable storage medium can be executed to implement the following operations in the above-mentioned method for playing water environment sound effects: superimposing multiple fluctuation amplitudes to obtain a first processing result; in response to the first processing result being greater than a preset amplitude threshold, triggering the playing of the water environment sound effect.
[0116] The machine executable instructions stored in the above-mentioned machine-readable storage medium can be executed to implement the following operations in the above-mentioned method for playing water environment sound effects: controlling the playing of water environment sound effects at the position of the first sound-emitting object.
[0117] The computer program product of the method, device, electronic device and storage medium for playing water environment sound effects provided in the embodiments of the present invention includes a computer-readable storage medium storing program code, and the instructions included in the program code can be used to execute the methods described in the previous method embodiments. The specific implementation can be found in the method embodiments, which will not be repeated here.
[0118] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system and device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0119] In addition, in the description of the embodiments of the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, and it can be the internal communication of two components. For those skilled in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0120] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0121] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.
[0122] Finally, it should be noted that the above embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above embodiments, those skilled in the art should understand that any person skilled in the art can still modify the technical solutions recorded in the above embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.
Claims
1. A method for playing water environment sound effects, characterized in that: The game scene includes a controlled virtual character and a water area; the method includes: Placing a plurality of sound-generating objects in the water area; wherein the sound-generating objects are hidden and displayed in the game scene; Acquire wind direction data in the game scene and the scene position of the controlled virtual character; wherein the wind direction data is used to indicate: the wind direction in the game scene; Determining a target sound-emitting object from among the plurality of sound-emitting objects based on the wind direction data and the scene position; The fluctuation data of the target sound-emitting object is obtained, and based on the fluctuation data, the playing of a preset water environment sound effect is controlled.
2. The method according to claim 1, characterized in that: A first specified distance is preset between the placement positions of each of the multiple sound-emitting objects.
3. The method according to claim 1, characterized in that: The game scene also includes a scene model; the method also includes: If the placement position of the sound-emitting object is located inside the scene model, the sound-emitting object is controlled to move in a preset direction so that the center position of the sound-emitting object is located at the edge of the scene model.
4. The method according to claim 3, characterized in that The step of determining a target sound-emitting object from the plurality of sound-emitting objects based on the wind direction data and the scene position comprises: Based on the wind direction data, removing the sound-emitting objects moving against the wind direction from the multiple sound-emitting objects to obtain candidate sound-emitting objects; Determine, from the candidate sound-emitting objects, a first sound-emitting object that is closest to the scene position, and other sound-emitting objects in a designated area corresponding to the first sound-emitting object; The first sound-emitting object and other sound-emitting objects in the designated area are determined as target sound-emitting objects.
5. The method according to claim 4, characterized in that The step of removing the sound-emitting object moving against the wind direction from the multiple sound-emitting objects based on the wind direction data to obtain the candidate sound-emitting objects comprises: Obtaining the wind direction vector in the wind direction data at the current moment, and the displacement vector of the sound-emitting object after moving in a preset direction; Determine the product result of the displacement vector and the wind direction vector corresponding to the sound-emitting object, and determine the sound-emitting object corresponding to a negative number as the sound-emitting object moving against the wind direction; The candidate sound-emitting object is obtained by removing the sound-emitting object moving against the wind direction from the multiple sound-emitting objects.
6. The method according to claim 4, characterized in that A first specified distance is preset between the placement positions of each of the sound-emitting objects; the specified area corresponding to the first sound-emitting object includes: a circular area with the first sound-emitting object as the center and the first specified distance as the radius.
7. The method according to claim 4, characterized in that The step of obtaining the fluctuation data of the target sound-emitting object comprises: Determining the fluctuation frequency of the target sound object; Based on the fluctuation frequency, time parameter, pi parameter and fluctuation adjustment parameter, a sinusoidal fluctuation curve of the target sound object is generated, and the sinusoidal fluctuation curve is determined as the fluctuation data of the target sound object.
8. The method according to claim 7, characterized in that A first specified distance is preset between the placement positions of each of the multiple sound-emitting objects; the specified area corresponding to the first sound-emitting object includes: a circular area with the first sound-emitting object as the center and the first specified distance as the radius; The step of determining the fluctuation frequency of the target sound object comprises: The fluctuation frequency is determined based on the first specified distance, the distance between the scene position of the target sound emitting object and the scene position of the first sound emitting object, and a preset period parameter.
9. The method according to claim 1, characterized in that: The fluctuation data of the target sound object includes: a sinusoidal fluctuation curve; The step of controlling the playing of a preset water environment sound effect based on the fluctuation data comprises: If the target sound-emitting object includes multiple ones, for each target sound-emitting object, obtaining the fluctuation amplitude corresponding to the sinusoidal fluctuation curve of the target sound-emitting object at the current moment; Based on the fluctuation amplitudes corresponding to the sinusoidal fluctuation curves of the target sound-emitting objects, the preset water environment sound effect is controlled to be played.
10. The method according to claim 9, characterized in that The step of controlling the playing of a preset water environment sound effect based on the fluctuation amplitudes corresponding to the sinusoidal fluctuation curves of the target sound-emitting objects comprises: Superimpose multiple fluctuation amplitudes to obtain a first processing result; In response to the first processing result being greater than a preset amplitude threshold, the playing of the water body environment sound effect is triggered.
11. The method according to claim 4, characterized in that The step of controlling the playing of a preset water environment sound effect comprises: Control the playing of the water body environment sound effect at the position of the first sound-emitting object.
12. The method according to claim 1, characterized in that The step of controlling the playing of a preset water environment sound effect comprises: Acquire wind strength data in the game scene; wherein the wind strength has a corresponding relationship with a sound effect type of a preset water environment sound effect; Based on the corresponding relationship, a first sound effect type of the water body environment sound effect corresponding to the wind strength is determined, and the playing of the water body environment sound effect of the first sound effect type is controlled.
13. A device for playing water environment sound effects, characterized in that: The game scene includes a controlled virtual character and a water area; the device includes: A first placement module is used to place a plurality of sound-generating objects in the water area; wherein the sound-generating objects are hidden and displayed in the game scene; A first acquisition module is used to acquire wind direction data in the game scene and the scene position of the controlled virtual character; wherein the wind direction data is used to indicate: the wind direction in the game scene; A first determination module, configured to determine a target sound-emitting object from among the plurality of sound-emitting objects based on the wind direction data and the scene position; The first control module is used to obtain the fluctuation data of the target sound-emitting object, and control the playing of a preset water environment sound effect based on the fluctuation data.
14. An electronic device, characterized in that: It comprises a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the method for playing water environment sound effects as described in any one of claims 1-12.
15. A machine-readable storage medium, characterized in that: The machine-readable storage medium stores machine-executable instructions. When the machine-executable instructions are called and executed by the processor, the machine-executable instructions prompt the processor to implement the method for playing water environment sound effects described in any one of claims 1-12.