Author Topic: 4.61 Bugs  (Read 6642 times)

0 Members and 1 Guest are viewing this topic.

Offline Silentbrick

  • Petty Officer
  • **
  • S
  • Posts: 16
Re: 4.61 Bugs
« Reply #45 on: November 28, 2009, 09:32:21 PM »
I've been letting it run some, and it went to 15 min intervals, then back to 30 and it's still crunching along at the 30 minute pace.  So I think it's likely whatever is causing it was fixed by 4.7.  Each interval seems to take a rather long period of time as well.  Thanks for all the prompt help though.
 

Offline Steve Walmsley

  • Aurora Designer
  • Star Marshal
  • S
  • Posts: 11695
  • Thanked: 20557 times
Re: 4.61 Bugs
« Reply #46 on: November 29, 2009, 11:01:34 AM »
Quote from: "welchbloke"
I seem to have encountered a Yo-Yo bug. Time is advancing in 30 min increments and has been doing so for about 10 days of game time so far. 480x30min increments take a long time to process  :cry:
I have found and squished the bug causing the problem. It was well hidden though as you will see below.

There is a function within Aurora called SystemBodyCheck that checks within a specific system for system bodies eligible for survey. It is used when you set default orders for geosurvey ships. If the system contains no unsurveyed bodies within 10 billion kilometers or no unsurveyed bodies at all, the system is flagged as having a completed geo survey using the 'GeoSurvey Done' flag. If an NPR geosurvey ship cannot find a body to survey, a second function is called which looks for nearby systems without a completed geosurvey.

A parameter called nRaceID is passed to the SystemBodyCheck function so the function knows for which race to check survey data. This variable is used to set the race-specific 'Geosurvey Done' flag. This is working fine when there are unsurveyed bodies in the system but none within ten billion kilometers. However, when I set the flag in the case of no unsurveyed bodies at all, I missed the 'n' from the start of nRaceID. Normally this would cause an error because the program wouldn't recognise the variable name. In the case though the mispelled variable is the same as the global variable RaceID, which is the current default race. Which means that the 'Geosurvey Done' flag for the system that was just checked was being set for the default race, rather than the race actually checking the system.

For player races this isn't a problem as they are very likely to be both the default race and the checking race. Even if an NPR race is the checking race and the Geosurvey Done flag is incorrectly set for the default race (almost certainly the player race), this still doesn't affect the player race because the Geosurvey Done flag is only used by NPRs. Which means a player race is never going to notice any abnormal behaviour caused by this bug. It will only affect NPRs.

The actual effect of the bug is as follows. If an NPR survey ship tries to survey System A and can find no bodies at all to survey (rather than none within ten billion km), it will attempt to set the Geosurvey Done flag. However, it will actually set the flag for the current default race instead. As there is nothing to survey that ship will then look for a nearby system which does not have a geosurvey done flag. Lets assume the adjacent System B is eligible. The geosurvey ship moves into that system and carries out a complete survey. If it can find no more bodies to survey then it sets the GeoSurvey Done flag (but for the wrong race). It then looks for systems without a Geosurvey Done flag and finds System A (because the flag for that system was set for the wrong race). So the survey ship moves to System A and looks for bodies to survey. It can't find any so it sets the flag for the wrong race again and looks for a system without a Geosurvey Done flag. It finds System B and repeats the whole cycle. Note that the flag is set correctly when there are system bodies in the system that lie more than 10 billion kilometers away so this problem doesn't occur for every system.

Even with all the above, that still won't cause the game to keep pausing because none of the above generates an interrupt. However, if one of the two systems also contains an alien race then the game will pause every time the geo survey ship enteres that system. That was the problem in this case. Several geosurvey ships were yoyoing between two systems due to the bug and one of the systems contained alien ships.

Anyway - fixed for v4.7!

Steve
 

Offline welchbloke

  • Vice Admiral
  • **********
  • Posts: 1044
  • Thanked: 9 times
Re: 4.61 Bugs
« Reply #47 on: November 29, 2009, 03:16:43 PM »
Quote from: "Steve Walmsley"
Quote from: "welchbloke"
I seem to have encountered a Yo-Yo bug. Time is advancing in 30 min increments and has been doing so for about 10 days of game time so far. 480x30min increments take a long time to process  :D
Welchbloke
 

Offline sloanjh

  • Global Moderator
  • Admiral of the Fleet
  • *****
  • Posts: 2805
  • Thanked: 112 times
  • 2020 Supporter 2020 Supporter : Donate for 2020
    2021 Supporter 2021 Supporter : Donate for 2021
Re: 4.61 Bugs
« Reply #48 on: November 30, 2009, 10:27:26 PM »
I think this (the incorrect GeoSurveyDone flag) might have caused some of the yoyos I've seen in the past.  The NPR would keep transiting into an already-surveyed (by him) system that I was picketing, then transit out when it got into the system and didn't have anything to survey.

John
 

Offline IanD

  • Registered
  • Commodore
  • **********
  • Posts: 725
  • Thanked: 20 times
Re: 4.61 Bugs
« Reply #49 on: December 01, 2009, 08:57:58 AM »
Minor point. When you get tech from ruins you are just informed you recovered tech, not that you also got a Research laboratory. Finally after recovering 13 labs in this game and 8 in the previous I got some tech :D . Steve, are you sure there is a 20% chance per lab recovered and not 5%?

Regards
IanD
 

Offline Steve Walmsley

  • Aurora Designer
  • Star Marshal
  • S
  • Posts: 11695
  • Thanked: 20557 times
Re: 4.61 Bugs
« Reply #50 on: December 03, 2009, 10:35:51 AM »
Quote from: "IanD"
Minor point. When you get tech from ruins you are just informed you recovered tech, not that you also got a Research laboratory. Finally after recovering 13 labs in this game and 8 in the previous I got some tech :D . Steve, are you sure there is a 20% chance per lab recovered and not 5%?
It's actually a 25% chance. The line of code is:

If RandomNumber(4) = 1 then // goto add tech

Seeing your figures, I started to get concerned about the random number generator in VB6. I fired up the old Dice Rolls window from SA, which uses the same code for random numbers. Running a few tests for a million random numbers, the distrubution from 1-10 seemed fine. I think you have just been unlucky.

I've corrected the recovery text for v4.71

Steve
 

Offline Father Tim

  • Vice Admiral
  • **********
  • Posts: 2162
  • Thanked: 531 times
Re: 4.61 Bugs
« Reply #51 on: December 04, 2009, 03:27:23 PM »
Just because I made the same mistake once, are you sure your random number generator is spitting out integers?
 

Offline Steve Walmsley

  • Aurora Designer
  • Star Marshal
  • S
  • Posts: 11695
  • Thanked: 20557 times
Re: 4.61 Bugs
« Reply #52 on: December 04, 2009, 09:26:10 PM »
Quote from: "Father Tim"
Just because I made the same mistake once, are you sure your random number generator is spitting out integers?
Yes it is, but a good idea for me to check. When I ran several million-number tests, all the numbers from 1-10 came out at approximately 100,000 each every time.

Steve