Pazyryk
Deity
- Joined
- Jun 13, 2008
- Messages
- 3,584
Edit: Problem solved! PopResearch and PushResearch seem to work as they should (I don't know how I missed these). All my observations below are still valid though.
It appears that SetResearchingTech is broken (and IsResearchingTech is, at minimum, unreliable). Evidence from live tuner session:
Conclusion: SetResearchingTech is changing the result of IsResearchingTech, but isn't having any actual effect on tech selection!
The tech related (player) functions that seem to work properly in all of my testing are:
GetLengthResearchQueue
GetNumFreeTechs
CanEverResearch
GetCurrentResearch
CanResearch
SetNumFreeTechs
ClearResearchQueue
player:ChooseTech just gives a free tech (it's not research selection).
The function called by TechTree.lua when a tech is selected is Network.SendResearch(eTech, player:GetNumFreeTechs(), UIManager:GetShift()). That doesn't help me for AI control.
Sadly, this leaves me no way to control AI tech selection, except for blocking all other available techs (that's a nasty kludge). Does anyone have any other ideas for controlling AI tech selection?
It appears that SetResearchingTech is broken (and IsResearchingTech is, at minimum, unreliable). Evidence from live tuner session:
Spoiler :
> Players[0]:GetCurrentResearch()
4
> Players[0]:IsResearchingTech(4)
true
> Players[0]:SetResearchingTech(4, false)
> Players[0]:IsResearchingTech(4)
false
> Players[0]:GetCurrentResearch()
4
> Players[0]:GetLengthResearchQueue()
1
> Players[0]:CanResearch(2)
true
> Players[0]:IsResearchingTech(4)
false
> Players[0]:IsResearchingTech(2)
false
> Players[0]:SetResearchingTech(2, true)
> Players[0]:IsResearchingTech(4)
false
> Players[0]:IsResearchingTech(2)
true
> Players[0]:GetCurrentResearch()
4
--NEXT TURN
> Players[0]:IsResearchingTech(4)
false
> Players[0]:IsResearchingTech(2)
true
> Players[0]:GetCurrentResearch()
4
> Players[0]:ClearResearchQueue() --note: this does clear the tech selection in UI
> Players[0]:GetLengthResearchQueue()
0
> Players[0]:GetCurrentResearch()
-1
> Players[0]:IsResearchingTech(4)
false
> Players[0]:IsResearchingTech(2)
false
> Players[0]:SetResearchingTech(2, true)
> Players[0]:SetResearchingTech(4, true)
> Players[0]:IsResearchingTech(2)
true
> Players[0]:IsResearchingTech(4)
true
> Players[0]:GetCurrentResearch()
-1
> Players[0]:GetLengthResearchQueue()
0
The UI is consistent with GetCurrentResearch when IsResearchingTech is giving a contradictory result. All of the above results are the same for an AI player
4
> Players[0]:IsResearchingTech(4)
true
> Players[0]:SetResearchingTech(4, false)
> Players[0]:IsResearchingTech(4)
false
> Players[0]:GetCurrentResearch()
4
> Players[0]:GetLengthResearchQueue()
1
> Players[0]:CanResearch(2)
true
> Players[0]:IsResearchingTech(4)
false
> Players[0]:IsResearchingTech(2)
false
> Players[0]:SetResearchingTech(2, true)
> Players[0]:IsResearchingTech(4)
false
> Players[0]:IsResearchingTech(2)
true
> Players[0]:GetCurrentResearch()
4
--NEXT TURN
> Players[0]:IsResearchingTech(4)
false
> Players[0]:IsResearchingTech(2)
true
> Players[0]:GetCurrentResearch()
4
> Players[0]:ClearResearchQueue() --note: this does clear the tech selection in UI
> Players[0]:GetLengthResearchQueue()
0
> Players[0]:GetCurrentResearch()
-1
> Players[0]:IsResearchingTech(4)
false
> Players[0]:IsResearchingTech(2)
false
> Players[0]:SetResearchingTech(2, true)
> Players[0]:SetResearchingTech(4, true)
> Players[0]:IsResearchingTech(2)
true
> Players[0]:IsResearchingTech(4)
true
> Players[0]:GetCurrentResearch()
-1
> Players[0]:GetLengthResearchQueue()
0
The UI is consistent with GetCurrentResearch when IsResearchingTech is giving a contradictory result. All of the above results are the same for an AI player
The tech related (player) functions that seem to work properly in all of my testing are:
GetLengthResearchQueue
GetNumFreeTechs
CanEverResearch
GetCurrentResearch
CanResearch
SetNumFreeTechs
ClearResearchQueue
player:ChooseTech just gives a free tech (it's not research selection).
The function called by TechTree.lua when a tech is selected is Network.SendResearch(eTech, player:GetNumFreeTechs(), UIManager:GetShift()). That doesn't help me for AI control.
Sadly, this leaves me no way to control AI tech selection, except for blocking all other available techs (that's a nasty kludge). Does anyone have any other ideas for controlling AI tech selection?