google-code-export / bwapi

Automatically exported from code.google.com/p/bwapi
0 stars 0 forks source link

Saving and loading the game will remove all temporary AI data. #163

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
For example: AI plans some strategy and saves it to a local variable. What
should occur if his multiplayer enemy will save the game and then reload it?

Is it ok that the AI will forget all it's internal data except the units
position? I think some save/load events accessibility should be added.

Original issue reported on code.google.com by bigfatbr...@gmail.com on 10 Dec 2009 at 10:16

GoogleCodeExporter commented 9 years ago
I don't think so. An AI match doesn't require such a feature.

Original comment by AHeinerm on 11 Dec 2009 at 3:09

GoogleCodeExporter commented 9 years ago
If the match is between two AIs, you're right - it does not. But if one or more
players in a match are humans? Or BWAPI made only for AI vs AI?

For example, the default AI tactic in Starcraft is too easy and uninteresting 
for me,
so I try to write my own. Sometimes during the long game it's a good point to 
save
the game, but I can't even think what will appear for my AI after reloading. 

For example, if there are 2 functions in AImodule:

virtual void OnLoadGame(std::string fileName);
virtual void OnSaveGame(std::string fileName);

then the AI can save it's own data in some datafile near the save file and try 
to
load this datafile on game load... It will be great! Can't you check for 
load/save
events or it's too hard? (i'm not good in hacking :) )

Original comment by bigfatbr...@gmail.com on 11 Dec 2009 at 6:19

GoogleCodeExporter commented 9 years ago
I never used the save feature against anyone in my life. AIs would need to 
include 
additional code for saving and loading (serializing and deserializing) their 
frame 
state. Diffent versions of the same AI would not have compatible saves, so AIs 
would 
have to make some sort of version check. I really don't think the effort of 
finding 
the right hooks and offset is worth it.

AIs who need to save their state could implement a hot key or a user interface 
for 
doing so. This way you can just pause the game in starcraft, goto your AI GUI, 
save 
it's state, save the starcraft game.

Original comment by goo...@teabix.com on 11 Dec 2009 at 9:15

GoogleCodeExporter commented 9 years ago
Well, it's not a serious defect, actually. But it's a little strange that the 
power
of BWAPI is such unbalanced yet: it provides methods like pauseGame(), but does 
not
handle game saving. Please, don't remove my question, maybe someone agree with 
me.
Thank you for listening ;)

Original comment by bigfatbr...@gmail.com on 11 Dec 2009 at 10:05

GoogleCodeExporter commented 9 years ago
Sorry I thought a new hook would be needed but seems like "save game" goes 
through 
the regular game command queue.

Original comment by goo...@teabix.com on 11 Dec 2009 at 12:16

GoogleCodeExporter commented 9 years ago
And? Should you implement it some day? :)

Original comment by bigfatbr...@gmail.com on 11 Dec 2009 at 1:59

GoogleCodeExporter commented 9 years ago
I think UMS and multi-opponent support is more likely than save game support.

First of all, save/load on a melee match is never used, ever.
Second, it's even less likely than never to use save/load in an AI match.

With this, it's probably best if save/load was supported (more for UMS maps 
rather
than melee maps).

Original comment by AHeinerm on 12 Dec 2009 at 3:08

GoogleCodeExporter commented 9 years ago
Yeah, I think we can do onSaveGame and onLoadGame. It wouldn't be much of a 
problem
to implement, just that we're lazy.

Original comment by AHeinerm on 31 Jan 2010 at 4:32

GoogleCodeExporter commented 9 years ago
I added an onSaveGame callback. Please check if it works. For onLoad, you'll 
just
have to retrieve the map file name for now.

Original comment by AHeinerm on 9 Feb 2010 at 5:24