Opened 10 years ago

Closed 10 years ago

Last modified 7 years ago

#2755 closed defect (fixed)

Allow bots to quit game for testing

Reported by: agentx Owned by: ben
Priority: Should Have Milestone: Alpha 17
Component: AI Keywords:
Cc: Patch:

Description

http://trac.wildfiregames.com/browser/ps/trunk/binaries/data/mods/public/gui/session/messages.js

90	    "quit": function(notification, player)
91	    {
92	        exit(); // TODO this doesn't work anymore
93	    },

Would be very useful to launch multiple games one after the other for overnight testing.

Change History (22)

comment:1 by Itms, 10 years ago

Keywords: AI Testing removed
Milestone: Alpha 17Alpha 18

This is a bit too complex to be fixed before release IMO.

comment:2 by Stan, 10 years ago

Made some research it's broken since : http://trac.wildfiregames.com/changeset/15394/

It's because of the cleanup the way argument are passed changed, and that maybe broke quickstart too.

comment:3 by Stan, 10 years ago

You could restore it as a temporary hack but I'm not sure that's a good idea :)

comment:4 by agentx, 10 years ago

Milestone: Alpha 18Alpha 17

Looks like there is unfinished and untested work, doesn't look complex at all.

in reply to:  4 comment:5 by Itms, 10 years ago

Replying to agentx:

Looks like there is unfinished and untested work, doesn't look complex at all.

What I meant is that it's not a trivial fix (otherwise a TODO wouldn't have been added), and nobody is taking care of that, so I guess this won't be fixed before release. I may be wrong though, if you think it's easily fixable you can submit a patch and prove I am :)

comment:6 by agentx, 10 years ago

if you think it's easily fixable you can submit a patch and prove I am

Interesting logic. We can make a deal: You finish Hannibal and I commit the fix. So it is shown work is done faster if swapped mid term. Has some potential, think about!

Last edited 10 years ago by agentx (previous) (diff)

comment:7 by Itms, 10 years ago

Hmm, I probably lacked some diplomacy here and I'm sorry about it, but you have to understand that if we postpone the feature to a18 it's because we don't think we are capable to do it in time, so the only other alternative is that someone else does it...

comment:8 by agentx, 10 years ago

Well, I'm not asking for a _new_ feature, I'm asking for a functionality that already worked and got lost recently as indicated by the word: 'anymore' in the comment. Whether code work for releases should be finished or not is not part of my responsibility. What I can offer is to check whether the other ~50 commands are still accepted by the engine.

comment:9 by historic_bruno, 10 years ago

Milestone: Alpha 17Alpha 18

If someone fixes this for A17, they can move the milestone back.

comment:10 by agentx, 10 years ago

It would help to know if there is/ever was any documentation or useful comments. I'm quite sure exit did work once, at least as I started to dev with A15. What has to be taken care of while closing the game properly and is there an option to close it a la "don't care"? Is there an entry point for the latter?

Fixing a feature without any words on how it was meant to work is not realistic to happen.

comment:11 by historic_bruno, 10 years ago

Try changing exit() to Engine.Exit(). I don't even know how this would be used - without a simple test case, I can't easily know if it's fixed or not.

comment:12 by agentx, 10 years ago

I'd build a quick test bot, but autostart doesn't work, so choose Petra as bot and copy these lines into _petrabot.js

m.PetraBot.prototype.OnUpdate = function(sharedScript)
{
// test start

if (this.playedTurn > 5) {
  Engine.PostCommand(PlayerID, { type: "quit"});
} else {
  Engine.PostCommand(PlayerID, {type: "chat", message: this.playedTurn});
}

// test end
	if (this.gameFinished)

Expected behaviour is some chat messages and no trace of pyrogenesis left in task manager or htop.

in reply to:  12 comment:13 by Josh, 10 years ago

Replying to agentx:

I'd build a quick test bot, but autostart doesn't work, so choose Petra as bot and copy these lines into _petrabot.js

m.PetraBot.prototype.OnUpdate = function(sharedScript)
{
// test start

if (this.playedTurn > 5) {
  Engine.PostCommand(PlayerID, { type: "quit"});
} else {
  Engine.PostCommand(PlayerID, {type: "chat", message: this.playedTurn});
}

// test end
	if (this.gameFinished)

Expected behaviour is some chat messages and no trace of pyrogenesis left in task manager or htop.

When did autostart stop working? It worked fine for me just a couple months ago.

comment:14 by Stan, 10 years ago

It did ;) now I ´m getting errors and can use agentx python script see yesterdays conv for the link

comment:15 by agentx, 10 years ago

When did autostart stop working?

forum: http://www.wildfiregames.com/forum/index.php?showtopic=19105 ticket: #2798

Last edited 10 years ago by historic_bruno (previous) (diff)

in reply to:  11 comment:16 by leper, 10 years ago

Replying to historic_bruno:

Try changing exit() to Engine.Exit(). I don't even know how this would be used - without a simple test case, I can't easily know if it's fixed or not.

agentx: Have you tried that?

comment:17 by agentx, 10 years ago

TIMER| common/global.xml: 4.51868 ms
GAME STARTED, ALL INIT COMPLETE
ERROR: notification without players found.
({type:"quit"})

That's all. Let me know if you have a fix.

in reply to:  15 comment:18 by mimo, 10 years ago

Replying to agentx:

When did autostart stop working?

forum: http://www.wildfiregames.com/forum/index.php?showtopic=19105 ticket: #2798

Mixing everything is not the best way to solve problems. The problem you quote here is that civs are not properly transmitted when running on scenarios. I don't see how this would prevent you from testing the exit function (for which you don't care about civs, and anyway you could always test it in skirmishes where autostart do work as expected).

comment:19 by ben, 10 years ago

Owner: set to ben
Resolution: fixed
Status: newclosed

In 15758:

Fixes "quit" command and GUI notification for AI debugging, fixes #2755

comment:20 by historic_bruno, 10 years ago

Milestone: Alpha 18Alpha 17

comment:21 by agentx, 10 years ago

Works. Thanks.

comment:22 by elexis, 7 years ago

In 19155:

Remove the "quit" simulation command and restrict the "set-shading-color" simulation command to AIs,
since they are only useful for AI debugging and counterproductive in multiplayer mode, refs #3551.

Instead, enable AI developers to exit the game from a new AI API command,
allowing to batch simulate matches. Refs #2755.

Differential Revision: D65
Reviewed By: leper
Consulted: mimo

Note: See TracTickets for help on using tickets.