Irbyz / aftershock-xe

AfterShock XE is a fork of the AfterShock mod for OpenArena FPS game.
https://discord.gg/fd79Ktf
GNU General Public License v2.0
12 stars 8 forks source link

Bug with sound cues for flag drop/taken #6

Closed coluccioa closed 5 years ago

coluccioa commented 6 years ago

From recent clan war practices I also noticed on multiple occasions sound cues not working when your teammate drops the flag (gets killed), and not working when enemy picks up your flag in some situations.. I'm not sure if the bug can occur on the flag returned sound cue, I don't exactly remember it happening with that one, but it makes sense to me that if it can happen with other two it can happen with it also.

Here's video proof: https://youtu.be/rMcTOu7JcZE Exactly at 0:09 of the video, pay attention to flag icon and you'll see icon indicates it's taken but there wasn't sound cue for it.. and I was oblivious our flag was taken.

Edit: It was also confirmed to me after the match that our defender (raGe|Fixer) also didn't hear the sound cue and didn't push to return either.

borg42 commented 6 years ago

Hard to say. The logic for the sound cues is in cg_event.c lines 1168ff: https://github.com/Irbyz/aftershock-xe/blob/master/code/cgame/cg_event.c#L1168

As far as i can tell that looks OK. It calls CG_AddBufferedSound with the sound cue. This buffer can have up to 20 sounds. If a 21st is added the oldest sound is dropped. Not sure if that many sounds were going on at the 0:09 mark in your video.

I am also not sure how computation-intensive this is, maybe we can just double the buffer size to 40 and give it ago.

borg42 commented 6 years ago

Looking at it some more, only very few cues use the BufferedSounds. All of them have to do with flags taken/dropped, blue/red team scores, etc. Stuff that the "announcer" says. I would say it is impossible that the buffer actually filled up.

The intention seems to be to get some distance between these sounds, so that if a flag is taken and then immediately dropped you can here both sounds after each other and they don't play at the same time.

The sounds play with 1.5 seconds space between them.

coluccioa commented 6 years ago

As you can see in the video, there were no sounds being played at the exact time the flag was picked up, not even shooting sounds nor anything flag related that could have gotten in the way of the announcement.

borg42 commented 6 years ago

I got the demo for the video and did some research on it.

Below you can find logs from the demo and from the server at the time the bug occurs.

demo log:

nosound^7 got the RED flag! --> RED FLAG TAKEN Mega ^Yra^WG^Ye^U|^Xc^Wolu^Xcc^U!^7 got the BLUE flag! --> BLUE FLAG TAKEN ^Yra^BG^Ye^B|^Yja^BB^Yba^7 fragged BLUE's flag carrier! nosound^7 ate ^Yra^BG^Ye^B|^Yja^BB^Yba^7's rocket ^Yra^BG^Ye^B|^Yja^BB^Yba^7 returned the RED flag! ^Yra^1G^Ye^1|^Yf^2:^Yx^53^Yr^^7 was gunned down by ^5v^7ihmu^5/^7mi^5O^7w^7 ^5v^7ihmu^5/^7dv^5q^7'^7 got the RED flag! ^Yra^XG^Ye^l|^Yau^Xr^Yin^7 was railed by ^4D^7aniels^7 nosound^7 fragged RED's flag carrier! ^Yra^WG^Ye^U|^Xc^Wolu^Xcc^U!^7 was gunned down by nosound^7 nosound^7 returned the BLUE flag! ^Yra^WG^Ye^U|^Xc^Wolu^Xcc^U!^7 was melted by nosound^7's plasmagun ^Yra^BG^Ye^B|^Yja^BB^Yba^7 was railed by ^5v^7ihmu^5/^7dv^5q^7'^7 (^Yra^BG^Ye^B|^Yja^BB^Yba^7) (^1Red Mega Health^7): ^5^3>> ^7^2HIGH ^3<< ^Yra^XG^Ye^l|^Yau^Xr^Yin^7 was railed by ^4D^7aniels^7 ^Yra^1G^Ye^1|^Yf^2:^Yx^53^Yr^^7 was melted by nosound^7's plasmagun nosound^7 was melted by ^Yra^WG^Ye^U|^Xc^Wolu^Xcc^U!^7's plasmagun (^Yra^XG^Ye^l|^Yau^Xr^Yin^7) (^1Red Mega Health^7): ^5^2INCOMING ^6HIGH (^Yra^XG^Ye^l|^Yau^Xr^Yin^7) (^1Red Mega Health^7): ^5^2INCOMING ^6HIGH (^Yra^XG^Ye^l|^Yau^Xr^Yin^7) (^1Red Lightning Gun^7): ^5^2INCOMING ^6HIGH ^5v^7ihmu^5/^7dv^5q^7'^7 captured the RED flag!

The parts with the "-->" are added by me as debug in the event loop. They are printed if the flag taken event is triggered. You can see that the last time duck takes the flag does not trigger the event.

The server logs look like below. We can't add any prints to any of this obviously, since server data can't e played back like the demos.

games.log:

36:18 Kill: 5 1 10: ^5v^7ihmu^5/^7dv^5q^7' killed ^Yra^BG^Ye^B|^Yja^BB^Yba by MOD_RAILGUN 36:18 Award: 5 3: ^5v^7ihmu^5/^7dv^5q^7' gained the DEFENCE award! 36:19 ClientUserinfoChanged: 7 n\^Yra^XG^Ye^l|^Yau^Xr^Yin\t\1\model\assassin/default\hmodel\assassin/default\g_redteam\g_blueteam\c1\2\c2\3\hc\100\w\0\l\0\tt\0\tl\0\id\36B05B96018EA09B60FFCB6DF643C537 36:19 sayteam: ^Yra^BG^Ye^B|^Yja^BB^Yba: ^3>> ^7^2HIGH ^3<< 36:20 Award: 5 2: ^5v^7ihmu^5/^7dv^5q^7' gained the IMPRESSIVE award! 36:20 Item: 0 weapon_railgun 36:20 Item: 3 weapon_plasmagun 36:22 Item: 5 item_armor_shard 36:22 Item: 5 item_armor_shard 36:22 Item: 5 item_armor_shard 36:22 Item: 5 item_armor_shard 36:23 Kill: 4 7 10: ^4D^7aniels killed ^Yra^XG^Ye^l|^Yau^Xr^Yin by MOD_RAILGUN 36:23 Award: 4 3: ^4D^7aniels gained the DEFENCE award! 36:23 Award: 4 2: ^4D^7aniels gained the IMPRESSIVE award! 36:23 Item: 6 item_health_large 36:23 Kill: 2 0 8: nosound killed ^Yra^1G^Ye^1|^Yf^2:^Yx^53^Yr^7 by MOD_PLASMA 36:23 Award: 2 3: nosound gained the DEFENCE award! 36:23 Kill: 3 2 8: ^Yra^WG^Ye^U|^Xc^Wolu^Xcc^U! killed nosound by MOD_PLASMA 36:23 Item: 1 weapon_shotgun 36:24 Item: 6 weapon_rocketlauncher 36:24 sayteam: ^Yra^XG^Ye^l|^Yau^Xr^Yin: ^2INCOMING ^6HIGH 36:24 sayteam: ^Yra^XG^Ye^l|^Yau^Xr^Yin: ^2INCOMING ^6HIGH 36:24 sayteam: ^Yra^XG^Ye^l|^Yau^Xr^Yin: ^2INCOMING ^6HIGH 36:25 Item: 2 weapon_grenadelauncher 36:25 Item: 6 weapon_lightning 36:25 ClientUserinfoChanged: 7 n\^Yra^XG^Ye^l|^Yau^Xr^Yin\t\1\model\assassin/default\hmodel\assassin/default\g_redteam\g_blueteam\c1\2\c2\3\hc\100\w\0\l\0\tt\0\tl\0\id\36B05B96018EA09B60FFCB6DF643C537 36:27 Item: 3 weapon_shotgun 36:27 Item: 7 weapon_rocketlauncher 36:28 Item: 4 weapon_grenadelauncher 36:28 Item: 5 weapon_railgun 36:28 Item: 6 item_armor_body 36:29 Item: 0 weapon_plasmagun 36:29 Item: 0 weapon_railgun 36:30 Item: 5 team_CTF_blueflag 36:30 CTF: 5 1 1: ^5v^7ihmu^5/^7dv^5q^7' captured the RED flag! 36:30 Award: 5 4: ^5v^7ihmu^5/^7dv^5q^7' gained the CAPTURE award!

qconsole.log:

broadcast: print "^5v^7ihmu^5/^7dv^5q^7'^7 got the RED flag!\n" CTF: 5 1 0: ^5v^7ihmu^5/^7dv^5q^7' got the RED flag! ClientUserinfoChanged: 7 n\^Yra^XG^Ye^l|^Yau^Xr^Yin\t\1\model\assassin/default\hmodel\assassin/default\g_redteam\g_blueteam\c1\2\c2\3\hc\100\w\0\l\0\tt\0\tl\0\id\36B05B96018EA09B60FFCB6DF643C537 Item: 3 ammo_grenades Kill: 4 7 10: ^4D^7aniels killed ^Yra^XG^Ye^l|^Yau^Xr^Yin by MOD_RAILGUN Kill: 2 3 1: nosound killed ^Yra^WG^Ye^U|^Xc^Wolu^Xcc^U! by MOD_SHOTGUN broadcast: print "nosound^7 fragged RED's flag carrier!\n" CTF: 2 1 3: nosound fragged RED's flag carrier! Item: 6 weapon_rocketlauncher Item: 6 ammo_rockets Item: 2 team_CTF_blueflag broadcast: print "nosound^7 returned the BLUE flag!\n" CTF: 2 2 2: nosound returned the BLUE flag! Item: 2 weapon_shotgun Item: 6 weapon_railgun Item: 2 weapon_plasmagun Kill: 2 3 8: nosound killed ^Yra^WG^Ye^U|^Xc^Wolu^Xcc^U! by MOD_PLASMA Item: 1 item_health Kill: 5 1 10: ^5v^7ihmu^5/^7dv^5q^7' killed ^Yra^BG^Ye^B|^Yja^BB^Yba by MOD_RAILGUN Award: 5 3: ^5v^7ihmu^5/^7dv^5q^7' gained the DEFENCE award! ClientUserinfoChanged: 7 n\^Yra^XG^Ye^l|^Yau^Xr^Yin\t\1\model\assassin/default\hmodel\assassin/default\g_redteam\g_blueteam\c1\2\c2\3\hc\100\w\0\l\0\tt\0\tl\0\id\36B05B96018EA09B60FFCB6DF643C537 sayteam: ^Yra^BG^Ye^B|^Yja^BB^Yba: ^3>> ^7^2HIGH ^3<< (^Yra^BG^Ye^B|^Yja^BB^Yba^7) (^1Red Mega Health^7): ^3>> ^7^2HIGH ^3<< Award: 5 2: ^5v^7ihmu^5/^7dv^5q^7' gained the IMPRESSIVE award! Item: 0 weapon_railgun Item: 3 weapon_plasmagun Item: 5 item_armor_shard Item: 5 item_armor_shard Item: 5 item_armor_shard Item: 5 item_armor_shard Kill: 4 7 10: ^4D^7aniels killed ^Yra^XG^Ye^l|^Yau^Xr^Yin by MOD_RAILGUN Award: 4 3: ^4D^7aniels gained the DEFENCE award! Award: 4 2: ^4D^7aniels gained the IMPRESSIVE award! Item: 6 item_health_large Kill: 2 0 8: nosound killed ^Yra^1G^Ye^1|^Yf^2:^Yx^53^Yr^7 by MOD_PLASMA Award: 2 3: nosound gained the DEFENCE award! Kill: 3 2 8: ^Yra^WG^Ye^U|^Xc^Wolu^Xcc^U! killed nosound by MOD_PLASMA Item: 1 weapon_shotgun Item: 6 weapon_rocketlauncher sayteam: ^Yra^XG^Ye^l|^Yau^Xr^Yin: ^2INCOMING ^6HIGH (^Yra^XG^Ye^l|^Yau^Xr^Yin^7) (^1Red Mega Health^7): ^2INCOMING ^6HIGH sayteam: ^Yra^XG^Ye^l|^Yau^Xr^Yin: ^2INCOMING ^6HIGH (^Yra^XG^Ye^l|^Yau^Xr^Yin^7) (^1Red Mega Health^7): ^2INCOMING ^6HIGH sayteam: ^Yra^XG^Ye^l|^Yau^Xr^Yin: ^2INCOMING ^6HIGH (^Yra^XG^Ye^l|^Yau^Xr^Yin^7) (^1Red Lightning Gun^7): ^2INCOMING ^6HIGH Item: 2 weapon_grenadelauncher Item: 6 weapon_lightning ClientUserinfoChanged: 7 n\^Yra^XG^Ye^l|^Yau^Xr^Yin\t\1\model\assassin/default\hmodel\assassin/default\g_redteam\g_blueteam\c1\2\c2\3\hc\100\w\0\l\0\tt\0\tl\0\id\36B05B96018EA09B60FFCB6DF643C537 Item: 3 weapon_shotgun Item: 7 weapon_rocketlauncher Item: 4 weapon_grenadelauncher Item: 5 weapon_railgun Item: 6 item_armor_body Item: 0 weapon_plasmagun Item: 0 weapon_railgun Item: 5 team_CTF_blueflag broadcast: print "^5v^7ihmu^5/^7dv^5q^7'^7 captured the RED flag!\n" CTF: 5 1 1: ^5v^7ihmu^5/^7dv^5q^7' captured the RED flag! broadcast: print "Flag held for 0:019:150\n" Award: 5 4: ^5v^7ihmu^5/^7dv^5q^7' gained the CAPTURE award!

Shows pretty much the same as the demo log, i think.

borg42 commented 6 years ago

Complete logs:

demo.log qconsole-bu-2018-07-04-184608.log games-bu-2018-07-04-184607.log

borg42 commented 6 years ago

Demo:

sound_bug_demo.zip

borg42 commented 6 years ago

Another hint: "Someone pointed out that someone picked up powerup at exact same time."

Might be related (or coincidence).

dedavidd commented 5 years ago

https://github.com/Irbyz/aftershock-xe/blob/master/code/game/g_team.c#L961

**// only play sound when the flag was at the base
// or not picked up the last 10 seconds**
switch (team) {
case TEAM_RED:
    if ( teamgame.blueStatus != FLAG_ATBASE ) {
        if (teamgame.blueTakenTime > level.time - 10000 && g_gametype.integer != GT_CTF_ELIMINATION)
            return;
    }
    teamgame.blueTakenTime = level.time;
    break;

case TEAM_BLUE: // CTF
    if ( teamgame.redStatus != FLAG_ATBASE ) {
        if (teamgame.redTakenTime > level.time - 10000 && g_gametype.integer != GT_CTF_ELIMINATION)
            return;
    }
    teamgame.redTakenTime = level.time;
    break;

}