Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Donate
Collapse

Plutonium

  1. Home
  2. MW3 Modding Releases & Resources
  3. [Preview][Animated movement(not fully)] AIBots

[Preview][Animated movement(not fully)] AIBots

Scheduled Pinned Locked Moved MW3 Modding Releases & Resources
34 Posts 13 Posters 4.8k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ViTaLC0D3Rundefined Offline
    ViTaLC0D3Rundefined Offline
    ViTaLC0D3R
    wrote on last edited by
    #2

    This is great. I know that you only want to implement this for your survival mod, but I am interested in helping you build this out fully not only for your mod but to actually add workings bots. Please let me know if your interested?

    1 Reply Last reply
    4
    • S3VDITOundefined S3VDITO

      Since I try to make Survival Mod, the first thing I started is the bots, or rather their logic of movement and attack.

      At the moment I only implemented LookLogic (not fully)

      This is just a preview, I think in the future I can give the bots full logic, but my plans are only related to Survival Mod, I do not consider other modes yet (FFA is currently working)

      Send me PM, if you have any ideas for realizing

      Watching logic
      https://www.youtube.com/watch?v=RDlMABVC9Vw

      Move logic
      https://www.youtube.com/watch?v=N81LXQvNl3k

      Animated move
      https://www.youtube.com/watch?v=3brC8vSBS1w

      Implemeted:

      1. Look logic (default target player with num 0)
      2. Move logic (default target player with num 0) IF BOT SEE YOU
      3. Animated movement

      [this list will be updated]

      Download only look logic

      Download move logic added

      Download movement animation added

      Source:

      // This is preview version 
      // This is only the beginning of creating bots with the logic of movement and attack, 
      // but first of all I want to create Survival mode, so do not expect bots that can play in TDM, FFA, DZ and other.
      // I guess I would do it after creating this script
      
      // AIBots by S3VDITO
      // Ver 0.0.0.3
      // Realized: 
      // 1 - watching for player function (not works now)
      // 2 - move logic [not fully] [without check collision] (in progress...)
      // 3 - animated movement
      
      gsc.setDvar("testClients_doAttack", 0);
      gsc.setDvar("testClients_doCrouch", 0);
      gsc.setDvar("testClients_doMove", 0);
      gsc.setDvar("testClients_doReload", 0);
      gsc.setDvar("testClients_doWatchKillcam", 0);
      
      gsc.setDvarIfUninitialized("testClients_doSpeed", 4);
      
      global bot_speed = to_float(gsc.getDvar("testClients_doSpeed"));
      
      global bots_list = [];
      
      global player_target_list = [];
      
      level.onNotify("connected", fun(args) {
      	var player = args[0];
      	print(player.getGuid().find("bot"));
      	if(player.getGuid().find("bot") != 0)
      	{
      		print("Player connected");
      		player_target_list.push_back_ref(player);
      	}
      });
      
      level.onNotify("prematch_done", fun(args) {
      	if(gsc.getDvar("g_gametype") == "dm") {
      		for(var entRef = 0; entRef < 18; ++entRef)
      		{
      			var tempEntBot = gsc.getEntByNum(entRef);
      			if(tempEntBot.getGuid().find("bot") == 0)
      			{
      				var animBody = gsc.spawn("script_model", tempEntBot.getOrigin());
      				animBody.setmodel("mp_body_delta_elite_assault_ab");
      				animBody.notsolid();
      				
      				animBody.LinkTo(tempEntBot, "tag_origin", [-4, 0, -1], [-4, 0, -1]);
      				
      				bots_list.push_back_ref(tempEntBot);
      				
      				setInterval(fun[tempEntBot, animBody]() { 
      					botMove(tempEntBot, gsc.getEntByNum(0), animBody); 
      				}, 50);
      				
      				setInterval(fun[animBody]() { 
      					animBody.scriptModelPlayAnim("pb_stumble_pistol_walk_forward");
      				}, 1000);
      			}
      		}
      	}
      });
      
      def botMove(bot, target, animModel)
      {		
      	var bot_weapon_origin = bot.getTagOrigin("tag_weapon_left");
      
      	HideTestClientParts(bot);
      	
      	if(LockSightTest(bot, target) == false)
      	{
      		// animModel.scriptModelPlayAnim("pb_stand_alert_pistol");
      		return;
      	}
      	else
      	{
      		
      	
      		var angle = gsc.vectorToAngles([target.getTagOrigin("j_helmet")[0] - bot_weapon_origin[0], target.getTagOrigin("j_helmet")[1] - bot_weapon_origin[1], target.getTagOrigin("j_helmet")[2] - bot_weapon_origin[2]]);
      		bot.setPlayerAngles(angle);
      		
      		// Spaming field bug =(
      		//animModel.set("angles", bot.getPlayerAngles());
      	}
      	
      	var moveTarget = target.getOrigin();
      	var distance = gsc.distanceSquared(moveTarget, bot.getOrigin());
      	if(gsc.distance(moveTarget, bot.getOrigin()) <= 64)
      	{
      		// bot_speed = 0;
      	}
      	else
      	{
      		bot_speed = to_float(gsc.getDvar("testClients_doSpeed"));
      		var normalize = gsc.vectorNormalize([moveTarget[0] - bot.getOrigin()[0], moveTarget[1] - bot.getOrigin()[1], moveTarget[2] - bot.getOrigin()[2]]);
      		bot.setOrigin([bot.getOrigin()[0] + normalize[0] * bot_speed, bot.getOrigin()[1] + normalize[1] * bot_speed, bot.getOrigin()[2] + normalize[2] * bot_speed]);
      	}
      }
      
      def HideTestClientParts(bot)
      {
      	bot.hidepart("j_ankle_le");
      	bot.hidepart("j_hiptwist_le");
      	bot.hidepart("j_head");
      	bot.hidepart("j_helmet");
      	bot.hidepart("j_eyeball_le");
      	bot.hidepart("j_clavicle_le");
      }
      
      
      // Stolen from _stinger.gsc :)
      def LockSightTest(self, target)
      {
      	var eyePos = self.GetEye();
      	
      	var passed = gsc.SightTracePassed(eyePos, target.getOrigin(), false, target);
      	if ( passed == 1)
      	{
      		return true;
      	}
      
      	var front = target.GetPointInBounds(1, 0, 0);
      	passed = gsc.SightTracePassed( eyePos, front, false, target );
      	if (passed == 1)
      	{
      		return true;
      	}	
      
      	var back = target.GetPointInBounds(-1, 0, 0);
      	passed = gsc.SightTracePassed( eyePos, back, false, target );
      	if (passed == 1)
      	{
      		return true;
      	}
      
      	return false;
      }
      
      
      Rosamahaundefined Offline
      Rosamahaundefined Offline
      Rosamaha
      wrote on last edited by
      #3

      S3VDITO good work!
      Take a look on spi his cod4 "mw3 survival mod" its really cool:
      https://www.youtube.com/watch?v=BnoNQw5Eq2Y

      Dasfoniaundefined 1 Reply Last reply
      1
      • VERsingthegamezundefined Offline
        VERsingthegamezundefined Offline
        VERsingthegamez
        wrote on last edited by
        #4

        This looks good so far! We might have functioning ai to play against soon!

        1 Reply Last reply
        2
        • Thanatosundefined Offline
          Thanatosundefined Offline
          Thanatos
          wrote on last edited by
          #5

          Nice job ! let us know if we can help some how !
          Waiting to hear from you soon

          1 Reply Last reply
          1
          • GFL Mosin Nagantundefined Offline
            GFL Mosin Nagantundefined Offline
            GFL Mosin Nagant
            wrote on last edited by
            #6

            Nice Mod you got rated it 10/10

            1 Reply Last reply
            1
            • Mr. Androidundefined Offline
              Mr. Androidundefined Offline
              Mr. Android
              Plutonium Admin
              wrote on last edited by
              #7

              This looks promising, if you can get bots to have some form of "acceptable" challenge for players then I'd love to chat about the future with Pluto, I'll need to see some more progress first to ensure it's doable ๐Ÿ™‚

              S3VDITOundefined 1 Reply Last reply
              3
              • Mr. Androidundefined Mr. Android

                This looks promising, if you can get bots to have some form of "acceptable" challenge for players then I'd love to chat about the future with Pluto, I'll need to see some more progress first to ensure it's doable ๐Ÿ™‚

                S3VDITOundefined Offline
                S3VDITOundefined Offline
                S3VDITO
                wrote on last edited by
                #8

                @Mr-Android
                I would like to implement this, but so far I am limited due to the lack of knowledge of many ChaiScript functions, and there is also a lack of GSC function waittill, thread (this is the most necessary), endon.
                MagicBullet => crush server
                BulletTrace(not working) and other functions that can return arrays do not return them
                Set/Get field either have no result or crush the server

                While I made the primitive logic of the movement of bots, I had to hide the model of the bot itself and move the model (otherwise I could not give animations of movement) (attached video, updated post)

                https://www.youtube.com/watch?v=N81LXQvNl3k

                Thanatosundefined 1 Reply Last reply
                2
                • S3VDITOundefined S3VDITO

                  @Mr-Android
                  I would like to implement this, but so far I am limited due to the lack of knowledge of many ChaiScript functions, and there is also a lack of GSC function waittill, thread (this is the most necessary), endon.
                  MagicBullet => crush server
                  BulletTrace(not working) and other functions that can return arrays do not return them
                  Set/Get field either have no result or crush the server

                  While I made the primitive logic of the movement of bots, I had to hide the model of the bot itself and move the model (otherwise I could not give animations of movement) (attached video, updated post)

                  https://www.youtube.com/watch?v=N81LXQvNl3k

                  Thanatosundefined Offline
                  Thanatosundefined Offline
                  Thanatos
                  wrote on last edited by
                  #9

                  S3VDITO Amazing it looks like you got the logic of it ! Really promising !

                  1 Reply Last reply
                  0
                  • Rosamahaundefined Rosamaha

                    S3VDITO good work!
                    Take a look on spi his cod4 "mw3 survival mod" its really cool:
                    https://www.youtube.com/watch?v=BnoNQw5Eq2Y

                    Dasfoniaundefined Offline
                    Dasfoniaundefined Offline
                    Dasfonia
                    Plutonium Staff
                    wrote on last edited by
                    #10

                    Rosamaha That is a COD4 singleplayer mod, nothing like that is possible multiplayer.

                    1 Reply Last reply
                    0
                    • H3X1Cundefined Offline
                      H3X1Cundefined Offline
                      H3X1C
                      Plutonium Staff
                      wrote on last edited by
                      #11

                      Nice work, looks promising.

                      1 Reply Last reply
                      1
                      • Xediundefined Offline
                        Xediundefined Offline
                        Xedi
                        wrote on last edited by Xedi
                        #12

                        nice job man, can't wait till the final product

                        1 Reply Last reply
                        0
                        • S3VDITOundefined Offline
                          S3VDITOundefined Offline
                          S3VDITO
                          wrote on last edited by
                          #13

                          The walking animation has been added, it is primitive, but I can explain it with the limitations of the scripting language(ChaiScript), but I hope that the errors will be removed and the possibilities will be expanded.

                          Post updated

                          Demo video:
                          https://www.youtube.com/watch?v=3brC8vSBS1w&t=8s

                          Thanatosundefined 1 Reply Last reply
                          3
                          • Dasfoniaundefined Offline
                            Dasfoniaundefined Offline
                            Dasfonia
                            Plutonium Staff
                            wrote on last edited by
                            #14

                            Looking better ๐Ÿ™‚

                            1 Reply Last reply
                            0
                            • VERsingthegamezundefined Offline
                              VERsingthegamezundefined Offline
                              VERsingthegamez
                              wrote on last edited by
                              #15

                              My guy keep it going. I am so excited for this you cannot even believe.

                              1 Reply Last reply
                              1
                              • S3VDITOundefined S3VDITO

                                The walking animation has been added, it is primitive, but I can explain it with the limitations of the scripting language(ChaiScript), but I hope that the errors will be removed and the possibilities will be expanded.

                                Post updated

                                Demo video:
                                https://www.youtube.com/watch?v=3brC8vSBS1w&t=8s

                                Thanatosundefined Offline
                                Thanatosundefined Offline
                                Thanatos
                                wrote on last edited by
                                #16

                                S3VDITO definitely more concrete ! Looking forward to your updates man ! Keep it up

                                1 Reply Last reply
                                0
                                • ViTaLC0D3Rundefined Offline
                                  ViTaLC0D3Rundefined Offline
                                  ViTaLC0D3R
                                  wrote on last edited by
                                  #17

                                  Is there a way for to actually move they just stand there for me.

                                  S3VDITOundefined 1 Reply Last reply
                                  0
                                  • ViTaLC0D3Rundefined ViTaLC0D3R

                                    Is there a way for to actually move they just stand there for me.

                                    S3VDITOundefined Offline
                                    S3VDITOundefined Offline
                                    S3VDITO
                                    wrote on last edited by
                                    #18

                                    ViTaLC0D3R
                                    No, in COD 4 and MW2 they use separately models to create motion animation. (mod makers hiding bots and use model for this)

                                    Probably C++ could emulate button presses of the movement (or using Notify, but I do not think that this is possible)...

                                    Something like this

                                    1 Reply Last reply
                                    0
                                    • VERsingthegamezundefined Offline
                                      VERsingthegamezundefined Offline
                                      VERsingthegamez
                                      wrote on last edited by
                                      #19

                                      Any new updates on these bots?

                                      1 Reply Last reply
                                      0
                                      • S3VDITOundefined Offline
                                        S3VDITOundefined Offline
                                        S3VDITO
                                        wrote on last edited by
                                        #20

                                        VERsingthegamez
                                        not yet.
                                        I canโ€™t implement some functions for bots due to problems in Chai.

                                        VERsingthegamezundefined 1 Reply Last reply
                                        1
                                        • S3VDITOundefined S3VDITO

                                          VERsingthegamez
                                          not yet.
                                          I canโ€™t implement some functions for bots due to problems in Chai.

                                          VERsingthegamezundefined Offline
                                          VERsingthegamezundefined Offline
                                          VERsingthegamez
                                          wrote on last edited by
                                          #21

                                          S3VDITO limitations or just problems that you have not learned?

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • 1
                                          • 2
                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Users
                                          • Groups
                                          • Donate