Method, device and electronic device for playing control of sound effects
By obtaining the visibility status of the target object in a multiplayer online tactical competitive game, combining the virtual camera position, and adjusting the sound effect playback method, the problem of players being unable to judge the distance battle situation is solved, and the user experience and game competitiveness are improved.
Patent Information
- Application Number
- CN202210393780.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-14
- Publication Date
- 2025-07-29
- Estimated Expiration
- 2042-04-14
AI Technical Summary
In multiplayer online tactical competitive games, players cannot accurately judge the game situation outside the display range of the game interface, resulting in poor user experience, and the sound effect does not change accordingly when the visibility of the game object changes, lacking competitiveness and fun.
By obtaining the visibility state of the target object, determining the playback method of the sound effect based on the visibility state and the virtual camera position, and updating the sound effect playback method when the visibility changes, the sound effect is played by combining virtual channels and physical channels to ensure that players can hear the sound effect of the visible object.
It improves players' ability to judge the battle situation of the entire game scene, enhances the user experience and the competitive and fun of the game.
Smart Images

Figure CN114887327B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of online games, and in particular, to a method, device, and electronic device for controlling the playback of sound effects. Background Art
[0002] In a game scene, in order to improve the user experience of players, some actions of game objects are accompanied by sound effects, also known as sound effects; for example, when a game object starts walking, the sound effect of the walking effect can be triggered, and when the game object activates a skill, the sound effect corresponding to the skill can be triggered.
[0003] In the related art, in a multiplayer online battle arena game scene, when a sound effect is triggered, it is determined whether the game object is within the display range of the game interface corresponding to the current player's character. If it is within this range, the sound effect is continuously played during the duration of the sound effect; if it is not within this range, the sound effect is not played at all during the duration of the sound effect. However, in a game scene, in addition to the display range of the game interface corresponding to the current player's character, there is usually also a game scene area outside this range. Based on the above method of playing sound effects, players cannot judge the game situation of the battlefield far away outside the display range of the game interface, resulting in a poor user experience; moreover, there may be some areas in the game interface display range where game objects can hide. Based on the above method of playing sound effects, there will be a situation where the character of the game object hides and is not visible, while its sound effect is still playing, and this situation will also lead to a poor user experience. Summary of the Invention
[0004] In view of this, an object of the present invention is to provide a method, device, and electronic device for controlling the playback of sound effects, so as to improve the accuracy of the position of the target object during the target guidance process and avoid the phenomenon of target omission, thereby improving the user experience.
[0005] In a first aspect, an embodiment of the present invention provides a method for controlling the playback of sound effects. A graphical user interface is provided through a terminal device, and the graphical user interface includes a scene picture of a part of the game scene, and the scene picture is obtained by a virtual camera corresponding to a controlled virtual object taking pictures in the game scene; the method includes: in response to a sound effect trigger event, determining a target object that triggers the sound effect and a target sound effect to be played; obtaining the visibility state of the target object; wherein, the visibility state is used to: indicate whether the target object can be seen by the controlled virtual object or a virtual object other than the controlled virtual object; based on the visibility state of the target object and the position of the virtual camera corresponding to the controlled virtual object in the game scene, determining the playback mode of the target sound effect, and playing the target sound effect; in response to a change in the visibility state of the target object, updating the playback mode of the target sound effect, and continuing to play the target sound effect based on the updated playback mode.
[0006] The above game scenario includes a hidden area; the visibility state includes visible or invisible; the steps of obtaining the visibility state of the target object include: obtaining the position of the target object in the game scenario; based on the position of the target object, determining whether the target object is located in the hidden area; if it is located in the hidden area, determining the visibility state of the target object as invisible; if it is not located in the hidden area, determining the visibility state of the target object as visible.
[0007] The above steps of determining the playing mode of the target sound effect based on the visibility state of the target object and the position of the virtual camera corresponding to the controlled virtual object in the game scenario include: determining the sound source position of the target object based on the visibility state of the target object; determining the playing mode of the target sound effect based on the sound source position of the target object and the position of the virtual camera corresponding to the controlled virtual object in the game scenario.
[0008] The above visibility state includes visible or invisible; the steps of determining the sound source position corresponding to the target object based on the visibility state of the target object include: if the visibility state of the target object is visible, determining the position of the target object in the game scenario as the sound source position corresponding to the target object; if the visibility state of the target object is invisible, determining the preset position in the game scenario as the sound source position corresponding to the target object; the distance between the preset position and the position of the virtual camera corresponding to the controlled virtual object in the game scenario is greater than the preset distance threshold.
[0009] The above steps of determining the playing mode of the target sound effect based on the sound source position of the target object and the position of the virtual camera corresponding to the controlled virtual object in the game scenario include: determining the volume parameter of the target sound effect based on the sound source position of the target object and the position of the virtual camera corresponding to the controlled virtual object in the game scenario; the volume parameter characterizes the influence of the distance between the sound source position and the virtual object on the volume of the target sound effect; determining the playing mode of the target sound effect based on the volume parameter of the target sound effect.
[0010] The above volume parameter includes an attenuation coefficient; the steps of determining the volume parameter of the target sound effect based on the sound source position of the target object and the position of the virtual camera corresponding to the controlled virtual object in the game scenario include: calculating the distance between the sound source position and the position of the virtual camera corresponding to the controlled virtual object in the game scenario; determining the attenuation coefficient of the target sound effect based on the pre-determined attenuation curve of the target sound effect and the distance between the sound source position and the listener position; the attenuation curve indicates the change trend of the volume of the target sound effect with the distance between the sound source position of the target sound effect and the listener position.
[0011] The steps of determining the playback mode of the target sound effect based on the playback parameters of the target sound effect include: determining the volume of the target sound effect based on the volume parameter; determining whether the volume of the target sound effect is greater than or equal to a preset volume threshold; if not, determining the playback mode of the target sound effect as: playing the target sound effect through the virtual voice part of the preset sound engine; if so, determining the playback mode of the target sound effect as: playing the target sound effect through the real voice part of the preset sound engine.
[0012] There are multiple target sound effects as described above; before the step of determining the playback mode of the target sound effect as: playing the target sound effect through the real voice part of the preset sound engine, the method further includes: determining whether the number of target sound effects is less than or equal to a preset sound number threshold; if not, determining the playback mode of the target sound effect with the lowest preset priority among the target sound effects as: playing the target sound effect through the virtual voice part of the preset sound engine; continuing to execute the step of determining whether the number of target sound effects is less than or equal to the preset sound number threshold until the number of target sound effects is equal to the sound number threshold.
[0013] In a second aspect, an embodiment of the present invention provides a sound effect playback control device. A graphical user interface is provided through a terminal device, and the graphical user interface includes a scene picture of some game scenes, and the scene picture is obtained by a virtual camera corresponding to a controlled virtual object shooting in the game scene; the device includes: a target sound effect determination module, configured to determine a target object that triggers a sound effect and a target sound effect to be played in response to a sound effect trigger event; a visibility state acquisition module, configured to acquire the visibility state of the target object; where the visibility state is used to indicate whether the target object can be seen by the controlled virtual object or a virtual object other than the controlled virtual object; a playback mode determination module, configured to determine the playback mode of the target sound effect based on the visibility state of the target object and the position of the virtual camera corresponding to the controlled virtual object in the game scene, and play the target sound effect; an update module, configured to update the playback mode of the target sound effect in response to a change in the visibility state of the target object, and continue to play the target sound effect based on the updated playback mode.
[0014] In a third aspect, an embodiment of the present invention provides an electronic device, including a processor and a memory, where 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 sound effect playback control method.
[0015] In a fourth aspect, an embodiment of the present invention provides a machine-readable storage medium, and the machine-readable storage medium stores machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions cause the processor to implement the above-mentioned sound effect playback control method.
[0016] The embodiments of the present invention bring the following beneficial effects:
[0017] The above method, apparatus, and electronic device for playing and controlling sound effects respond to a sound effect trigger event to determine the target object that triggers the sound effect and the target sound effect to be played; and obtain the visibility state of the target object; the visibility state is used to indicate whether the target object can be seen by a controlled virtual object or other virtual objects; based on the visibility state of the target object and the position of the virtual camera corresponding to the controlled virtual object in the game scene, determine the playing mode of the target sound effect and play the target sound effect; in response to a change in the visibility state of the target object, update the playing mode of the target sound effect and continue to play the target sound effect based on the updated playing mode. In the above manner, the playing mode of the sound effect is determined based on the visibility state of the target object, and when the visibility changes, the playing mode of the sound effect is adjusted, enabling the player controlling the virtual object to hear the sound effects of the visible objects, thereby learning about the game situation in the entire game scene and improving the user experience.
[0018] Other features and advantages of the present invention will be described in the subsequent description, and in part, will be obvious from the description, or can be understood by implementing the present invention. The objectives and other advantages of the present invention are achieved and obtained by the structures specifically pointed out in the description, claims, and drawings.
[0019] To make the above objectives, features, and advantages of the present invention more obvious and understandable, the following specific preferred embodiments are given, and in conjunction with the accompanying drawings, the detailed description is as follows. Description of the Drawings
[0020] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following will briefly introduce the drawings required for the description of the specific embodiments or the prior art. Obviously, the following drawings are some embodiments of the present invention. For those skilled in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0021] Figure 1 It is a flowchart of a method for playing and controlling sound effects provided by an embodiment of the present invention;
[0022] Figure 2 It is a schematic diagram of an attenuation curve provided by an embodiment of the present invention;
[0023] Figure 3 It is a schematic structural diagram of a device for playing and controlling sound effects provided by an embodiment of the present invention;
[0024] Figure 4 It is a schematic structural diagram of an electronic device provided by an embodiment of the present invention. Detailed Embodiments
[0025] To make the objectives, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Apparently, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0026] Compared with 3D games, Multiplayer Online Battle Arena (MOBA) games have a larger game scene range, and the battlefield layout is usually planar. MOBA games have very high competitiveness and ornamental value. As an indispensable part of the game, audio can bring players accurate sound localization and battlefield information. To enhance the competitive experience of players and enable them to more accurately judge the information and situation on the battlefield from the sound, it is usually necessary to update and upgrade the functions of audio attenuation and audio visibility in the game.
[0027] To further understand the principle of audio playback in the game, the following concepts need to be understood:
[0028] Listener: Represents the position of the microphone in the game, which can locate the direction of 3D sound in the speaker to simulate a real 3D environment. There are usually two listener modes in the game. One is the dual-listener mode: when the player is alive, the listener is bound to the character and faces the fixed upper direction, and can hear the sounds around the actual position of the character, which has no association with the camera; when the player is dead, the listener is bound to the camera lens and plays according to the relative position between the sound source and the lens. The other is the single-listener mode: the sound is played according to the relative position between the sound source and the lens. The sense of sound direction is the same in both the alive and dead states.
[0029] Game Object: An entity that can connect elements such as the interface, sound, and trigger. In an audio solution (such as Wwise), sound can be played by sending an Event (sound effect trigger event) to the objects registered in the game, and positions may also be specified for the objects in the game.
[0030] Virtual voice: A virtual environment in the sound engine where sounds and vibrations are managed and monitored by the sound engine but not processed. When the volume level of a sound is lower than the threshold or the number of sounds exceeds the playback limit, these sounds are allowed to enter the virtual voice part.
[0031] Attenuation curve: Affects the intensity of the sound signal according to the distance between the sound source and the listener.
[0032] In the related art, the playing logic of sound effects in MOBA games is as follows: The visibility of game objects (game unit models and game special effects) that serve as carriers of sound effects is used as the basis for judging the playing method of the corresponding sound effects. That is, when the game object is visible, the sound effect is played; otherwise, it is not played. This can save unnecessary consumption, but at the same time, it causes the sound effect not to change even when the visibility of the game object changes. Moreover, the visibility of the game object here means being visible within the game scene displayed on the screen, and when the game object is not in the game scene displayed on the screen, it is considered invisible.
[0033] In the above sound effect playing method, when the player is in the alive state, the moving camera cannot hear the sounds of distant enemies or teammates, and only the battlefield situation can be judged visually, which relatively lacks some competitiveness. When switching between the dead and alive states, there are significant differences in the auditory perception and functions. In the settings of existing game engines, for skills outside the screen range but within the field of view, the sounds will not be triggered, resulting in the inability to receive sound information from the distant battlefield. For sounds outside the field of view or invisible, the lack of judging the real-time visibility of each game object (game object) leads to the inability to stop the sound or being forced to play synchronously with the vision. Based on this, an embodiment of the present invention provides a method, device, and electronic device for controlling the playing of sound effects, and this technology can be applied to the control of the playing of sound effects in various game scenes.
[0034] The method for controlling the playing of sound effects in one embodiment of the present disclosure can run on a local terminal device or a server. When the method for controlling the playing of sound effects runs on the server, the method can be implemented and executed based on a cloud interaction system, where the cloud interaction system includes a server and a client device.
[0035] In an alternative embodiment, various cloud applications can run under the cloud interaction system, such as cloud games. Taking cloud games as an example, cloud games refer to a game mode based on cloud computing. In the operation mode of cloud games, the running entity of the game program and the presenting entity of the game screen are separated. The storage and operation of the sound effect playing control method are completed on the cloud game server. The role of the client device is to receive and send data and present the game screen. For example, the client device can be a display device with data transmission function near the user side, such as a mobile terminal, a television, a computer, a personal digital assistant, etc.; however, the cloud game server in the cloud performs information processing. When playing a game, the player operates the client device to send an operation instruction to the cloud game server. The cloud game server runs the game according to the operation instruction, encodes and compresses data such as the game screen, and returns it to the client device through the network. Finally, the client device decodes and outputs the game screen. In an alternative embodiment, taking a game as an example, the local terminal device stores the game program and is used to present the game screen. The local terminal device is used to interact with the player through the graphical user interface, that is, conventionally, the game program is downloaded and installed on the electronic device and run. The way for the local terminal device to provide the graphical user interface to the player can include various methods. For example, it can be rendered and displayed on the display screen of the terminal, or provided to the player through holographic projection. For example, the local terminal device can include a display screen and a processor. The display screen is used to present the graphical user interface, which includes the game screen. The processor is used to run the game, generate the graphical user interface, and control the display of the graphical user interface on the display screen.
[0036] In a possible embodiment, the embodiment of the present invention provides a method for controlling the playback of sound effects, which provides a graphical user interface through a terminal device. Among them, the terminal device can be the aforementioned local terminal device or the client device in the aforementioned cloud interaction system. The graphical user interface includes the scene pictures of some game scenes, and the scene pictures are taken in the game scene by a virtual camera corresponding to the controlled virtual object; as Figure 1 shown, the method includes the following steps:
[0037] Step S102, in response to the sound effect trigger event, determine the target object that triggers the sound effect and the target sound effect to be played.
[0038] The above target object can be a system virtual object in the game scene corresponding to the controlled virtual object currently manipulated by the player, such as a non-player character (NPC), or a controlled virtual object manipulated by other players in the game scene. The target object can be a movable virtual object (also called a "game object"), such as a hero character, a pet character, etc., or a virtual object with a fixed position, such as a defense tower.
[0039] The above sound effect trigger events can include various types, such as the target object starting to walk, the target object triggering a skill, or certain actions of other virtual objects having an impact on the state of the target object, such as the target character being attacked by an enemy and producing a sound of being injured, etc. Corresponding to different sound effect trigger events, target sound effects are preset. These sound effects can be pre - saved in the terminal device in the form of audio.
[0040] Step S104, obtain the visibility state of the target object; wherein, the visibility state is used to indicate whether the target object can be seen by the controlled virtual object or virtual objects other than the controlled virtual object.
[0041] Different from the related art where only whether the target object is in the scene image captured by the virtual camera corresponding to the controlled virtual object is used to determine whether the target object can be seen, the above - mentioned visibility state of the target object refers to whether the target object can be seen by the virtual objects in the entire game scene. The visibility state of the target object can be visible or invisible. Usually, during the game process, the target object is visible, and other virtual objects can interact with the target object or apply skills to the target object. When the target object enters a preset hidden area in the game scene, such as a grassland or other area where it can hide, or the target object has an invisibility attribute, such as triggering an invisibility skill or using an invisibility item, etc., other virtual objects in the game scene cannot see the target object, and at this time the target object is invisible.
[0042] When obtaining the visibility state of the target object, if there is an invisibility skill or invisibility item in the game, it can first check whether the target object has an invisibility attribute at this time. If the target object has an invisibility attribute, then the target object is invisible; if the target object does not have an invisibility attribute or there is no invisibility skill or invisibility item in the game, it is necessary to check whether the position of the target object in the game scene is in the hidden area of the game scene. If the target object is in the hidden area, it is considered that the target object is invisible. In other cases, usually the target object is considered visible.
[0043] Step S106, based on the visibility state of the target object and the position of the virtual camera corresponding to the controlled virtual object in the game scene, determine the playing mode of the target sound effect and play the target sound effect.
[0044] When the visibility state of the target object is visible, its target sound effect can be played normally. The effects such as the volume of the target sound effect are mainly related to the distance between the target object and the controlled virtual object. When the Listener is bound to the virtual camera, it is related to the distance between the target object and the virtual camera. Specifically, the attenuation theory of sound waves can be referred to. When the visibility state of the target object is invisible, its target sound effect usually cannot be heard by the controlled virtual object, and it can be chosen not to play this target sound effect. However, when the visibility state of the target object is visible, if the distance between the target object and the virtual camera is far, the volume heard by the controlled virtual object is small and it is difficult to obtain the corresponding information, and it can also be chosen not to play this target sound effect.
[0045] If the target object can move, its visibility state may change. If its target sound effect is not played, it is difficult to make the target sound effect play at the correct time when the target object changes from invisible to visible. In related technologies, the sound engine of the game provides two sound playback methods: virtual voice parts (which can also be called "virtual channels") and real voice parts. The real voice part processes the sound effect throughout the process, including streaming playback, decoding, filtering, etc., and can make the sound play normally. The virtual voice part only calculates the volume of the sound effect and no actual sound will be played, which is equivalent to the mute state. Therefore, when it is not necessary to play the target sound effect, the virtual voice part can be used to play the target sound effect. When the target object is invisible, the sound source position of the target object can be set far from the virtual camera, so that the sound effect of the target sound effect is small, thus realizing the mute state of the target sound effect.
[0046] Generally, the virtual voice part is used to play the target sound effect whose volume is less than the preset volume threshold. At the same time, since the virtual voice part calculates the volume of the sound effect, when the volume of the target sound effect is higher than the volume threshold, the target sound effect can also be moved to the real voice part and the real voice part is used to play the target sound effect.
[0047] Step S108, in response to the change in the visibility state of the target object, update the playback method of the target sound effect, and continue to play the target sound effect based on the updated playback method.
[0048] During the playback of the target sound effect, the visibility state of the target object can be obtained in real time, such as determining whether the target object has an invisibility attribute, or whether the target object is in a hidden area of the game scene, so as to determine the visibility state of the target object. When the visibility state of the target object changes, based on the changed visibility state, determine the playback method of the target sound effect. Specifically, when the target object changes from visible to invisible, the virtual voice part can be used to continue playing the target sound effect from the current moment. When the target object changes from invisible to visible, the real voice part can be used to continue playing the target sound effect from the current moment.
[0049] The above-mentioned method for controlling the playback of a sound effect determines, in response to a sound effect triggering event, the target object that triggers the sound effect and the target sound effect to be played; and obtains the visibility status of the target object; the visibility status is used to indicate whether the target object can be seen by the controlled virtual object or other virtual objects; based on the visibility status of the target object and the position of the virtual camera corresponding to the controlled virtual object in the game scene, determines the playback mode of the target sound effect and plays the target sound effect; in response to a change in the visibility status of the target object, updates the playback mode of the target sound effect, and continues to play the target sound effect based on the updated playback mode. In the above-mentioned method, the playback mode of the sound effect is determined based on the visibility state of the target object, and when the visibility changes, the playback mode of the sound effect is adjusted, so that the player controlling the virtual object can hear the sound effect of the visible object, thereby knowing the game situation in the entire game scene and improving the user experience.
[0050] The following embodiment provides an implementation method for obtaining the visibility status of a target object.
[0051] In order to increase the fun of the game, some hidden areas are usually set in the game scene, such as bushes and rivers where you can hide. Correspondingly, when a virtual object is in a hidden area, its visibility state is invisible, and when the virtual object is in a non-hidden area, its visibility state is visible.
[0052] When determining the visibility state of a target object, you can first obtain the position of the target object in the game scene, and then based on the position of the target object, determine whether the target object is located in a hidden area. Specifically, you can determine whether the position coordinates of the target object are included in the coordinate range of the hidden area; if it is located in the hidden area, determine that the visibility state of the target object is invisible; if it is not located in the hidden area, determine that the visibility state of the target object is visible.
[0053] Furthermore, the target object can activate invisibility skills or use invisibility items to become invisible. In some scenarios, the controlled virtual object can also activate skills such as "X-ray Vision" that allow it to see "invisible" targets. In this case, the impact of these situations on the target object's visibility state must be comprehensively considered to determine the target object's visibility state.
[0054] The following embodiment provides an implementation method for determining a playback mode of a target sound effect.
[0055] During the propagation of sound, since the sound wave attenuates as the propagation distance increases, the 3D sound effects in the game will change the sound volume according to the distance between the sound source position and the listener's position. The farther the distance, the smaller the sound. The distance between the position where the sound is generated (usually referred to as the "sound source position") and the listener (in this method, the position of the virtual camera in the game scene) is crucial in determining the playback effect of the sound. Therefore, after obtaining the visibility state of the target object, it is necessary to determine the sound source position of the target object based on the visibility state of the target object, and then determine the playback mode of the target sound effect based on the sound source position of the target object and the position of the virtual camera corresponding to the controlled virtual object in the game scene.
[0056] Specifically, when determining the sound source position corresponding to the target object, if the visibility state of the target object is visible, the position of the target object in the game scene is determined as the sound source position corresponding to the target object; if the visibility state of the target object is invisible, the preset position in the game scene is determined as the sound source position corresponding to the target object; the distance between the preset position and the position of the virtual camera corresponding to the controlled virtual object in the game scene is greater than the preset distance threshold. This distance threshold can ensure that the attenuation of the target sound effect is relatively large, so the volume is relatively small, and it is moved to the virtual voice part for playback, so that the target sound effect of the invisible target object cannot be heard either. When the target object in the game moves, it is necessary to synchronously update the sound source position of the sound effect at the same time to maintain consistency with the position of the target object, or when the target object is invisible, set the sound source position to the preset position.
[0057] That is, it is possible to judge the visibility of the game object where the sound effect is located. If it is in a visible state, its sound source position is set normally. At this time, the sound effect can be heard normally. When it is in an invisible state, its sound source position is set to a position far away from the listener. At this time, this sound effect is inaudible. Specifically, it can be implemented using the following programming language:
[0058]
[0059] After determining the sound source position of the target object, the volume parameter of the target sound effect can be determined based on the sound source position of the target object and the position of the virtual camera corresponding to the controlled virtual object in the game scene; the volume parameter can characterize the influence of the distance between the sound source position and the virtual object on the volume of the target sound effect, usually the attenuation coefficient; further, the playback mode of the target sound effect can be determined based on the volume parameter of the target sound effect.
[0060] When determining the attenuation coefficient of the target sound effect, it is necessary to calculate the distance between the sound source position and the position of the virtual camera corresponding to the controlled virtual object in the game scene; based on the pre-determined attenuation curve of the target sound effect and the distance between the sound source position and the listener position, determine the attenuation coefficient of the target sound effect; the attenuation curve indicates the change trend of the volume of the target sound effect with the distance between the sound source position of the target sound effect and the listener position.
[0061] Among them, the relative distance between the sound source position (usually the position of the 3D sound emitter) and the virtual camera (Listener) can also be called the attenuation distance, and the sound intensity can be calculated based on the attenuation distance and the attenuation curve. According to requirements, in the case of a conventional screen ratio of 16:9, the distance from the center point (player position) to the screen edge is set to 1000 yards, and the audio attenuation distance ratio is 1:10, which is converted to a distance of 100 units in the Wwise audio engine. And according to different sound types, different attenuation distance ranges are set. It is mainly divided into the following 5 categories: 3D environmental sounds (maximum range 200 units); general sound effects (maximum range 200 units); hero character skill sound effects (maximum range 200 units); hero character footstep sound effects (maximum range 120 units); monster sound effects (maximum range 200 units).
[0062] For example: as Figure 2 shown, in the most important skill sound effect attenuation curve, it can be seen that the volume reduction is relatively slow within the 0-100 range curve, ensuring that players can hear clear and complete skill sound effects within the screen range and are not covered by distant sounds. In the range of 100-140, the sound change will be more obvious, which conforms to the auditory habit and enables players to receive nearby sound information. In the range of 140-200, the sound is more subtle, and the listener only retains some key skill sounds and ignores unimportant battlefield information, moving them to the virtual channel.
[0063] When determining the playback method of the target sound effect, based on the volume parameter, determine the volume of the target sound effect. Specifically, the initial volume of the target sound effect can be multiplied by the attenuation coefficient to obtain the volume when the target sound effect is played; determine whether the volume of the target sound effect is greater than or equal to the preset volume threshold; if not, determine the playback method of the target sound effect as: playing the target sound effect through the virtual voice part of the preset sound engine; if so, determine the playback method of the target sound effect as: playing the target sound effect through the real voice part of the preset sound engine.
[0064] Generally speaking, there are multiple target sound effects as mentioned above. Before the step of playing the target sound effects through the real voice part of the preset sound engine, it is also necessary to determine whether the number of target sound effects is less than or equal to the preset sound quantity threshold. If not, the playback method of the target sound effect with the lowest preset priority among the target sound effects is determined as: playing the target sound effect through the virtual voice part of the preset sound engine. Then, it is determined again whether the number of target sound effects is less than or equal to the preset sound quantity threshold until the number of target sound effects is equal to the sound quantity threshold. That is, when the number of target sound effects that need to be played through the real voice part is greater than the sound quantity threshold, the target sound effects with lower priority are moved to the virtual voice part for playback.
[0065] In the above method, when a sound effect needs to be played, regardless of the visibility of the game object, a playback event is sent to the sound engine, that is, a global sound effect playback event. Compared with the related technology, the control of visibility judgment during playback by the current client needs to be removed. And for the sound effect events of invisible targets, further processing is required to make them inaudible, such as setting their sound source position to a very far distance from the listener as mentioned above.
[0066] When many sounds are played simultaneously or sequentially, it will consume the performance resources of the machine. Therefore, it is necessary to turn on the virtual channel setting in the sound engine and make some sounds enter the virtual channel through the setting rules. At the same time, it is also necessary to ensure that when the sound returns from the virtual channel to the real voice part, the sound matches the timeline to avoid the phenomenon of out-of-sync audio and video.
[0067] There are two different implementation methods for moving the sound effect to the virtual voice part:
[0068] 1. When the volume of the voice part is lower than the preset threshold, the voice part will be moved into the virtual channel, and the sound will not be processed by the sound engine, reducing performance consumption.
[0069] 2. When one or a certain type of sound is played simultaneously and exceeds the preset maximum playback number, the sound with a lower priority will be moved to the virtual channel according to the set priority value.
[0070] In the initial stage of design, special classification is made for different machine performances. Low-performance machines can handle fewer sounds simultaneously, so the global maximum playback number is set to 30 and the volume threshold is set to -40dB. That is, in the overall game, at most 30 sounds can be played simultaneously. When the limit is exceeded, the content with lower priority will be moved to the virtual channel. At the same time, the content with a sound volume lower than -40dB will also be moved to the virtual channel.
[0071] Priority classification of sounds (1 - 100): According to the importance of sounds, the sounds existing in the game are classified and their priorities are set. Sounds with lower priorities are more likely to be moved to virtual channels and hidden, leaving the channels for more important sound content. For example, the following can be set respectively: UI button sound effect: 80; system voice broadcast: 80; summoner skill: 70; champion ultimate skill: 60; champion small skill: 55; champion normal attack, general skill: 50; champion movement footstep sound: 40. Thus, the priorities of various sound effects are distinguished, enabling sound effects with lower priorities to enter the virtual sound part when there are more sounds to be played.
[0072] The above playback method can produce the following sound playback effects:
[0073] Example scenario 1: In a battle situation, the 1P player (oneself) is in the lower lane position, and the enemy or teammate is in the upper lane position. At this time, the upper lane character (the sound source) is far beyond the maximum range of 200 yards from the Listener, so all 3D sounds of the upper lane character will be moved to the virtual channel to save performance.
[0074] Example scenario 2: In a team battle, multiple players release skills simultaneously, and the maximum number of plays reaches the peak value of 40. At this time, to ensure the game experience, important sounds need to be retained, such as champion ultimate skills, system broadcasts, UI sound effects, summoner skills, etc. Sounds with low priorities (unimportant sounds) will be moved to the virtual sound part, such as footstep sounds, normal attack and hit sounds, death or recall sounds, small skill voices, etc.
[0075] For the above method embodiments, refer to Figure 3 A sound effect playback control device as shown, which provides a graphical user interface through a terminal device. The graphical user interface includes the scene pictures of some game scenes, and the scene pictures are taken in the game scene by the virtual camera corresponding to the controlled virtual object; the device includes:
[0076] A target sound effect determination module 302, configured to determine the target object that triggers the sound effect and the target sound effect to be played in response to a sound effect trigger event;
[0077] A visibility state acquisition module 304, configured to acquire the visibility state of the target object; wherein, the visibility state is used to: indicate whether the target object can be seen by the controlled virtual object or virtual objects other than the controlled virtual object;
[0078] A playback method determination module 306, configured to determine the playback method of the target sound effect based on the visibility state of the target object and the position of the virtual camera corresponding to the controlled virtual object in the game scene, and play the target sound effect;
[0079] An update module 308, configured to update the playing mode of a target sound effect in response to a change in the visibility state of a target object, and continue to play the target sound effect based on the updated playing mode.
[0080] The above-mentioned playing control device for a sound effect determines a target object that triggers the sound effect and a target sound effect to be played in response to a sound effect trigger event; and obtains the visibility state of the target object; the visibility state is used to indicate whether the target object can be seen by a controlled virtual object or other virtual objects; based on the visibility state of the target object and the position of the virtual camera corresponding to the controlled virtual object in the game scene, determine the playing mode of the target sound effect, and play the target sound effect; in response to a change in the visibility state of the target object, update the playing mode of the target sound effect, and continue to play the target sound effect based on the updated playing mode. In the above manner, the playing mode of the sound effect is determined based on the visibility state of the target object, and when the visibility changes, the playing mode of the sound effect is adjusted, so that the player controlling the virtual object can hear the sound effects of the visible objects, thereby learning about the game situation in the entire game scene and improving the user experience.
[0081] The above-mentioned game scene includes a hidden area; the visibility state includes visible or invisible; the visibility state acquisition module is further configured to: obtain the position of the target object in the game scene; based on the position of the target object, determine whether the target object is located in the hidden area; if it is located in the hidden area, determine the visibility state of the target object as invisible; if it is not located in the hidden area, determine the visibility state of the target object as visible.
[0082] The above-mentioned playing mode determination module is further configured to: determine the sound source position of the target object based on the visibility state of the target object; based on the sound source position of the target object and the position of the virtual camera corresponding to the controlled virtual object in the game scene, determine the playing mode of the target sound effect.
[0083] The above-mentioned visibility state includes visible or invisible; the above-mentioned playing mode determination module is further configured to: if the visibility state of the target object is visible, determine the position of the target object in the game scene as the sound source position corresponding to the target object; if the visibility state of the target object is invisible, determine a preset position in the game scene as the sound source position corresponding to the target object; the distance between the preset position and the position of the virtual camera corresponding to the controlled virtual object in the game scene is greater than a preset distance threshold.
[0084] The above-mentioned playing mode determination module is further configured to: determine the volume parameter of the target sound effect based on the sound source position of the target object and the position of the virtual camera corresponding to the controlled virtual object in the game scene; the volume parameter characterizes the influence of the distance between the sound source position and the virtual object on the volume of the target sound effect; based on the volume parameter of the target sound effect, determine the playing mode of the target sound effect.
[0085] The above volume parameter includes an attenuation coefficient; the above playback mode determination module is further configured to: calculate the distance between the sound source position and the position of the virtual camera corresponding to the controlled virtual object in the game scene; determine the attenuation coefficient of the target sound effect based on the pre-determined attenuation curve of the target sound effect and the distance between the sound source position and the listener position; the attenuation curve indicates the change trend of the volume of the target sound effect with the distance between the sound source position of the target sound effect and the listener position.
[0086] The above playback mode determination module is further configured to: determine the volume of the target sound effect based on the volume parameter; determine whether the volume of the target sound effect is greater than or equal to a preset volume threshold; if not, determine the playback mode of the target sound effect as: playing the target sound effect through the virtual voice part of the preset sound engine; if so, determine the playback mode of the target sound effect as: playing the target sound effect through the real voice part of the preset sound engine.
[0087] There are multiple above target sound effects; the above device further includes: a quantity judgment module, configured to judge whether the quantity of the target sound effects is less than or equal to a preset sound quantity threshold; a priority playback mode determination module, configured to if not, determine the playback mode of the target sound effect with the lowest preset priority among the target sound effects as: playing the target sound effect through the virtual voice part of the preset sound engine; continue to execute the step of judging whether the quantity of the target sound effects is less than or equal to the preset sound quantity threshold until the quantity of the target sound effects is equal to the sound quantity threshold.
[0088] This embodiment further provides an electronic device, including a processor and a memory, 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 sound effect playback control method, for example:
[0089] As Figure 1 shown, in response to a sound effect trigger event, determine the target object that triggers the sound effect and the target sound effect to be played; obtain the visibility state of the target object; wherein, the visibility state is used to: indicate whether the target object can be seen by the controlled virtual object or a virtual object other than the controlled virtual object; based on the visibility state of the target object and the position of the virtual camera corresponding to the controlled virtual object in the game scene, determine the playback mode of the target sound effect, and play the target sound effect; in response to a change in the visibility state of the target object, update the playback mode of the target sound effect, and continue to play the target sound effect based on the updated playback mode.
[0090] Optionally, the above game scenario includes a hidden area; the visibility state includes visible or invisible; the step of obtaining the visibility state of the target object includes: obtaining the position of the target object in the game scenario; based on the position of the target object, determining whether the target object is located in the hidden area; if it is located in the hidden area, determining the visibility state of the target object as invisible; if it is not located in the hidden area, determining the visibility state of the target object as visible.
[0091] Optionally, the step of determining the playback mode of the target sound effect based on the visibility state of the target object and the position of the virtual camera corresponding to the controlled virtual object in the game scenario includes: determining the sound source position of the target object based on the visibility state of the target object; determining the playback mode of the target sound effect based on the sound source position of the target object and the position of the virtual camera corresponding to the controlled virtual object in the game scenario.
[0092] Optionally, the above visibility state includes visible or invisible; the step of determining the sound source position corresponding to the target object based on the visibility state of the target object includes: if the visibility state of the target object is visible, determining the position of the target object in the game scenario as the sound source position corresponding to the target object; if the visibility state of the target object is invisible, determining the preset position in the game scenario as the sound source position corresponding to the target object; the distance between the preset position and the position of the virtual camera corresponding to the controlled virtual object in the game scenario is greater than the preset distance threshold.
[0093] Optionally, the step of determining the playback mode of the target sound effect based on the sound source position of the target object and the position of the virtual camera corresponding to the controlled virtual object in the game scenario includes: determining the volume parameter of the target sound effect based on the sound source position of the target object and the position of the virtual camera corresponding to the controlled virtual object in the game scenario; the volume parameter characterizes the influence of the distance between the sound source position and the virtual object on the volume of the target sound effect; determining the playback mode of the target sound effect based on the volume parameter of the target sound effect.
[0094] Optionally, the above volume parameter includes an attenuation coefficient; the step of determining the volume parameter of the target sound effect based on the sound source position of the target object and the position of the virtual camera corresponding to the controlled virtual object in the game scenario includes: calculating the distance between the sound source position and the position of the virtual camera corresponding to the controlled virtual object in the game scenario; determining the attenuation coefficient of the target sound effect based on the pre-determined attenuation curve of the target sound effect and the distance between the sound source position and the listener position; the attenuation curve indicates the change trend of the volume of the target sound effect with the distance between the sound source position of the target sound effect and the listener position.
[0095] Optionally, the step of determining the playback mode of the target sound effect based on the playback parameters of the target sound effect includes: determining the volume of the target sound effect based on the volume parameter; determining whether the volume of the target sound effect is greater than or equal to a preset volume threshold; if not, determining the playback mode of the target sound effect as: playing the target sound effect through the virtual voice part of the preset sound engine; if so, determining the playback mode of the target sound effect as: playing the target sound effect through the real voice part of the preset sound engine.
[0096] Optionally, there are multiple target sound effects; before the step of determining the playback mode of the target sound effect as: playing the target sound effect through the real voice part of the preset sound engine, the method further includes: determining whether the number of target sound effects is less than or equal to a preset sound number threshold; if not, determining the playback mode of the target sound effect with the lowest preset priority among the target sound effects as: playing the target sound effect through the virtual voice part of the preset sound engine; continuing to execute the step of determining whether the number of target sound effects is less than or equal to the preset sound number threshold until the number of target sound effects is equal to the sound number threshold.
[0097] The above method for controlling the playback of a sound effect responds to a sound effect trigger event, determines the target object of the triggered sound effect and the target sound effect to be played; and obtains the visibility state of the target object; the visibility state is used to indicate whether the target object can be seen by the controlled virtual object or other virtual objects; based on the visibility state of the target object and the position of the virtual camera corresponding to the controlled virtual object in the game scene, determines the playback mode of the target sound effect and plays the target sound effect; in response to a change in the visibility state of the target object, updates the playback mode of the target sound effect and continues to play the target sound effect based on the updated playback mode. In the above manner, the playback mode of its sound effect is determined based on the visibility state of the target object, and when the visibility changes, the playback mode of the sound effect is adjusted, so that the player controlling the virtual object can hear the sound effects of the visible objects, thereby learning about the game situation in the entire game scene and improving the user experience.
[0098] See Figure 4 As shown, the electronic device includes a processor 100 and a memory 101. 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 method for controlling the playback of a sound effect.
[0099] Furthermore, Figure 4 The shown electronic device further includes a bus 102 and a communication interface 103. The processor 100, the communication interface 103, and the memory 101 are connected through the bus 102.
[0100] Among them, the memory 101 may include high-speed random access memory (RAM), and may also include non-volatile memory, such as at least one disk memory. The communication connection between this 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, an EISA bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For the sake of representation, Figure 4 only a bidirectional arrow is used in Figure 4 , but it does not mean that there is only one bus or one type of bus.
[0101] 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 integrated logic circuit in the hardware of the processor 100 or by instructions in software form. The above-mentioned processor 100 can be a general-purpose processor, including a central processing unit (CPU for short), a network processor (NP for short), etc.; it can also be a digital signal processor (DSP for short), an application specific integrated circuit (ASIC for short), a field-programmable gate array (FPGA for short), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. It can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiments of the present invention. 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 combination with the embodiments of the present invention can be directly embodied as being executed and completed by a hardware decoding processor, or executed and completed by a combination of hardware and software modules in the decoding processor. The software module can be located in a mature storage medium in the art such as random access memory, flash memory, read-only memory, programmable read-only memory, or electrically erasable programmable memory, register, etc. This storage medium is located in the memory 101, and the processor 100 reads the information in the memory 101 and combines its hardware to complete the steps of the method in the foregoing embodiments.
[0102] This embodiment also provides a machine-readable storage medium, and 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 cause the processor to implement the above-mentioned sound effect playback control method.
[0103] A method, apparatus, and electronic device for playing and controlling sound effects provided by an embodiment of the present invention include a computer-readable storage medium storing program code, and the instructions included in the program code can be used to execute the method described in the foregoing method embodiment, for example:
[0104] As Figure 1 shown, in response to a sound effect trigger event, determine the target object that triggers the sound effect and the target sound effect to be played; obtain the visibility state of the target object; wherein, the visibility state is used to: indicate whether the target object can be seen by a controlled virtual object or a virtual object other than the controlled virtual object; based on the visibility state of the target object and the position of the virtual camera corresponding to the controlled virtual object in the game scene, determine the playing method of the target sound effect, and play the target sound effect; in response to a change in the visibility state of the target object, update the playing method of the target sound effect, and continue to play the target sound effect based on the updated playing method.
[0105] Optionally, the above game scene includes a hidden area; the visibility state includes visible or invisible; the step of obtaining the visibility state of the target object includes: obtaining the position of the target object in the game scene; based on the position of the target object, determining whether the target object is located in the hidden area; if it is located in the hidden area, determining that the visibility state of the target object is invisible; if it is not located in the hidden area, determining that the visibility state of the target object is visible.
[0106] Optionally, the above step of determining the playing method of the target sound effect based on the visibility state of the target object and the position of the virtual camera corresponding to the controlled virtual object in the game scene includes: determining the sound source position of the target object based on the visibility state of the target object; determining the playing method of the target sound effect based on the sound source position of the target object and the position of the virtual camera corresponding to the controlled virtual object in the game scene.
[0107] Optionally, the above visibility state includes visible or invisible; the step of determining the sound source position corresponding to the target object based on the visibility state of the target object includes: if the visibility state of the target object is visible, determining the position of the target object in the game scene as the sound source position corresponding to the target object; if the visibility state of the target object is invisible, determining a preset position in the game scene as the sound source position corresponding to the target object; the distance between the preset position and the position of the virtual camera corresponding to the controlled virtual object in the game scene is greater than a preset distance threshold.
[0108] Optionally, the step of determining the playback mode of the target sound effect based on the sound source position of the target object and the position of the virtual camera corresponding to the controlled virtual object in the game scene includes: determining the volume parameter of the target sound effect based on the sound source position of the target object and the position of the virtual camera corresponding to the controlled virtual object in the game scene; the volume parameter characterizes the influence of the distance between the sound source position and the virtual object on the volume of the target sound effect; determining the playback mode of the target sound effect based on the volume parameter of the target sound effect.
[0109] Optionally, the volume parameter includes an attenuation coefficient; the step of determining the volume parameter of the target sound effect based on the sound source position of the target object and the position of the virtual camera corresponding to the controlled virtual object in the game scene includes: calculating the distance between the sound source position and the position of the virtual camera corresponding to the controlled virtual object in the game scene; determining the attenuation coefficient of the target sound effect based on the pre-determined attenuation curve of the target sound effect and the distance between the sound source position and the listener position; the attenuation curve indicates the change trend of the volume of the target sound effect with the distance between the sound source position of the target sound effect and the listener position.
[0110] Optionally, the step of determining the playback mode of the target sound effect based on the playback parameter of the target sound effect includes: determining the volume of the target sound effect based on the volume parameter; determining whether the volume of the target sound effect is greater than or equal to a preset volume threshold; if not, determining the playback mode of the target sound effect as: playing the target sound effect through the virtual voice part of the preset sound engine; if so, determining the playback mode of the target sound effect as: playing the target sound effect through the real voice part of the preset sound engine.
[0111] Optionally, there are multiple target sound effects; before the step of determining the playback mode of the target sound effect as: playing the target sound effect through the real voice part of the preset sound engine, the method further includes: determining whether the number of target sound effects is less than or equal to a preset sound number threshold; if not, determining the playback mode of the target sound effect with the lowest preset priority among the target sound effects as: playing the target sound effect through the virtual voice part of the preset sound engine; continuing to execute the step of determining whether the number of target sound effects is less than or equal to the preset sound number threshold until the number of target sound effects is equal to the sound number threshold.
[0112] The above method for controlling the playback of a sound effect responds to a sound effect trigger event to determine the target object that triggers the sound effect and the target sound effect to be played; and obtains the visibility state of the target object; the visibility state is used to indicate whether the target object can be seen by the controlled virtual object or other virtual objects; based on the visibility state of the target object and the position of the virtual camera corresponding to the controlled virtual object in the game scene, determine the playback method of the target sound effect, and play the target sound effect; in response to a change in the visibility state of the target object, update the playback method of the target sound effect, and continue to play the target sound effect based on the updated playback method. In the above manner, the playback method of the sound effect is determined based on the visibility state of the target object, and when the visibility changes, the playback method of the sound effect is adjusted, so that the player controlling the virtual object can hear the sound effects of the visible objects, thereby learning about the game situation in the entire game scene and improving the user experience.
[0113] Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems and devices described above can refer to the corresponding processes in the foregoing method embodiments and will not be elaborated herein.
[0114] In addition, in the description of the embodiments of the present invention, unless otherwise clearly specified and limited, the terms "installation", "connection", and "connection" 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 directly connected or indirectly connected through an intermediate medium, and it can be the communication inside 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 situations.
[0115] If the above function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a 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 and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical discs that can store program codes.
[0116] In the description of the present invention, it should be noted that the orientation or positional relationship indicated by the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc. is based on the orientation or positional relationship shown in the drawings. It is 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. Therefore, it should not be construed as a limitation to the present invention. In addition, the terms "first", "second", "third" are only used for descriptive purposes and cannot be construed as indicating or implying relative importance.
[0117] Finally, it should be noted that the above embodiments are only specific embodiments of the present invention, used to illustrate the technical solutions of the present invention, rather than limiting it. The protection scope of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art within the technical scope disclosed by the present invention can still modify the technical solutions recorded in the foregoing embodiments, or can easily think of changes, or make equivalent replacements for some of the technical features; 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 all be covered within the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims
1. A method for playing and controlling sound effects, characterized in that, Provide a graphical user interface through a terminal device, where the graphical user interface includes a scene picture of a part of the game scene, and the scene picture is obtained by a virtual camera corresponding to a controlled virtual object shooting in the game scene; the method includes: In response to a sound effect trigger event, determine the target object that triggers the sound effect and the target sound effect to be played; Obtain the visibility state of the target object; wherein, the visibility state is used to indicate whether the target object can be seen by at least one virtual object in the entire game scene; Based on the visibility state of the target object and the position of the virtual camera corresponding to the controlled virtual object in the game scene, determine the playback mode of the target sound effect and play the target sound effect; In response to a change in the visibility state of the target object, update the playback mode of the target sound effect and continue to play the target sound effect based on the updated playback mode.
2. The method according to claim 1, characterized in that, The game scene includes a hidden area; the visibility state includes visible or invisible; The step of obtaining the visibility state of the target object includes: Obtain the position of the target object in the game scene; Based on the position of the target object, determine whether the target object is located in the hidden area; If it is located in the hidden area, determine that the visibility state of the target object is invisible; If it is not located in the hidden area, determine that the visibility state of the target object is visible.
3. The method according to claim 1, characterized in that, The step of determining the playback mode of the target sound effect based on the visibility state of the target object and the position of the virtual camera corresponding to the controlled virtual object in the game scene includes: Based on the visibility state of the target object, determine the sound source position of the target object; Based on the sound source position of the target object and the position of the virtual camera corresponding to the controlled virtual object in the game scene, determine the playback mode of the target sound effect.
4. The method according to claim 3, wherein The visibility state includes visible or invisible; The step of determining the sound source position corresponding to the target object based on the visibility state of the target object includes: If the visibility state of the target object is visible, determine the position of the target object in the game scene as the sound source position corresponding to the target object; If the visibility state of the target object is invisible, determine a preset position in the game scene as the sound source position corresponding to the target object; the distance between the preset position and the position of the virtual camera corresponding to the controlled virtual object in the game scene is greater than a preset distance threshold.
5. The method according to claim 1, wherein The step of determining the playback mode of the target sound effect based on the sound source position of the target object and the position of the virtual camera corresponding to the controlled virtual object in the game scene includes: Based on the sound source position of the target object and the position of the virtual camera corresponding to the controlled virtual object in the game scene, determine the volume parameter of the target sound effect; the volume parameter characterizes the influence of the distance between the sound source position and the virtual object on the volume of the target sound effect; Based on the volume parameter of the target sound effect, determine the playback mode of the target sound effect.
6. The method according to claim 5, characterized in that, The volume parameter includes an attenuation coefficient; The step of determining the volume parameter of the target sound effect based on the sound source position of the target object and the position of the virtual camera corresponding to the controlled virtual object in the game scene includes: Calculating the distance between the sound source position and the position of the virtual camera corresponding to the controlled virtual object in the game scene; Determining the attenuation coefficient of the target sound effect based on the pre-determined attenuation curve of the target sound effect and the distance between the sound source position and the position of the virtual camera; the attenuation curve indicates the change trend of the volume of the target sound effect with the distance between the sound source position of the target sound effect and the position of the virtual camera.
7. The method according to claim 5, characterized in that, The step of determining the playback mode of the target sound effect based on the playback parameter of the target sound effect includes: Determining the volume of the target sound effect based on the volume parameter; Judging whether the volume of the target sound effect is greater than or equal to a preset volume threshold; If not, determining the playback mode of the target sound effect as: playing the target sound effect through the virtual voice part of a preset sound engine; If so, determining the playback mode of the target sound effect as: playing the target sound effect through the real voice part of a preset sound engine.
8. The method according to claim 7, characterized in that, There are multiple target sound effects; Before the step of determining the playback mode of the target sound effect as: playing the target sound effect through the real voice part of a preset sound engine, the method further includes: Judging whether the number of the target sound effects is less than or equal to a preset sound number threshold; If not, determining the playback mode of the target sound effect with the lowest preset priority among the target sound effects as: playing the target sound effect through the virtual voice part of a preset sound engine; and continuing to execute the step of judging whether the number of the target sound effects is less than or equal to the preset sound number threshold until the number of the target sound effects is equal to the sound number threshold.
9. A playback control device for a sound effect, characterized in that, Providing a graphical user interface through a terminal device, where the graphical user interface includes a scene picture of a part of the game scene, and the scene picture is taken by the virtual camera corresponding to the controlled virtual object in the game scene; the device includes: A target sound effect determination module, configured to determine a target object that triggers a sound effect and a target sound effect to be played in response to a sound effect trigger event; A visibility state acquisition module, configured to acquire the visibility state of the target object; wherein, the visibility state is used to: indicate whether the target object can be seen by at least one virtual object in the entire game scene; A playback mode determination module, configured to determine the playback mode of the target sound effect based on the visibility state of the target object and the position of the virtual camera corresponding to the controlled virtual object in the game scene, and play the target sound effect; An update module, configured to update the playback mode of the target sound effect in response to a change in the visibility state of the target object, and continue to play the target sound effect based on the updated playback mode.
10. An electronic device, characterized in that, It includes a processor and a memory. The memory stores machine-executable instructions that can be executed by the processor. The processor executes the machine-executable instructions to implement the sound effect playing control method according to any one of claims 1-8.
11. 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 a processor, the machine-executable instructions cause the processor to implement the sound effect playing control method according to any one of claims 1-8.
Citation Information
Patent Citations
Method and device for audio control in games
CN110270094A
Sound effect playing method and device in game scene and electronic device
CN111111167A