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
0000031Zandronum[All Projects] Suggestionpublic2010-09-16 23:222018-09-30 22:43
ReporterAlexMax 
Assigned ToTorr Samaho 
PrioritynormalSeverityminorReproducibilityN/A
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version98c 
Target VersionFixed in Version 
Summary0000031: New DMFlag: "Use Classic PRNG"
DescriptionThis is a well known issue with modern source ports, but since there isn't a bug for it on the bugtracker I'll post it here.

Basically, the doom PRNG resulted in higher than average SSG damage, and many oldschool players complain that the skulltag SSG feels "nerfed" compared to the Doom 2 rendition. It would be nice if there was a DMFlag to switch back to the old PRNG.
Additional InformationThe Doom wiki covers the major points:

'http://doomwiki.org/wiki/Random [^]'
Attached Files

- Relationships
has duplicate 0000192closedTorr Samaho compat_hitscan implementation tweak to replicate oldschool damage more effectively 

-  Notes
User avatar (0000067)
unknownna (updater)
2010-09-17 09:49
edited on: 2011-01-30 18:07

If what you say is true, then IMHO, this should have been added in ages ago. Perhaps a compatibility flag? But wouldn't it need the old blockmap behavior as well?

'http://www.doomworld.com/vb/showthread.php?s=&postid=880116#post880116: [^]'
-restored original Doom behavior for hitscans to only check actors which have their center in the blockmap cells being checked, compatibility optioned by COMPATF_HITSCAN
-re-added the original hitscan checking code using a cross-section of the actor instead of the bounding box, compatibility optioned with COMPATF_HITSCAN

User avatar (0000071)
TIHan (reporter)
2010-09-17 20:34

I can see this could be interesting. I have noticed myself that in Odamex and ZDaemon the SSG deals more damage than Skulltag. But then again, you probably want to consult with ZDoom on this.
User avatar (0000131)
unknownna (updater)
2010-09-22 12:10
edited on: 2011-01-30 18:03

> ZD's does 4.24% more damage than ST's. IIRC this has not been fixed in ST (So ST's SSG is the same as ZDoom's). In ZD it is a DMFlag and it's typically only on on OS 1on1 servers, not CTF/FFA. The difference is so minor anyway that most people wont notice it, but it IS there.

> I've heard lots of claims that the ZDoom SSG is less powerful, just from gut feeling. Now, gut feeling isn't scientific, so since it was a possible "compatability problem" for me, I decided to go out and research it. Here is what I found. ZDoom uses a pseudo random number generator, Doom2.exe uses a fixed table of 256 numbers, ranging from 0 to 255, all accounted for. Doom2.exe iterates through this table linearly.

> There are exactly 256 different SSG shots patterns possibile in Doom2.exe. Each shot pattern does the same damage every time. I even wrote a little mod that plays back a demo, takes a screenshot of each ssg shot, and points out the profile number for you to look in another chart I made (which contains all the different SSG spread patterns).

> The ZD SSG uses the doom2.exe mode. Dash also did damage calculations (where the 4.24% comes from), and the ZD SSG does more damage on average.

ZDaemon has something called "classic weapon strength". It's toggled by setting "sv_oldrandom" to 1 or 0.

> "Random" numbers on a computer are normally pseudo-random: not truly random. This applies to practically all computer programs out there. The reason is that computers are deterministic machines and it's pretty hard to find a source of true randomness.

> Every pseudo-random number generator (PRNG) generates some sequence of numbers that look random enough to pass statistical tests. That's usually good enough for games and other simulations (but not for crypto work; you need fancier PRNGs there). Whether that's done via some math algorithm or some table is pretty much irrelevant. What really matters is the mean and std. deviation of the sequence.

> The dmflag (sv_oldrandom) you're asking about determines if ZDaemon uses the PRNG of Doom (OS) or the one of ZDoom (NS). Their means are not very different, but their std. deviations are (OS PRNG has higher std. dev. than the NS one); that is important with weapons such as the SG, SSG, CG where you fire repeated shots at the opponent (vs. the RL for example where the damage per hit is much larger); the increased std. deviation means that wild shots from downtown will bring the other guy down. Of course there is the flip side of the coin: you might hit someone right on the chest and very little damage happens (which also means that you should not blame every SSG miss to netcode, lag, etc)

> Overall, it's fairly clear that the OS PRNG makes the SG, SSG, CG more effective than otherwise. This is just the way things are; I'm not implying that one way is better than the other. Please avoid turning this into the millionth OS/NS debate. There is no point in that.

> Here is my comment from the X-Doom m_random.cpp source tree:

// [Dash|RD] -- Make random number generation use the original random number chart.
// The way we pick numbers from this chart is NOT the way the original
// game does it, but that's hardly relevant. We aren't trying to play back
// demos afterall. More work may need to be done on this.
//
// Why did I do it? With this chart the game appears to pick consistently higher
// numbers. This should address the reports that the SSG (and various other weapons)
// do less damage in ZDaemon.
//
// SSG damage statistics, 20 shot survey.
// PrBoom -- Max: 245 Min: 165 Median: 210 Average: 206.5 Total: 4,130
// ZDaemon -- Max: 215 Min: 155 Median: 195 Average: 194.5 Total: 3,890
// This Code -- Max: 245 Min: 155 Median: 205 Average: 202.75 Total: 4,055
//
// Obviously you want to give a bit of room for randomness, but has is definitely been my experience that
// this code statistically gives off higher `random' numbers. Other shotgun guru's have also claimed that
// this code fixes their issues with weapon damage.

User avatar (0000872)
Torr Samaho (administrator)
2011-01-25 02:07

So, technically speaking, it should be sufficient if I add a compat flag that makes FRandom::operator()() return P_Random() and FRandom::Random2() return "P_Random()-P_Random()" where P_Random() gets the next number from Vanilla Doom's random table?
User avatar (0000873)
AlexMax (developer)
2011-01-25 02:22

I admit that I'm not that familiar with ZDoom's code, so I can't give you a definitive yes. However, that would probably be a good starting point.

Definitely would recommend a numbered 98e beta though, so we can test it using real world conditions. I've been looking forward to the next version of Skulltag anyway because of your fixes to keepteams. :)
User avatar (0000886)
Torr Samaho (administrator)
2011-01-29 01:11

Ok, I excavated P_Random from the original Doom source and added the new flag compat_oldrandom that replaces ZDoom's rng in the functions I mentioned above. Before I roll out an official beta build, I'd like somebody to confirm that this at least seems to be somewhat working.
User avatar (0000889)
unknownna (updater)
2011-01-29 04:24
edited on: 2011-01-29 08:19

The compat flag isn't cleared when I set another compatibility mode. I also wonder, what is exactly affected by this? The player weapons only? Does it take code pointers such as A_Explode into account?

EDIT:

Ok, it's in compatflags2.

User avatar (0000893)
Torr Samaho (administrator)
2011-01-29 13:03

> I also wonder, what is exactly affected by this?

Technically, everything that uses FRandom::operator()() and FRandom::Random2(). Thus, it should affect everything that uses random integers between [0,255] which should include most of the code pointers and definitely all of the pointers used in the Vanilla Doom weapons.
User avatar (0000894)
unknownna (updater)
2011-01-29 13:29
edited on: 2011-01-29 14:03

> Doom2.exe uses a fixed table of 256 numbers, ranging from 0 to 255, all accounted for. Doom2.exe iterates through this table linearly. There are exactly 256 different SSG shots patterns possibile in Doom2.exe. Each shot pattern does the same damage every time.

So the compat flag basically does this? Runs through the old table linearly exactly like Vanilla Doom did.

User avatar (0000895)
AlexMax (developer)
2011-01-29 14:22

Well, he did say that he "excavated the old function", so I don't see why not.
User avatar (0000896)
Torr Samaho (administrator)
2011-01-29 14:28

> Runs through the old table linearly exactly like Vanilla Doom did.

Exactly.
User avatar (0000897)
unknownna (updater)
2011-01-29 14:37

Thanks. Now we finally have it. Thank you very much for this, Torr.
User avatar (0000898)
Torr Samaho (administrator)
2011-01-29 15:22

You're welcome :). Let's just hope that it is working as expected, so far I didn pretty much no tests with it. To facilitate testing before I make the next official beta release, I created matching Linux and a Windows binaries.
User avatar (0000899)
AlexMax (developer)
2011-01-29 18:51
edited on: 2011-01-29 19:11

Preliminary reports:

"Yea, it works, I can tell already"
"It's better than zd's, it feels like choco doom"
"Yeah, it's a lot nicer"

Will keep you updated if there are any complaints, but so far I think you nailed it.

Thanks a million Torr.

User avatar (0000900)
Xenaero (reporter)
2011-01-29 19:43

Yeah, this works really well. Great stuff, thanks Torr!
User avatar (0000902)
Torr Samaho (administrator)
2011-01-29 23:19

I'm glad to hear that :). If all goes well I'll make an official beta release tomorrow evening so that this can receive more widespread testing.
User avatar (0000906)
unknownna (updater)
2011-01-30 21:24

Perhaps the server dialog box needs to be updated to support this compat flag. It won't allow me to set the flag in "Settings -> Flags... -> Compatibility". Setting the compatflags2 value to 8 has no effect.
User avatar (0000907)
Torr Samaho (administrator)
2011-01-30 22:29

You are right. This reminds me of one of the reasons why I hate the Windows server GUI code. Anyway, should be fixed now.
User avatar (0000912)
unknownna (updater)
2011-02-01 07:11
edited on: 2011-02-01 08:47

Would it be possible to also have it as a visible option to toggle in the "Oldschool" section? Actually, there are more flags you cannot see in the compatibility options, e.g., compat_noland and compat_clientssendfullbuttoninfo.

Ok, it seems like compat_nocrosshair and compat_disabletaunts is toggled in "Settings -> Flags... -> Players".

I'm also testing the new feature on the tracker.

User avatar (0000914)
Edward-san (developer)
2011-02-01 12:01

It would be useful, indeed. Even better is if it's backported to zdoom code.

Torr: Can I ask Graf to backport this into zdoom code?
User avatar (0000934)
Torr Samaho (administrator)
2011-02-03 01:25

> Would it be possible to also have it as a visible option to toggle in the "Oldschool" section? Actually, there are more flags you cannot see in the compatibility options, e.g., compat_noland and compat_clientssendfullbuttoninfo.

That's certainly possible. The main problem is that I really don't like Windows GUI coding ;) (platform independent GUI libs are much nicer).

> Torr: Can I ask Graf to backport this into zdoom code?

Sure, but Skulltag's implementation needs to be adjusted to be used in ZDoom. Otherwise you most likely would get sync problems in ZDoom's multiplayer and in single player demos.
User avatar (0000939)
unknownna (updater)
2011-02-03 11:37
edited on: 2011-02-03 12:38

> That's certainly possible. The main problem is that I really don't like Windows GUI coding ;) (platform independent GUI libs are much nicer).

I understand. But it would be nice and practical to have it though.

EDIT:

I just wonder, why are these new compat flags in compatflags2?

User avatar (0000942)
Edward-san (developer)
2011-02-03 13:23

> Sure, but Skulltag's implementation needs to be adjusted to be used in ZDoom. Otherwise you most likely would get sync problems in ZDoom's multiplayer and in single player demos.

Ok, I'll wait for this. Should I make a new suggestion in the tracker about this?
User avatar (0000943)
Torr Samaho (administrator)
2011-02-03 13:31

> I just wonder, why are these new compat flags in compatflags2?

compatflags is full.

> Ok, I'll wait for this. Should I make a new suggestion in the tracker about this?

Right now I don't intend to make these adaptions myself because they are not needed in Skulltag at all: ST neither supports single player demos nor ZDoom's P2P networking.
User avatar (0001014)
Wagi (reporter)
2011-02-07 16:47

Please note that the claim that all the numbers between 0-255 are "accounted for" is false. In Vanilla Doom's random number table, 1 does not appear at all, for example. 145 appears five times, 0 appears twice.

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
2010-09-16 23:22 AlexMax New Issue
2010-09-17 09:49 unknownna Note Added: 0000067
2010-09-17 20:34 TIHan Note Added: 0000071
2010-09-18 20:47 Anonymous Note Added: 0000078
2010-09-21 14:36 Anonymous Note Deleted: 0000078
2010-09-22 12:10 unknownna Note Added: 0000131
2010-09-22 15:10 Anonymous Note Added: 0000132
2010-09-25 07:59 unknownna Note Edited: 0000131 View Revisions
2010-09-25 15:52 Anonymous Note Deleted: 0000132
2010-09-27 05:15 unknownna Note Edited: 0000131 View Revisions
2010-10-05 11:31 unknownna Note Edited: 0000131 View Revisions
2011-01-25 02:07 Torr Samaho Note Added: 0000872
2011-01-25 02:07 Torr Samaho Assigned To => Torr Samaho
2011-01-25 02:07 Torr Samaho Status new => feedback
2011-01-25 02:22 AlexMax Note Added: 0000873
2011-01-25 02:22 AlexMax Status feedback => assigned
2011-01-29 01:11 Torr Samaho Note Added: 0000886
2011-01-29 01:11 Torr Samaho Status assigned => feedback
2011-01-29 04:24 unknownna Note Added: 0000889
2011-01-29 04:28 unknownna Note Edited: 0000889 View Revisions
2011-01-29 08:19 unknownna Note Edited: 0000889 View Revisions
2011-01-29 13:03 Torr Samaho Note Added: 0000893
2011-01-29 13:29 unknownna Note Added: 0000894
2011-01-29 13:39 unknownna Note Edited: 0000894 View Revisions
2011-01-29 13:40 unknownna Note Edited: 0000894 View Revisions
2011-01-29 14:03 unknownna Note Edited: 0000894 View Revisions
2011-01-29 14:22 AlexMax Note Added: 0000895
2011-01-29 14:22 AlexMax Status feedback => assigned
2011-01-29 14:28 Torr Samaho Note Added: 0000896
2011-01-29 14:37 unknownna Note Added: 0000897
2011-01-29 15:22 Torr Samaho Note Added: 0000898
2011-01-29 18:51 AlexMax Note Added: 0000899
2011-01-29 19:06 AlexMax Note Edited: 0000899 View Revisions
2011-01-29 19:06 AlexMax Note Edited: 0000899 View Revisions
2011-01-29 19:11 AlexMax Note Edited: 0000899 View Revisions
2011-01-29 19:43 Xenaero Note Added: 0000900
2011-01-29 23:19 Torr Samaho Note Added: 0000902
2011-01-30 16:26 unknownna Note Edited: 0000131 View Revisions
2011-01-30 18:03 unknownna Note Edited: 0000131 View Revisions
2011-01-30 18:07 unknownna Note Edited: 0000067 View Revisions
2011-01-30 21:24 unknownna Note Added: 0000906
2011-01-30 22:29 Torr Samaho Note Added: 0000907
2011-02-01 07:11 unknownna Note Added: 0000912
2011-02-01 08:47 unknownna Note Edited: 0000912 View Revisions
2011-02-01 12:01 Edward-san Note Added: 0000914
2011-02-03 01:25 Torr Samaho Note Added: 0000934
2011-02-03 11:37 unknownna Note Added: 0000939
2011-02-03 12:38 unknownna Note Edited: 0000939 View Revisions
2011-02-03 13:23 Edward-san Note Added: 0000942
2011-02-03 13:31 Torr Samaho Note Added: 0000943
2011-02-07 16:47 Wagi Note Added: 0001014
2011-02-18 20:53 unknownna Relationship added has duplicate 0000192
2014-05-14 18:52 Dusk Status assigned => resolved
2014-05-14 18:52 Dusk Resolution open => fixed
2014-05-14 18:52 Dusk Additional Information Updated View Revisions
2018-09-30 22:43 Blzut3 Status resolved => closed






Questions or other issues? Contact Us.

Links


Copyright © 2000 - 2024 MantisBT Team
Powered by Mantis Bugtracker