Page 1 of 7

[MOD] Shield Module

Posted: Thu May 28, 2020 12:59 am
by l3lessed
Current Release: 4.2: 10.28+ Compatibility, NPC vs NPC Parry added, Bug Fixes

I'll be releasing the shield module as a stand alone mod, so I will keep its development tracked under this thread.

Currently works by converting and drawing a shield png on the users UI. From their, I use offsets to give it animation appearances.

Current Features:
  • Complete: Basic Animations:Raise, Lower, Hold, Walk Bob, On Attack, & On Hit, On Hit Vulnerable.
  • Complete: Formula Helper Override to Block Damage and redirect the damage to fatigue cost.
  • Complete: All animations are built with and controlled by coroutines to ensure animation accuracy and smoothness; also allows for more complicated animation transitions.
  • Complete: Alternative hand detection and swap shield.
  • Complete: Detect if shield is equipped to allow for blocking at all.
  • Complete: Detect if buckler/targe or kite/heater and load appropriate shield texture..
  • Complete: Tie fatigue costs and shield raise/lower speed to enemy damage and block skills for scaling.
  • Complete: Adjustable Mod settings to allow player full control of mod balance/properties, including turning on and off shield bobbing.
  • Complete: Basic Timed block mechanics for all shields. If you block and attack right before you finish raising your shield, you will do increased knock back, and have a chance of a slight stun and enemy hit animation.
  • Complete: Animation manager controls animation coroutines; ensures only one coroutine thread is running at a time and animations transition from one another smoothly.
  • Complete: Make buckler unique. It will not be holdable, but will have a very large time block window and raise and lower much quicker than all the other shields. All successful timed blocks with it will also activate an automatic shield bash that deflects % of enemy damage based on the timing of the block. Closer to end frame = more damage.
  • Complete: Added audio feedback hits and raising shield.
  • Complete: Added a weapon management system as part of the shield mechanics system.
  • Complete: Classic animation mimic system to blend mod into original df.
  • Complete: Added a shield bash that heaters and kites can do. Knocks enemies back and damages them based on strength; cost noticeable stamina if spammed.
  • Complete: Setup proper namespace and class objects and properties for other developers/modders to use for patches and sub-features.
  • Complete: Setup developer documentation for creating sub-mods and patches.
  • Complete: Setup developer package with documentation to support developer sub-mods and patches.
Possible Future Features:
  • Make Tower shield unique can be placed, like real tower shields. This could allow the player to create cover if fighting multiple enemies, including ranged variations or control the flow of battle and positioning.


Again, thanks to Olgimpy & Daggerdude on the shield art work. They provided the shield art.

Test/Example Videos.

Re: Shield Module

Posted: Thu May 28, 2020 3:08 am
by Vomitaburger
I really like this! Maybe i would remove of reduce the back and forth animation since the other hand doesnt move when you walk, but i'll probably be using it either way.

The thing i'm most concerned about is balancing, like do these new functionality straight up makes your character stronger? and by how much? Do shield still give armor on top of the blocking action they can now do?

Re: Shield Module

Posted: Thu May 28, 2020 6:30 am
by l3lessed
This is meant originally as a module built around my combat overhaul project, so it will be balanced considering those needs. This will include a rework of how armor functions.

However, I will put in mod settings to allow users as much control as possible, including toggling the walk bob effect. I still want vanilla users and others to be able to ensure it can be balanced around their needs and builds.

The weapon bob was put in because it looks good in my combat overhaul project because all weapons have a weapon bob built into them when playing on that build.

As of now, shields will still function normally when it comes to armor. This won't be game breaking in my opinion, because they didn't add tons of armor or really affect the overall survivability of most encounters and build types.

Re: Shield Module

Posted: Thu May 28, 2020 2:40 pm
by King of Worms
I really like it, great job!!

Re: Shield Module

Posted: Fri May 29, 2020 1:02 am
by l3lessed
Nothing really flashy to show, but I did get the code all cleaned up, restructured, and much more responsive.

I removed bunch of place holder properties and code and put in a proper object setup to pull the shields values.

I also chopped out some redundant bool switches and collapsed it down to a single bool switch that is blockStart and blockFinished.

I also updated my lerp calculator to use proper cycles. Now, I merely put in how many cycles I want and for it not to loop, and it will loop through the lerp calculator. I coupled this with a breathe switch.As an example, now, the bob animation is a single routine reference with some input vars for controlling how the animation looks.

The biggest benefit of all of this is I can now transition between differing animations, even when one is activated in the middle of another. This allowed me to improve shield feedback mechanics by allowing a block hit animation as the shield is being raised. Now the shield continues to move, but also resizes for the hit animation at the same time.

This should allow me now to build the more precise timed block systems and mechanics, including a shield bash activation at the end of the targe shield raise (The player would have a very short window to press attack to activate it before the shield goes back down automatically). Done for today.

The final goal, coding wise, will be to move all the calculation code into a coroutine with a return, so as to ensure timing lines up 100% with frame calculations/renders. This would help ensure any small weird delta time calculations dowt go buggy if the update routine goes slightly out of sync with the frame render itself. Right now, the shield rect is dropped into a coroutine, and that helped a tone, but moving the calculation code into one too would both help with script load and ensuring times line up.

Re: Shield Module

Posted: Sun May 31, 2020 9:59 pm
by enderandrew
Looks great!

Re: Shield Module

Posted: Mon Jun 01, 2020 5:46 pm
by l3lessed
Thanks, release 1.0 is almost here.

I'm polishing how the animation system will work. Setting up a framework for future mods of my own and for other modders.

As of now, I have created an png importer, an animation creator/manager, and a automatic lerp calculator that can be used in the future or mine or other mods.

I'll release once I get over this last little coding bump. I need to create a way to retrieve the current position of the image coordinates and pass them into the rect, while also storing them in a globally retrievable var. But the way it is setup right now, I'm running into a dumb, nub logic loop issue. My update value is setting the store value causing them to feedback into each other and create a ton of issues.

Re: Shield Module

Posted: Tue Jun 02, 2020 5:34 pm
by l3lessed
Jeez, was this a coding hurdle, but I finally figured out how to properly setup and use coroutines to create a complete animation management system for this mod.

In short terms, what it does, is load individual ienumerator objects, checks to see if they are a new ienumerator object, and if so, stops the previous coroutine, records the animation values, passes them, and then starts the new loaded object/animation; Once finished, it stops the current animation/object from running and outputs a true to demark being finished. It will also detect if the previous animation has finished, and will reset the animation/object so it will retrigger if you want.

Also, with the animation manager being a bool output, you can do fun things, like setup an if-then trigger with it, and once the animation ends, have the code execute something. As an example, I used it to detect when the onhit animation finishes, and then trigger the player fatigue cost for blocking a hit. This if-then setup took me from 20+ lines of code to get this fatigue cost done, down to 4.

The most important part though is that this ensures there is no unneeded script cycles or loads being used in the background. Every single coroutine is stopped/destroyed the moment it finishes execution. This includes the onscreen gui draw and block monitoring code. When you put your weapon down, the script load goes to nothing. And, when using it, the script load is a single script thread, using a fraction of the cpu process.

Without this, the cpu demand and waste to properly move the image around, maintain positioning, and register everything clearly had a memory leak some where in it. Not only that, it is just better object design to manage instances/objects of coroutines than to just start creating of unique ones over and over.

I'll be dropping a pre-release of the mod on this forum. I'm not sure yet if I will drop a release on nexus right now, or wait until timed block system is build.

Buckler/Targe with new animation manager system.

Heater/Kite with new animation manager system.

Re: Shield Module

Posted: Wed Jun 03, 2020 9:25 pm
by l3lessed
version 1.0 is released, now with proper keybinding setup for mouse and keyboard inputs. You can now setup your combat like a modern fighter. Change activate to E, set attack to left Mouse, block to right mouse, and dodge to middle mouse.

Re: Shield Module

Posted: Wed Jun 03, 2020 9:49 pm
by Jay_H
Any reason you wouldn't want this moved to Released Mods, |3lessed?