Page MenuHomeWildfire Games

Notify players with a sound when a player is defeated
ClosedPublic

Authored by Stan on Jul 3 2020, 2:37 PM.

Details

Reviewers
bb
Silier
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Commits
rP24199: Notify players with a sound when a player is defeated
Summary

Currently there is only a text notification when a player is defeated this patch a sound will also be played.

Open Questions:

  • Better defeat sound
Test Plan

Play a game with multiple players, and change perspective to make them lose, or use cheats. Check that the sound is heard

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
Stan edited the summary of this revision. (Show Details)Jul 17 2020, 2:51 PM

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/2683/display/redirect

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/2150/display/redirect

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/1051/display/redirect

Stan updated this revision to Diff 12753.Jul 17 2020, 2:59 PM

I can't do better than this, the patch applies fine on my end...

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/2684/display/redirect

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/1052/display/redirect

Silier added a comment.EditedJul 18 2020, 5:36 PM

Nice feature and it works but.
1.) I think we need another sounds for these situations and to they should be a bit more different among themselves, mainly when enemy is defeated and ally/me is defeated, also ally and me is defeated could be better distinguishable.
2.) When player wins, it should play winning sound and not enemy defeated sound as that will be played likely during the match as well so I would rather want to hear something else, maybe something more fancy.
3.) Also I would add option for player to disable these sounds, for someone they could be annoying or distracting, mainly enenmy/ally defeated.

Stan updated this revision to Diff 12781.Jul 19 2020, 1:03 PM

Try With config borkne
...

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/2171/display/redirect

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/1072/display/redirect

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/2704/display/redirect

Stan updated this revision to Diff 12788.Jul 20 2020, 1:18 AM

Revert jsinterface changes

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/2709/display/redirect

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/1077/display/redirect

Stan updated this revision to Diff 12789.Jul 20 2020, 1:21 AM

Try crlf

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/2710/display/redirect

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/1078/display/redirect

Stan added a subscriber: Imarok.Jul 20 2020, 1:26 AM

Tried with @Imarok suggestion using the GUIInterface to access the config but it didn't work. The problem is you actually have to call the actual gui to get the config value, and that also allows you to call the playuisound. There are however a lot of issues.

  • That function doesn't accept soundgroups only sound files (.ogg)
    • Bad for modding
    • Hardcoding in js files
  • That function is played regardless of the caller, so while all the players play a different sound, they all hear every sound played by the other players

So I do not think it's possible using that route. That also means one will not be able to disable the sounds without disabling all the other ui sounds. Here is the code if someone has a better idea

Stan updated this revision to Diff 12863.Jul 22 2020, 10:43 PM

Fix broken behavior reported by Angen

Stan updated this revision to Diff 12865.Jul 22 2020, 10:50 PM

Revert changes

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/2758/display/redirect

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/2760/display/redirect

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/1128/display/redirect

Freagarach added inline comments.
binaries/data/mods/public/simulation/components/Player.js
930

Since the ternary below is already huge, you can inline this as well, since it is used merely once ;)

935

Unnecessary newline.

bb added a subscriber: bb.Sep 29 2020, 9:27 PM
bb added inline comments.
source/simulation2/components/CCmpSoundManager.cpp
98

If am I parsing the code right, by setting that last argument to true, the sound will be heard by everyone, i.e., ALL sounds will be heard by everyone. Since everyone runs the simulation, everyone runs ALL the player.js code, for ALL players, hence this gets called for all players, and I don't see where the call gets nuked.

HowToFix: as you can see in the PlaySoundGroup function above, we can set the last variable in the call depending on the currently viewed player. It might be fruitful to not pass the playerEnt but the playerID int (and pass INVALID_ENTITY furtheron).

Stan added inline comments.Sep 29 2020, 9:44 PM
source/simulation2/components/CCmpSoundManager.cpp
98

There is a specific player specified there so since the sound are owner only you only hear one sound although all are played.

Stan updated this revision to Diff 13580.Sep 29 2020, 11:07 PM

Update, for some reason I got confused. Now works with @bb's suggestion

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/3265/display/redirect

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/1613/display/redirect

Freagarach added inline comments.Sep 30 2020, 8:35 AM
source/simulation2/components/ICmpSoundManager.cpp
27

Why is this _const?

Stan added inline comments.Sep 30 2020, 8:37 AM
source/simulation2/components/ICmpSoundManager.cpp
27

Cause it doesn't alter the CCmpSoundComponent

bb added inline comments.Oct 10 2020, 5:18 PM
source/simulation2/components/CCmpSoundManager.cpp
68

why do we use something different here than below?

94

Why do we pass the playerEntity? querying cmpVisual down the line should return null anyway. Pass INVALID_ENTITY down.

96

This disables the "heardby" tag of the sound, probably better to pass g_Game->GetViewedPlayerID() == playerId as last argument below.

Stan updated this revision to Diff 13620.Oct 11 2020, 3:55 PM
Stan marked 8 inline comments as done.

Fix notes.

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/3291/display/redirect

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/1639/display/redirect

What do observers hear?

binaries/data/mods/public/simulation/templates/special/player/player.xml
94–95

Seems more in line with other sounds?

Stan updated this revision to Diff 13923.Nov 14 2020, 6:39 PM
Stan marked an inline comment as done.

Rebase. Observers don't hear sounds unless they are viewing the game as a specific player.

Build failure - The Moirai have given mortals hearts that can endure.

builderr-debug-gcc6.txt
<command-line>:0:0: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
make[1]: *** [obj/simulation2_Debug/CCmpSoundManager.o] Error 1
make: *** [simulation2] Error 2

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/3546/display/redirect

Successful build - Chance fights ever on the side of the prudent.

builderr-release-macos.txt
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libsimulation2.a(precompiled.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libgraphics.a(precompiled.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libatlas.a(precompiled.o) has no symbols

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/1889/display/redirect

Stan updated this revision to Diff 13991.Nov 17 2020, 1:08 PM

Rename sounds, allow to play sound for all players

Stan updated this revision to Diff 13992.Nov 17 2020, 1:14 PM

Fix name

Successful build - Chance fights ever on the side of the prudent.

builderr-release-macos.txt
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libsimulation2.a(precompiled.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libgraphics.a(precompiled.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libatlas.a(precompiled.o) has no symbols

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/1944/display/redirect

Successful build - Chance fights ever on the side of the prudent.

builderr-release-macos.txt
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libsimulation2.a(precompiled.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libgraphics.a(precompiled.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libatlas.a(precompiled.o) has no symbols

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/1945/display/redirect

bb added a comment.Nov 17 2020, 9:43 PM

Observer not viewing a player don't hear anything => probably wanted, certainly not possible i the current design (also would need new sound).

No sound for won?

binaries/data/mods/public/audio/interface/alarm/alarm_defeated.xml
3

seems like omnipresent and heardby tag are missing, don't hear much now...

binaries/data/mods/public/simulation/components/Player.js
929

inline

source/simulation2/components/ICmpSoundManager.h
46

period

47–48

probably should be periods too, might be called inconsistent with comments above

Stan updated this revision to Diff 14002.Nov 17 2020, 10:12 PM
Stan marked 4 inline comments as done.

No sound for won?

I need an extra sound for that one, and we don't have anything fitting at the moment.

Fix notes

Build failure - The Moirai have given mortals hearts that can endure.

builderr-debug-gcc6.txt
g++: internal compiler error: Segmentation fault (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
make[1]: *** [obj/simulation2_Debug/CCmpSoundManager.o] Error 4
make: *** [simulation2] Error 2

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/3615/display/redirect

Successful build - Chance fights ever on the side of the prudent.

builderr-debug-macos.txt
../../../source/simulation2/scripting/JSInterface_Simulation.cpp:152:4: warning: suggest braces around initialization of subobject [-Wmissing-braces]
                        CFixedVector2D(-halfSize.X, -halfSize.Y),
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
In file included from ../../../source/graphics/tests/test_Camera.cpp:17:
/Users/wfg/Jenkins/workspace/macos-differential/source/graphics/tests/test_Camera.h:168:4: warning: suggest braces around initialization of subobject [-Wmissing-braces]
                        CVector3D(-101.0f, -101.0f, 101.0f),
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
In file included from ../../../source/simulation2/tests/test_SerializeTemplates.cpp:17:
/Users/wfg/Jenkins/workspace/macos-differential/source/simulation2/tests/test_SerializeTemplates.h:39:4: warning: suggest braces around initialization of subobject [-Wmissing-braces]
                        3, 0, 1, 4, 1, 5
                        ^~~~~~~~~~~~~~~~
                        {               }
1 warning generated.
builderr-release-macos.txt
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libnetwork.a(precompiled.o) has no symbols
../../../source/simulation2/scripting/JSInterface_Simulation.cpp:152:4: warning: suggest braces around initialization of subobject [-Wmissing-braces]
                        CFixedVector2D(-halfSize.X, -halfSize.Y),
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libsimulation2.a(precompiled.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libscriptinterface.a(precompiled.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libengine.a(precompiled.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libgraphics.a(precompiled.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libatlas.a(precompiled.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libgui.a(precompiled.o) has no symbols
In file included from ../../../source/graphics/tests/test_Camera.cpp:17:
/Users/wfg/Jenkins/workspace/macos-differential/source/graphics/tests/test_Camera.h:168:4: warning: suggest braces around initialization of subobject [-Wmissing-braces]
                        CVector3D(-101.0f, -101.0f, 101.0f),
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
In file included from ../../../source/simulation2/tests/test_SerializeTemplates.cpp:17:
/Users/wfg/Jenkins/workspace/macos-differential/source/simulation2/tests/test_SerializeTemplates.h:39:4: warning: suggest braces around initialization of subobject [-Wmissing-braces]
                        3, 0, 1, 4, 1, 5
                        ^~~~~~~~~~~~~~~~
                        {               }
1 warning generated.

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/1956/display/redirect

bb accepted this revision.Nov 17 2020, 10:42 PM

Testing verifies sounds are heard, also for observers (when viewing a player). Defeating sound work (sim is processed before gui, the g_ViewedPlayer didn't change yet when the sound is played).

Silier resigned from this revision.Nov 18 2020, 7:50 AM
This revision is now accepted and ready to land.Nov 18 2020, 7:50 AM
This revision was landed with ongoing or failed builds.Nov 18 2020, 10:14 AM
This revision was automatically updated to reflect the committed changes.
Owners added subscribers: Restricted Owners Package, Restricted Owners Package, Restricted Owners Package.Nov 18 2020, 10:14 AM