Cracking Open Combat

Discuss modding questions and implementation details.
User avatar
Jay_H
Posts: 2712
Joined: Tue Aug 25, 2015 1:54 am

Re: Cracking Open Combat

Post by Jay_H » Thu Aug 22, 2019 1:58 pm

Looking forward to first release!

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

Re: Cracking Open Combat

Post by l3lessed » Sun Aug 25, 2019 6:10 am

Okay, I have attack frame raycast tracing in now. It is in early alpha and needs more smoothing around the edges and custom vector offsets for some of the non-horizontal attack animations.

It is pretty simple in how it operates. Took little messing with the weaponManager.cs switches, but it checks for when the attack state is initiated. When this happens, it starts a if then switch that activates anytime the attack animation is between number 1 and 4. When activated, it begins sending out raycasts every frame from the camera direction outward trying to detect what it is hitting and if it is a successful hit.

Currently it keeps going running, even after an initial hit, so broken in a way. When you attack, you can do ten+ attack on an enemy within a second. But hey, the basic setup is there. I also need to create animation offsets for the individual animation types to match what player sees visually.

I plan on adding a time switch to possible minimize the amount of raycast draws, as we probably don't need one every single frame. I also will add a proper hit detection switch, so the raycasts stop going after a successful hit. This will save raycasts and also stop from multiple enemy hit bug. Then just need a parry/recoil animation.


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

Re: Cracking Open Combat

Post by l3lessed » Mon Aug 26, 2019 6:52 pm

Hit detection and raycast draw stop is in. Now, any object, including walls, register a hit and stop anymore raycast.

Now, to just hijack the animation update system to force in reverse frame counting, and hopefully we have bug-free functioning recoils. May not be 100% beautifully rendered using a coding, frame count trick instead of actual animation files.

User avatar
Jay_H
Posts: 2712
Joined: Tue Aug 25, 2015 1:54 am

Re: Cracking Open Combat

Post by Jay_H » Mon Aug 26, 2019 7:43 pm

Any estimate for a release date on this? You sound like you're wrapping stuff up.

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

Re: Cracking Open Combat

Post by l3lessed » Tue Aug 27, 2019 4:03 am

Depends. Coding has slowed down some, as school is back into full gear. The amount of spare time I have to put into the coding side of this project has gone down as a result.

I have four more large hurdles to overcome before release.

Need to get the time together to figure out proper raycast offsetting and setup switches for animations and proper raycast placement to match attack animation. Should be easy, just time consuming programming each animation raycast offset.

Currently working on finding a way to get in a parry animation. When I have a few hours, I have a new idea I want to try, which is to hijack the animation code that times each individual frame. Will see if it goes smoothly or not.

Blocking mechanism. Coding, I think this should only take a few dedicated hours. Again, animation side may be more complicated, since I can't craft the animations myself. Again, coding solutions via offsets and individual frame updating is a theoretical solution to this, but will see how hard it is.

Weapon parry for those who duel wield or don't use shields. Again, coding I think shouldn't be to hard. Pretty much a short invuln frame. Animation, again, will see.

Hoping no more than three or so weeks for a initial release.

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

Re: Cracking Open Combat

Post by l3lessed » Wed Aug 28, 2019 2:13 am

Ok, I came home from work and had two hours or so to myself. I thought I would take a crack at the animation/collision simulation system. Here is the magic, be it currently buggy, I came up with hijacking the frame by frame system animation system.

So, I largely understand how the specific animation methods, code, and individual frames work and are rendered. This allowed me to hi-jack the existing animation system and then run an animation backwards at a faster rate after a hit is detected. I hope, in the future, I can possibly smooth animations out further by adding offset frames in between each sprite frame. Might allow me to double the frames with minimal time and effort. Will see when I get there.

Here is my first real attempt. It still has one switch bug in it, but I know of one solution already.

Right now, weaponmanager triggers it, then won't stop sending raycasts out and playing the animation until it stops hitting the object. This is because fpsweapon needs to send out a bool trigger the moment a frame hits an object so weaponmanager can update and stop sending raycasts for hit detection. To fix this, all I need to create a unique hitobject bool for the fpsweapon script, so it also keeps track of when each individual frame is hitting and can pass it to Weaponmanager. At that point, the weaponmanager should then flip off the raycasting via its own unique hitobject bool and stop the hit loop animation bug.



Also, I'm almost positive this will have to be a stand alone build, as I am not seeing a way currently to modify the animation system without editing the base files. The base files need added bool triggers to figure out what is happening, when, and this cannot be done, as I understand it, with reflection nor at the speed it needs to. I'll keep exploring though. I could be wrong.

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

Re: Cracking Open Combat

Post by l3lessed » Wed Aug 28, 2019 5:12 am

Well, Collisions are officially in. I will probably try to mess with frame switches little more to see if I can smooth out some of the transitions back to idle.

However, other than the vanilla poor 2d animation system, it seems to be in and working. Each raycast hits, when it hits, it triggers a hitobject switch in the animation updater, which then increases animation time and begins reversing frame count from the current animation position. Once it hits frome 0, it switches back to idle state and animation.

Here is a quick playthrough, until I get rolled by an imp.


I personally am liking the feel more. Weapons feel like they have some physics and weight to them.

I may try and see if I can do something different animation wise for hitting an actual enemy. Maybe I will send the player back to idle faster without the giant recoil animation to try and simulate a weapon pull back.

User avatar
Jay_H
Posts: 2712
Joined: Tue Aug 25, 2015 1:54 am

Re: Cracking Open Combat

Post by Jay_H » Wed Aug 28, 2019 6:05 am

Weapon swings simulating material weight and momentum... What a time to be alive. My big pull for this is dodging/blocking/parrying but this is impressive too.

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

Re: Cracking Open Combat

Post by l3lessed » Wed Aug 28, 2019 3:40 pm

Blocking/parry is next. I first needed to sort out how to simulate hits, and manipulate the animation system.

Then release and smoothing out coding, raycasts, and animations as I get feedback and maybe some assists.

Ommamar
Posts: 334
Joined: Thu Jul 18, 2019 3:08 am

Re: Cracking Open Combat

Post by Ommamar » Wed Aug 28, 2019 5:07 pm

Doing great work it is noticeable when you make contact with something but not to over the top so it feels like enemies and walls are made of rubber.

I am curious and sure this would be a future expansion but how hard do you think it would be put these combat effects into enemy weapon casts? It is great to see my swings having a more realistic reaction to the environment, it would be even more dynamic to see the NPC enemies having to deal with the same factors.

Post Reply