Announcement

Collapse
No announcement yet.

SOCOM II :: AI BOTS

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • SOCOM II :: AI BOTS

    SOCOM II :: Bots
    The following code will spawn players on the map. Each player is using the offline AI and will fire at you. I tend to use this code in lan using pcsx2. It can be useful for testing other codes that require people in the room.
    Code Designer Source
    Code:
    address $200a0000
    /*
    # Will create a specified amount of players aka bots
    */
    __CreateBots:
    addiu sp, sp, $ffd0
    sw ra, $0000(sp)
    sw s0, $0004(sp)
    sw s1, $0008(sp)
    sw s2, $000c(sp)
    
    setreg s0, $00440c38
    lw s0, $0000(s0)
    beq s0, zero, :EndCreateBot
    nop
    
    setreg s1, $000b0000
    lb s2, $0000(s1)
    addiu s2, s2, $0001
    addiu v0, zero, $000a
    beq s2, v0, :AfterCreation
    nop
    
    //Create name string
    addiu a0, s1, $0024
    addiu a1, s1, $0014
    jal $001988d0
    daddu a2, s2, zero,
    //Get skin pointer
    jal $0053e170
    addiu a0, s1, $0004
    
    //Create Bot
    daddu a0, v0, zero,
    addiu a1, s1, $0024
    jal $002b3a00
    addiu a2, zero, $0001
    daddu s3, v0, zero,
    
    //Store bot pointer in bot list
    addiu t0, s1, $002c
    sll t1, s2, 2
    add t0, t0, t1
    sw s3, $0000(t0)
    
    
    //update name
    addiu a1, s1, $0024
    jal $00314ee0
    lw a0, $0028(s3)
    
    addiu a1, s1, $0024
    jal $0029ec70
    daddu a0, s3, zero,
    
    
    //force clean spawn
    sw zero, $000c(s3)
    
    //set team id
    setreg t0, $C0020000
    sw t0, $00c8(s3)
    
    //respawn
    setreg t0, $66666666
    sw t0, $0FCC(s3)
    
    sb s2, $0000(s1)
    beq zero, zero, :EndCreateBot
    nop
    
    AfterCreation:
    
    //already run check?
    addiu t0, s1, $002c
    lb v0, $0000(t0)
    bne v0, zero, :EndCreateBot
    nop
    addiu v0, zero, $0001
    sb v0, $0000(t0)
    
    //update team id and respawn 
    StartTeamUpdate:
    addiu t0, t0, $0004
    lw t1, $0000(t0)
    beq t1, zero, :EndCreateBot
    nop
    
    //set the team id to bot team id
    addiu t2, zero, $0000
    sw t2, $00c8(t1)
    
    //respawn
    setreg t2, $66666666
    sw t2, $0FCC(t1)
    beq zero, zero, :StartTeamUpdate
    nop
    
    EndCreateBot:
    jal :__RespawnHandler
    daddu a0, s1, zero,
    lw ra, $0000(sp)
    lw s0, $0004(sp)
    lw s1, $0008(sp)
    lw s2, $000c(sp)
    jr ra
    addiu sp, sp, $0030
    
    
    /*
    # Will monitor each bot for when it is time to respawn
    */
    
    __RespawnHandler:
    addiu t0, a0, $0100
    lw v0, $0000(t0)
    lw v1, $0004(t0)
    bne v0, v1, :EndRespawnHandler
    nop
    sw zero, $0004(t0)
    daddu v1, zero, zero,
    
    addiu t1, a0, $0030
    
    StartRespawnHandler:
    lw t2, $0000(t1)
    beq t2, zero, :EndRespawnHandler
    nop
    lw t3, $1044(t2)
    bne t3, zero, :RespawnHandlerNext
    nop
    
    setreg t3, $66666666
    sw t3, $0FCC(t2)
    RespawnHandlerNext:
    beq zero, zero, :StartRespawnHandler
    addiu t1, t1, $0004
    
    
    EndRespawnHandler:
    addiu v1, v1, $0001
    sw v1, $0004(t0)
    jr ra
    nop
    
    /*
    # Will get the UICharType String
    */
    
    __SkinHandler:
    
    
    /*
    Bots Pointer
    -------------------------------
    0000 = Amount of bots created
    0004 = Character string
    0014 = Format String
    0024 = Bot Name
    0030 = Bot List
    0100 = Respawn Timer Interval
    0104 = Respawn Current time
    */
    
    
    address $200b0004
    print "UiCharType2"
    nop
    print "Bot%d"
    
    address $200b0100
    hexcode $00000250
    
    /*
    Bot codes
    -------------------------------
    */
    
    //On Joker
    address $D044F15C 
    hexcode $0000FBFF
    address $202CED04
    j :__CreateBots
    
    //Off Joker
    //address $D044F15C 
    //hexcode $0000FFFF
    //address $202CED04
    //jr ra
    
    //Spectator Fix
    address $202C3038
    hexcode $10000006

  • #2
    Still the most interesting code for SOCOM 2. I have a variation of this code where you can grab seals/terrorists spawned as hostages. Once you grab them it changes their ID to your team ID and they follow you around as your own personal body guards. I think I sent to this to you at some point. Anyways I'm uploading a video of your code in action.

    Edit:

    Last edited by Harry62; 02-12-2016, 09:37:28 AM.

    Comment


    • #3
      Originally posted by Harry62 View Post
      Still the most interesting code for SOCOM 2. I have a variation of this code where you can grab seals/terrorists spawned as hostages. Once you grab them it changes their ID to your team ID and they follow you around as your own personal body guards. I think I sent to this to you at some point. Anyways I'm uploading a video of your code in action.

      Edit:

      Thanks Harry. I should also note this code was created by myself. Harry and renagade were a huge help with helping me find everything I needed. Harry was the one who found that changing the team id to the offline team id makes the bots go into ai mode
      Last edited by Cronotrigga; 02-12-2016, 11:36:35 AM.

      Comment


      • #4
        I tried something like this on ftb3 but only manage to kill the whole team. Could never find the function to create ai. This is so dope

        Comment


        • #5
          Originally posted by Professor-X View Post
          I tried something like this on ftb3 but only manage to kill the whole team. Could never find the function to create ai. This is so dope
          I used the same function that is used to spawn hostages. The function I have provided basically just creates new players with the default arguments that are needed and then I send a new player name that uses sprintf to format the string. A respawn game and a round based game are different because of this a force respawn was used to execute the process. My friend harry who is above posting the video who is also on this website was playing with my code one day and happened to be messing with some team functionality and discovered a way to enable AI by using one of the offline team ids. The code itself could probably be done better using the online spawn player function. As of right now my code suffers from creating a valid team player. This causes the ai to not have a proper player object. I feel like using the online spawn system would allow me to create bots that would also work in a networked environment.
          Last edited by Cronotrigga; 05-11-2016, 09:02:54 PM.

          Comment


          • #6
            I know what I'm about to say maybe different from this game but on socom fireteam bravo series. In the multiplayer mode, "things" are represented by objects for example, there's a PersonaObject a SealObject a QBlatherObject a BombObject etc etc... All these objects are refercenced with a number. This number is the index of the object in the array where they are listed

            Example "player id" , 0x4, 0x66, 0xCA, etc to kill someone? False, Coders on the game thought those were players Id but really its the index of the SealObject. The real player ID of each player is between 0 and 15.

            Generally, in the array of all game objects the objects of a same player are next to each other 0x64 = PersonaObject index 0x65 = QBlatherObject index 0x66 = SealObject index these 3 objects are created for EACH player in the game. The PersonaObject provides textual informations about a player you can read/edit a player's nickname, clantag, player's id and votes.

            Click image for larger version

Name:	9f8b135f992f8476c56b2cfc91ce59af.png
Views:	1
Size:	190.9 KB
ID:	162843
            Last edited by Professor-X; 05-12-2016, 10:18:13 PM.

            Comment


            • #7
              Originally posted by Professor-X View Post
              I know what I'm about to say maybe different from this game but on socom fireteam bravo series. In the multiplayer mode, "things" are represented by objects for example, there's a PersonaObject a SealObject a QBlatherObject a BombObject etc etc... All these objects are refercenced with a number. This number is the index of the object in the array where they are listed

              Example "player id" , 0x4, 0x66, 0xCA, etc to kill someone? False, Coders on the game thought those were players Id but really its the index of the SealObject. The real player ID of each player is between 0 and 15.

              Generally, in the array of all game objects the objects of a same player are next to each other 0x64 = PersonaObject index 0x65 = QBlatherObject index 0x66 = SealObject index these 3 objects are created for EACH player in the game. The PersonaObject provides textual informations about a player you can read/edit a player's nickname, clantag, player's id and votes.

              [ATTACH=CONFIG]3588[/ATTACH]
              Ps2 versions of socom have the exact same setup. You have a label that says unsure, that is the player rank icon. The persona pointer can be found in the persona list. Filling the persona list with persona objects allows for lobby bots. In game bots consist of a czseal object being created. You should be able to port just about any ps2 code from any version of socom without much hassle.

              The actual way I went about finding out how to create players started by taking my czseal object pointer and tracing it back to the function that contains session master. The function in socom does not need any arguments so it is safe to hook. By hooking this function you will notice duplicates of your body being made with the same control object as your czseal object. I first tried to replace the control pointer that is located in the czseal object with the same pointer a hostage would use. This unfortunately just nulled the movement of the duplicate. I then tried to swap out the skins of the duplicates I was creating, this worked but only for the available skins to online players. At this point the bot code wasn't looking like it was going to be very cool so i decided to try again but this time I found 2 functions one dealing with ai/hostages and one for net players. I used the hostage function, swapped out the skin and added names. This worked pretty well, plus it was cool to have seals as hostages that followed me around. So my next idea was to try and make them more like the offline ai team you have. I tried pretty much everything to get the ai control to work but had no luck until harry was messing with my code one day and figured out that team ids are actually more then just a team id. The bots now work really well with ai abilities.

              This code does have issues though. One big issue is that the bots that are created sometimes show up in the online players menu and sometimes they don't. This mostly has to do with the team id and how players enter the room. I believe to solve this issue I could rewrite that whole process which wouldn't be to difficult but the better approach may be to use the net player functionality instead and seeing if i can still use the skins I want. The plan one day would be to have bots just like call of duty that you can play against.
              Last edited by Cronotrigga; 05-12-2016, 11:20:00 PM.

              Comment


              • #8
                SCA has bots now too. Bot wars are fun to watch
                Click image for larger version

Name:	CA Bot Wars.png
Views:	1
Size:	1.55 MB
ID:	162941
                Click image for larger version

Name:	CA Spawn Players.png
Views:	1
Size:	1.21 MB
ID:	162942
                Click image for larger version

Name:	ca stuff.png
Views:	1
Size:	1.35 MB
ID:	162943


                It gets pretty intense, and laggy when there's a whole lot
                Click image for larger version

Name:	i167^cimgpsh_orig.jpg
Views:	1
Size:	92.8 KB
ID:	162944
                Last edited by Gtlcpimp; 01-16-2017, 12:35:20 AM.

                Comment


                • #9
                  Originally posted by Gtlcpimp View Post
                  SCA has bots now too. Bot wars are fun to watch
                  *images*
                  S2 hostage bots are better

                  Click image for larger version

Name:	BhkDRg8.jpg
Views:	1
Size:	596.2 KB
ID:	162949

                  Comment


                  • #10
                    Ha.

                    But do you have these?
                    Click image for larger version

Name:	ca stuff.png
Views:	1
Size:	1.39 MB
ID:	162950

                    Or customized one
                    Click image for larger version

Name:	CA Truck Mod.png
Views:	1
Size:	1.03 MB
ID:	162951
                    Last edited by Gtlcpimp; 01-18-2017, 02:56:55 PM.

                    Comment


                    • #11
                      Your guys' geniusness is enviable.
                      July 7, 2019

                      https://www.4shared.com/s/fLf6qQ66Zee
                      https://www.sendspace.com/file/jvsdbd

                      Comment


                      • #12
                        Originally posted by Gtlcpimp View Post
                        Ha.
                        Or customized one
                        [ATTACH=CONFIG]3797[/ATTACH]
                        You would drive a beater truck.

                        How about that ESP?
                        Click image for larger version

Name:	OXEXV4B.jpg
Views:	1
Size:	214.8 KB
ID:	162952


                        Originally posted by bungholio View Post
                        Your guys' geniusness is enviable.
                        You should hack SOCOM 2 or SOCOM CA. We have so many functions/variables mapped out.

                        Comment


                        • #13
                          You're making my little seal want to go super saiyan blue to fight this battle.

                          Click image for larger version

Name:	CA Super Saiyan BLUE.png
Views:	1
Size:	927.8 KB
ID:	162953

                          Comment


                          • #14
                            Spawn mp bomb in any map anyone?
                            If you guys are going to post pictures you should release the codes for others to use.

                            Click image for larger version

Name:	MPBOMB.png
Views:	2
Size:	507.9 KB
ID:	162954
                            Click image for larger version

Name:	MPBOMB2.png
Views:	2
Size:	412.5 KB
ID:	162955
                            Last edited by Cronotrigga; 01-21-2017, 05:41:46 PM.

                            Comment


                            • #15
                              Would it be possible to add random respawn points scrattered across the map so they don't spawn on top of each other? Random as in anywhere on the map, not just the set respawn points. I think this would be pretty awesome to play with in a crossroads respawn where the ai lurked on every corner. Ha nice work. Is there a compiled version? Or a link to the compiler you use?

                              Comment

                              Working...
                              X