Closed GoogleCodeExporter closed 9 years ago
I tried with another level. where I get this output in the Monoailog.log. But
the game didn't crash.
15:09:58 ------------------------------------------------------
15:09:58 Mono Init Started
15:09:58 Setting DLL Dir for Mono to [C:\Program Files (x86)\Mono-2.8\bin]
15:09:58 Setting DLL Dir for Mono to [C:\Program Files (x86)\Mono-2.8\bin]
15:09:58 Initializing JIT
15:09:58 D:\Spil\StarCraft\bwapi-data\AI\bot\MonoBridgeAI.dll
15:09:58 Loading AI DLL: [D:\Spil\StarCraft\bwapi-data\AI\bot\MonoBridgeAI.dll]
15:09:58 Loading Assembly
15:09:58 Finding class: [StarcraftBotProxy]
15:09:58 Creating Bot Object - Memory Alloc
15:09:58 Creating Bot Object - Constructor
15:09:59 Finding Methods
15:09:59 [onStart] found in StarcraftBotProxy class
15:09:59 [onEnd] found in StarcraftBotProxy class
15:09:59 [onFrame] found in StarcraftBotProxy class
15:09:59 [onSendText] found in StarcraftBotProxy class
15:09:59 [onReceiveText] found in StarcraftBotProxy class
15:09:59 [onPlayerLeft] found in StarcraftBotProxy class
15:09:59 [onNukeDetect] found in StarcraftBotProxy class
15:09:59 [onUnitDiscover] found in StarcraftBotProxy class
15:09:59 [onUnitEvade] found in StarcraftBotProxy class
15:09:59 [onUnitShow] found in StarcraftBotProxy class
15:09:59 [onUnitHide] found in StarcraftBotProxy class
15:09:59 [onUnitCreate] found in StarcraftBotProxy class
15:09:59 [onUnitDestroy] found in StarcraftBotProxy class
15:09:59 [onUnitMorph] found in StarcraftBotProxy class
15:09:59 [onUnitRenegade] found in StarcraftBotProxy class
15:09:59 [onSaveGame] found in StarcraftBotProxy class
15:09:59 Mono Init Complete
15:10:38 Error in .Net
Argument is out of range.
Parameter name: index
15:10:38 Error in .Net
Argument is out of range.
Parameter name: index
Original comment by twsandb...@gmail.com
on 28 Oct 2010 at 1:12
I'll have to look into the other crashes, but the bot needs mono to run because
it is not possible to embed the .net framework into the starcraft process in a
way which would be useful. If you want to use .net use the bwapi-clr-bridge.
Original comment by dpershouse@gmail.com
on 28 Oct 2010 at 11:32
Would it be possible to get a copy of your starcraft bot and which map caused
this problem (the argument is out of range problem)
Original comment by dpershouse@gmail.com
on 28 Oct 2010 at 11:43
Original comment by dpershouse@gmail.com
on 28 Oct 2010 at 11:43
Here you have my Bot. In most cases it looks like the crash happens when one of
my unit dies (see for instance the map file GoliathsZerglings.scm)
But in the other map file it crashes a lot faster.
It worked in the 2.6.1 version. But I must handle the unitdeath wrong, because
it seems like my bot tries to use units that are already dead.
Hope you can help me finding out what is wrong.
Original comment by twsandb...@gmail.com
on 29 Oct 2010 at 10:49
Attachments:
found it.
UnitAgent bestUnitAgent = squad[0];
inside mymath.cs findbestleadercandidate
You should check the bounds of the squad list to ensure it contains at least
one unit. When the last golaith dies, this gets called before the game ends,
and the size of the squad list is 0, so squad[0] throws and index out of range
error (which is what you were getting in your log file for the embedded bot.
To get better error descriptions, run your bot through the monoaimoduleloader
but from a cmd window (run cmd.exe as administrator and then from there run
monoaimoduleloader.exe) when the bot gets an unhandled exception (like index
out of range) it will do a stack trace and exit. Running your bot from the
command line will allow you to see the trace before the window closes (which is
default if you just double click on the executable.)
I will add a logfile and a readline to the next version of monoaimoduleloader
so that these exceptions are easier to see.
Original comment by dpershouse@gmail.com
on 29 Oct 2010 at 1:58
Original comment by dpershouse@gmail.com
on 29 Oct 2010 at 1:58
Thanks for your answer, but there is only a monoaimoduleloader in the CLR
Client and not in the embedded MonoBridgeAI bot, as I see it. So is there a way
for the embedded bot to get these unhandled exeptions?
Original comment by twsandb...@gmail.com
on 1 Nov 2010 at 10:10
It seems like it crashes if I try to select different units with the mouse in
game, to check there health. Is there a new Mouse event handler, that maybe has
an error in the new 3.2B, because I could do that without any crash in 2.6.1?
I'm not sure about when OnUnitHide and OnUnitDestroy is called, I try to clean
up my own Unit Lists when these events are called, but I think one of my
problems maybe is here too, even when it worked in 2.6.1.
I have checked an change the code in findbestleadercandidate, but I don't think
that was the problem.
Original comment by twsandb...@gmail.com
on 1 Nov 2010 at 11:06
Now I have tried to outcommend so much so my units should only try to move to
the corner, but it still crashes after some time. Very weird, because there is
no lists that should have been changed, so it can't be because i'm trying to do
an action with a unit that is dead.
Original comment by twsandb...@gmail.com
on 1 Nov 2010 at 12:43
Attachments:
the monoaimoduleloader works with your bot
(it will work with any bot using the IStarcraftBot interface) just put it in
the same folder as bwapi-native.dll and bwapi-clr.dll and monoaimoduleloader.exe
Run the loader, run starcraft, wait for error.
Original comment by dpershouse@gmail.com
on 1 Nov 2010 at 12:46
I just ran your latest bot. (using monoaimoduleloader.exe) and it worked fine.
They all died and I lost the game.
Original comment by dpershouse@gmail.com
on 1 Nov 2010 at 12:52
Original comment by dpershouse@gmail.com
on 1 Nov 2010 at 12:53
Maybe it is only with the embedded bot
Original comment by dpershouse@gmail.com
on 1 Nov 2010 at 12:54
How do you run the embedded bot with monoaimoduleloader.exe from CMD?
Can you call the MonoBridge.dll as a command to the monoaimoduleloader.exe?
I have attached the AI folder from the bwapi-data\AI.
Original comment by twsandb...@gmail.com
on 1 Nov 2010 at 1:08
Attachments:
If I put the monoaimoduleloader.exe into the AI\Bot folder where my
StarCraftBot.dll is placed it says the same error: no Types implement
IStarcraftBot
Original comment by twsandb...@gmail.com
on 1 Nov 2010 at 1:15
This map with some marines Crashes each time after short time. Hope you get the
same crash as I do.
Original comment by twsandb...@gmail.com
on 1 Nov 2010 at 1:36
Attachments:
To run with the loader, copy monoaimoduleloader.exe,
monoaimoduleloader.app.config, bwapi-native.dll, bwapi-clr.dll and your bot
(starcraftbot.dll) to the bwapi\ai folder.
Start a cmd.exe window by typing cmd into the search box on your start menu and
then selecting cmd.exe when it comes up.
navigate to your starcraft bwapi-data\ai folder, type monoaimoduleloader.exe
and it should check the monoaimoduleloader.app.config file for the name of the
bot dll and load the bot (with some warning about it replacing
monobridge-interop.dll with bwapi-clr.dll)
Original comment by dpershouse@gmail.com
on 1 Nov 2010 at 9:16
Ok, now it works and I can now see what was wrong before. The
monobridgeai-interop.dll cannot be in the same folder as monoaimoduleloader,
because then it throws an error, saying that "No types implement
IStarCraftBot". If I remove it, it gives the warning you told me and runs.
At the same time my Bot runs without crashing. That is very weird, because if I
run it as Embedded it crashes all the time. So there must be something wrong
with the embedded version.
I think I will move my Embedded StarCraftBot project into the CLR Client
version instead.
Again, thanks for your help.
Original comment by twsandb...@gmail.com
on 2 Nov 2010 at 8:14
Could you tell me what exceptions your code caught with the new exception
handler in the embedded bot, (to help me fix the embedded bot)
Original comment by dpershouse@gmail.com
on 2 Nov 2010 at 8:35
I implemented the exception handler for the CLR client version, not in the
Embedded version. So I didn't get any exeptions, StarCraft just crashed some
times.
Now I get no errors after using the monoaimoduleloader.exe to load the same AI,
that crashed when running as embedded.
If you will try to reproduce the error, it should be possible if you run the
StarCraftBot_mono(01-11-2010)CRASH.rar with the map MarineZerglings.scm as
Embedded, and without the loader. Just with adding the MonoBridge.dll to the
bwapi.ini like ai_dll = bwapi-data\AI\MonoBridge.dll.
Original comment by twsandb...@gmail.com
on 3 Nov 2010 at 8:17
Managed to reproduce the problem. Adding an unhandledExceptionhandler to
monobridgeAI.dll seemed to fix the problem!? even if the handler is completely
blank. (it doesn't seem to ever get called), I'll chalk this up as either a
horrible race condition, or a bug in mono/swig. I'll leave the
unhandledexception handler in the code to help future people.
Original comment by dpershouse@gmail.com
on 3 Nov 2010 at 11:26
Original comment by dpershouse@gmail.com
on 25 Nov 2010 at 1:38
Original issue reported on code.google.com by
twsandb...@gmail.com
on 28 Oct 2010 at 1:08