• Print view

## Wrong Para-Koopas/Para-Goombas Chasing AI

Description: Report bugs of SMBX-38A here.
Moderators: Lx Xzit, Yoshi021, 5438A38A, Moderators, Semi-moderatos

 Lx Xzit Topic author, Moderator Lx Xzit Topic author, Moderator Reputation: 219 Posts: 500 Joined: 9 Nov 2015 Website Post #1by Lx Xzit » 26 Jun 2018, 5:52 While I was doing some tests I found things that really needs to be fixed with Hover / Chasing behaviours, especially the last one. This applies for all the kind of para-goombas and para-koopas.Chasing AIWhat are the problems with the current chasing AIs? They are very inaccurate, they do not have any speed limits (meaning the can go at the speed of light) and will get stuck in almost every edge. These things make the chasing pretty inaccurate. I made a deep research over SMBX 1.3 and found that their chasing AIs are actually very interesting: when the NPC is under the player and it's horizontally close (A distance minor than 5 blocks) it will try to move away from the player until gains altitudes and stabilish itself in the process. I also could noticce that the acceleration is much more slower than in SMBX 1.4.4. Knowing this, I made a chasing AI which tries to be a recreation to SMBX 1.3's AI.SpoilerRed: original Chasing AIGreen: Custom AIThe code can explain the things better that I could, please give it a look:SpoilerCode: Select all`with npc(sysval(param1))   'Speed limits   if .xsp => 3.2 then      .xsp = 3.2      elseif .xsp <= -3.2 then      .xsp = -3.2      elseif .ysp => 3.4 then      .ysp = 3.4      elseif .ysp <= -3.4 then      .ysp = -3.4   end if      'First frames control   .ivala = .ivala + 1      'Collision with Block   if .ysp = 0 and .ivala > 2 then      .ysp = -3.6      elseif .xsp = 0 and .ivala = 0 then      .xsp = 1   end if      'Horizontal movement   if char(1).x > .x - char(1).pwidth + 32 + 6 then      if .ivalc = 0 then         .xsp = .xsp + 0.048         end if         if .facing = 1 then         .facing = 0      end if   elseif char(1).x < .x + 32 - 6 then       if .ivalc = 0 then         .xsp = .xsp - 0.048         end if      if .facing = 0 then         .facing = 1      end if   end if         'Vertical movement (sighly different to the horizontal one)   if char(1).y > .y - char(1).pheight + 32 then      .ivalc = 0      .ysp = .ysp + 0.056         .ivalc = 0      elseif char(1).y < .y + char(1).pheight + 32*4 then       .ysp = .ysp - 0.036               'If the npc is under the player and it's close, it'll will try to move away. The ivalc control is to prevent two movements of x axis at the same time      if char(1).x > .x - char(1).pwidth - 32*4 + 32 and char(1).x < .x + 32*4 then            if .x > char(1).x then            .xsp = .xsp + 0.048            elseif .x < char(1).x then            .xsp = .xsp - 0.048         end if         .ivalc = 1      else         .ivalc = 0      end if   end ifend with`Here's the example level: Flying AI.zip (4.18 KiB) Downloaded 34 times Another little suggestion:I noticed that in SMBX 1.4 the Para-Goombas and Para-Koopas jumps actually a bit mor (in comparison to SMBX 1.3). I'd suggest add a jump of a Y speed of -8 instead of -9 which is the current one) in this way it would stand exact the same as SMBX 1.3. [size=100][b]VISIT MY YOUTUBE CHANNEL![/b] [url=https://www.youtube.com/channel/UC_AcXEExdYtaydxcCVPSGoQ]LX XZIT[/url][/size]﻿[size=100]Join our 38A Discord server! [url= https://discord.gg/7hCmNBE]CLICK HERE[/url][/size]