Skip to content
This repository has been archived by the owner on Apr 17, 2022. It is now read-only.

When autogame is activated AI gets 15k power #1374

Closed
wzdev-ci opened this issue Jan 8, 2010 · 22 comments
Closed

When autogame is activated AI gets 15k power #1374

wzdev-ci opened this issue Jan 8, 2010 · 22 comments

Comments

@wzdev-ci
Copy link
Contributor

wzdev-ci commented Jan 8, 2010

keyword_autogame_power resolution_fixed type_bug | by DylanDog


when autogame is activated AI gets 15k power (in warzone 2.2 this is not happening).

What is the reason for this? I would prefer to get the standard power to see how the AI beheaves in standard sitatuations.

If more power is required for debug purposes it should be given in another way.


Issue migrated from trac:1374 at 2022-04-15 20:51:15 -0700

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Jan 8, 2010

DylanDog uploaded file wz2100_shot_001.jpg (69.1 KiB)

before autogame is activated
wz2100_shot_001.jpg

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Jan 8, 2010

DylanDog uploaded file wz2100_shot_002.jpg (83.1 KiB)

after autogame is activated
wz2100_shot_002.jpg

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Jan 8, 2010

DylanDog uploaded file std_ai.wz (228.8 KiB)

modified WZ AI with debug=true on player0 (for test purposes)

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Jan 8, 2010

DylanDog commented


ok apologies, this happens only with DyDo and 2.3 betaX and not with the standard AI.
this is strange as it does not happens on warzone 2.2 release.

@wzdev-ci
Copy link
Contributor Author

Per changed status from new to closed

@wzdev-ci
Copy link
Contributor Author

Per set resolution to external

@wzdev-ci
Copy link
Contributor Author

Per changed status from closed to reopened

@wzdev-ci
Copy link
Contributor Author

Per changed resolution from external to ``

@wzdev-ci
Copy link
Contributor Author

Per commented


I closed this one because I thought this was a problem in DyDo AI itself. I still think so. 'autogame on' is implemented completely in scripts, and the C function calls should note have to get involved at all.

Reopening ticket until further investigation, though.

@wzdev-ci
Copy link
Contributor Author

Zarel commented


If it's a problem with DyDo, assign to DylanDog. ;) He does have tracker access now, y'know. ;)

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Jan 29, 2010

DylanDog commented


Replying to Warzone2100/old-trac-import#1374 (comment:4):

If it's a problem with DyDo, assign to DylanDog. ;) He does have tracker access now, y'know. ;)

I am quite sure it is not an AI script issue. The same version of Dydo in WZ2.2 does not get any additional power when autogame is activated, it happens only on the WZ 2.3beta versions. I am happy to fix DyDo related bugs but I do not think this is one of those ;-)

@wzdev-ci
Copy link
Contributor Author

Per commented


Is there a difference between how DyDo does autogame, and normal AI does?

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Feb 2, 2010

DylanDog commented


I have not been able to activate via the console the autogame for the normal AI, I have managed to do it only by manually setting _DEBUG=TRUE or removing from the script the debugModeEnabled() check. I this way I could activated the autogame in the normal AI and there was no power gift. Back to your answer: Looking at both scripts, they are very very very similar. Both scripts activates the triggers-events for that AI using a function.
Standard AI:

event consoleEv(consoleTr)
{
	//turn on 'autogame'
	if(message ## "autogame on" && (sender me))
	{
		if(debugModeEnabled())
		{
			if(myResponsibility(me))
			{
				if(not bRunning)		//make sure current machine is responsible for this AI and it's not already active
				{
					console(getPlayerName(me) & " is active");
					reassignAI();
					setEventTrigger(startLevel, chainloadTr);
				}
			}
		}
	}

DyDo-AI:

  if(message ## "/autogame on" && (sender player))
	{
		if(myResponsibility(player))
		{
			if(!bRunning)		//make sure current machine is responsible for this AI and it's not already active
			{
				console(getPlayerName(player) & " is now active");
        bRunning = true;
				activateAI();
			}
		}
	}

What is really strange is
1 - In WZ2.2.x this was not happening (same DyDo version).
2 - The piece of script which activates the autogame is the same one executed in the initialized event, just calling the activateAI() function. When executed in the initialized event the power gift is not given.

I am completely lost here...

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Feb 2, 2010

Ai_Tak commented


player#.vlo:

EnableSliders BOOL true

eventfunction "difficultyModifier" on line 5812 of player#.slo:

  if ( EnableSliders == TRUE )//can be changed in the vlo file
  {
  	skDifficultyModifier(player);
  }
...

Human players don't have sliders, so skDifficultyModifier(HUMANplayer) results in +12,750 power for some reason. The stock AI avoids calling this function on human players:

event difficultyModifier(difficultyModifierTr)
{
	if(not isHumanPlayer(me))
	{
		skDifficultyModifier(me);
	}
}

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Feb 3, 2010

Per commented


For humans the slider is set to UBYTE_MAX (255), while for AIs the sliders go from 0..20, IIRC. Setting 'autogame on' does not change the value reported by isHumanPlayer() - I am not sure if that is correct or not.

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Feb 3, 2010

DylanDog changed status from reopened to closed

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Feb 3, 2010

DylanDog changed resolution from `` to closed

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Feb 3, 2010

DylanDog commented


Thanks for this, I close this ticket as this "hack" resolves the issue.

@wzdev-ci wzdev-ci closed this as completed Feb 3, 2010
@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Feb 5, 2010

DylanDog commented


@ Per, just in case I have not been clear: AI_Tak has found the solution, I tested it and he is right. This means, from my point of view, that the issue is still there but not in the AI script, skDifficultyModifier() should not give power gifts (and it doesn`t in WZ ver2.2!), this is a bug, but the fact we can simply add the check for human player or not reduces it to a very low priority issue.

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Feb 7, 2010

Per changed resolution from closed to fixed

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Feb 7, 2010

Per commented


(In [9719]) Clean up scrSkDifficultyModifier() (the AI cheat function), and make it ignore human
autogame players. This should fix #1374 where players get tons of power in
autogames.

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Feb 7, 2010

Per commented


(In [9720]) 2.3: Make skDifficultyModifier() (the AI cheat function) ignore human autogame players.
This closes #1374 where players get tons of power in autogames.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant