• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Spinning Black Hole [3D] v1.8

Credits:
iAyanami aka Ayanami
- StunSystem
Bribe
- SpellEffectEvent, Table
Flux
- DummyRecycler
TriggerHappy
- UnitDex
Rising_Dusk
- GroupUtils
Nestharus
- WorldBounds
Vexorian
- BoundSentinel, dummy.mdx
AGD
- ResourcePreloader


As of version 1.8, the black hole explosion knockback is now 3D. The latest 2D version (1.7) is still
included in the bundle but will no longer be updated. Only the 3D version will be given future updates.

Since the 3D version is still new, there might be some unexpected bugs that you might encounter. If
you did, don't hesitate to share it with me.

Click on the "Preview Triggers" button below to view the codes.


Spell Description:
full





*v1.8
- The spell is now 3D
- The kinematics of the spell now uses a non-arbitrary formula for motion (this is acheived with the use of the included UnitMotion library)
- Other significant changes

v1.7
- Reorganized and optimized the code
- Now uses linked-list instead of dynamic indexing
- Restructured the configuration section
- Added more configuration
- Added some optional libraries
- Made StunSystem a required library
- Fixed a vulnerability for bugs regarding removed units causing FirstOfGroup() call to return null, causing the loop to exit prematurely
- Now uses a better algorithm for the thrown targets' motion
- Other changes

v1.6c
- Not uploaded

v1.6b
- Not uploaded

v1.6
- Added ResourcePreloader as an optional requirement
- Added WorldBounds as an optional requirement
- Now uses UnitAlive() native instead of not IsUnitType(unit, UNIT_TYPE_DEAD)
- Replaced local variables with global variables
- Other changes

v1.5c
- Added TimerUtils to the optional spell requirements
- Added to the configuration the option to account for the terrain walkability when moving units
- Used static ifs instead of normal ifs on constant booleans like PAUSE_UNITS
- Some other changes

v1.5b
- Added an optional spell add-on that ensures setting unit coordinates on walkable terrains
- Replaced Bribe's MissileRecycler with Flux's DummyRecycler
- Some small fixes

v1.5
- Added two additional optional libraries (StunSystem and MissileRecycler)
- Renamed variables to fit that of JPAG's naming conventions
- Stun duration is now fully configurable but only if StunSystem is found
- Removed the hashtable leftover
- Some other changes

v1.4c
- Added some optional libraries
- Replaced hashtables with dynamic indexing

v1.4b
- Replaced the all StringHash with integers
- Removed the configuration regarding to allow enemies as targets
- Replaced the 0.03 loop interval with 0.3125
- Removed the debug message leftover

v1.4
- Rewrote the code from GUI to Jass/vJass
- Replaced the periodic event with timer
- Added more configurations
- Replaced the configuration for Spinswitch with Spindirection where you can enter ANY POSITIVE integer for a clockwise spin direction, ANY NEGATIVE integer for a counter-clockwise spin direction, and a ZERO value to turn off the spin.
- Remade the configuration regarding the spell's formulas
- Combined the cast condition and action into one function
- Used some vJass features hence, now requires vJass Compiler

v1.3
- Pullspeed is now fully configurable ( base speed and acceleration )
- You can now configure if you want to use the default hardcoded motion formulas or if you want your own values
- Spin angle declination is also added to configuration
- Fixed the bug regarding allowing allies as targets
- added the abilities to configuration
- Fixed the bug regarding units being pulled out of map bounds
- You can now configure if you want the spell to pause targets or not
- Other changes

v1.2
- Added more configuration
- Other changes

v1.1
- Fixed some leaks
- Added more configurations
- Some minor changes

v1.0
- First upload
Contents

Spinning Black Hole v1.7 by AGD (Map)

Spinning Black Hole v1.8 [3D] by AGD (Map)

Reviews
05:53, 25th May 2016 Tank-Commander: V1.3 - Some of the problems I raised in my previous posts (notably the lag issue) still occur, I'm also curious why you bother having two separate equations for the same things through if you want your own formula...

Moderator

M

Moderator

05:53, 25th May 2016
Tank-Commander: V1.3 - Some of the problems I raised in my previous posts (notably the lag issue) still occur, I'm also curious why you bother having two separate equations for the same things through if you want your own formula or not - just make the normal formula configurable and set the default values to your one.


00:00, 12th May 2016
Tank-Commander: V1.2 - Did a full rundown of the updated version, I found a few problems (particularly when testing ingame) please see my post

10:30, 4th May 2016
Tank-Commander: V1.1 - Some of the issues from my previous post still persist, set back to needs fix

17:13, 2nd May 2016
Tank-Commander: V1.0 - Thanks for the submission to the spell section. There's a number of issues that need to be addressed - please see my post and update accordingly
 
I quickly went over your code and I noticed the following things:

Major:
- Please get rid of all the extra commenting, the configuration is 80% comments and would be significantly smaller if you didn't do that
- The same goes for most of the loop and cast triggers
- All the data calculated in the cast trigger could be put straight into the hashtable, you don't need the extra variables
- Likewise they can be accessed straight from the hashtable, variable assignment is doubled by this and the previous point
- When you pick a unit in a unit group always assign picked unit to a variable, you refer to it over 10 times

Minor:
- Timers should run every 0.03 seconds, not 0.02
- Instead of units move unit to point it's advised to used co-ordinates and SetUnitX/Y instead as it generates less lag
- Attacktype and Weapontype could be configurable
- You really don't need to filter hidden or illusion units, it's safe to assume that the spell should hit them
- Your learning tooltip doesn't have any level data; try to make your tooltips resemble other default tooltips (Level1 - information, Level2 - information or use a data: level1/level2/level3 format
 
V1.2 - There's no major issues that I can see (though I'm currently unable to run ingame tests which I will do once I'm back on my main PC) but I've spotted a minor issue or two

Edit: Tested ingame, here's a summary of my findings:

Major:
- While configured to not target allies, the spell affects allies
- Multiple casts on nearby targets lags heavily due to the spell affecting both units
- Allies are not stunned by the spell (may be related to my first issue
- Pausing units is generally not advised, in this case it makes the ability rather overpowered in any setting - this should be configurable at least
- The pulling can pull units out of the playable map bounds
- units will still get knocked back even if they are exceptionally far from the spell so long as it affected them at some point
- Last created unit is referenced a lot without going into a temporary variable at any point
- There's a lot of hard coded numbers used in your calculations (such as in the line " Set SBH_SBHPullAngle = (SBH_PullAngle - ((Power((((Load (Key Radius) of SBH_Key from SBH_Hash) - SBH_TargetDistance) / 10.00), 2.25)) / 1600.00)) what are these hardcoded values for and why are they not configurable? The one I reference here is just an example, the point extends to all calculations using numbers like these

Minor:
- The ability itself could be a configurable just to avoid the need to go into and modify the other triggers
- The DoT should be an optional feature for units being knocked back (as it doesn't make much sense, particularly with no effects)
- The amount of effects created by the black hole should be controllable through the config
 
Last edited:

AGD

AGD

Level 16
Joined
Mar 29, 2016
Messages
688
The reason I converted the spell from GUI to Jass is because of this lag issue. I can't think of another solution aside from yours. But since I think it will be more realistic if multiple black holes can interact with each other, I converted it to Jass to cut many function calls by using natives and also i used globals instead of constant functions in the configuration to minimize more function calls. And now the result is significantly less lag (Just don't target too many units lets say 80+ units which in this test map is 4 creep camps).
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
StringHash is not a commonly used function, even though it could make the code mroe readable. Still, I would change all StringHash calls to an integer.

The target filter logic is flawed. "If false == false" will return true and that will mess up the intended targets when combined with "or".

You could try to find an alternative to PauseUnit. It pauses expiration timers for example.

It might not be a good idea to damage units 33 times per second, especially if one was to use this with a damage displaying system.

SetUnitScale Only requires the first parameter, the rest can be left to zero.

There is a debug message in the code and it is not deactivated.

It looks like the spell is not registered for neutral player.

GetUnitState( picked, UNIT_STATE_LIFE ) > 0 does not work correctly. 0.405 is the correct value. IsUnitType(unit, UNIT_TYPE_DEAD is a better solution.
 

AGD

AGD

Level 16
Joined
Mar 29, 2016
Messages
688
Im inclined to ask before use:
is this multiplayer compatible or campaigns only ?
Im not sure, how do I know if it is multiplayer compatible or campaign only?

After removing the pause unit, the spell tends to lag a bit at the instance of cast for unknown reason. And also I tried using your pause concept - the channel ability used to pause units but one problem is that after the channel ability is removed from the units, they are able to move even if they are stunned( units should be stunned after the black hole's explosion ) .
 
Last edited by a moderator:
V1.4c - Firstly I'll apologize for my absence making this review a bit later than it ought to be
Eitherway the restructured code is very good, the lag issue has been resolved, I only have these two small things that stuck out to me:

Two nearby casts can interfere with the scaling of the other making it incorrect - a "shrink targets" configurable may be appropriate to resolve this though it's only minor
GetWidgetLife is faster than GetUnitState(unit, UNIT_STATE_LIFE) sadly there is no equivelent for mana

Since these are the two only real issues I could locate in the code I've decided to approve this - it's a good spell and I applaud the effort you took in re-coding the entire thing
 

AGD

AGD

Level 16
Joined
Mar 29, 2016
Messages
688
V1.4c - Firstly I'll apologize for my absence making this review a bit later than it ought to be
Eitherway the restructured code is very good, the lag issue has been resolved, I only have these two small things that stuck out to me:
Thanks for the review. Maybe I'll update sometime.

a "shrink targets" configurable may be appropriate to resolve this though it's only minor
Btw, by setting these values to 0 (UNITSCALEREDUCTIONBASE and UNITSCALEREDUCTIONPERLEVEL), the SetUnitScale will not run.
 
Last edited:

AGD

AGD

Level 16
Joined
Mar 29, 2016
Messages
688
Updated to v1.5
- Added two additional optional libraries (StunSystem and MissileRecycler)
- Renamed variables to fit that of JPAG's naming conventions
- Stun duration is now fully configurable but only if StunSystem is found
- Removed the hashtable leftover
- Some other changes
 
Level 8
Joined
Jun 13, 2008
Messages
344
this is the best ever done black hole simulation spell for wc3. But I think you should hide those absorbed units at the hole location, seeing them very small and colliding with each other kinda breaks the immersion imo.
 

AGD

AGD

Level 16
Joined
Mar 29, 2016
Messages
688
this is the best ever done black hole simulation spell for wc3. But I think you should hide those absorbed units at the hole location, seeing them very small and colliding with each other kinda breaks the immersion imo.
Thanks for your feedback. I once tried implementing that, however, the ShowUnit(unit, true) is just a little less heavy than CreateUnit() and causes a brief lag at the instance of explosion.
I might add the feature if I can find an alternative way though.
 
Level 8
Joined
Jun 13, 2008
Messages
344
Thanks for your feedback. I once tried implementing that, however, the ShowUnit(unit, true) is just a little less heavy than CreateUnit() and causes a brief lag at the instance of explosion.
I might add the feature if I can find an alternative way though.
Yeah like I said, we're not supposed to see them since they are probably transfered to past/present/parallel universe:)...but this is just an idea, spell is very good as it is.
My second question would be; those who are devoured into the "event horizon" are out of control(disabled) of player,right?...and they can still get attacked/damaged by at least AoE spells?

Rated 5/5 btw.
 
Last edited:

AGD

AGD

Level 16
Joined
Mar 29, 2016
Messages
688
UPDATED to v1.7

- Reorganized and optimized the code
- Now uses linked-list instead of dynamic indexing
- Restructured the configuration section
- Added more configuration
- Added some optional libraries
- Made StunSystem a required library
- Fixed a vulnerability for bugs regarding removed units causing FirstOfGroup() call to return null, causing the loop to exit prematurely
- Now uses a better algorithm for the thrown targets' motion
- Other changes
 
Top