Zandronum Chat on our Discord Server Get the latest version: 3.1
Source Code

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0002054Zandronum[All Projects] Bugpublic2015-01-05 00:072018-09-30 23:30
ReporterRu5tK1ng 
Assigned ToEdward-san 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformMicrosoftOSWindowsOS VersionXP/Vista/7
Product Version1.3 
Target Version1.4Fixed in Version1.4 
Summary0002054: A_Playsound and Attenuation
DescriptionAttenuation of A_Playsound does not seem to work online even though offline in local mode it works as intended. I have attached a wad that illustrates this bug by using a chainsaw's idle sound. Loading up map01 and adding a bot shows that attenuation is working as you move around the map. However, when loaded online, the chainsaw sound goes back to normal range.

Edward-San stated:

'Attenuation code does not handle well attenuation values different from named ones'.
Attached Files? file icon echainsaw.wad [^] (183,181 bytes) 2015-01-05 00:07
diff file icon attenuation.diff [^] (2,222 bytes) 2015-01-05 12:05 [Show Content]

- Relationships

-  Notes
User avatar (0011282)
Edward-san (developer)
2015-01-05 01:54
edited on: 2015-01-05 01:58

The actual code did not know that it's possible to pass different values of the attenuation than the ATTN_ values, hence the chainsaw would make the server spam continuously "NETWORK_AttenuationFloatToInt: Warning unknown attenuation value".

Imho, we need a compromise between sending less data (we were sending bytes) and keeping enough precision (ie we'd like to distinguish between 3.5 and 3.9, for example). For example, the server could multiply the float value with 1000 and convert it to int, then clamp the value in the unsigned short interval (the attenuation must be positive, so it's okay), then the server will send a Short, not a Byte, then the client would divide the received value by 1000 and convert it to float...

User avatar (0011283)
Dusk (developer)
2015-01-05 09:55
edited on: 2015-01-05 10:17

How about this: split half of the byte range to represent limiting attenuations and half to represent broadening ones:

'http://pastebin.com/s5R00fSZ [^]'


#!/usr/bin/env python
def unpack_attn(a):
    if a < -128 or a > 127:
        raise ValueError ('argument out of range')

    if a < 0:
        return (128 + a) / 128.
    else:
        return (a / 19.) + 1

def pack_attn(a):
    if a < 0:
        raise ValueError ('argument is negative')

    if a < 1:
        return int (round (-128 + (a * 128)))
    else:
        return min (int (round ((a - 1) * 19)), 127)

# for a in range (-128, 128):
# print "%d -> %f" % (a, unpack_attn (a))

while 1:
    a = float (raw_input ('> '))
    if a < 0:
        break

    b = pack_attn (a)
    print "Packed: %d" % b
    print "Unpacked: %f" % unpack_attn (b)


If you guys are good with this I could work this into a patch.

User avatar (0011284)
Edward-san (developer)
2015-01-05 12:06
edited on: 2015-01-05 12:06

I suggest avoiding doing SBYTE casts uselessly, hence here it is my patch, which uses [0, 255] range instead of [-127,127].

User avatar (0011331)
Dusk (developer)
2015-01-08 11:27

'https://bitbucket.org/Torr_Samaho/zandronum-stable/pull-request/127 [^]'
User avatar (0011346)
Edward-san (developer)
2015-01-09 21:01
edited on: 2015-01-09 21:23

I'm not giving up. Server spamming for a legitimate value of attenuation is not an option.

[edit]'https://bitbucket.org/Torr_Samaho/zandronum-stable/pull-request/129/fixed-custom-attenuation-values-did-not/diff [^]'

User avatar (0011357)
cobalt (updater)
2015-01-10 16:34

Issue addressed by commit 3e0f7ff0d4cc: - Fixed: Custom attenuation values did not work online (fixes 2054).
Committed by edward_san [edward-san] on Saturday 10 January 2015 17:04:02

Changes in files:
 docs/zandronum-history.txt | 1 +
 src/network.cpp | 14 ++++++++------
 src/network.h | 1 +
 3 files changed, 10 insertions(+), 6 deletions(-)
User avatar (0011887)
Ru5tK1ng (updater)
2015-03-25 21:02

I tested the latest build (2.0-alpha-150118-1152) and it seems that the new values work. I tested the attenuation with a few integer and float values and they worked fine. Additionally the NETWORK_AttenuationFloatToInt message no longer appeared in the server console.

Issue Community Support
This issue is already marked as resolved.
If you feel that is not the case, please reopen it and explain why.
Supporters: No one explicitly supports this issue yet.
Opponents: No one explicitly opposes this issue yet.

- Issue History
Date Modified Username Field Change
2015-01-05 00:07 Ru5tK1ng New Issue
2015-01-05 00:07 Ru5tK1ng File Added: echainsaw.wad
2015-01-05 01:54 Edward-san Note Added: 0011282
2015-01-05 01:58 Edward-san Note Edited: 0011282 View Revisions
2015-01-05 09:55 Dusk Note Added: 0011283
2015-01-05 09:56 Dusk Note Edited: 0011283 View Revisions
2015-01-05 09:56 Dusk Note Edited: 0011283 View Revisions
2015-01-05 09:58 Dusk Note Edited: 0011283 View Revisions
2015-01-05 10:01 Dusk Note Edited: 0011283 View Revisions
2015-01-05 10:01 Dusk Assigned To => Dusk
2015-01-05 10:01 Dusk Status new => needs review
2015-01-05 10:04 Dusk Note Edited: 0011283 View Revisions
2015-01-05 10:14 Dusk Note Edited: 0011283 View Revisions
2015-01-05 10:17 Dusk Note Edited: 0011283 View Revisions
2015-01-05 12:05 Edward-san File Added: attenuation.diff
2015-01-05 12:06 Edward-san Note Added: 0011284
2015-01-05 12:06 Edward-san Note Edited: 0011284 View Revisions
2015-01-08 11:27 Dusk Note Added: 0011331
2015-01-09 19:00 Dusk Assigned To Dusk =>
2015-01-09 19:00 Dusk Status needs review => new
2015-01-09 21:01 Edward-san Note Added: 0011346
2015-01-09 21:01 Edward-san Assigned To => Edward-san
2015-01-09 21:01 Edward-san Status new => assigned
2015-01-09 21:23 Edward-san Note Edited: 0011346 View Revisions
2015-01-10 16:34 cobalt Status assigned => needs testing
2015-01-10 16:34 cobalt Target Version => 1.4
2015-01-10 16:34 cobalt Description Updated View Revisions
2015-01-10 16:34 cobalt Note Added: 0011357
2015-03-25 21:02 Ru5tK1ng Note Added: 0011887
2015-03-25 21:14 Dusk Status needs testing => resolved
2015-03-25 21:14 Dusk Fixed in Version => 1.4
2015-03-25 21:14 Dusk Resolution open => fixed
2018-09-30 23:30 Blzut3 Status resolved => closed






Questions or other issues? Contact Us.

Links


Copyright © 2000 - 2024 MantisBT Team
Powered by Mantis Bugtracker