Closed GoogleCodeExporter closed 9 years ago
I have made a work around where I in the onFrame event checks if any of the
teams has any unit left. If they don't I restart the game manually.
Instead of having a Trigger on the map, that ends the game, when any of the
teams has 0 units left.
if (BWAPI.bwapi.Broodwar.getFrameCount() != 0 && !gameRestarted &&
!AnyUnitsLeftOnTeams() && numberOfRestartExecutions <= numberOfRestarts)
{
Logger.AddAndPrint(string.Format("numberOfRestartExecutions: {0}", numberOfRestartExecutions));
Logger.AddAndPrint(string.Format("framecount: {0} gameRestarted: {1}", BWAPI.bwapi.Broodwar.getFrameCount(), gameRestarted));
Logger.AddAndPrint("One of the teams has now no units left. The game should be restarted...");
Logger.AddAndPrint("Set Game Restarted to true");
gameRestarted = true;
Game.RestartSinglePlayerGame();
numberOfRestartExecutions++;
}
It can now run and restart 7-15 times, but sometimes the game still crashes and
I don't know why.
Do you know if the onEnd Frame should be called when RestartGame is executed,
because I can see that it is called. But i'm not sure if it is my Restart call
that makes the onEnd event be executed or it is something else in BWAPI that
checks if there is no units left.
Is there any way I can save a counter value, that will be remained after a
restart. Can it be saved somehow in StarcraftBotProxy. Or will I have to save
it to a file, and manually reset the counter each time I start the bot?
Original comment by twsandb...@gmail.com
on 12 Nov 2010 at 12:03
From the ClrAIModuleLoader would it be possible to get information out of my
bot. I mean can I somehow say MyBot.getSomeValue. The reason I ask is because,
maybe I could control the overall Genetic Algorithm from your
ClrAIModuleLoader, and from here save values like fitness and restart my Bot
after each run.
Original comment by twsandb...@gmail.com
on 12 Nov 2010 at 11:59
This is a bug with BWAPI, not bwapi-mono-bridge, and has been fixed for the
next release.
Original comment by lowerlo...@gmail.com
on 19 Nov 2010 at 9:06
@twsandberg this is definately possible, ClrAIModuleLoader is just .net code
that loads up another dll that implements IStarcraftBot. You maybe could extend
the IStarcraftBot interface with your getSomeValue function, and make the
module loader load a bot of type IStarcraftBotExtended.
Btw I am about to release a version for 3.3
Original comment by dpershouse@gmail.com
on 25 Nov 2010 at 1:42
version 3.3a of bwapi-mono-bridge uses BWAPI 3.3 so I will assume this is fixed
for now.
Original comment by dpershouse@gmail.com
on 25 Nov 2010 at 2:42
Original issue reported on code.google.com by
twsandb...@gmail.com
on 11 Nov 2010 at 1:56Attachments: