View Single Post
  #909  
Old May 8th, 2007, 08:56 AM
phalzyr's Avatar

phalzyr phalzyr is offline
Private
 
Join Date: Oct 2006
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
phalzyr is on a distinguished road
Default Re: Balance Mod v1.06

Captain Kwok: I did some more reasearch, and can not only describe the issue better but can point to the exact part of your code that causes it, and how to easily recreate it, and even how to fix it , and yes it still happens in 1.06 clean install.

Problem: After first turn, and possibly at other times during the game An AI player home planet and possibly other planets will scrap some or all facilties on said planet. I've only noticed it after first turn since it shows their starting points and stuff only deal with the homeworld and very easy to see the issue...

Cause: In the Script_AI_Construction.txt empire script file under the Remove_Uneeded_Items function is a call to check for and clear up room for a resupply depot and Space port. That area of code causes the problem, specifically not clearing last_colony_id. this still doesn't explain those 3/14 hitting this if routine but if fixed by below method it'll make them only scrap one facility instead of all. (they should all start with both facilities yet randomly, or at least I couldn't see a reason in how long I looked at it, the code falls through to the if anyway...)

Recreate: Simply change the homeworld starting facilites to not include a space port. 90% chance an AI will self-destruct as I call it.

Solution: clearing the last_colony_id right after the "if (found_item) then" routine or at start of loop.

Some Thoughts: This if it isn't just restricted to homeworld could majorally cripple the AI, and if I read the code correctly I assume it runs each turn to check all systems for said facilites? I hope this helps, if you have any questions feel free to ask .

More detail (probaly too much):

Please ignore me if I'm way off or read the code wrong. You loop through each system as long as a person has one planet period. the first thing you do each loop is set found_space to false. Then if no owned planet is in that system it will remain false and go into next loop that deletes a facility. So... As many facilities as there are systems, minus the one they really have a colony in, and minus which system number they are in, are removed. I.E. their colony is in system 248 of a 250 system, they'd loose 2 facilities, since it got to 248 sets the last_colony_id then does two more systems setting found_space to false then next if checks this value and removes a facility for last_colony_id for the last two systems since no planet is found in system it doesn't change the id and thus last planet it checked gets a facility axed...

BTW out of curiousity how often does this part of script fire?
Reply With Quote