Author Topic: AI-ing (.py files, coding, nose-orienting R+D, and help)  (Read 159449 times)

Offline 09090901

  • competitive irl
  • *
  • Posts: 1742
  • Rep: 22
  • anti-boomer super soldier
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #1220 on: July 16, 2016, 05:19:00 PM »
if it's still not spinning up instantly then it might be because you don't have a range parameter. try a line like this:

    list.append(("Mega Gator","Omni",{'invertible':True,'range':99,'topspeed':99,'turnspeed':3,'throttle':130,'weapons':(0,)}))

also use a button instead of a switch. with a button the ai will just keep turning it on and off.
DSL-IRL is the libtard’s meta. Go drink more soylent, retard! #BLUELIVESMATTER

Offline R01

  • Heavyweight
  • Posts: 769
  • Rep: 1
  • Awards BOTM Winner
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #1221 on: July 16, 2016, 05:25:06 PM »
if it's still not spinning up instantly then it might be because you don't have a range parameter. try a line like this:

    list.append(("Mega Gator","Omni",{'invertible':True,'range':99,'topspeed':99,'turnspeed':3,'throttle':130,'range':99,'weapons':(0,)}))

also use a button instead of a switch. with a button the ai will just keep turning it on and off.
Works now, thanks guys, thought that this parameter might be missing but didn't want to mess around more with it(already had the game crash like 10 times because of multiple errors), it is a button and not a switch(are there even switch controls for AI? think only buttons exist) full line is this:
list.append( ("Mega Gator", "ModSpinner", { 'range':99, 'weapons': (0,) }) )
The other parameters are optional so I didn't add them.(also you have range twice?) Do top/turn speed and throttle go past the values that the bot would normally be able to get or do they keep those limits/only work for slowing the bot down and making it more controlable?
Tournament History:
Showcases:
https://gametechmods.com/forums/index.php?topic=18882.0
https://gametechmods.com/forums/index.php?topic=19197.0

Offline R01

  • Heavyweight
  • Posts: 769
  • Rep: 1
  • Awards BOTM Winner
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #1222 on: July 18, 2016, 01:26:22 PM »
Would it be possible to create a bot that only starts using it's second weapon once the enemy hp reaches 0 or the first weapon(set via ID) breaks down?
Tournament History:
Showcases:
https://gametechmods.com/forums/index.php?topic=18882.0
https://gametechmods.com/forums/index.php?topic=19197.0

Online apanx

Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #1223 on: July 18, 2016, 02:36:23 PM »
if it's still not spinning up instantly then it might be because you don't have a range parameter. try a line like this:

    list.append(("Mega Gator","Omni",{'invertible':True,'range':99,'topspeed':99,'turnspeed':3,'throttle':130,'range':99,'weapons':(0,)}))

also use a button instead of a switch. with a button the ai will just keep turning it on and off.
Works now, thanks guys, thought that this parameter might be missing but didn't want to mess around more with it(already had the game crash like 10 times because of multiple errors), it is a button and not a switch(are there even switch controls for AI? think only buttons exist) full line is this:
list.append( ("Mega Gator", "ModSpinner", { 'range':99, 'weapons': (0,) }) )
The other parameters are optional so I didn't add them.(also you have range twice?) Do top/turn speed and throttle go past the values that the bot would normally be able to get or do they keep those limits/only work for slowing the bot down and making it more controlable?

Top speed and turn speed is just a max limit, they don't make the bot go faster than possible just for making the bot more controllable. Throttle, (and Max Turn) are capped at 100.

Would it be possible to create a bot that only starts using it's second weapon once the enemy hp reaches 0 or the first weapon(set via ID) breaks down?
Yes. It is possible.

Offline Jet-speed

  • The Transient
  • Lightweight
  • Posts: 202
  • Rep: 1
  • Over 10 years and still can't build HWs.
    • View Profile
    • Awards
  • See profile for gamer tags: Yes
  • Discord: Andle#5961
Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #1224 on: July 24, 2016, 06:45:44 AM »
Trying to find my way around the bot file.

Say I want to find the component IDs for my weapons so that my bot switches tactics upon being deweaponed, what value am I looking for exactly? Out of this for example:

Weapon
Components\dao40.txt
21
4
1
0 0 0
0 3.55271e-015 0 1
3.14159 0

Have I even segmented that properly? Took a stab in the dark. I think that's the Knife component in Ironforge? Who knows, confuzzled.

Online apanx

Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #1225 on: July 24, 2016, 06:47:17 AM »
Count number of objects, the first one after the chassis has ID 1.
Or use the exporter, it is simpler.

Offline Jet-speed

  • The Transient
  • Lightweight
  • Posts: 202
  • Rep: 1
  • Over 10 years and still can't build HWs.
    • View Profile
    • Awards
  • See profile for gamer tags: Yes
  • Discord: Andle#5961
Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #1226 on: July 24, 2016, 07:06:06 AM »
Eh, getting VB6 set up on windows 10 looks like more effort than it's worth as someone who's computer illiterate and would have no use for it other than the exporter, as great a tool as it is.

I think I've sussed the bot file now, thanks for the help. :P

Offline Badger

  • Permanent Artifact
  • Giga Heavyweight
  • Posts: 6318
  • Rep: 3
  • I wish to be with my people
  • Awards BOTM Winner Donated money for site hosting 2019
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #1227 on: July 24, 2016, 07:59:53 AM »
VB6 outputs programs as a simple .exe, which should work on all Windows systems, right? Assuming you have the correct C++ redistributable but you almost certainly already do.
also lol at most toxic guy around calling others out on this sh**
Google Drive with my newer bots

Offline R01

  • Heavyweight
  • Posts: 769
  • Rep: 1
  • Awards BOTM Winner
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #1228 on: July 24, 2016, 08:06:20 AM »
VB6 outputs programs as a simple .exe, which should work on all Windows systems, right? Assuming you have the correct C++ redistributable but you almost certainly already do.
I was going to make a post saying that the X(VB6) runtimes are needed to run all X(in this case VB6) applications, so having them on your pc definitely wouldn't hurt.
Tournament History:
Showcases:
https://gametechmods.com/forums/index.php?topic=18882.0
https://gametechmods.com/forums/index.php?topic=19197.0

Offline R01

  • Heavyweight
  • Posts: 769
  • Rep: 1
  • Awards BOTM Winner
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #1229 on: July 29, 2016, 10:46:03 AM »
Would it be possible to create a bot that only starts using it's second weapon once the enemy hp reaches 0 or the first weapon(set via ID) breaks down?
Yes. It is possible.
How would one do that? I'm also interested on how you would read other stuff about the enemy bots, like their current rotation(based on their default forward heading),changing tactics depending on time left or being able to rotate your own bots servo motors until they reach a certain degree.
Tournament History:
Showcases:
https://gametechmods.com/forums/index.php?topic=18882.0
https://gametechmods.com/forums/index.php?topic=19197.0

Online apanx

Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #1230 on: July 29, 2016, 12:56:35 PM »
By exploiting functions of the plus-class for fun and profit and code a custom Python AI.
Bind a button for secondary weapon. Use plus.GetHealth(BotID,0) to find HP and insert custom tactic to switch to when Enemy HP is 0 or all primary weapons are lost.
Use plus.getHeading(botID, useOffset) to get the Heading of the enemies, compare with your own to find their heading in comparison with yours.
Don't think there is a nice way to find time left, but maybe plus.getTimeElapsed could be used to change tactics based on time. A better way would be to maybe compare enemy points with your own and cower when in lead.
Use plus.AI.GetMotorAngle(MotorComponentID) to find the current servomotor angle. The first page in this thread explains usage.

There are a lot of good stuff buried in this thread, but it is worth reading through if you want to create custom AIs.

Offline R01

  • Heavyweight
  • Posts: 769
  • Rep: 1
  • Awards BOTM Winner
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #1231 on: July 29, 2016, 01:02:59 PM »
By exploiting functions of the plus-class for fun and profit and code a custom Python AI.
Bind a button for secondary weapon. Use plus.GetHealth(BotID,0) to find HP and insert custom tactic to switch to when Enemy HP is 0 or all primary weapons are lost.
Use plus.getHeading(botID, useOffset) to get the Heading of the enemies, compare with your own to find their heading in comparison with yours.
Don't think there is a nice way to find time left, but maybe plus.getTimeElapsed could be used to change tactics based on time. A better way would be to maybe compare enemy points with your own and cower when in lead.
Use plus.AI.GetMotorAngle(MotorComponentID) to find the current servomotor angle. The first page in this thread explains usage.

There are a lot of good stuff buried in this thread, but it is worth reading through if you want to create custom AIs.
Thanks a lot, I'll try to mess around with those before I ask for more help. Is there a document or a page somewhere? It would make it much easier(which is the reason why I'm adding all my bots to the main post in the showcase) than browsing the entire thread in hopes of finding something.
Tournament History:
Showcases:
https://gametechmods.com/forums/index.php?topic=18882.0
https://gametechmods.com/forums/index.php?topic=19197.0

Offline R01

  • Heavyweight
  • Posts: 769
  • Rep: 1
  • Awards BOTM Winner
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #1232 on: August 04, 2016, 11:55:19 AM »
I'm having a little AI issue with only limited time to fix(still should be plenty), basically the AI I'm using works a bit like a push bot, pushing the other around. Combat performance has been great so far, however the problem is the countdown, if that one happens the bot sometimes turns when moving backwards and ends up with the side sticking in the opponent's direction, it doesn't rotate to face the opponent again, giving them a easy win.
Think this problem happens with almost all of the AI and the easiest solution would probably be to make it face the enemy all the time/when moving backwards?
Tournament History:
Showcases:
https://gametechmods.com/forums/index.php?topic=18882.0
https://gametechmods.com/forums/index.php?topic=19197.0

Online apanx

Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #1233 on: August 04, 2016, 11:58:35 AM »
Add a StuckHandler and InvertHandler and put in your own code there. Standard is to move forward and backward when stuck or inverted. Some bot have InvertHandler code to fire SRMs or do other stuff. Facing the enemy when moving backwards leads to driving of the edge, a hazard, sticking into the wall.
Anyways, it would be easier to see whats wrong if you post the python file for the AI.

Offline R01

  • Heavyweight
  • Posts: 769
  • Rep: 1
  • Awards BOTM Winner
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #1234 on: August 04, 2016, 12:06:26 PM »
Add a StuckHandler and InvertHandler and put in your own code there. Standard is to move forward and backward when stuck or inverted. Some bot have InvertHandler code to fire SRMs or do other stuff. Facing the enemy when moving backwards leads to driving of the edge, a hazard, sticking into the wall.
Anyways, it would be easier to see whats wrong if you post the python file for the AI.
I'm still rather new to all this, so adding own commands will probably be out of question for now. The AI file I'm using is still the basic EternalFlame, might change some stuff to create my own one but it's currently only that.
Driving backwards would be the right thing to do and fair instead of pinning the opponent, the front(nose) is the default one(0?) so maybe code that tells the nose to face the way the other bot is would be enough?
Tournament History:
Showcases:
https://gametechmods.com/forums/index.php?topic=18882.0
https://gametechmods.com/forums/index.php?topic=19197.0

Offline R01

  • Heavyweight
  • Posts: 769
  • Rep: 1
  • Awards BOTM Winner
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #1235 on: August 09, 2016, 12:23:08 PM »
I might not have been enough clear before, but what happens is that the bot turns sideways just like it sometimes happens when driving a robot backwards(apparently that happens in IRL as well), I'd want to correct that so that it faces the enemy instead of sitting there sideways ready to get attacked. Even if the driving off the edges issue would be there(which I think would happen anyways with the default AI) I'd still want that as that robot is only going to fight in closed, no hazard arenas.

A different problem that I'm having with a 2wd robot is that it seems to "shuffle" to move, first moves left side, then right, making it very easy to get attacked. Thought that adding radius would fix it, but it's still doing that.
list.append( ("", "", {'radius':1.0,'invertible':False,'range':99,'weapons': (0,) }))
Also where can one find the latest AI files? I've got AI Chart 2.3, and while that mentions popup.py it doesn't have one. The one from Starcore AI v4 seems to only fire when something enters that zone(so if the chassis enters it fires once but then stops), think that was mentioned some time before in this thread. Jaydee's seems to crash the game.
Tournament History:
Showcases:
https://gametechmods.com/forums/index.php?topic=18882.0
https://gametechmods.com/forums/index.php?topic=19197.0

Offline Badger

  • Permanent Artifact
  • Giga Heavyweight
  • Posts: 6318
  • Rep: 3
  • I wish to be with my people
  • Awards BOTM Winner Donated money for site hosting 2019
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #1236 on: August 09, 2016, 12:28:17 PM »
Sounds like your bot is turning too fast and is having to continuously correct itself. Try reducing the turn value in the bindings.
also lol at most toxic guy around calling others out on this sh**
Google Drive with my newer bots

Offline 09090901

  • competitive irl
  • *
  • Posts: 1742
  • Rep: 22
  • anti-boomer super soldier
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #1237 on: August 09, 2016, 12:29:48 PM »
anyone know of a .py that works like fbs_2, but reverses direction while inverted and isn't a meltybrain .py?

@ro1 this has alot .pys
http://beetlebros.gametechmods.com/files/AIessentials.zip

alot of ai packs like ASAI have a ton .pys aswell
DSL-IRL is the libtard’s meta. Go drink more soylent, retard! #BLUELIVESMATTER

Online apanx

Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #1238 on: August 09, 2016, 12:30:23 PM »
The bot drives well manually? What AI does it use? Does that AI use the Engage tactic (like 90% of all AIs)
What might be happening is that the AI overshoots its intended heading as the bot turns too quick for the standard tickInterval. Either cap turnspeed, maximum Turn input, or increase tickInterval.

Offline R01

  • Heavyweight
  • Posts: 769
  • Rep: 1
  • Awards BOTM Winner
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #1239 on: August 09, 2016, 12:30:39 PM »
Sounds like your bot is turning too fast and is having to continuously correct itself. Try reducing the turn value in the bindings.
I wonder why that happens to begin with. Both bots start on one side of the arena so they should move in a straight line. Isn't it supposed to use the wired Forward key instead of using the motors independently? And wouldn't that have a negative impact on turning for Left/Right movement?

The bot drives well manually? What AI does it use? Does that AI use the Engage tactic (like 90% of all AIs)
What might be happening is that the AI overshoots its intended heading as the bot turns too quick for the standard tickInterval. Either cap turnspeed, maximum Turn input, or increase tickInterval.
It's a popup which uses popup.ai, I've had a similar thing happen with my VS before and both of them drive well manually.
Tournament History:
Showcases:
https://gametechmods.com/forums/index.php?topic=18882.0
https://gametechmods.com/forums/index.php?topic=19197.0