![]() |
Re: 2.08 and Incompatible Battle Reports
There may be #pragmas or compiler options to change reordering behavior, but I'm not too familiar with MSVC.
Wrapping the randomizer in an object and making sure that the "get a random number" method (perhaps as a static method, even) might serve as a hint to the compiler; could be more work than it's worth. [edit] Making sure that it's not flagged as constant, that is. IOW to encourage the compiler to consider side-effects of function invocation. [ February 25, 2004, 18:51: Message edited by: Taqwus ] |
Re: 2.08 and Incompatible Battle Reports
I have often battle inconstancies message now, with solo play on windows platform.
|
Re: 2.08 and Incompatible Battle Reports
Way outside of my area but I was thinking that the Devs might have to write their own randomizing routine, and have the host create a seed. Then pass the seed its using inside each of the player files so that the players copy of Dom would definetly use the same routine on the same seed. I never figured on different OSs doing standard math in different orders. Thats insane.
[ February 25, 2004, 18:58: Message edited by: Gandalf Parker ] |
Re: 2.08 and Incompatible Battle Reports
Quote:
|
Re: 2.08 and Incompatible Battle Reports
Quote:
|
Re: 2.08 and Incompatible Battle Reports
I have seen this bug about 3 times for all of the games I have played. It is very rare... and definitely a bizarre bug.
It has worked both ways for me... One battle it showed me losing... yet on the map I won. Another battle it showed me winnning... yet on the map I lost. 2 of these were seen with patch 2.08 installed. [ February 25, 2004, 19:17: Message edited by: NTJedi ] |
Re: 2.08 and Incompatible Battle Reports
*scratches head*
'volatile' may also help. The MSDN C++ Language Reference states, "Objects declared as volatile are not used in optimizations because their value can change at any time". Perhaps creating an 'int volatile do_not_reorder_me = 0;' declaration, explicitly separating the computations into multiple lines e.g. int lhs = lhs_base + invoke_2d6() + do_not_reorder_me; int rhs = rhs_base + invoke_2d6() + do_not_reorder_me; would work. I haven't played around with that keyword much however -- been awhile since I wrote MT code. |
Re: 2.08 and Incompatible Battle Reports
Quote:
1: a=2d6+penetration 2: b=2d6+mrst 3: if(a>b){do c} Lines 1 & 2 could be rearranged by a compiler if, for example, mrst is more local (already in a register) and penetration has to be fetched. That would have the same effect. I think C has some commands that let you force the complier to not rearrange things, though. So the moral is actually not to trust Microsoft products, since they take away your control http://forum.shrapnelgames.com/images/icons/icon10.gif </font><hr /></blockquote><font size="2" face="sans-serif, arial, verdana">Having done quite a bit of compiler beta-testing in my younger days, what this basically amounts to is an issue of (no offense to IW intended) somewhat sloppy coding practice by programmers. If you want to force the compiler to evaluate things a certain way, then make liberal use of parenthesis and local-scope intermediate variables. But what I see all too often is programmers that try to cram as much code as possible into a single line. That's just begging for trouble. And it's an absolute no-no when writing cross-platform code. BTW, the MSVC compiler is actually very good. A bit odd at times, but good nonetheless. You just have to be very well acquainted with all it's various switches, directives, etc. The compiler doesn't really take control away from you. It's settings default to newbie usage. Which can be overridden. And should be, by professional coders. My $0.02 worth on the subject. |
Re: 2.08 and Incompatible Battle Reports
Quote:
Microsoft strives to prevent inter-os compatibility; maybe using an Intel compiler would be best=) |
Re: 2.08 and Incompatible Battle Reports
Quote:
The problem here is that the lines are NOT LONG ENOUGH! The Microsoft compiler sees a simple rearrangement it can do to break inter-OS compatibility, and does it. If the lines are so long and confusing that the compiler can't figure out how to mutate them without breaking the program, it will just process them in order like it is supposed to http://forum.shrapnelgames.com/images/icons/icon10.gif Really! I promise! http://forum.shrapnelgames.com/images/icons/tongue.gif |
All times are GMT -4. The time now is 04:05 PM. |
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©1999 - 2025, Shrapnel Games, Inc. - All Rights Reserved.