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

Offline Redalert

  • The inventor of Wandering Spinners and invincirammers
  • Ultra Heavyweight
  • Posts: 1349
  • Rep: -48
  • Yes, I’m an outsider.
    • View Profile
    • RedStorm's RA2 website
    • Awards
  • Discord: RedStorm
Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #1320 on: April 30, 2019, 08:40:38 AM »
from the very top of clickbeetle's flipper2.py

Quote
# Flipper2.py last updated 7/24/12 by Clickbeetle
# Update 7/24/12: Renamed this file to Flipper2.py so Flipper.py is not overwritten.  Added customizable srimech firing interval.

# This AI will act normally as long as the opponent is moving.  If the opponent stops moving, this AI will also stop and wait for the opponent to be counted out.  If the opponent starts moving again, so will this AI.  In a rumble, this AI will ignore any bots that aren't moving and will only stop if all opponents stop.
# Has support for two smart zone-based weapons and one analog-controlled spinner.  Name the smart zones "flip" and "weapon" and the controls "Flip", "Fire", and "Spin".  "Srimech" control for self-righting.  Note you must put 'UseSrimech':1 in Bindings.py to self-right with the Srimech control; otherwise it will use Flip.
# CUSTOMIZABLE SETTINGS:
# 'EnemyMoveRadius' sets how far the enemy must move in order to be considered mobile.  Default is 1.
# 'EnemyMoveTime' sets how long (in seconds) the enemy has to move the required distance before being considered immobile.  Default is 3.
# 'PrioritizeFlipper' if set to 1, the AI won't fire the other weapon until the flipper fires.  Useful for bots that use the flipper to get under opponents.  When all of self.weapons are lost, the flipper will stop firing and the other weapon will fire even when the flipper doesn't.  The flipper component id's should therefore be set in self.weapons and no other id's for this to work.  Default is 0.
# 'NoChassisTime' sets how long (in half-seconds) the AI will wait to find the chassis before giving up and firing, when there are components in the smart zone.  ONLY WORKS FOR SECONDARY WEAPON, NOT FLIPPER so wire the bot and name the controls like you are using Omni or Popup.py if you use this.  Default is 1.
# 'SrimechInterval' sets how often the AI fires the srimech when attempting to self-right.  Srimech will fire once every X seconds.  Default is 1.
it tries to be smart by not flipping things that are immobilized
the stock flipper.py is mostly the same thing except without the extra controls to fire, spin, and srimech. I'm not sure how well it works though and at the end of the day I don't think the ai is that important.

Good point. I guess the omni is better for the most part, but when it comes to fighting a non-invertible bot, then flipper is better.


Offline UberPyro

  • Lightweight
  • Posts: 205
  • Rep: 6
  • Well, here goes.
  • Awards GTMCS Division Winner
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #1321 on: April 30, 2019, 09:23:06 AM »
from the very top of clickbeetle's flipper2.py

Quote
# Flipper2.py last updated 7/24/12 by Clickbeetle
# Update 7/24/12: Renamed this file to Flipper2.py so Flipper.py is not overwritten.  Added customizable srimech firing interval.

# This AI will act normally as long as the opponent is moving.  If the opponent stops moving, this AI will also stop and wait for the opponent to be counted out.  If the opponent starts moving again, so will this AI.  In a rumble, this AI will ignore any bots that aren't moving and will only stop if all opponents stop.
# Has support for two smart zone-based weapons and one analog-controlled spinner.  Name the smart zones "flip" and "weapon" and the controls "Flip", "Fire", and "Spin".  "Srimech" control for self-righting.  Note you must put 'UseSrimech':1 in Bindings.py to self-right with the Srimech control; otherwise it will use Flip.
# CUSTOMIZABLE SETTINGS:
# 'EnemyMoveRadius' sets how far the enemy must move in order to be considered mobile.  Default is 1.
# 'EnemyMoveTime' sets how long (in seconds) the enemy has to move the required distance before being considered immobile.  Default is 3.
# 'PrioritizeFlipper' if set to 1, the AI won't fire the other weapon until the flipper fires.  Useful for bots that use the flipper to get under opponents.  When all of self.weapons are lost, the flipper will stop firing and the other weapon will fire even when the flipper doesn't.  The flipper component id's should therefore be set in self.weapons and no other id's for this to work.  Default is 0.
# 'NoChassisTime' sets how long (in half-seconds) the AI will wait to find the chassis before giving up and firing, when there are components in the smart zone.  ONLY WORKS FOR SECONDARY WEAPON, NOT FLIPPER so wire the bot and name the controls like you are using Omni or Popup.py if you use this.  Default is 1.
# 'SrimechInterval' sets how often the AI fires the srimech when attempting to self-right.  Srimech will fire once every X seconds.  Default is 1.
it tries to be smart by not flipping things that are immobilized
the stock flipper.py is mostly the same thing except without the extra controls to fire, spin, and srimech. I'm not sure how well it works though and at the end of the day I don't think the ai is that important.

Good point. I guess the omni is better for the most part, but when it comes to fighting a non-invertible bot, then flipper is better.
flipper checks if its opponent has set invertible to true in its AI

Offline Redalert

  • The inventor of Wandering Spinners and invincirammers
  • Ultra Heavyweight
  • Posts: 1349
  • Rep: -48
  • Yes, I’m an outsider.
    • View Profile
    • RedStorm's RA2 website
    • Awards
  • Discord: RedStorm
Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #1322 on: May 02, 2019, 09:25:43 AM »
How do you make your own PY file? I was looking into making one for my Wandering Spinner bot type...


Offline UberPyro

  • Lightweight
  • Posts: 205
  • Rep: 6
  • Well, here goes.
  • Awards GTMCS Division Winner
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #1323 on: May 02, 2019, 10:54:49 PM »
How do you make your own PY file? I was looking into making one for my Wandering Spinner bot type...
Philetbabe's AI Chart
but without a decent working understanding of python programming there's no point

Offline Redalert

  • The inventor of Wandering Spinners and invincirammers
  • Ultra Heavyweight
  • Posts: 1349
  • Rep: -48
  • Yes, I’m an outsider.
    • View Profile
    • RedStorm's RA2 website
    • Awards
  • Discord: RedStorm
Re: AI-ing (.py files, coding, nose-orienting R+D, and help)
« Reply #1324 on: May 03, 2019, 08:58:17 AM »
Thank you!