don't click here

Concept Proposal - Homing Attack with momemtum

Discussion in 'Fangaming Discussion' started by Mejokiv, May 8, 2024.

  1. Mejokiv

    Mejokiv

    Member
    6
    10
    3
    Hello,

    I'm considering starting the development of a 3D Sonic fan game soon using the Bumper engine.

    I'm intrigued by the idea of turning the Homing Attack into a skill-based mechanic centered around the concept of momentum. This would require players to execute successive attacks with precision, creating the sensation that Sonic is truly harnessing his momentum to leap from one target to another. To explore this concept further, I've delved into the Bumper engine and made modifications to the Homing Attack script, adapting it to fit this experimental approach.

    Personally, I'm quite pleased with the gameplay so far, and I see potential in refining the Homing Attack into a mechanic that players must master. By intertwining it with the game's physics, it could offer players not only a sense of agility but also a deeper level of interaction and challenge.

    I've put together a video showcasing some scenes that highlight Sonic's fluid movement and the enhanced Homing Attack mechanic in action. It serves as a preview of what players can expect in terms of gameplay dynamics and challenges.



     
  2. Palas

    Palas

    Don't lose your temper so quickly. Member
    1,099
    749
    93
    I don't know how you did it, but it looks so... fluid. Like the homing attack is but a small course correction for a jump, and I think that's pretty valid as a proposal. This kin of homing attack that keeps most or all momentum has a lot of potential, especially in skatepark-like structures like the ones in the video. Maybe the small window of opportunity is the key for an interesting implementation, and hell, it looks like it feels really good to chain them like this.
     
  3. Chimpo

    Chimpo

    I Gotta Be Me Member
    8,690
    1,560
    93
    Los Angeles, 2029
    Don't Forget! Try Your Best!
    It always bothered me how the homing attack would just straight up kill your flow in the games. I think the only time I ever enjoyed it functioning was when you attacked the balloons in Sonic Unleashed. For some reason, theyse objects would not halt your movement and shoot you up vertically, you would continue moving horizontally. Lightspeed Lina ended up replicating this behaviour. It just makes the game feel a lot more fluid. I can see the same idea in your proposal as well. Here's how Lina looks.


    One thing I always wanted to try and toy around with was the option of removing the vertical recoil by holding down the button and add a stacking effect for successful chains. So instead of immediately flying up after connecting with an enemy, you would just burst through them and keep moving forward in the angle that you were attacking. So if you would attack from below an enemy, you would end up launching yourself upwards for more height, or attack from above to reach the ground faster and carry that speed into your run. Here's an expertly crafted demonstration image.

    Sample1.png
    Each homing attack add to your velocity. In a 3D space with chains of enemies, you could change up your attacks to get a desired outcome. If you want more height, maybe attack the first 2 enemies directly and then delay your third attack so that you're below an enemy so that you can use the burst of speed to climb higher. If there's a 4th guy in the air, chain the last attack above him so that you come rocketing down to the ground and move forward.

    Sample2.png
    This idea came fom trying to replicate the fun sensation from swinging in Bionic Commando 2009, but make it work in a Sonic environment. I'm not good at fidling with 3D games so I never got a proper demo out, but redoing the homing attack has always been in my mind since that damn balloon in Unleashed.
     
  4. Mejokiv

    Mejokiv

    Member
    6
    10
    3
    Code (Text):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class Action02_Homing : MonoBehaviour {
    5.  
    6.     public ActionManager Action;
    7.     public Animator CharacterAnimator;
    8.     PlayerBhysics Player;
    9.  
    10.     public bool isAdditive;
    11.     public float HomingAttackSpeed;
    12.     public float AirDashSpeed;
    13.     public float HomingTimerLimit;
    14.     public float FacingAmount;
    15.     public GameObject HomingTrailContainer;
    16.     public GameObject HomingTrail;
    17.     public GameObject JumpDashParticle;
    18.     float Timer;
    19.     float Speed;
    20.     float Aspeed;
    21.     Vector3 direction;
    22.  
    23.  
    24.     public Transform Target { get; set; }
    25.     public float skinRotationSpeed;
    26.     public bool HomingAvailable { get; set; }
    27.     public bool IsAirDash { get; set; }
    28.  
    29.  
    30.     void Awake()
    31.     {
    32.         HomingAvailable = true;
    33.         Player = GetComponent<PlayerBhysics>();
    34.     }
    35.  
    36.     public void InitialEvents()
    37.     {
    38.  
    39.         Action.Action01.JumpBall.SetActive(false);
    40.         if (HomingTrailContainer.transform.childCount < 1)
    41.         {
    42.             GameObject HomingTrailClone = Instantiate (HomingTrail, HomingTrailContainer.transform.position, Quaternion.identity) as GameObject;
    43.             HomingTrailClone.transform.parent = HomingTrailContainer.transform;
    44.  
    45.             GameObject JumpDashParticleClone = Instantiate (JumpDashParticle, HomingTrailContainer.transform.position, Quaternion.identity) as GameObject;
    46.             JumpDashParticleClone.transform.parent = HomingTrailContainer.transform;
    47.         }
    48.            
    49.  
    50.         if (Action.Action02Control.HasTarget)
    51.         {
    52.             Target = HomingAttackControl.TargetObject.transform;
    53.        
    54.  
    55.  
    56.  
    57. }
    58.  
    59.         Timer = 0;
    60.         HomingAvailable = false;
    61.  
    62.         if (isAdditive)
    63.         {
    64.            
    65.             // Apply Max Speed Limit
    66.             float XZmag = new Vector3(Player.p_rigidbody.velocity.x, 0, Player.p_rigidbody.velocity.z).magnitude;
    67.  
    68.             if (XZmag < HomingAttackSpeed)
    69.             {
    70.                 Speed = 33;
    71.             }
    72.             else
    73.             {
    74.                 Speed = 33;
    75.             }
    76.  
    77.             if(XZmag < AirDashSpeed)
    78.             {
    79.                 Aspeed = 33;
    80.             }
    81.             else
    82.             {
    83.                 Aspeed = 33;
    84.             }
    85.         }
    86.         else
    87.         {
    88.             Aspeed = AirDashSpeed;
    89.             Speed = 33;
    90.  
    91.         }
    92.  
    93.         //Check if not facing Object
    94.         if (!IsAirDash)
    95.         {
    96.             Vector3 TgyXY = HomingAttackControl.TargetObject.transform.position.normalized;
    97.             TgyXY.y = 0;
    98.             float facingAmmount = Vector3.Dot(Player.PreviousRawInput.normalized, TgyXY);
    99.            // //Debug.Log(facingAmmount);
    100.            // if (facingAmmount < FacingAmount) { IsAirDash = true; }
    101.         }
    102.  
    103.     }
    104.  
    105.     void Update()
    106.     {
    107.  
    108.         //Set Animator Parameters
    109.         CharacterAnimator.SetInteger("Action", 1);
    110.         CharacterAnimator.SetFloat("YSpeed", Player.p_rigidbody.velocity.y);
    111.         CharacterAnimator.SetFloat("GroundSpeed", Player.p_rigidbody.velocity.magnitude);
    112.         CharacterAnimator.SetBool("Grounded", Player.Grounded);
    113.  
    114.         //Set Animation Angle
    115.         Vector3 VelocityMod = new Vector3(Player.p_rigidbody.velocity.x, 0, Player.p_rigidbody.velocity.z);
    116.         Quaternion CharRot = Quaternion.LookRotation(VelocityMod, transform.up);
    117.         CharacterAnimator.transform.rotation = Quaternion.Lerp(CharacterAnimator.transform.rotation, CharRot, Time.deltaTime * skinRotationSpeed);
    118.  
    119.  
    120.  
    121.     }
    122.  
    123.     void FixedUpdate()
    124.     {
    125.         Timer += 1;
    126.  
    127.         CharacterAnimator.SetInteger("Action", 1);
    128.  
    129.         if (IsAirDash)
    130.         {
    131.             if (Player.RawInput != Vector3.zero)
    132.             {
    133.                 Player.p_rigidbody.velocity = transform.TransformDirection(Player.RawInput) * Aspeed;
    134.             }
    135.             else
    136.             {
    137.                // //Debug.Log("prev");
    138.                 Player.p_rigidbody.velocity = transform.TransformDirection(Player.PreviousRawInput) * Aspeed;
    139.             }
    140.             Timer = HomingTimerLimit + 20;
    141.         }
    142.         else
    143.         {
    144.             direction = Target.position - transform.position;
    145.             Player.p_rigidbody.velocity = direction.normalized * Speed;
    146.         }
    147.  
    148.         //Set Player location when close enough, for precision.
    149.         if (Target != null && Vector3.Distance (Target.position, transform.position) < 5)
    150.         {
    151.             transform.position = Target.position;
    152.             //Debug.Log ("CloseEnough");
    153.         }
    154.  
    155.         //End homing attck if on air for too long
    156.         if (Timer > HomingTimerLimit -100)
    157.         {
    158.             Action.ChangeAction(0);
    159.         }
    160.     }
    161.    
    162.     public void ResetHomingVariables()
    163.     {
    164.         Timer = 0;
    165.         HomingTrailContainer.transform.DetachChildren ();
    166.         //IsAirDash = false;
    167.     }
    168.  
    169.  
    170.  
    171. }
    172.  
    I think the video of this game you posted suggests the reaction of movement in different objects due to their different material natures (such as balloons and badniks that are robots, for example). I also noticed the balloon objects you mentioned.

    The perspective of the vertical attack in the first image seemed interesting to me since in Sonic R, Sonic performed the double jump after pressing the jump button twice. But I think an important point is that the targeting mechanic should also work for the other characters. For example, we know that Tails flies, Knuckles glides, and Amy uses her hammer, and it seems like we have the drop dash mechanic for Sonic now. So the mechanic proposes to give the opportunity for a stage of the same nature to be played and completed by all these characters.

    I'm not sure if anyone on the forum works with the bumper engine, but I'm attaching the updated Homing Attack script in the reply. However, I tested it with the "Mania Sonic" character since he performs the drop dash with the targeting disabled, instead of performing the homing attack in the air with such targeting disabled.

    But the ability is also working with vertical attacks, so I'll try to record a second video based on what you posted, but at the moment I can't make it load in the air
     
  5. LordOfSquad

    LordOfSquad

    bobs over baghdad Member
    5,215
    249
    43
    Winnipeg, MB
    making cool music no one gives a shit about
    Momentum fixes the homing attack problem, simple as. Sonic World DX features this kind of movement, where landing the homing attack on the first enemy in an airborne chain of them while holding the jump button either lets you shoot through the chain without further attacks (similar to the balloon behavior Chimpo mentioned), or just bounces you up and forward and over the rest of them with a similar rebound to what you'd get holding the jump after hitting an enemy in the classic games, depending on the angle and speed you come into it with. It feels real good. Yet another egregious entry in the laundry list of "things Sonic Team should be doing but just don't for some reason".
     
  6. Palas

    Palas

    Don't lose your temper so quickly. Member
    1,099
    749
    93
    I'd like to learn more about how a homing attack that takes momentum into account works. Both in OP's proposal and anywhere else. I can't read code and the last time I dealt with physics as a subject was in high school like 15 years ago, so please be patient with me.

    So what I know is, momentum is a vector quantity, calculated by mass (which for us will be irrelevant because it's always the same) times velocity, and can be read as the result of three x, y and z vectors in 3D. So if I take a snapshot of @Mejokiv's video right before the homing attack is activated, I get something like this:

    upload_2024-5-9_15-18-5.png

    So your input and gravity are accelerating Sonic both forward and down, right? And when you activate it, what you get is:

    upload_2024-5-9_15-37-56.png

    Which I suppose changes the direction of your momentum towards the target, but not its quantity. Right? So here would be the first problem with the momentum-base homing attack: not all homing attacks are created equal. So targeting would work or not based on how much momentum you currently have. Is that right?

    Besides, Sonic is launched at the target as if his velocity couldn't change direction for a while, negating both input and gravity, and is aimed directly at the target. Otherwise, you'd most likely miss the target. This means your momentum is locked. But when do input and gravity start having an effect again, especially if you're able to go through a target? If you hit it and just bounce, that's easier: just reverse the Y speed and start calculating as you were. But if you go through the object as you destroy it, does the homing attack just "lock" the value of momentum for a fixed amount of time? Is it dependent on how close you were to the target when you activated it? Should the homing attack not lock it at all, just change the direction and force the player to be good at ballistics (or offer a very small window of opportunity that ensures you won't miss it)?

    The "standard", non-momentum-dependent homing attack, as I understand it, just makes you shoot Sonic at a target at a fixed velocity, which makes it easier to implement. But how do all the momentum-centered solutions consider these problems?

    I'm not sure if I made myself clear. It just looks like such a hard thing to implement, which makes all the proposals all the more interesting.
     
  7. Mejokiv

    Mejokiv

    Member
    6
    10
    3
    Interesting that you mentioned that sensation of hitting an object like in classic Sonic games. I've never played Sonic World DX myself. But I'll give it a try later. I watched some videos.

    I see that the gameplay created must address the issue of having common performance mechanics among the characters, but at the same time, it should allow them to leverage their unique abilities. This contrasts with making it repetitive and always requiring the same effort in gameplay, consequently generating 'enemies and objects just waiting to be destroyed and hit'.

    @Palas

    What defines this homing attack is this part of the code:

    csharp
    if (XZmag < HomingAttackSpeed)
    {
    Speed = 33;
    }
    else
    {
    Speed = 33;
    }

    if(XZmag < AirDashSpeed)
    {
    Aspeed = 33;
    }
    else
    {
    Aspeed = 33;
    }
    }
    else
    {
    Aspeed = AirDashSpeed;
    Speed = 33;
    }

    If I change the integer number 33 to 100, it will change the execution speed. Considering 33 is an integer, I consider homing attacks as equal. It's defined by an integer number, which could be in place of this number 33. If it's under these conditions, it executes at a certain distance. You can influence Sonic's behavior while he's in the ability, despite the intention of the mechanics being timing and precision in this gameplay of the video. Sonic's other abilities, like rolling, don't have the target considered by me. I understand that the issue to be resolved is while Sonic is in the air, due to the establishment of the difficulty of hitting the objects. I considered this as a "directed double jump with short range that works with a target." I changed it until I reached the number 33 when it sounded to me like the character was indeed jumping on the object, with the number reflecting its ability to bounce off the object enough for Sonic to gain momentum and go to the other object, sounding fun to me. I could change it to 100, but the bounce would change and it would sound out of proportion to me, bouncing much higher. The number 33 reflects what I felt was proportional to the game's objects as I tested it.

    If you're at high speed, it might be more difficult to hit these enemies depending on the player's skill, but not impossible; it revolves around the issue of mastering the skill, it's all about when the player triggers the proposal that the target makes, with the value 33. It's possible to make Sonic "bounce" off objects at low height depending on when the ability is activated.
     
    Last edited: May 10, 2024
  8. ajazz

    ajazz

    Member
    10
    2
    3
    the idea is interesting but absent holding an actual controller i can't really assess it further. i'm on the same page as @Palas regarding the confusion about how it would even work conceptually, but i also want to note that i think that the homing attack is very underrated by Certified Sonic Experts (myself included) in terms of how much more accessible it makes high-speed 3d platformer combat for newcomers. if you've seen a normie play a 3d mario game (hell, even a 2d mario game) you'll see them struggle to line up jumps at mario's relatively slow speed. now imagine them trying to manually do badnik bounces at sa1 sonic's default usain bolt pace and i think it'll make more sense why the homing attack has remained a pretty restrained combat option. the momentum drain is a feature in some cases, not a bug

    that's not to say it's not worth exploring alternatives, but maybe it's worth considering in whatever larger project you're working on if the traditional homing attack can co-exist with classic-style badnik bouncing as two different combat options for players of different skill levels. the homing attack's automation can serve as a useful and reliable option for newcomers, while skilled players could go for manual bouncing and get more height / access to better routes / more points as a result.
     
  9. Palas

    Palas

    Don't lose your temper so quickly. Member
    1,099
    749
    93
    I see-- that's actually the simplest, most elegant solution. And it makes the most sense, too. The momentum is preserved after the homing attack, then! In any case, the video you showed looks like it's really fkuid and I'd like to see it in a "real life" environment. Looking forward to it.
     
  10. Mejokiv

    Mejokiv

    Member
    6
    10
    3

    Well, just because Mario didn't establish an aiming logic doesn't mean Sonic shouldn't or couldn't do it. What you said reminded me of Super Monkey Ball games, in the sense of having "beginner areas and areas for experienced players", which Sonic is familiar with. From that, speaking of Sonic in 3D, I think this issue revolves around maintaining balance in something.
     
    Last edited: May 12, 2024
  11. CL_Supersonic.wad

    CL_Supersonic.wad

    Professional Breather Member
    2
    0
    1
    I think this idea is really cool, reminds me some of Neo Sonic from SRB2. I do wish the homing attack flowed better in the concept video but I still think it's cool. Would probably work well with fangames like Sonic GT.
     
  12. Mejokiv

    Mejokiv

    Member
    6
    10
    3
    In a few, not many, days, I'll upload the files so that it can be played by anyone to try out.
     
    • Like Like x 1
    • Useful Useful x 1
    • List