Both Lobbies Bork LuaAI tests

Both Lobbies Bork LuaAI tests

Discuss your problems with the latest release of the engine here. Problems with games, maps or other utilities belong in their respective forums.

Moderator: Moderators

User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Both Lobbies Bork LuaAI tests

Post by Argh »

Both SpringLobby and TASClient fail to load a SP game vs. LuaAI properly.

TASClient's SP interface is Byzantine- it appears that when you set a AI player, it's being Allied to the player, not automatically set as the enemy- yet there doesn't seem to be a way to fix that, nor a way to save a setup.

SpringLobby just plain fails to operate. It crashes, claiming there will be an Infolog, but there's nothing.

So, I set it up in SpringLobby as a MP game.

Still failed. No explanation, just quits. It's like it's not writing the script correctly.

Giving up on SpringLobby, I try TASClient in MP.

Ah, it runs. But, like the previous test, the Units just stand around. They're following orders, but aren't able to attack. It's almost like they don't have Energy, which is ludicrous, because I'm testing Pylon Wars and the Pylon side should never have resource problems.

Anyhow, I'm left with a lot of wtf. I'm using NullAI, and I should see exactly the same results as when I'm running the engine. But I don't.
User avatar
koshi
Lobby Developer
Posts: 1059
Joined: 14 Aug 2007, 16:15

Re: Both Lobbies Bork LuaAI tests

Post by koshi »

generated script and why you think it's wrong please
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Re: Both Lobbies Bork LuaAI tests

Post by Tobi »

Uhm, are you testing LuaAI or NullAI? Topic suggests the first, post suggest the second...

LuaAI (C.R.A.I.G.) works fine for me, using SpringLobby.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: Both Lobbies Bork LuaAI tests

Post by zwzsg »

Yeah, the two Kernel Panic LuaAI works for me, both in TASClient and SpringLobby. I am using the multiplayer lobby though. Or for SpringLobby, the single player tab. But I am never using the special single player menu with image background they both have.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Both Lobbies Bork LuaAI tests

Post by Argh »

NullAI, with LuaRules performing AI duties. Haven't tested LuaAI yet, but isn't that pretty much the same thing?

Again, works when tested with the engine.

Script is attached.

P.S., ignore the "modoptions", they're just leftovers from Skirmish Module that I haven't cleaned up yet. Shouldn't have an impact on the outcome.
Attachments
script.txt
(1.42 KiB) Downloaded 110 times
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: Both Lobbies Bork LuaAI tests

Post by zwzsg »

Argh wrote:NullAI, with LuaRules performing AI duties. Haven't tested LuaAI yet, but isn't that pretty much the same thing?
I don't know, I never use NullAI, but, at this point, worth trying.

If you have a way that work, and a way that doesn't, compare the generated script files, then gradually merge them, to see at which point is the difference that makes one not work.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Both Lobbies Bork LuaAI tests

Post by Argh »

I'll give it a shot, when I'm done with the code. I mean, meh, it shouldn't be this much of a pain in the arse, though. If it's a NullAI, then, by definition, it shouldn't do anything, and script settings shouldn't magically cause problems with resources, etc. That was the problem I found the weirdest- even when I got the scenario running, it was still screwy- the Units were clearly trying to Do Stuff, but it was like they didn't have Energy available, which is ludicrous, the Pylons in Pylon Wars produce (for all practical purposes) unlimited Energy.
User avatar
BrainDamage
Lobby Developer
Posts: 1164
Joined: 25 Sep 2006, 13:56

Re: Both Lobbies Bork LuaAI tests

Post by BrainDamage »

Argh wrote:NullAI, with LuaRules performing AI duties. Haven't tested LuaAI yet, but isn't that pretty much the same thing?
no
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Both Lobbies Bork LuaAI tests

Post by Argh »

OK. So, what's the difference? I mean, I'm staring at the "AI" code over here, and it's just some config strings.

It was the same way in BA's port of Chickens- it's just config. It doesn't *do* anything, and it shouldn't magically interfere with, say, the resource economy (as I stated, in the case where something "worked" the game state was still clearly borked, and it looked like a resource problem).

LuaRules does all of the actual behavior right now.

And even if that was some major hurdle, a NullAI in the Lobbies with LuaRules performing all the gamecode operations for the "ai" players should perform 100% like it does in engine testing. This is a whole lotta wtf, guys. Since I don't get a script output when running directly from the engine, I have no idea what differences there might be- but I don't see anything in that MP script mentioning screwing around with gameplay variables (other than unit limit... Gaia really should not be limited to 500 by default, but that's a side issue). Yet that has to be what's happening here- I see Units attempting to Attack, going through the motions, but they don't ever attack.

[Big, fat EDIT]I've checked and re-checked. Whatever's wrong, it's not just Energy- I tested with the Space Chickens in Pylon Wars, now that I have them set up... and nope, it's not Energy. They simply attack, but nothing happens. Yet I'm not Allied with the AI players, and the Script doesn't say that, either.[/EDIT]
Attachments
script.txt
(1.24 KiB) Downloaded 107 times
User avatar
BrainDamage
Lobby Developer
Posts: 1164
Joined: 25 Sep 2006, 13:56

Re: Both Lobbies Bork LuaAI tests

Post by BrainDamage »

afaik nullai is not an "active" player(team), that's why players can take it's units, and it would explain why it wouldn't behave correctly when you'd try to use as one.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Both Lobbies Bork LuaAI tests

Post by Argh »

Hmm, really?

The attached hand-edited script worked just fine. No borks... until it was time for combat, and then un-allied Teams magically can't shoot at each other, which doesn't happen when I run the NullAI state in the engine :P

I'm not sure I buy that theory. Something's seriously borked here. >1 NullAI == bork. I'll test just one here in a moment. My guess is that it's something being mis-set. NullAI != can't attack, when run directly from the engine. Hell, my Missions are all using NullAI, and they're all working, as of the last time I tested them (about a week ago).

However, let me add more to this, because it looks like I'm turning up bugs wherever I poke:

I get this result:

[ 0] AI Teams: 1, overmind
[ 0] AI Teams: 1, overmind
[ 0] AI Teams: 2, astrum gallina

From this Lua:

Code: Select all

function GameStart()
	--GET ALL TEAM STATES, AND DETERMINE THEIR TYPE
	for a = 0,32,1 do
		local aiState = Spring.GetAIInfo(a)
		if aiState ~= nil then
			_,_,_,_,mySide = Spring.GetTeamInfo(a)
			table.insert(GG.aiTeams,{teamNum = a,mySide = mySide,myAnger = 0})	

			for i,k in ipairs(GG.aiTeams) do
				Spring.Echo("AI Teams:  "..k.teamNum,k.mySide)
			end
		end
	end
end
..which should be totally impossible. There should be exactly two entries. Not three.
Attachments
001SP_PYLON_WARS_EASY.txt
(1.03 KiB) Downloaded 10 times
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Re: Both Lobbies Bork LuaAI tests

Post by Tobi »

Lol, check your debugging code.

You're printing the entire list (up to that point) for every AI, so no wonder it prints the first AI twice.

(Guess what, with 3 AI it would print the 1st AI 3 times, the 2nd AI 2 times, and the last AI 1 time.)
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Both Lobbies Bork LuaAI tests

Post by Argh »

Yeah, yeah. And this is more elegant anyhow:

Code: Select all

function GameStart()
	--GET ALL TEAM STATES, AND DETERMINE THEIR TYPE
	for a = 0,32,1 do
		_,_,_,aiState,mySide = Spring.GetTeamInfo(a)
		if aiState == true then
			table.insert(GG.aiTeams,{teamNum = a,mySide = mySide,myAnger = 0})	
		end
	end
end
But that's a side issue.

One of the borks is that Spring is screwing around with resources.

Somehow, magically, if you give people enough resources in scripted mode, Spring makes the Team incomes negative. This doesn't happen in un-scripted mode.

I'll see what happens when I make the Pylons give less E/M. Maybe that will fix it all up, IDK.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Both Lobbies Bork LuaAI tests

Post by Argh »

Nope, doesn't do a damn thing, but the resources are magically OK now that make doesn't exceed storage by 10:1 :P

So, wtf is wrong here? I'm scared to go test the Skirmish Module, but I guess I need to find out how much has been fubar'd. And then go read through KP to see what, if anything, is different. Of all the bizzarre things I've seen with this engine, the spectacle of two non-ally groups of Units aiming at each other, but refusing to fire... really takes the cake. It's not my Lua, people. The pylons work, the Units go where they're programmed to, I can see them attempting to fight. They just don't.
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Re: Both Lobbies Bork LuaAI tests

Post by Tobi »

It's (probably) because in the built-in start scripts there will be two active teams no matter what, and when using a script.txt startup the NullAI will fail to join the team (by design of the NullAI), so the team will be considered empty/dead by engine, with whatever side effects that may have.

(Like, 0 energy, triggering the bug that no unit can fire if you have exactly 0 energy, even if the weapon doesn't cost energy to fire.)
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Both Lobbies Bork LuaAI tests

Post by Argh »

That may be part of the problem.

But I've obviously also made some sort of <facepalm> worthy error. Skirmish scripts are still working. Dunno how, dunno why, but a Skirmish game results in dead things. So, off to review what's in Skirmish Module's LuaRules that is allowing it (and Missions, which also continue to function) to work... and breaks Pylon Wars.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Both Lobbies Bork LuaAI tests

Post by Argh »

I'm still not at the bottom of this, but I can confirm something: the AI team's resources read -20/1.

The Pylons have storage of 10000. This isn't happening :roll:

Soooo... I'm going to take a wild guess, and see what happens if I don't delete the initial Commanders... like I don't in Skirmish. Maybe it thinks we're playing Commander Ends.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Both Lobbies Bork LuaAI tests

Post by Argh »

AHA.

Not deleting the Commanders == magical fix (with that custom script, that is).

So, that problem's resources. I probably made a big "whoops" somewhere. OK.

Now for multiple LuaAIs...
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Both Lobbies Bork LuaAI tests

Post by Argh »

OK, that works. Now back to the Lobbies.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Both Lobbies Bork LuaAI tests

Post by Argh »

Score thus far:

SP Mode.

SpringLobby: 0. Crashes upon game start, probably writing a bad script.
TASClient: 0.5. Launches, and game functions, but does not seem to use Fixed or Random start positions, which is necessary for anything other than a game like Pylon Wars to work right (Pylon Wars doesn't care, so long as stranding us in the corner 0,0 doesn't mean we can't spawn or move).

MP Mode.

SpringLobby: 0. Crashes upon game start.
TASClient: 1.0. Ran perfectly, in Fixed or Random, all scripts operated, game appears to be fine.

So, basically, we're back to Lobby issues; I've un-borked the gamecode; if it will run the game, then it all works in Spring, even with multiple "AI" players.
Post Reply

Return to “Help & Bugs”