|
|
|
 |

June 10th, 2005, 11:26 AM
|
First Lieutenant
|
|
Join Date: Sep 2004
Posts: 666
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Re: Replay bug- again !
No offense, Johan K, but if your C code runs differently on different systems, then there must be a bug in your code, such as reading uninitialized memory, making unportable assumptions about the size of an integer, etc. It is traditional for C code to have lots of these bugs.
You could try using the "valgrind" tool on Linux. It is an excellent tool that gives very few false alarms but catches lots of actual errors.
(Of course, if your code is depending on the system for something, such as networking, file system usage, interprocess communication, etc., then maybe it isn't a bug but a legitimate difference of behavior. But I can't see how such a system-level behavior would change the outcome of battles, except via race conditions.)
|

June 10th, 2005, 12:28 PM
|
 |
Brigadier General
|
|
Join Date: Aug 2003
Location: Mictlan
Posts: 1,767
Thanks: 12
Thanked 165 Times in 22 Posts
|
|
Re: Replay bug- again !
Quote:
Zooko almost said:
No offense, Johan K, but if your C code runs differently on different systems, then there must be a bug in your code, such as reading uninitialized memory, making unportable
|
Sure there have been plenty of those bugs. But there have been compiler bugs and inconsistencies too. The Dominions battles are oversensitive to these things, otherwise the compiler shortcomings would probably never have been noticed.
|

June 10th, 2005, 01:35 PM
|
 |
Sergeant
|
|
Join Date: Dec 2004
Location: North Carolina, USA
Posts: 276
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Re: Replay bug- again !
I am confused about how the replay bug occurs. My (obviously faulty) understanding of a Dom2 battle is that the host machine runs it and writes the series of events (call them A, B, C, etc.) to the Turn file. When I replay the battle, my machine reads the file and displays A, B, C, and so on. How does my mental model differ from what the game really does?
|

June 10th, 2005, 01:45 PM
|
First Lieutenant
|
|
Join Date: Feb 2005
Posts: 693
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Re: Replay bug- again !
For size, I don't think the battles store every event - like every unit movement/death/etc. They just store the initial state and random number seeds, and then the algorithm is such that every battle with those conditions should turn out the same. But if the conditions are somehow different (like intial version number), or due to compiler/os/etc. issues where the state gets off, then each battle could wind up widly different.
Thats because they are cycling through a big, big list of random numbers... but if you have 1 more or less attack in one version of the battle, that throws off the entire cycle.
btw All the above is an educated guess.
|

June 10th, 2005, 06:23 PM
|
 |
Brigadier General
|
|
Join Date: Aug 2003
Location: Mictlan
Posts: 1,767
Thanks: 12
Thanked 165 Times in 22 Posts
|
|
Re: Replay bug- again !
Yup, that's how it works Oversway.
|

June 10th, 2005, 11:33 PM
|
 |
General
|
|
Join Date: Nov 2000
Posts: 3,013
Thanks: 17
Thanked 25 Times in 22 Posts
|
|
Re: Replay bug- again !
Quote:
Zooko said:
No offense, Johan K, but if your C code runs differently on different systems, then there must be a bug in your code, such as reading uninitialized memory, making unportable assumptions about the size of an integer, etc. It is traditional for C code to have lots of these bugs.
|
The classic replay bug was caused by this code:
(get_a_random_number() < get_a_random_number())
which is not evaluated in the same order by every compiler.
|
Thread Tools |
|
Display Modes |
Hybrid Mode
|
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
|
|
|
|
|