|  | 
| 
 
 
 
 
 
 
 
 
    
    
 |  | 
 
 
	
		|  |  |  
	
	
		
	
	
	| 
			
			 
			
				February 25th, 2004, 08:26 PM
			
			
			
		 |  
	| 
		
			|  | 
 Major General |  | 
					Join Date: Aug 2000 Location: Mountain View, CA 
						Posts: 2,162
					 Thanks: 2 
		
			
				Thanked 4 Times in 4 Posts
			
		
	      |  |  
    
	| 
				 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 ]
 
				__________________Are we insane yet?  Are we insane yet?   Aiiieeeeee...
 |  
	
		
	
	
	| 
			
			 
			
				February 25th, 2004, 08:46 PM
			
			
			
		 |  
	| 
		
			
			| 
 Lieutenant Colonel |  | 
					Join Date: Apr 2003 Location: Nuts-Land, counting them. 
						Posts: 1,329
					 Thanks: 1 
		
			
				Thanked 0 Times in 0 Posts
			
		
	      |  |  
    
	| 
				 Re: 2.08 and Incompatible Battle Reports 
 I have often battle inconstancies message now, with solo play on windows platform. 
				__________________Currently playing: Dominions III, Civilization IV, Ageod American Civil War.
 |  
	
		
	
	
	| 
			
			 
			
				February 25th, 2004, 08:57 PM
			
			
			
		 |  
	| 
		
			|  | 
 Shrapnel Fanatic |  | 
					Join Date: Oct 2003 Location: Vacaville, CA, USA 
						Posts: 13,736
					 Thanks: 341 
		
			
				Thanked 479 Times in 326 Posts
			
		
	      |  |  
    
	| 
				 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 ]
 
				__________________-- DISCLAIMER:
 This game is NOT suitable for students, interns, apprentices, or anyone else who is expected to pass tests on a regular basis. Do not think about strategies while operating heavy machinery. Before beginning this game make arrangements for someone to check on you daily. If you find that your game has continued for more than 36 hours straight then you should consult a physician immediately (Do NOT show him the game!)
 |  
	
		
	
	
	| 
			
			 
			
				February 25th, 2004, 09:06 PM
			
			
			
		 |  
	| 
		
			|  | 
 Brigadier General |  | 
					Join Date: Aug 2003 Location: Mictlan 
						Posts: 1,767
					 Thanks: 12 
		
			
				Thanked 165 Times in 22 Posts
			
		
	      |  |  
    
	| 
				 Re: 2.08 and Incompatible Battle Reports 
 
	Bah, can't you let me be happy for more than 1 hour and 13 minutes.Quote: 
	
		| Originally posted by Pocus: I have often battle inconstancies message now, with solo play on windows platform.
 |   |  
	
		
	
	
	| 
			
			 
			
				February 25th, 2004, 09:15 PM
			
			
			
		 |  
	| 
		
			
			| 
 Second Lieutenant |  | 
					Join Date: Jan 2004 
						Posts: 510
					 Thanks: 24 
		
			
				Thanked 31 Times in 12 Posts
			
		
	      |  |  
    
	| 
				 Re: 2.08 and Incompatible Battle Reports 
 
	No, the moral is to be damn careful when using random numbers in sync.Quote: 
	
		| Originally posted by Saber Cherry: So the moral is actually not to trust Microsoft products, since they take away your control
  [/QB] |  
				__________________When I said Death before Dishonour, I meant alphabetically.
 |  
	
		
	
	
	| 
			
			 
			
				February 25th, 2004, 09:16 PM
			
			
			
		 |  
	| 
		
			|  | 
 General |  | 
					Join Date: Jun 2003 Location: az 
						Posts: 3,069
					 Thanks: 41 
		
			
				Thanked 39 Times in 28 Posts
			
		
	      |  |  
    
	| 
				 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 ]
 
				__________________There can be only one.
 |  
	
		
	
	
	| 
			
			 
			
				February 25th, 2004, 09:29 PM
			
			
			
		 |  
	| 
		
			|  | 
 Major General |  | 
					Join Date: Aug 2000 Location: Mountain View, CA 
						Posts: 2,162
					 Thanks: 2 
		
			
				Thanked 4 Times in 4 Posts
			
		
	      |  |  
    
	| 
				 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.
 
				__________________Are we insane yet?  Are we insane yet?   Aiiieeeeee...
 |  
	
		
	
	
	| 
			
			 
			
				February 25th, 2004, 11:12 PM
			
			
			
		 |  
	| 
		
			|  | 
 Major General |  | 
					Join Date: Jan 2004 Location: twilight zone 
						Posts: 2,247
					 Thanks: 0 
		
			
				Thanked 0 Times in 0 Posts
			
		
	      |  |  
    
	| 
				 Re: 2.08 and Incompatible Battle Reports 
 
	Compliers do strange things.  A poorly-written compiler could rearrange consecutive lines if there is no obvious dependancy.Quote: 
	
		| Originally posted by Saber Cherry: 
 quote:Originally posted by PhilD:
 Don't use two function calls in the same expression, is the lesson.
 
 |  
 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
   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.
 |  
	
		
	
	
	| 
			
			 
			
				February 25th, 2004, 11:14 PM
			
			
			
		 |  
	| 
		
			|  | 
 Major General |  | 
					Join Date: Oct 2003 Location: Crystal Tokyo 
						Posts: 2,453
					 Thanks: 0 
		
			
				Thanked 0 Times in 0 Posts
			
		
	      |  |  
    
	| 
				 Re: 2.08 and Incompatible Battle Reports 
 
	Yeah, volatile was what I was thinking about.  I suspect there are similar commands as well.  Volatile, IIRC, is mainly used in multithreading and i/o.  It can prevent a variable from being replaced by a constant, or ignored, but I'm not sure if it can prevent reordering.Quote: 
	
		| Originally posted by Taqwus: *scratches head*
 'volatile' may also help.
 |  
 Microsoft strives to prevent inter-os compatibility; maybe using an Intel compiler would be best=)
 |  
	
		
	
	
	| 
			
			 
			
				February 25th, 2004, 11:23 PM
			
			
			
		 |  
	| 
		
			|  | 
 Major General |  | 
					Join Date: Oct 2003 Location: Crystal Tokyo 
						Posts: 2,453
					 Thanks: 0 
		
			
				Thanked 0 Times in 0 Posts
			
		
	      |  |  
    
	| 
				 Re: 2.08 and Incompatible Battle Reports 
 
	Hahaha... My lines are rarely less than 5X that long, and would be longer with a bigger monitor.  Parenthesis do not help you if a compiler ignores your instruction ordering.Quote: 
	
		| Originally posted by Arryn: what this basically amounts to is an issue of (no offense to IW intended) somewhat sloppy coding practice by programmers...  all too often (programmers) try to cram as much code as possible into a single line. That's just begging for trouble.
 |  
 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
   
 Really!  I promise!
  |  
	
		
	
	
	
	
	
	
	| 
	|  Posting Rules |  
	| 
		
		You may not post new threads You may not post replies You may not post attachments You may not edit your posts 
 HTML code is On 
 |  |  |  |  |