• 🏆 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!

Physics Master v 1.4

This Pack contains 4 Spell Templates which are related to physics and simulation of different laws.

They are mostly 'Throw Missile' Spells, so they would fit better in a Warlock-like Arena than a Melee-game.
Uses Jass New Gen Pack and the map should use 'Bound Sentinel' (credits to Vexorian). If 'Terran Pathability' (credits to Rising_Dusk) is imported to your map, the objects will be reflected by unwalkable terrain.

The Spells are:
Holy Chain: Summons 2 Balls of Light which will fly into the target direction. The balls are connected by an invisible Spring which follows Hooke's law. When hitting a unit, the balls will stick to them, healing or damaging their target proportional to the length of the spring. The Unit's death will release the balls again. Should the balls come to close to eachother or stick on the same unit, they will deal damage to their targets and explode.

Divine Attractor: Summons a Ball of godly might which will fly towards the target direction and attracts all Physics objects (Holy Chains, Divine Attractors and Gods Fists) with Newtons law.

Gods Fist: Summons an inert Missile which will accelerates towards the target, but is slowed down by friction. Upon hit, it heals or damages the target.

Repulsion: Repulses all Physics objects (Holy Chains, Divine Attractors and Gods Fists) with an inverse Newtons law.

The library contains functions that will allow you to create missiles which react similar to these, but look completely different.

Features:
-Highly Configurable, Spell Instances can have different atrributes
-MUI
-leakless
-reflections on cliffs/strcutures/doodads/destructables/all unwalkable things in general
-objects affected by terrain height

Disadvantages:
-no support of channel spells
-bigger amounts of Divine Attractors will lag

Changelog:
v 1.0 - not uploaded, simple converted GUI
v 1.1 - first uploaded version, uses vJass, increased performance a lot
v 1.2 - changed code to a System, created Create-Functions for all Spells
v 1.3 - supports TerrainPathability
v 1.4 - supports Terrain Height

Keywords:
Physics, Missile, Newton, Kepler, Hooke, Coulomb, Spring, Planet, Inertia, Paladin, Holy, Divine, Light
Contents

Noch eine WARCRAFT-III-Karte (Map)

Reviews
10:28, 10th Aug 2010 The_Reborn_Devil: Ah, finally something with physics in it. Hmm, nice. It would be more awesome if the balls actually collided with the terrain though :D I see you've made it easier to configure now too ^^ Status...

Moderator

M

Moderator

10:28, 10th Aug 2010
The_Reborn_Devil:

Ah, finally something with physics in it.

Hmm, nice. It would be more awesome if the balls actually collided with the terrain though :D
I see you've made it easier to configure now too ^^


Status: Approved
Rating: Highly Recommended
 
Level 7
Joined
Jun 6, 2010
Messages
224
meh all these math functions really confused my tiny brain ='[

+ The globals give the user flexibility of configuration
+ Very well coded (even though confusing for some... like me!)
+ Leakless

I'll give it a 5/5

Also this could be done in JASS or GUI xD
All you use is functions, others just use Structs in vJass in cost of less variables. Well i guess either works just fine by me.

+rep

P.S>

Could you add some unit revival system and document your spells better by also adding hotkeys and a better description? Multi Level Instaneable is also what we want to see.
 
Level 14
Joined
Nov 18, 2007
Messages
1,084
You should post your spell code here to make it easier for people to review.

Anyway, you shouldn't have categorized your spell pack as vJass since you're only taking advantage of global declaration. As Prince.Zero mentioned, this could have been done in vanilla Jass.

There are also some problems with your code as well:

  • You should make each spell independent from each other. In other words, each spell should have its own trigger. This makes it easier for the user to choose which spell he wants to use instead of having to have one trigger that contains all of the spells, even if he only wanted to use one of them. Upon testing the spells, I see that you have a nice synchronizing effect with the spells. However, I still would advise you to have separate triggers.
  • Your invulnerable check isn't fool-proof since not all units will have that ability when invulnerable. Also, when checking to see if a unit is magic-immune or not, you should use IsUnitType(YourUnit,UNIT_TYPE_MAGIC_IMMUNE) instead of the ability check.
  • Use Get/SetWidgetLife instead of Get/SetUnitState.
  • You're creating and destroying dynamic groups. You should have just used one global group variable for your group enumerations.
  • The animation thing with call AddUnitAnimationProperties( u1, "alternate", true ) should have been done in the Object Editor.
My own thoughts:
The effects for the spell were nice.
It seems like this would be much more useful if it was a system...
 
You should post your spell code here to make it easier for people to review.

Anyway, you shouldn't have categorized your spell pack as vJass since you're only taking advantage of global declaration. As Prince.Zero mentioned, this could have been done in vanilla Jass.
Is there a way to define globals in Jass without these annoying udg_'s? If so, i'll change it.
There are also some problems with your code as well:

  • You should make each spell independent from each other. In other words, each spell should have its own trigger. This makes it easier for the user to choose which spell he wants to use instead of having to have one trigger that contains all of the spells, even if he only wanted to use one of them. Upon testing the spells, I see that you have a nice synchronizing effect with the spells. However, I still would advise you to have separate triggers.
The problem is that all triggers refer to eachother. They use the same cast trigger and the same timer. Splitting them into multiple triggers would be confusing.
  • Your invulnerable check isn't fool-proof since not all units will have that ability when invulnerable. Also, when checking to see if a unit is magic-immune or not, you should use IsUnitType(YourUnit,UNIT_TYPE_MAGIC_IMMUNE) instead of the ability check.
  • Use Get/SetWidgetLife instead of Get/SetUnitState.
  • You're creating and destroying dynamic groups. You should have just used one global group variable for your group enumerations.
I'll add that with the next update
  • The animation thing with call AddUnitAnimationProperties( u1, "alternate", true ) should have been done in the Object Editor.
It could not. Its one of the few things that is not configurable, but its mostly invisible anyway except with the dummy i use. This one has 2 death animation: Death, the Ball simply collapses to a point and disappears. Death Alternate, the Ball explodes. The alternate animation is for the double-free, when the holy chain explodes. But i'll remove it with the next update and add a special effect.
My own thoughts:
The effects for the spell were nice.
It seems like this would be much more useful if it was a system...
Would be a hell to trigger this as a system. Maybe a simple version with friction and gravity, but not this.

@Anachron: Its difficult to think of anything that could change upon level-up.

Thanks for the feedback, i'll update it probably next weekend.
 
Level 19
Joined
Feb 4, 2009
Messages
1,313
I saw your system @inwarcraft ( http://warcraft.ingame.de/forum/showthread.php?t=203390 )
and I was very impressed of it since I never thought about such a simple way to calculate movement
unfortunately trigonometric funtions are faster since the implementation of arithmetics in wc3 is rather crappy
nice idea though

edit:
just read the thread again and it seems like you changed the code
without this original idea it's rather boring :/

edit2:
checked the map and it still contains the old code to watch at it
I don't really like the spells since they are rather boring in my eyes but the coding is nice 5/5

edit3:
the map which is attached here, unlike the one @ inwarcraft, does not have these codes so the idea is gone and I think without it I would probably change my rating to 3/5
please add them again

edit4:
too lazy to follow this thread
just make things even a little bit better
I'm sure you are doing that so I'll leave rating at 5
 
Last edited:
Since you read the discussion at inwarcraft, you know the reason why i changed the code. It was a good idea, but not better than the other way. But the original idea, having a cartesian coordinate system, is still there. But i will add the old triggers with the next version. For those who can not read german:
I originally used
JASS:
    r=SquareRoot(dx1*dx1+dy1*dy1);
    dx=dx1/r;
    dy=dy1/r;
to calculate the speeds in x and y direction. So the whole system was based on catresian coordinates and never mentioned the word 'angle'.
 
Level 14
Joined
Nov 18, 2007
Messages
1,084
Is there a way to define globals in Jass without these annoying udg_'s? If so, i'll change it.
Probably not. It's just that it would be nice to see other usage of vJass instead of those globals. =P
The problem is that all triggers refer to eachother. They use the same cast trigger and the same timer. Splitting them into multiple triggers would be confusing.
It could not. Its one of the few things that is not configurable, but its mostly invisible anyway except with the dummy i use. This one has 2 death animation: Death, the Ball simply collapses to a point and disappears. Death Alternate, the Ball explodes. The alternate animation is for the double-free, when the holy chain explodes. But i'll remove it with the next update and add a special effect.
Would be a hell to trigger this as a system. Maybe a simple version with friction and gravity, but not this.
Alright then.
@Anachron: Its difficult to think of anything that could change upon level-up.
There are lots of things that could be changed upon level. For example, the healing and damaging done in God's Fist. The spell target area for Repulsion. The duration for the balls in Holy Chain. Be creative. =D

Also, you can use GetTriggerPlayer() instead of GetOwningPlayer(u). It's a bit faster and easier to type. Not really important, but it's nice to know.
 

Rmx

Rmx

Level 19
Joined
Aug 27, 2007
Messages
1,164
The Coding and the idea is really nice, but the special effects are very boring and dull :(

I do like special effects and explosions alot, the trigger work very very smooth but !
You need creative special effects :D so i rate it 4/5 the 4 is for triggering hehe :)
 
May I ask you, why did you make this in vJass?
I could make this one in GUI, so please, explain me why vJass.

because of the Global declarions without udg_...

and I guess he is much comfortable with vJASS/JASS rather than GUI... I also think that you should not ask that question since its a matter of preference of the coder... ^^
 
Well, here is an update, as promised. I fixed some of the points that were mentioned and changed the whole pack to something more system-like. All attributes except detection/disable radiuses are now Instance-spezific, so it now supports multiple levels. But since i were not creative enough to think of any, i simply added a random factor to the spells to demonstrate the principle.

To make the creation of similar spells more easy for the user, there are now Create-Functions which take all neccesary parameters and create the Physix Object for you.
 
Looks like i had enough freetime for another update. The Objects will now rebounce from walls if TerrainPathability is imported to the map. Next step will be the terrain height, but i dont think i'll manage that this weekend.
They just keep coming, i cant help it: The Update for the Terrain Height is there along with Friction for Holy Chains and Divine Attractors. But now i'm low on ideas, so any suggestion what i might add would be appreciated.
 
Last edited:
Level 16
Joined
Jul 4, 2008
Messages
1,106
Well, im not sure of this, but as this is a good system, people might want to use it.
So, maybe add a "Requires Jass newgen pack" in the desc? And a link where to get it.

EDIT: Maybe add a effect on object high-speed?
For examble; if it goes EXTREMELY fast, it well... drags the nearby objects with it.
Liek tornadoes do, ye know.
 
Uses Jass New Gen Pack and the map should use 'Bound Sentinel' (credits to Vexorian). If 'Terran Pathability' (credits to Rising_Dusk) is imported to your map, the objects will be reflected by unwalkable terrain.

read the description properly, i mention it. And for the link: i dont even know how i got jngp for myself.
 
Level 8
Joined
Aug 2, 2008
Messages
193
I would use structs and much more vJass possibilities than just scopes and libraries. The code looks horrible in my eyes. You indexing system isn't good to read even if it works. The system doesn't support custom filtration nor possibilities to control the missiles in mid air. Creating a struct for the missiles with function interfaces like onUnitHit, onLoop ect would be much better. Also a struct which can be used like a "Missile-Type" Struct would be good to store the values inside it and allows the user to react on Missile-Types when some missiles collides each other.
At the moment, the system is just a missile system written in jass, but signed as a vJass System because it uses libraries and free global declarations...
I don't think this system should not be rated as highly recommended unless the code will be changed to allow the user is allowed to do more with the missiles.

Kricz
 
Level 6
Joined
Aug 20, 2009
Messages
95
Have you even read the description? I shall repeat myself:
This system does not ude hashtables
This system requires the jass new gen pack
This system does not define the effects itself. You can use any dummy unit to create effects, even different effects for the same spell.

I HEARD YOU. I am saying that when I try to save it with JASSNEWGEN PACK it gives me one hundred errors when converting pjass to blizzard.j.
 
Top