gametechmods
Robot Arena => Tutorials and Tips => Other Tutorials => Topic started by: Hi5er on October 29, 2016, 09:45:21 AM
-
This is becoming real tiresome hosting this tournament now lol!
I've run into another snag. Three of the entrants use a custom AI File. I have the standard pack if you like containing popup, flipper2 etc. But the AI lines im using crash the game, well at least I assume that they are the cause of the crashes.
Here are the facts:
- All three bots load fine into the bot lab and I can drive all 3 without any issues.
- All three bots can be selected in the team preview as AI opponents
- All three bots can load into the map.
- The countdown starts. 3. 2. 1. Crash.
With the following error message:
(https://gametechmods.com/uploads/images/90772AI Error Message.png)
Here is my AI folder with all corresponding files:
(https://gametechmods.com/uploads/images/90424AI Folder layout.png)
Here are the lines of AI code that don't seem to work.
list.append(("You Wish I Was A Girl!","Flipper2",{'nose':math.pi,'UseSrimech':1,'invertible':False,'range':50,'radius':1,'topspeed':100,'throttle':100,'turn':100,'turnspeed':4,'UseSrimech':0,'EnemyMoveRadius':1,'EnemyMoveTime':3,'PrioritizeFlipper':0,'NoChassisTime':3,'SrimechInterval':1,'weapons':(0,)}))
list.append(("Big Hammer","Popup",{'nose':math.pi*2,'invertible':False,'radius':1,'topspeed':130,'throttle':120,'turn':65,'turnspeed':1.1,'NoChassisTime':2,'RunUpsideDown':0,'weapons':(0,)}))
It should be noted that I can reference Omni and EternalSnowy fine. But popup and Flipper2 don't work. Could it be the smart zones? I am honestly clueless now.
I was told by Redace that yugitom had a similar problem a few months ago if anyone had helped him resolve that?
-
First off, in the first AI line you should delete "'UseSrimech':1," as it is overwritten later. I don't think that's causing the crashes though. As always, make sure that the line is preceded by 4 spaces, not a tab.
Try copying an AI line from a bot that works and just changing the bot name and .py name to make it work with the bot that's crashing. If it works you can transfer the original line's arguments one by one to see which one is causing the crash.
-
Big Hammer is actually called Big Time Hammer in the splash. That may be your issue. I'll leave the rest to others.
-
Id try setting your weapon numbers correctly or at least to a value other than zero.. I could be wrong but id imagine the game wouldnt like a nil value for that section.
Plus the weapons line is tracked while in battle which may explain why the robots get as far the countdown before giving you trouble
-
Id try setting your weapon numbers correctly or at least to a value other than zero.. I could be wrong but id imagine the game wouldnt like a nil value for that section.
Plus the weapons line is tracked while in battle which may explain why the robots get as far the countdown before giving you trouble
Having them set to "0, " works, I've done that before. I guess there's a tab somewhere where spaces should be? I've had crashes like that as well which happened because of exactly that.
-
Much like Hammer, I've noticed you've listed "You Wish I Was A Girl!" as the AI name, while the end-part of the name is "was a girl", no caps. Check their names in their bot files, just in case
-
@JB, using 0 references the Chassis, so basically the AI will always try and use the weapon. Not as good a solution as using the actual IDs but a whole world quicker :)
-
Thanks for the suggestions guys.
I should point out that "Big Hammers" name has been shortened for ease of reference as the name is fecking huge and it's copied exactly from the bot files in both cases, even if it doesn't exactly match the splash, i'm confident this isn't the issue.
I'll try the space suggestion first off.
-
BTW guys, I wrote this AI line myself, tested it in my game, ot worked, and then I sent it to him. I also had sent him one woth Popup.py and it didn't work, so I believe it doesn't have anything to do with the binding line itself as they were working 100% in my game.
-
BTW guys, I wrote this AI line myself, tested it in my game, ot worked, and then I sent it to him. I also had sent him one woth Popup.py and it didn't work, so I believe it doesn't have anything to do with the binding line itself as they were working 100% in my game.
This is true. As had Redace.
I can get both bots to work using Omni. Which leads me to think that it must be something in the Flipper2/Popup files that is causing the error.
Both files are up to date and in the correct folder.
-
BTW guys, I wrote this AI line myself, tested it in my game, ot worked, and then I sent it to him. I also had sent him one woth Popup.py and it didn't work, so I believe it doesn't have anything to do with the binding line itself as they were working 100% in my game.
This is true. As had Redace.
I can get both bots to work using Omni. Which leads me to think that it must be something in the Flipper2/Popup files that is causing the error.
Both files are up to date and in the correct folder.
Check what other files those are referencing, might need another .py added or a updated version of pusher, rammer or something. Also I guess you've got the Ai.py files from the hosts as well?
Edit: another thing that came to my mind, you are referencing popup and flipper2 by the right name(the one used in the .py file and not the filename)?
-
This is what happens when modders edit __init__.py. Keep edits to separate files.
Download updated versions from AI repo.
https://github.com/apanx/RA2_AI
-
This is what happens when modders edit __init__.py. Keep edits to separate files.
Download updated versions from AI repo.
https://github.com/apanx/RA2_AI
Amazing.
Apanx has done it again haha, downloading these source files has corrected whatever the issue was and both bots are now working fine.
Many thanks everyone, time for me to get some videos going!
-
@JB, using 0 references the Chassis, so basically the AI will always try and use the weapon. Not as good a solution as using the actual IDs but a whole world quicker :)
Ive always used "1" to shortcut as the first component is always a baseplate mounted one (thus indestructible)
"0" in a bindings line usually calls the default AI coding.. I was under the impression the weapon's ID had no default (since all robots are different) which is why I figured it was crashing.. but after looking through the ironforge defaults it looks like it __init__.py was updated at some point from the earlier one I have and the default call is a weapons ID "1"
So yes "0" should work but it actually defaults and references component "1" not the chassis..
That is of course if my memory serves me right with all this.. its been years since ive played with python and now my brain hurts.. :dead:
-
Stock has the weapon list empty, anything else is modded.
Specifications in bindings should overwrite the values set during init.
-
Yep thats were I was tripping up.. I was looking in a bare stock game, Ive never noticed the later update :)