Victory Screen Mods

What is the friendly/pleased adjustment? AFAICT, we are doing 2 already and 1 as soon as I write the averaging code (trivial). Unless this adjustment you mentioned is something else that I'm thinking of, I'm asking if we should include some of the attitude modifiers that are known from the SDK and easily determined using the normal game screens.

Personally, I favor leaving them all out, but I wanted to ask for completeness. Someone is going to complain, "BUG said I was going to win the diplomatic victory but I didn't and lost $281,972 in Vegas because of it!" and I want to COCA (Cover Our Collective Assets). ;)
 
Personally, I favor leaving them all out, but I wanted to ask for completeness. Someone is going to complain, "BUG said I was going to win the diplomatic victory but I didn't and lost $281,972 in Vegas because of it!" and I want to COCA (Cover Our Collective Assets). ;)
Nice. Our automatic response to this should be ... thanks for your money, we will improve BUG with it. Or, you stupid idiot, you should have spread bet.
 
What is the friendly/pleased adjustment? AFAICT, we are doing 2 already and 1 as soon as I write the averaging code (trivial). Unless this adjustment you mentioned is something else that I'm thinking of, I'm asking if we should include some of the attitude modifiers that are known from the SDK and easily determined using the normal game screens.
The friendly/pleased adjustment is this bit of my code:
Code:
	if ( (eAttitudeLevel[k] >= AttitudeTypes.ATTITUDE_FRIENDLY) and (iAttitude[k] < 10) ):
		iAttitude[k] = 10
	elif ( (eAttitudeLevel[k] <= AttitudeTypes.ATTITUDE_PLEASED) and (iAttitude[k] > 9) ):
		iAttitude[k] = 9
Basically, it assumes that if an attitude is "friendly" but the estimated value was less than 10 then there must be at least enough hidden diplo pluses to bring you to exactly 10. Similarly, if the attitude is "pleased", the maximum the true attitude would be is 9 so it drops the estimated attitude to 9. It is still just a guess though as the true attitude could still be higher in the case of a promotion to +10 due to friendly or lower in the case of a demotion to +9 due to pleased.

I think implementing that in calculateRelations itself would probably just be confusing. ("Glance says Gandhi is +10 with me but I only count +8!") However, using it in the vote estimator didn't seem any worse than knowing about the guts of the voting algorithm. Its only real effect in the vote estimator is preventing the choosing of a "pleased" candidate over a "friendly" candidate.

It doesn't really expose any of the hidden diplo modifiers since you can already see the paradox where one AI is +11 but only pleased with you and another is +8 but friendly; it's just recognizing that situation in the vote estimate, but I guess it is borderline. That's as far as I'd like to go regarding the hidden diplo modifiers, though. I'm against trying to directly simulate any of them in either the voting estimator or anywhere else. Not only does it "feel" like going too far, but I have seen several mods which either change some of those hidden modifiers and/or expose them to the AttitudeString that we can see (and therefore expose them indirectly to calculateRelations). Both cases would cause problems and I think are much more likely modifications to see than, say, changes to the voting algorithm.
 
Yes, that makes perfect sense. I thought you were refering to a diplo modifier in the SDK that said, "If the AI is Friendly, give another +1 hidden modifier" or something. We are on the same page, and I think that's a good solution.

It seems no one is asking for the hidden modifiers, so let's go with #1 for the vote calculation.
 
I've been following the vote estimator debate but not really sharing my 2c (prob only worth 1c) as I'm going to be happy to go with the crowd on this. We might want to consider having these two columns votes for candidate #1 and #2) optional.

Take a look at the uploaded victory screen - I've stored the AIs in an array and then sorted based on category (Pope, full member, member, non member) and then votes. It should be pretty easy to drop in a function that returns voting estimates. Does someone have some code that does the calcs for me?
 
Here is my thinking for displaying victory stuff for the SShip ...
  • no one has built the Apollo Project
    • message says "Apollo Project: Not yet built"
  • Human team has built the Apollo Project, no AI team has
    • message for AI says "Apollo Project: Not yet built"
    • Human: "Apollo Project: Built"
    • All SS parts
    • Counter is blank if tech not known
    • Counter shows number of parts built if tech known
    • Counter shows number of parts under construction
    • Counter for AI is blank
  • An AI team has built the Apollo Project, human team hasn't
    • message for AI says "Apollo Project: Built"
    • Human: "Apollo Project: Not yet built"
    • All SS parts shown
    • Human counter is blank
    • AI Counter shows number of parts built
  • Human team and an AI team have built the Apollo Project
    • as above

We will be updating the AI part information once we have written some code to determine if the human knows that the AI knows a tech.
 
We will be updating the AI part information once we have written some code to determine if the human knows that the AI knows a tech.

I've committed some untested utility functions for just such an occasion. Check out TechUtil.py:

PHP:
getVisibleKnownTechs(ePlayer, eAskingPlayer)

Pass in the human -- gc.getGame().getActivePlayer() -- as the second argument, the AI as the first. Those are player IDs (thus the e prefix). It returns a set of tech IDs (eTech). Just check if the appropriate tech ID is in there.

PHP:
TECH_FUSION = gc.getInfoTypeForString("TECH_FUSION")
techs = TechUtil.getVisibleKnownTechs(...)
if TECH_FUSION in techs:
    # can build engine ...
 
ok - will do. But I want to test 'component.techprereq' instead of 'tech fusion'. The question is ... What does techprereq return?
 
ok - will do. But I want to test 'component.techprereq' instead of 'tech fusion'. The question is ... What does techprereq return?

I wasn't sure if you'd coded that part yet, so I didn't do it. My guess is that getTechPrereq() returns the Tech ID of the prereq, i.e. TECH_FUSION in my example code.

Note that using the returned set of techs from getVisibleKnownTechs, you cannot tell if a player has a tech that you cannot research or if they simply don't have the tech. For example, these are indistinguishable:

  1. Human has Sailing and AI doesn't have Sailing
  2. Human has Fishing and AI doesn't have Sailing
  3. Human doesn't have Fishing and AI has Sailing
  4. Human doesn't have Fishing and AI doesn't have Sailing
In all three cases, Sailing will not be returned in the set of techs, but you aren't told why. Let me know if you ever need this information and I'll expand the functions.

What I can do is return two sets: the known techs and the unknown techs. Both sets will be restricted to the ones you have or can research. The first set would be identical to the current result of the function. The second set would be the techs that you know the AI hasn't researched.

In the example above, cases 1 and 2 would return Sailing in the second set.
 
Ok, I've committed (or will do in the next few minutes) the latest version of the Victory screen. ToDos are
  • finish up the vote estimator code (see below)
  • BUG Options - I am thinking of two, 1 globally to turn off all the BUG added things and the 2rd to show the voting estimate columns
  • remove hard coded text
  • hook up the AI tech items for the SShip

Victory-0000.jpg


Victory-0001.jpg


Victory-0002.jpg


Victory-0003.jpg


Victory-0004.jpg


this is what I have in the vote estimate code at the moment:
PHP:
	def getVotesForWhichCandidate(self, iPlayer, iCand1, iCand2):
		# returns are 1 = vote for candidate 1
		#             2 = vote for candidate 2
		#            -1 = abstain
		if iPlayer == iCand1:
			return 1
		if iPlayer == iCand2:
			return 2

		return -1
 
Wow, this is really sweet. Being me :) I've got a few comments.

VICTORIES:

Why are there no colors for the rival's spaceship? I might be wrong about the colors you chose, but given that he has a docking bay, shouldn't it be red?

Future: A "View Spaceship" button for the rival's SS that opens a screen that lets you target it with lasers and blow up parts at whim. ;)

VOTES:

Where are you getting the human's attitude toward the other candidate? From the first pic, my guess is Dang Kon is the human player, yet he has a cautious attitude toward his rival. Humans don't have attitudes; only AIs have emotions.

Did you try putting the matching columns for each rival together? I.E., attitude and votes for Dang Kon then attitude and votes for Charlemagne. I realize that since this is not an IconGrid you can't create the spanning headings, so it may look goofy. You could try adding a second heading row:

Code:
Rival       Dang Kon                 Charlemagne
            Attitude    Votes        Attitude    Votes
               :)        249            :(         -

Actually, maybe just make the candidate's name be the heading for the Attitude column.

Code:
Rival       Dang Kon    Votes        Charl...    Votes
               :)        249            :(         -

Maybe highlight the predicted winner's vote total (green or underlined?). It looks like it puts the winner on the left, but this would make it clear.

APOSTOLIC PALACE:

I hate words! Change "(Christianity)" to the religion's char.

PHP:
if pPlayer.isStateReligion():
    eReligion = pPlayer.getStateReligion()
    szText = u"%c" % gc.getReligionInfo(eReligion).getChar()
    screen.setLabel(...) # whatever you have now

Bonus points for changing it to "getHolyCityChar()" when the AP owner also controls the Holy City.

Über cool. I was wondering if the Voting screen could be extended to include other organizations if they were added by another mod? If so, how easy would it be?

It would be pretty hard to guess without a concrete example. I'd say find an example and then get the mod developer to merge in BUG and we can help with some pointers.
 
Ah, I see. Well, as it's my mod and I've merged BUG already, I'll have to make some sort of example, I guess :) It's quite complicated how they're going to work, so I don't think it'd be worth putting together a half-done example only to find the screen doesn't work properly when it's finished.
 
Why are there no colors for the rival's spaceship? I might be wrong about the colors you chose, but given that he has a docking bay, shouldn't it be red?
Because I haven't done the AI ss parts yet. Going to bring in your buggy tech util and color code at the same time. Planning to use the same color code for the AI as for the human (yellow = minimum complete, green = maximum complete).

Future: A "View Spaceship" button for the rival's SS that opens a screen that lets you target it with lasers and blow up parts at whim. ;)
good idea - will get right on it. Should this ability require the laser tech?

Where are you getting the human's attitude toward the other candidate? From the first pic, my guess is Dang Kon is the human player, yet he has a cautious attitude toward his rival. Humans don't have attitudes; only AIs have emotions.
good catch - will remove.

Did you try putting the matching columns for each rival together?
Nice - will updated. I knew I posted temp stuff like this for a reason.
 
Should this ability require the laser tech?

I figured that was obvious. :rolleyes: I'm reminded of the most excellent "Starvin' Marvin in Space" episode of South Park.

What we need now is an argon crystal laser. Eh you see, an argon crystal laser can pierce thick space hulls in a way that other lasers just can't.

-- Pat Robertson, 600 Club
 
Looking good, ruff. Nice to see those saves are coming in handy. ;)

Maybe highlight the predicted winner's vote total (green or underlined?). It looks like it puts the winner on the left, but this would make it clear.
How about coloring so that, for example, the leading candidate's estimated vote total is yellow if it's not enough to actually win and green if it is? And if you want to be really thorough maybe red if it's "too much"; i.e. the situation where you could win simply from your own votes but aren't allowed to call for the election.
 
I found this ...

Diplomacy vote (Diplomatic Victory):
An AI will always vote itself. If this is not a choice it will vote for a team member. If this is not a choice it will vote for the Player towards whom the iAttitudeVal is highest if iAttitudeVal is greater than +7. If both players are tied it will abstain. If both players are at or below iAttitudeVal of +7 it will abstain.​

... in a thread about the AIs attitude. Now, iAttitudeVal is the hidden attitude so we cannot use it. Here is what I am proposing that we code up for the estimated voting ...
  • AI votes for itself if it can
  • AI votes for a team member if it can
  • AI votes for its master, if it is a vassal
  • if the AI attitude to one of the candidates is 'friendly' and the other is 'pleased' or less, AI votes for 'friend'
  • if both candidates are at 'friendly' status, votes for one with highest attitude
  • if neither candidate is at 'friendly', abstains

This isn't 100% accurate because the 'friendly' cut-off is actually 'internal attitude at +7 or more' while friendly is at +10 or more.
 
* If neither candidate is at 'friendly', abstains

This isn't 100% accurate because the 'friendly' cut-off is actually 'internal attitude at +7 or more' while friendly is at +10 or more.

I would alter this slightly to

  1. If both candidates are at Pleased, vote "Undecided"
  2. If candidate A is at Pleased, B below Pleased, vote "maybe A"
  3. Else abstain
This would require a new "Undecided" column. I also think having an "Abstain" column would be helpful. This allows you to still show how many votes each player has and where they are "most likely" to go.

For #1 above, you don't want to say Abstains because that is misleading. The AI could abstain, sure, but they might also vote for someone. Undecided identifies these AIs separate from the ones that you can for sure tell will abstain.

#2 is a tough one, because you don't want to add two more columns (one for each candidate) of "maybe" votes. Perhaps just put them into Undecided as well. Let the user figure out that they will definitely not vote for candidate B, but might vote for A or abstain.

Or you could go overboard and split the votes. Given that Friendly = 10+ and I'll just say Pleased is 5+ for the sake of argument, and the vote cutoff is 8+, there are 2 Pleased attitude values that will cause a positive vote (8 and 9) out of the 5 possible (5, 6, 7, 8, 9). Assuming an even distribution, the AI is 40% likely to vote for the candidate and 60% likely to abstain. You could split the votes between candidate A and the Abstains column if you wanted.

You know how much I love completeness. ;)

And icons! I loves me some icons! :goodjob: In fact, iconoclastic is my favorite word -- after nefarious. :devil:
 
Back
Top Bottom