Combat Overhaul Alpha

Show off your mod creations or just a work in progress.
Post Reply
l3lessed
Posts: 458
Joined: Mon Aug 12, 2019 4:32 pm
Contact:

Re: Combat Overhaul Alpha

Post by l3lessed » Sat Mar 21, 2020 4:00 am

Small updates:

1. I added a case switch to FPSWeapon to check what weapon type is being used and shift the offset distances value based on the weapon. I found certain weapons needed fine tuning to ensure the smoothest transitions between sprite changes as possible. This combined with the mathf.lerp process is creating the smoothest animations no matter the weapon being used. Before, some weapons would have almost no frame skipping, and others would. This is because each weapon has its own set of 5 animation sprites, which creates small variations in how much offset needs to be done between changes.

2. I got sick of having to restart the game every time I changed script values. So, I quickly threw together a script to enable console commands for the FPSWeapon script. It is a separate script file to minimize the impact on the FPSWeapon script file. It has been added to the front page with a list of console commands under the debug area. Now you can enable or disable default animations and enable the ability to set offset distances in game and then change the float value. This right now is only for debugging and creation purpose, but I'll add more console commands upon release as more things are needed for developing and players.

3. Tweaking mathf.lerp calculations to try and ensure smooth animations are properly calculated no matter the players fps or attack speed. As of now, it seems it shifts offsetting properly no matter the weapon attack speed or players FPS. Of course, lower FPS the more frame skipping you will see, as the less frames the engine has to offset the spite.

Process now: Attack starts -> Switch sets proper offset distance -> script calculates number of offsets needed -> multiplies that by set offset distance -> figures out how much time has passed in animation -> passes that to mathf.lerp along with the total offset distance needed -> mathf.lerp does all the hard work and moves the animation smoothly along based on how far into the animation we are.
My Skyrim Mods: l3lessed Nexus Page

Daggerfall Unity mods: Combat Overhaul Mod

Enjoy the free work I'm doing? Consider lending your support.

User avatar
King of Worms
Posts: 3230
Joined: Mon Oct 17, 2016 11:18 pm
Location: Scourg Barrow (CZ)
Contact:

Re: Combat Overhaul Alpha

Post by King of Worms » Sun Mar 22, 2020 11:39 am

Thanks for update, quite complicated stuff.. but u will reach a goal I thought was impossible - 60fps weapon movement. Plus much more!

l3lessed
Posts: 458
Joined: Mon Aug 12, 2019 4:32 pm
Contact:

Re: Combat Overhaul Alpha

Post by l3lessed » Mon Mar 23, 2020 2:10 am

Next large phase done.

I was thinking release was going to stall again, as I hit another large bug. The raytracing arcs were not lining up with attacks once attack speed was changed. This wasn't a huge surprise, as I created a formula out of thin air to approximate.

However, thankfully, unity has a lerp for Quaternion angle rotations for vector3 angles. Once I found this, I got it in and setup and running off a 1 frame lerp calculation. Well, same issue again, as lerp doesn't know how fast the animation is going. It only knows frame counts when it does it calculations.

So, I tried a number of math guesses, and landed on the solution. I found the line up frame count number for the lerp to line up with a specific time animation, used some math to rework the basic equation, and create the formula for the lerp to change the frame count so it moves the raycasts with the animation offset. Of course, the lerp calculations line up with the lerp calculations used in animation offset. Now, raycasts line up with attacks no matter the attack speed and detect object hits. Of course, faster the attack and the less fps, the less rays will be cast. At low enough numbers, you may get some visual bugs if the raycasts have large gaps.

Code is pretty simple once I got it setup. Much more elegant and efficient than the bruteforce ramming random numbers in.

Code: Select all

         else if (ScreenWeapon.WeaponState == WeaponStates.StrikeRight)
                    {
                        //sets up starting and ending quaternion angles for the vector3 offset/raycast.
                        Quaternion startq = Quaternion.AngleAxis(-30, transform.up);
                        Quaternion endq = Quaternion.AngleAxis(45, transform.up);
                        //computes rotation for each raycast using a lerp. The time percentage is modified above using the animation time.
                        Quaternion slerpq = Quaternion.Slerp(startq, endq, perc);
                        //rot = (-30 + raynum);
                        attackcast = slerpq * (mainCamera.transform.forward * (itemRange - SphereCastRadius));
                    }
More console commands added also.
My Skyrim Mods: l3lessed Nexus Page

Daggerfall Unity mods: Combat Overhaul Mod

Enjoy the free work I'm doing? Consider lending your support.

l3lessed
Posts: 458
Joined: Mon Aug 12, 2019 4:32 pm
Contact:

Re: Combat Overhaul Alpha

Post by l3lessed » Mon Mar 23, 2020 6:29 am

Getting closer to release. First pass of four basic melee animations is done. Now, I need to create custom attack raycasts for the melee attacks. And, dare I say, developer release 1.0 (Not considering even alpha for first release, as I cannot guarantee any long term playability yet).

Melee attack configuration
Right + Attack = right swing.
Left + attack = right double jab.
Forward + attack = uppercut.
Back + attack = Chest kick.

quick clip of melee attacks and messing with console commands.
My Skyrim Mods: l3lessed Nexus Page

Daggerfall Unity mods: Combat Overhaul Mod

Enjoy the free work I'm doing? Consider lending your support.

User avatar
King of Worms
Posts: 3230
Joined: Mon Oct 17, 2016 11:18 pm
Location: Scourg Barrow (CZ)
Contact:

Re: Combat Overhaul Alpha

Post by King of Worms » Mon Mar 23, 2020 1:01 pm

Nice, one thing Ive noticed is that while standing very close next to the wall the attack gets canceled properly.
But when u stand in moderate distance from the same wall, the attack gets cancelled too early it seems.

Something seems a bit off in that wall hit simulation with varying distance from the wall.

l3lessed
Posts: 458
Joined: Mon Aug 12, 2019 4:32 pm
Contact:

Re: Combat Overhaul Alpha

Post by l3lessed » Mon Mar 23, 2020 3:39 pm

If you're talking about the melee attacks, they need raycasts redone for them, since their animations are so different.

Also, stab animations need the raycast to grow as the animation stabs outward. Default raycasts shoot one long line instantly.

As for all other animations, they will require further fine tuning of raycast arc and lerping to line up hit recoils little better.
My Skyrim Mods: l3lessed Nexus Page

Daggerfall Unity mods: Combat Overhaul Mod

Enjoy the free work I'm doing? Consider lending your support.

User avatar
King of Worms
Posts: 3230
Joined: Mon Oct 17, 2016 11:18 pm
Location: Scourg Barrow (CZ)
Contact:

Re: Combat Overhaul Alpha

Post by King of Worms » Mon Mar 23, 2020 6:21 pm

I see.. well those are minor things which can be finetuned later indeed

l3lessed
Posts: 458
Joined: Mon Aug 12, 2019 4:32 pm
Contact:

Re: Combat Overhaul Alpha

Post by l3lessed » Tue Mar 24, 2020 4:38 pm

Raycasts can now grow in length overtime to simulate increasing reach of attacks, specifically stab/punching style attacks. This also ensures recoil animations align properly with the hit detect of stab/punch animations.

This adds another feature I didn't original intend. There now is a framework to create completely dynamic raycasts in 360 degrees over any time frame you wish :o . This could allow things like growing sphere casts to simulate outward effects from specific origin points, delayed attack effects, and so on. Outside proper weapon simulation, I'm thinking this could be useful for better and more dynamic spell effects.

We can increase their length and offset them both horizontally and vertically, which gives full 4th dimensional simulation; this means raycasts can simulate a weapon moving through both space and time. What we observe in reality as physics is merely the movement of physical objects on a y,z, and x dimensional axis over the dimensional axis of time (Which for us observers of said reality always runs in a forward linear movement t = +t). In the game, this is simulated using the mathf.lerp formulates to convert frames into a forward linear time unit (t = +Time.delta) that then moves the ray cast to a set position in the games z, x, y, dimensional space.
My Skyrim Mods: l3lessed Nexus Page

Daggerfall Unity mods: Combat Overhaul Mod

Enjoy the free work I'm doing? Consider lending your support.

User avatar
numidium3rd
Posts: 72
Joined: Sun Mar 25, 2018 12:34 am
Location: United States

Re: Combat Overhaul Alpha

Post by numidium3rd » Tue Mar 24, 2020 6:19 pm

The interpolated attack animations look fantastic! I feel like that's how they should have looked on release, almost as if Bethesda ran out of time to give them this kind of polish (which very well may be the case).
I also like the idea of weapon bobbing but if I may humbly offer a suggestion... Could you make the weapons bob in a "U" shape similar to the way they do in Doom? Maybe have them sway in a narrower angle since the weapons are off to the side unlike Doom's centered guns.
Looks great, can't wait to see it finished!

l3lessed
Posts: 458
Joined: Mon Aug 12, 2019 4:32 pm
Contact:

Re: Combat Overhaul Alpha

Post by l3lessed » Tue Mar 24, 2020 6:33 pm

This game was originally release in 1992. It wasn't laziness or a lack of time; it was coding and hardware limitations of the time that stopped them from putting in a smoother animation system. Gun animations are super simple, usually two frames, one for idle and one for fire. On top of that, you have no real large movement outside maybe a recoil or weapon bob; weapon bobs weren't actually showing up in games until years later. Melee animations, especially using old school 2d sprites is much more complicated because you have to simulate the full movement, frame by frame, of the object through space and a set time frame (which also has to be calculated on every frame to ensure proper time calculations). So, they had to limit the draw animation to 5 frames to ensure systems could render it properly.

It is now over 20 years later, and we have all this spare processing power and updated coding libraries and languages, the engine and computer system can easily handle rendering a sprite and its offset every frame. The hard part was figuring out how the original systems math worked and creating the lerp calculation formulas to ensure it all matches with the classic engine; that has been over a year of hammering away and making improvements one incremental lesson at a time.

And thank you and every one else for the encouragement and all the help over the last year. I couldn't of done all of it without some crucial support, patience, and knowledge of community members here.
My Skyrim Mods: l3lessed Nexus Page

Daggerfall Unity mods: Combat Overhaul Mod

Enjoy the free work I'm doing? Consider lending your support.

Post Reply