Author Topic: Battlebots arena  (Read 2435 times)

Offline Classicus

  • Middleweight
  • Posts: 315
  • Rep: 5
    • View Profile
    • Awards
Battlebots arena
« on: September 26, 2012, 05:41:37 AM »
Hi guys, I'd like to use the Battlebots arena for tournaments and matches in general but how do I deactivate/remove the pop-up central floor tiles. I don't like that the AI doesn't know they're there. Any help would be great.

Offline Thyrus

  • *
  • Posts: 6210
  • Rep: 19
  • Back to purple '17
    • http://www.youtube.com/Th
  • Awards BOTM Winner
    • View Profile
    • Awards
Re: Battlebots arena
« Reply #1 on: September 26, 2012, 05:51:04 AM »
freezie did it for his battlebots tourney. may you ask him

Offline Classicus

  • Middleweight
  • Posts: 315
  • Rep: 5
    • View Profile
    • Awards
Re: Battlebots arena
« Reply #2 on: September 26, 2012, 06:03:12 AM »
Thanks I'll message him and see if he can help. If anyone else knows in the mean time I'd appreciate it. Thanks.

Offline JoeBlo

Re: Battlebots arena
« Reply #3 on: September 26, 2012, 06:40:23 AM »
I dont have my windows handy but if you open up the battle bots arena python (.py file) in notepad and find the section that activates the heck raiser hazards (python is pretty english based)


then put "#" (no quotations) at the start of the line. Dont delete anything!


# tag means the game will ignore that line, so if you mess up you havent deleted anything important.

Offline Classicus

  • Middleweight
  • Posts: 315
  • Rep: 5
    • View Profile
    • Awards
Re: Battlebots arena
« Reply #4 on: September 26, 2012, 06:49:48 AM »
Thanks Joe, but it didn't work I'm affraid, although I don't really know what I'm doing as I have no coding knowledge. This is what it looks like (+ #'s I added), just to help if anyone knows what I need to change. It seems the popups are linked to the other hazards or something. Any help would be great.


from __future__ import generators
import plus
import Arenas
import random
import Hazards2
import math

class ClawTop(Arenas.SuperArena):
    "The classic Battlebox replicated for the ultimate experience in real robot fighting.  It is a bit laggy, however."
    name = "Battlebox"
    preview = "BATTLEBOX_2_0/BB_preview.bmp"
    game_types = ['DEATHMATCH']
    extent = (-13, 13, 14, -14)

    def __init__(self):
        Arenas.SuperArena.__init__(self, "Arenas/BATTLEBOX_2_0/arena.gmf")
        #plus.Arena.__init__(self, "")
        plus.setBackColor(0,0,0)
                                 #(X,Y,Z), (CamSwing[Up-Down 0-1.57],CamRotate:lower#=ccw/higher#=cw), CamZoom*FieldOfView}       
        fov = 0.015
        self.AddStaticCamera("              StaticCam-Over-1", (0, 40, -63), (1.5708,0), 72*fov)
        self.AddStaticCamera("              StaticCam-Over-2", (0, 22, -63), (1.59,0), 73*fov)
        self.AddStaticCamera("              StaticCam-Angled-1", (0, 15, -30), (0.7, 3.14), 55*fov)
        self.AddStaticCamera("              StaticCam-Angled-2", (0, 15, -20), (0.4, 3.14), 50*fov)

        self.AddWatchCamera("               WatchCam-Over-1", (0, 30, -63), (6, 12, 30*fov, 20*fov))
        self.AddWatchCamera("               WatchCam-Over-2", (0, 30, -63), (6, 12, 40*fov, 30*fov))
        self.AddWatchCamera("               WatchCam-Over-3", (0, 30, -63), (6, 12, 50*fov, 40*fov))
        self.AddWatchCamera("             WatchCam-Corner-1a", (15.7, 12, -48), (6, 12, 30*fov, 20*fov))
        self.AddWatchCamera("             WatchCam-Corner-1b", (15.7, 12, -48), (6, 12, 40*fov, 30*fov))
        self.AddWatchCamera("             WatchCam-Corner-1c", (15.7, 12, -48), (6, 12, 50*fov, 40*fov))
        self.AddWatchCamera("             WatchCam-Corner-2a", (-15.8, 12, -79.5), (6, 12, 30*fov, 20*fov))
        self.AddWatchCamera("             WatchCam-Corner-2b", (-15.8, 12, -79.5), (6, 12, 40*fov, 30*fov))
        self.AddWatchCamera("             WatchCam-Corner-2c", (-15.8, 12, -79.5), (6, 12, 50*fov, 40*fov))
        self.AddWatchCamera("             Platform Cam -L", (8, 5, -40), (6, 12, 50*fov, 30*fov))
        self.AddWatchCamera("             Platform Cam -R", (-8, 5, -40), (6, 12, 50*fov, 30*fov))

        #self.AddWatchCamera(".     Watch Cam -1", (0, 30, -30), (6, 12, 50*fov, 10*fov))
        #self.AddWatchCamera(".     Watch Cam -2", (0, 30, -30), (6, 12, 30*fov, 20*fov))
        #self.AddWatchCamera(".     Watch Cam -3", (0, 30, -30), (6, 12, 30*fov, 30*fov))
        #self.AddWatchCamera(".     Low Watch Cam -4", (0, 10, -30), (6, 12, 80*fov, 10*fov))
        #self.AddWatchCamera(".     Low Watch Cam -5", (0, 10, -30), (6, 12, 50*fov, 30*fov))
        #self.AddWatchCamera(".     Low Watch Cam -6", (0, 10, -30), (6, 12, 50*fov, 30*fov))

       
        self.players = ()

    def Activate(self, on):
        if on: self.players = plus.getPlayers()
       
        Arenas.SuperArena.Activate(self, on)


    def HazardsOn(self, on):
        if on:

            #RamRod stuff
            prism = self.AddPrismatic("Floor", "spikes", 0, 1, 0, 0, .8, 0)
            self.spikes1 = Hazards2.Spikes(prism, 80000, (-3.7, -2.2, -5.2))

            prism = self.AddPrismatic("Floor", "spikes01", 0, 1, 0, 0, .8, 0)
            self.spikes2 = Hazards2.Spikes(prism, 80000, (-3.7, -2.2, -5.2))

            self.AddHazard(self.spikes1)
            self.AddHazard(self.spikes2)

            self.RegisterZone("spike_zone",13)
            self.RegisterZone("spike_zone01",14)

            self.SetSubMaterialSound("hammer1", "metal", .8, "Sounds\\hzd_hammer_thud.wav")
            self.SetSubMaterialSound("hammer2", "metal", .8, "Sounds\\hzd_hammer_thud.wav")
       
            #Hellraiser stuff
            #hinge = self.GetHinge("Hinge01")
            #self.RegisterZone("heckzone1", 1)
            #self.Hell1 = Hazards2.HellRaiser(hinge, (3.034, 0.0, -6.926))
            #self.AddHazard(self.Hell1)
           
            #hinge = self.GetHinge("Hinge02")
            #self.RegisterZone("heckzone2", 2)
            #self.Hell2 = Hazards2.HellRaiser(hinge, (-3.049, 0.0, -6.926))
            #self.AddHazard(self.Hell2)

            #Hammers           
            hinge = self.GetHinge("hammerhinge1")
            self.RegisterZone("hammerzone1", 3)
            self.Hammer1 = Hazards2.HellRaiser(hinge, (-16.645, -80.815, -5.586))
            self.AddHazard(self.Hammer1)
           
            hinge = self.GetHinge("hammerhinge2")
            self.RegisterZone("hammerzone2", 4)
            self.Hammer2 = Hazards2.HellRaiser(hinge, (16.811, -80.453, -5.584))
            self.AddHazard(self.Hammer2)

            hinge = self.GetHinge("hammerhinge3")
            self.RegisterZone("hammerzone3", 5)
            self.Hammer3 = Hazards2.HellRaiser(hinge, (-16.645, -80.815, -5.586))
            self.AddHazard(self.Hammer3)
           
            hinge = self.GetHinge("hammerhinge4")
            self.RegisterZone("hammerzone4", 6)
            self.Hammer4 = Hazards2.HellRaiser(hinge, (16.811, -80.453, -5.584))
            self.AddHazard(self.Hammer4)
           
            #saw stuff to make them pop up
            hinge = self.GetHinge("saw_hinge")
            self.RegisterZone("saw_zone", 7)
            self.Hell3 = Hazards2.Saws(hinge, (3.034, 0.0, -6.926))
            self.AddHazard(self.Hell3)

            hinge = self.GetHinge("saw_hinge01")
            self.RegisterZone("saw_zone01", 8)
            self.Hell4 = Hazards2.Saws(hinge, (3.034, 0.0, -6.926))
            self.AddHazard(self.Hell4)

            hinge = self.GetHinge("saw_hinge02")
            self.RegisterZone("saw_zone02", 9)
            self.Hell5 = Hazards2.Saws(hinge, (3.034, 0.0, -6.926))
            self.AddHazard(self.Hell5)

            hinge = self.GetHinge("saw_hinge03")
            self.RegisterZone("saw_zone03", 10)
            self.Hell6 = Hazards2.Saws(hinge, (3.034, 0.0, -6.926))
            self.AddHazard(self.Hell6)

            hinge = self.GetHinge("saw_hinge04")
            self.RegisterZone("saw_zone04", 11)
            self.Hell7 = Hazards2.Saws(hinge, (3.034, 0.0, -6.926))
            self.AddHazard(self.Hell7)

            hinge = self.GetHinge("saw_hinge05")
            self.RegisterZone("saw_zone05", 12)
            self.Hell8 = Hazards2.Saws(hinge, (3.034, 0.0, -6.926))
            self.AddHazard(self.Hell8)

            #arena spinners
            self.spinner = self.GetHinge("spinner")
            self.spinner.SetAutoLocks(False, True)
            self.spinner.SetPowerSettings(20, 1000)
            self.spinner.Lock(False)
            self.spinner.SetDirection(-100)

            self.spinner2 = self.GetHinge("spinner2")
            self.spinner2.SetAutoLocks(False, True)
            self.spinner2.SetPowerSettings(20, 1000)
            self.spinner2.Lock(False)
            self.spinner2.SetDirection(-100)

            #saw stuff to make them spin
            self.sawspin = self.GetHinge("saws_spin")
            self.sawspin.SetAutoLocks(False, True)
            self.sawspin.SetPowerSettings(20, 1000)
            self.sawspin.Lock(False)
            self.sawspin.SetDirection(-100)

            self.sawspin2 = self.GetHinge("saws_spin01")
            self.sawspin2.SetAutoLocks(False, True)
            self.sawspin2.SetPowerSettings(20, 1000)
            self.sawspin2.Lock(False)
            self.sawspin2.SetDirection(-100)

            self.sawspin3 = self.GetHinge("saws_spin02")
            self.sawspin3.SetAutoLocks(False, True)
            self.sawspin3.SetPowerSettings(20, 1000)
            self.sawspin3.Lock(False)
            self.sawspin3.SetDirection(-100)

            self.sawspin4 = self.GetHinge("saws_spin03")
            self.sawspin4.SetAutoLocks(False, True)
            self.sawspin4.SetPowerSettings(20, 1000)
            self.sawspin4.Lock(False)
            self.sawspin4.SetDirection(-100)

            self.sawspin5 = self.GetHinge("saws_spin04")
            self.sawspin5.SetAutoLocks(False, True)
            self.sawspin5.SetPowerSettings(20, 1000)
            self.sawspin5.Lock(False)
            self.sawspin5.SetDirection(-100)

            self.sawspin6 = self.GetHinge("saws_spin05")
            self.sawspin6.SetAutoLocks(False, True)
            self.sawspin6.SetPowerSettings(20, 1000)
            self.sawspin6.Lock(False)
            self.sawspin6.SetDirection(-100)

        else:
            pass
       
        return Arenas.SuperArena.HazardsOn(self, on)

    def Tick(self):
        # check to see if anyone has been "eliminated" by falling into a pit
        for each in self.players:
            if plus.getLocation(each)[1] < -8 and not plus.isEliminated(each):
                plus.eliminatePlayer(each)
               
        if self.bHazardsOn:

            #activate hazards
            self.Hell1.Tick()
            self.Hell2.Tick()
            self.Hell3.Tick()
            self.Hell4.Tick()
            self.Hell5.Tick()
            self.Hell6.Tick()
            self.Hell7.Tick()
            self.Hell8.Tick()
            self.spikes1.Tick()
            self.spikes2.Tick()
            self.Hammer1.Tick()
            self.Hammer2.Tick()
            self.Hammer3.Tick()
            self.Hammer4.Tick()

        return Arenas.SuperArena.Tick(self)

    def ZoneEvent(self, direction, id, robot, chassis):
        #if people are in zones then make the hazards to stuff
        if (id==1 and direction==1):
            self.Hell1.RaiseHell()
        elif (id==2 and direction==1):
            self.Hell2.RaiseHell()
        elif (id==3 and direction==1):
            self.Hammer1.RaiseHell()
        elif (id==4 and direction==1):
            self.Hammer2.RaiseHell()
        elif (id==5 and direction==1):
            self.Hammer3.RaiseHell()
        elif (id==6 and direction==1):
            self.Hammer4.RaiseHell()
        elif (id == 7 and direction==1):
            self.Hell3.RaiseHell()
        elif (id == 8 and direction==1):
            self.Hell4.RaiseHell()
        elif (id == 9 and direction==1):
            self.Hell5.RaiseHell()
        elif (id == 10 and direction==1):
            self.Hell6.RaiseHell()
        elif (id == 11 and direction==1):
            self.Hell7.RaiseHell()
        elif (id == 12 and direction==1):
            self.Hell8.RaiseHell()
        elif (id == 13):
            # entering spikes zone 1
            self.spikes1.ZoneEvent(direction)
        elif (id == 14):
            # entering spikes zone 1
            self.spikes2.ZoneEvent(direction)

        return True
       
Arenas.register(ClawTop)

Offline Classicus

  • Middleweight
  • Posts: 315
  • Rep: 5
    • View Profile
    • Awards
Re: Battlebots arena
« Reply #5 on: September 26, 2012, 07:31:09 AM »
I managed to solve it, just changed two values: ("heckzone1", n)    n changed to zero for both heckzone1 and heckzone2.

#Hellraiser stuff
            hinge = self.GetHinge("Hinge01")
            self.RegisterZone("heckzone1", 0)
            self.Hell1 = Hazards2.HellRaiser(hinge, (3.034, 0.0, -6.926))
            self.AddHazard(self.Hell1)
           
            hinge = self.GetHinge("Hinge02")
            self.RegisterZone("heckzone2", 0)
            self.Hell2 = Hazards2.HellRaiser(hinge, (-3.049, 0.0, -6.926))
            self.AddHazard(self.Hell2)


My RA2 experience has just got a tiny bit better I think :D

Offline JoeBlo

Re: Battlebots arena
« Reply #6 on: September 26, 2012, 10:42:00 AM »
Nice work, But what you have done is known as "destructive editing" :P The number change set the hazard zones to use a zone thats non existent within the arena.



You started off right..


The part you blocked out was the part that ID'd the hazards and the hazard trigger zones... problem is if you look further down, the python actives said hazards and also event triggers them


so basically the arena was trying to run and trigger hazards that no longer exist..


self.Hell1 and self.Hell2 entries needed to be # tagged in the def Tick section (this section basically constantly c what the robots are doing during the match) and the def ZoneEvent (which the name is self explanatory what this does)

for future reference, take note, self.AddHazard(self.name) the name in brackets is the reference for each part of the python, so you can ID what parts and interacting with what ;)


Offline Classicus

  • Middleweight
  • Posts: 315
  • Rep: 5
    • View Profile
    • Awards
Re: Battlebots arena
« Reply #7 on: September 26, 2012, 02:06:53 PM »
I very much appreciate the help. Took me about 5 reads to understand but I get the jist now. I think.

For me someone talking about code is like




as I have no aptitude for it. I will try to get my head around it.


The help is very much appreciated though.


Just to be clear is the second hack-job with two values OK? Seems to work so far.

Offline Badnik96

  • tired of your shit
  • *
  • Posts: 17527
  • Rep: 3
  • Awards BOTM Winner
    • View Profile
    • Awards
Re: Battlebots arena
« Reply #8 on: September 26, 2012, 03:55:12 PM »
Just put the # in front of the line that states where the smartzone is and it should work, it did for me.

Offline JoeBlo

Re: Battlebots arena
« Reply #9 on: September 26, 2012, 10:00:26 PM »
If it works then it's ok.. the only thing is the arena is loading, activating and checking hazards that basically just have no smartzone anymore .. just for load/ lag reduction sake you have you have wasted coding. ;)

Offline Classicus

  • Middleweight
  • Posts: 315
  • Rep: 5
    • View Profile
    • Awards
Re: Battlebots arena
« Reply #10 on: September 27, 2012, 01:35:13 PM »
Thanks for the help Joe, do you (or anyone who happens to be reading this) know what part of the .py governs how many bots the arena can support? I'm looking to do some display tournaments and I'd like to have 4 bot limit instead of 2. Thanks for any help.

Offline Mr. AS

  • TheGloriousCarbideArstotzkanIronsideChaosProtocol
  • *
  • Posts: 7557
  • Rep: 19
    • robotarenagtm
  • Awards BOTM Winner
    • View Profile
    • Awards
Re: Battlebots arena
« Reply #11 on: September 27, 2012, 06:37:41 PM »
just copy the "game_types = " from the combat zone (box.py i think)

the battlebox only has 2 starting points tho and starting points are in the .gmf .........
How you make Alarm Clock Pizza is:
Step 1: You buy an alarm clock from the store, and then you have to break it and put it in the sauce.
Step 2: Fold the sauce in 5 slices and put it in the dough.
Step 3: Paint the eggs with a pitcher of a clock showing what time you want to wake up and eat pizza for breakfast.
Step 4: Put the eggs in the dough.
Step 5: Make it flat into a round shape and draw the time you want on it.
Step 6: Put some old steel to prevent other peple from stealing it.
Step 7: Make it flat and cut into 60 slices 1 for each minute in 1 our.
Step 8: Put in the oven set the timer to 30048813.2884 seconds and put the temperature on 'Volcano' setting.
Step 9: If you think it is take to long, then get yor alarm clock and set it to now so that it will ring and you can take it out.
Step 10: Take it out uv the uvin wen it is redy and go to bed. In the morning eat pizza and also eat yor hands bi mistake.

Offline MassimoV

  • I Move Weight
  • *
  • Posts: 8924
  • Rep: 25
  • I make rap for people of Serbia
    • MassimoVTV
  • Awards BOTM Winner
    • View Profile
    • Mourning Glory
    • Awards
  • See profile for gamer tags: Yes
  • Skype: myhandsarefood
Re: Battlebots arena
« Reply #12 on: September 27, 2012, 08:23:40 PM »
I want to do this but I'm still confused, what values in what line do I change?

Offline JoeBlo

Re: Battlebots arena
« Reply #13 on: September 28, 2012, 06:57:30 PM »
It's a 2 second change in the python but all it does is make it show up in the rumble game mode... you need to gif edit in 2 new start points for bots 3 and 4..

Offline MassimoV

  • I Move Weight
  • *
  • Posts: 8924
  • Rep: 25
  • I make rap for people of Serbia
    • MassimoVTV
  • Awards BOTM Winner
    • View Profile
    • Mourning Glory
    • Awards
  • See profile for gamer tags: Yes
  • Skype: myhandsarefood
Re: Battlebots arena
« Reply #14 on: September 28, 2012, 10:34:58 PM »
I'm sorry I meant the heckraizer fix. I'm still confused on that.

Offline Classicus

  • Middleweight
  • Posts: 315
  • Rep: 5
    • View Profile
    • Awards
Re: Battlebots arena
« Reply #15 on: September 29, 2012, 02:30:58 AM »
It's a 2 second change in the python but all it does is make it show up in the rumble game mode... you need to gif edit in 2 new start points for bots 3 and 4..

I managed to solve that one myself in the python, just fiddling with the start points to see if it can be done. Don't think its worth it though as there are hazards in the area where the two new start points would go. Unless I make all bots start in the corners.



I'm sorry I meant the heckraizer fix. I'm still confused on that.


This is how I did it:

Change two values: ("heckzone1", n)    n changed to zero for both heckzone1 and heckzone2.

#Hellraiser stuff
            hinge = self.GetHinge("Hinge01")
            self.RegisterZone("heckzone1", 0)
            self.Hell1 = Hazards2.HellRaiser(hinge, (3.034, 0.0, -6.926))
            self.AddHazard(self.Hell1)
           
            hinge = self.GetHinge("Hinge02")
            self.RegisterZone("heckzone2", 0)
            self.Hell2 = Hazards2.HellRaiser(hinge, (-3.049, 0.0, -6.926))
            self.AddHazard(self.Hell2)

This isn't the best way to do it though.