Bug: Death Ray 3 tech & ancient ruins

Describe your experience with the latest version of FreeOrion to help us improve it.

Moderator: Oberlus

Forum rules
Always mention the exact version of FreeOrion you are testing.

When reporting an issue regarding the AI, if possible provide the relevant AI log file and a save game file that demonstrates the issue.
Post Reply
Message
Author
User avatar
MatGB
Creative Contributor
Posts: 3310
Joined: Fri Jun 28, 2013 11:45 pm

Bug: Death Ray 3 tech & ancient ruins

#1 Post by MatGB »

I cannot see why this happens.

I unlocked Death Ray with an ancient ruins very early in my current game. I'm, finally, about to finish researching DR2 about 100 turns later, no problems.

I queue Death Ray 3 tech, and it also queues Plasma1. It didn't do this when I queued death ray 2, the only listed prerequisite is:

Code: Select all

    prerequisites = "SHP_WEAPON_4_2"
Because it didn't do it for DR2, I assumed it had an inaccurate prerequisite. But it doesn't, there's nothing wrong I can see with the code.
Mat Bowles

Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

User avatar
MatGB
Creative Contributor
Posts: 3310
Joined: Fri Jun 28, 2013 11:45 pm

Re: Bug: Death Ray 3 tech & ancient ruins

#2 Post by MatGB »

OK, curiouser and illuminating.

Next turn, Death Ray 2 complete, I had on a hunch deleted DR3 from my queue. I go back in and queue DR3 and it doesn't look for plasma1. But if I also queue DR4 then it does.

So, if you queue something that hasn't got its prerequisites, it goes back and checks for all prerequisites even if there's an interstitial that is no longer needed and negates them.

But if the immediate prerequisite listed is complete, it happily starts researching without queing unneccessary techs.

I have zero clue how the backend code works, but this could be solved by either each prerequisite trying to queue itself and only going further back if needed (if that's possible) or, slightly more simply, have Ancient Ruins unlcok Death Ray 1 and Plasma Cannon 1 to get around the issue entirely. The latter is certainly easier but less elegant. Is the former possible?

(If not, I propose the latter as a stopgap bugfix for RC2 as it's annoying and pointless)
Mat Bowles

Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

User avatar
Vezzra
Release Manager, Design
Posts: 6095
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: Bug: Death Ray 3 tech & ancient ruins

#3 Post by Vezzra »

MatGB wrote:I have zero clue how the backend code works, but this could be solved by either each prerequisite trying to queue itself and only going further back if needed (if that's possible) or, slightly more simply, have Ancient Ruins unlcok Death Ray 1 and Plasma Cannon 1 to get around the issue entirely. The latter is certainly easier but less elegant. Is the former possible?
I'm not familiar with the code section in question, but I guess it should be doable - the only question is how much effort will be needed to implement that change, and if it's straightforward enough and can be done in time for RC2. Dear fellow devs, any comments on that?
(If not, I propose the latter as a stopgap bugfix for RC2 as it's annoying and pointless)
I want to second that - I don't think it's a good idea to ignore that issue for the 0.4.4 release. So if no one comes up with a better solution for 0.4.4, I'm going to commit the proposed stopgap fix for RC2 (it might be necessary to also include Laser 1 just to be on the safe side).

User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

Re: Bug: Death Ray 3 tech & ancient ruins

#4 Post by Dilvish »

Vezzra wrote:it might be necessary to also include Laser 1 just to be on the safe side.
Yes, a quick check via adding SHP_WEAPON_4_1 to preunlocked_items.txt and then queuing DR3 shows that it adds Laser 1 in addition to Plasma 1. I'll see if I can sort out what's happening.
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

User avatar
MatGB
Creative Contributor
Posts: 3310
Joined: Fri Jun 28, 2013 11:45 pm

Re: Bug: Death Ray 3 tech & ancient ruins

#5 Post by MatGB »

I have just this minute finished testing by restarting, if you unlcok DR with ruins before you have researched laser1, then queing DR1 tis fine, but DR2+ will queue both laser1 and plasma1.

(I hacked my specials file to guarantee DR, and restarted the game knowing I'd get an easy ruins unprotected on this setting).

If you want a layout guaranteed to give a ruins next to your homeworld, the default install seed 0 clusters gives you one in the system immediately to the south. Not a fun layout to play through mind (well, it is Clusters, what do we expect), but guaranteed ruins.

So yeah, it needs to unlock plasma1 and laser1 as a stopgap unless someone thinks they can patch the big issue quickly?

EDIT
Dilvish wrote:
Vezzra wrote:it might be necessary to also include Laser 1 just to be on the safe side.
Yes, a quick check via adding SHP_WEAPON_4_1 to preunlocked_items.txt and then queuing DR3 shows that it adds Laser 1 in addition to Plasma 1. I'll see if I can sort out what's happening.
smartarse, I played through 50 turns to check that, never occured to me to just hack preunlocked. D'oh!
Mat Bowles

Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

Re: Bug: Death Ray 3 tech & ancient ruins

#6 Post by Dilvish »

Code: Select all

r7486 | dilvish-fo | 2014-08-17 02:14:57 -0700 (Sun, 17 Aug 2014) | 1 line
changes TechManager::RecursivePrereqs  so that unless directed to ignore knowledge, prereqs already researched by the empire will not be included in the results and will not be recursed into.
I added an extra bool parameter "min_required" to TechManager::RecursivePrereqs that specifies whether to do an exhaustive search treating all the prereqs as unknown; the default is to not ignore the prereq status. I don't know when we'd actually need to do the search ignoring prereq status, so perhaps the option is unnecessary and the code could be a tad simpler. But it's just more my style to allow the option.

It's pretty straightforward but I figured I'd give Geoff a chance to consider asking for the simpler approach before merging it into 0.4.4
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

User avatar
Vezzra
Release Manager, Design
Posts: 6095
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: Bug: Death Ray 3 tech & ancient ruins

#7 Post by Vezzra »

Dilvish wrote:

Code: Select all

r7486 | dilvish-fo | 2014-08-17 02:14:57 -0700 (Sun, 17 Aug 2014) | 1 line
changes TechManager::RecursivePrereqs  so that unless directed to ignore knowledge, prereqs already researched by the empire will not be included in the results and will not be recursed into.
Merged that fix to the release branch.

Post Reply