Page 1 of 2

Does Nexus AI cheat?

Posted: 17 Feb 2012, 23:17
by aubergine
...like a lot?

It seems to be capable of researching at roughly 1.5 the speed me and other AIs can. And at the same time it seems capable of creating far more units!

Re: Does Nexus AI cheat?

Posted: 18 Feb 2012, 00:20
by Berg
That's called cheating aubergine.

PS yes Im pretty sure it does

Re: Does Nexus AI cheat?

Posted: 18 Feb 2012, 04:54
by effigy
Yeah, the Nexus AI cheats power and speed. The higher the difficulty the more.

Re: Does Nexus AI cheat?

Posted: 18 Feb 2012, 08:25
by The Dominion of Duat
I love the challenge of it though. Gives ya the good 'ol grit and spit in your teeth. :D

Re: Does Nexus AI cheat?

Posted: 18 Feb 2012, 10:48
by Per
It cheats at any difficulty above the minimum.

Re: Does Nexus AI cheat?

Posted: 18 Feb 2012, 15:18
by NoQ
I wonder how exactly it cheats, cause i didn't find the place in its script responsible for cheating last time i tried :oops:

Re: Does Nexus AI cheat?

Posted: 18 Feb 2012, 15:29
by Cyp
In nexus.slo:

Code: Select all

event difficultyModifier(difficultyModifierTr)
{
	if(not isHumanPlayer(me))
	{
		skDifficultyModifier(me);
	}
}
In src/scriptai.cpp:

Code: Select all

bool scrSkDifficultyModifier(void)
{
	int 			player;
	RESEARCH_FACILITY	*psResFacility;
	STRUCTURE		*psStr;
	PLAYER_RESEARCH		*pPlayerRes;

	if (!stackPopParams(1,VAL_INT, &player ))
	{
		return false;
	}

	/* Skip cheats if difficulty modifier slider is set to minimum or this is a true multiplayer game.
	 * (0 - player disabled, 20 - max value, UBYTE_MAX - autogame)
	 */
	if (game.skDiff[player] <= 1 || game.skDiff[player] == UBYTE_MAX || NetPlay.bComms)
	{
		return true;
	}

	// power modifier, range: 0-1000
	giftPower(ANYPLAYER, player, game.skDiff[player] * 50, true);

	//research modifier
	for (psStr=apsStructLists[player];psStr;psStr=psStr->psNext)
	{
		if (psStr->pStructureType->type == REF_RESEARCH)
		{
			psResFacility =	(RESEARCH_FACILITY*)psStr->pFunctionality;

			// subtract 0 - 80% off the time to research.
			if (psResFacility->psSubject)
			{
				RESEARCH	*psResearch = (RESEARCH *)psResFacility->psSubject;

				pPlayerRes = &asPlayerResList[player][psResearch->ref - REF_RESEARCH_START];
				pPlayerRes->currentPoints += (psResearch->researchPoints * 4 * game.skDiff[player]) / 100;
				syncDebug("AI %d is cheating with research time.", player);
			}
		}

	}

	return true;
}
So, as far as I understand, it cheats at any difficulty level (including minimum), if it's in single-player skirmish. (Or multiplayer skirmish in 2.3.)

Even on minimum, it's guaranteed to finish any research in under 6 minutes (due to subtracting 20% from the research time, every minute), even if not having any power.

Re: Does Nexus AI cheat?

Posted: 18 Feb 2012, 15:38
by NoQ
Thanks :oops:
Even on minimum, it's guaranteed to finish any research in under 6 minutes (due to subtracting 20% from the research time, every minute), even if not having any power.
I don't think so:

Code: Select all

   if (game.skDiff[player] <= 1 || game.skDiff[player] == UBYTE_MAX || NetPlay.bComms)
   {
      return true;
   }
Still, it does cheat by producing and building things it didn't research yet (eg., hardened sensor towers, or repair tank halftracks even without halftracks), but that doesn't really matter. (note: Semperfi is non-cheating in the sense of power and research, but it still cheats in the same way when it comes to sensor towers etc.)

Ok, so here is what really bothers me. Should AI cheat? Cause if it doesn't, it will pretty much never be a challenge in 1x1, at least not at our current level of development, which is a puty (an interesting battle on Startup against an AI is impossible). Nexus AI is no challenge even at Insane difficulty, but my brand-new super-duper AI could be quite nasty if only it cheated just a little.

Re: Does Nexus AI cheat?

Posted: 18 Feb 2012, 16:06
by aubergine
Maybe something like this:

Image Easy: no cheating at all

Image Medium: Deity cheating (ie. can see all enemy units/structures) only

Image Hard: Deity + small amount of power cheating

Image Insane: Cheat like a trainer munching scriptkiddie

But I also think alliances / number of players needs to factor in to the equation. Currently playerData doesn't tell us who is human, if it's MP/SK, or which AIs are being used. (you can find alliances/teams easily enough though).

For example, if nullbot were to power cheat then it should power cheat less per AI if there are several allied nullbot AIs.

Re: Does Nexus AI cheat?

Posted: 18 Feb 2012, 16:13
by NoQ
+deity cheating
I think currently deity-cheating is hardcoded. There is no AI that doesn't deity-cheat, just some AIs don't use that. You can see it by switching players with Ctrl+O in cheat mode.

Re: Does Nexus AI cheat?

Posted: 18 Feb 2012, 16:22
by aubergine
I plan on having EggPlant avoid deity cheating wherever possible (so will always filter enum lists to me+ally visibility).

However, even then there will still be bits of deity cheat happening: if I see a unit, and then it retreats to the fog, I'll still know about it. And if ranged attack on my units, I get told about the attacker and so know where the attacker is.

BTW: Edited my post above.

Re: Does Nexus AI cheat?

Posted: 18 Feb 2012, 17:56
by Cyp
NoQ wrote:Thanks :oops:
Even on minimum, it's guaranteed to finish any research in under 6 minutes (due to subtracting 20% from the research time, every minute), even if not having any power.
I don't think so:

Code: Select all

   if (game.skDiff[player] <= 1 || game.skDiff[player] == UBYTE_MAX || NetPlay.bComms)
   {
      return true;
   }
Still, it does cheat by producing and building things it didn't research yet (eg., hardened sensor towers, or repair tank halftracks even without halftracks), but that doesn't really matter. (note: Semperfi is non-cheating in the sense of power and research, but it still cheats in the same way when it comes to sensor towers etc.)
Oh, ok. In 2.3, it was probably possible for game.skDiff[player] to be equal to 1. In 3.1, I think it's restricted to the values 5, 10, 15, 20. In multiplayer skirmish, it can't cheat with research speed/power, since it was breaking synch, and I didn't really approve of the AI cheating enough to consider possibly contemplating thinking of trying to start implementing a workaround.
Ok, so here is what really bothers me. Should AI cheat? Cause if it doesn't, it will pretty much never be a challenge in 1x1, at least not at our current level of development, which is a puty (an interesting battle on Startup against an AI is impossible). Nexus AI is no challenge even at Insane difficulty, but my brand-new super-duper AI could be quite nasty if only it cheated just a little.
In my opinion, the AI should never cheat; should have exactly equal opportunities as a human player, including having a reaction time limit equal to how fast it's physically possible for a non-augmented human player to click, and should have input equivalent to what a human player sees on the screen; but should beat the human player by making superior decisions.

Re: Does Nexus AI cheat?

Posted: 18 Feb 2012, 19:28
by aubergine
In my opinion, the AI should never cheat; should have exactly equal opportunities as a human player, including having a reaction time limit equal to how fast it's physically possible for a non-augmented human player to click, and should have input equivalent to what a human player sees on the screen; but should beat the human player by making superior decisions.
I think for now AIs are going to have to cheat a little (based on difficulty setting) because it's not going to be possible to put a human's adaptable brian in to an AI at the moment.

AIs are still pretty much blind to what's going on in the game. For example, they can't work out how long it will take to reach a target. Because distBetweenTwoPoints() calculates distance in straight line regardless of terrain obstacles, what might look like a nearby target to the AI could actually require a droid to travel half way around the map to get to it.

It's because of things like this, which are known about but non-trivial to fix, that the AI isn't going to be making superior decisions any time soon.

Re: Does Nexus AI cheat?

Posted: 18 Feb 2012, 19:30
by NoQ
Pathfinder-aware distBetweenTwoPoints could be really helpful, yeah (:
That's not the worst thing though (:

Re: Does Nexus AI cheat?

Posted: 18 Feb 2012, 19:43
by aubergine
Ability to properly micromanage droids would be most important thing IMHO? So, specifically an event telling me a droid has fired its weapon, so I can retreat it a little. And a way of knowing the reload time of that droid, so I could set a timer to tell it to return to the fight once it's reloaded.