wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Resources > Code Resources > Samples
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 03-17-2007, 01:18 PM   #1
Daelin
Kelani Mage
 
Daelin's Avatar
 
Join Date: Oct 2003
Posts: 737

Submissions (48)

Daelin is a glorious beacon of light (474)Daelin is a glorious beacon of light (474)Daelin is a glorious beacon of light (474)Daelin is a glorious beacon of light (474)

Hero Contest - First place

Default Graphic System

The Graphic System is a library that makes certain graphical aspects in Warcraft 3 much easier.

Version: 1.3
Last updated: March 25 - 2007

Features
- Easily create primitive and more advanced static shapes such as circles, lines, spirals and more.
- Flexibility: manipulate the parameters of the shapes created in many ways.
- Geometrical checks
- Dynamic effect birth & death: create static objects with a slight delay between units composing them and destroy them in the same manner.
- Timed effects.
- Dynamic and static destruction of the effects.

Promising features to come
- Dynamic effects: orbiting around units/a certain point, dynamic wheels
- Lightning pools: effects with lightnings
- More static effects (eg: stars)

I expect criticism to fix possible leaks, flaws and problems. Suggestions are heartily welcome as this system is made for the modding community for great usefulness and easy implementability. Expect new versions.

History:

Version 1.0 - First version of the system with the basic static shapes (circle,arc,line,spiral,hypercycloid).
- Basic geometric checks.
Version 1.1 - Dynamic birth and death shapes included.
- Radius reduction function added for safety reasons.
Version 1.2 - GS_DestroyEffectDynamic() function added.
- Timed versions of both static and dynamic (fixed) shapes added.
Version 1.21 - Epicycloid shape added and fixed a small bug with hypocycloids.
Version 1.3 - Rose shape included
- Fixed major bug which caused imperfect (and most of the times incomplete) shapes.

Credits: Thanks to Vexorian for the dummy unit model.

~Daelin
Attached Images
File Type: jpg GraphicSystem.jpg (171.3 KB, 1618 views)
Attached Files
File Type: w3x Graphic System.w3x (57.6 KB, 1077 views)
__________________
I am Grand Magister Daelin Silverwing not Grand Admiral Daelin Proudmoore!!!




Last edited by Daelin : 03-25-2007 at 05:23 PM.
Daelin is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 03-17-2007, 01:40 PM   #2
Rising_Dusk
Obscurity, the Art


Projects Director
Project Leader: OD
 
Join Date: Feb 2006
Posts: 9,729

Submissions (27)

Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)

Hero Contest #3 - 1st PlaceApproved Map: Desert of ExileApproved Map: Advent of the ZenithHero Contest #2 - 1st PlaceHero Contest - Third place>

Send a message via AIM to Rising_Dusk Send a message via MSN to Rising_Dusk
Default

Collapse JASS:
function GS_Sin takes real angle returns real
   local integer k
   local real kr

   set angle = GS_ReduceAngle(angle)
   set kr = (angle-R2I(angle))*GS_Position()
   set k = R2I(kr)
   if (kr>(k+0.5)) then
      set k = k + 1
   endif

   set angle = R2I(angle)+I2R(k)/GS_Position()
   return udg_LSine[R2I(angle*GS_Position())]
endfunction
I just have to ask.
How is calling 4 wrapper functions (Each using at least 15 LoC) in a function that in itself has 13 LoC and is slower because it's a wrapper going to be faster than just calling Sin()?

While I realize Sin() is slow, I'll be damned if it's that slow.
Your Cos() replacement is negligibly better.

If you've done tests on it and somehow it is faster, then please cast aside my ignorance.
But seeing that just made lil' red alert lights go off in my head.

And erm...
Maybe it's ironic here, but your "GS_CircleQuick" function uses TSAs en mass inside of a loop.
That would be pretty... Slow, and inaccurate on BNet.
Timers would be far superior.

I really like the PART 5 stuff for geometric tests.
Some of those checks really aren't intuitive and in themselves are pretty useful to have 'round.

But yeah, looks like it would be useful for some people.
__________________

Last edited by Rising_Dusk : 03-17-2007 at 01:41 PM.
Rising_Dusk is offline   Reply With Quote
Old 03-17-2007, 01:41 PM   #3
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,898

Submissions (37)

Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)

Hero Contest #3 - 2nd Place

Default

The idea to use precalc for trig functions appeared in the forums one day. When I benchmarked stuff, native Sin was faster than a non-native function call... Of course, the one to blame would be blizz for making function calls so slow, but there you go.

Gamecache is not exactly the best idea. I would have done something like this:



Collapse JASS:
globals
   effect array GS_linked1
   effect array GS_linked2
endglobals

function GS_H2I takes handle h returns integer
   return h
   return 0
endfunction

function GS_LinkEffect takes handle pivot, effect which returns nothing
 local integer i=GS_H2I(pivot)-0x100000
    if (i>=16382) then
        call StoreInteger(udg_GSCache, "GS_Effect",I2S(i) , GS_H2I(which))
        //swapped it, this should be faster and take less memory since it will have a main hash and many values in that hash,
        // instead of a lot of hashes one value each
    elseif (i>=8191) then
        set GS_linked2[i-8191]=which
    else
        set GS_linked2[i]=which
    endif
endfunction

function GS_GetEffect takes handle pivot returns effect
 local integer i=GS_H2I(pivot)-0x100000
    if (i>=16382) then
        return GetStoredInteger(udg_GSCache, "GS_Effect",I2S(i) )
    elseif (i>=8191) then
        return GS_linked2[i-8191]
    endif
        return GS_linked2[i]
endfunction


edit: Darn dusk
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote
Old 03-17-2007, 01:46 PM   #4
Daelin
Kelani Mage
 
Daelin's Avatar
 
Join Date: Oct 2003
Posts: 737

Submissions (48)

Daelin is a glorious beacon of light (474)Daelin is a glorious beacon of light (474)Daelin is a glorious beacon of light (474)Daelin is a glorious beacon of light (474)

Hero Contest - First place

Default

The TSA was mistakenly left there... I forgot it there. Sorry bout that.

And indeed... I intuitively found that the Sin would be faster as it doesn't actually calculate the value. It's time to switch to Grimoire I guess.

Edit: Just saw Vex's post. What's wrong with gamecache anyway?

~Daelin
__________________
I am Grand Magister Daelin Silverwing not Grand Admiral Daelin Proudmoore!!!




Last edited by Daelin : 03-17-2007 at 01:47 PM.
Daelin is offline   Reply With Quote
Old 03-17-2007, 02:00 PM   #5
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,898

Submissions (37)

Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)

Hero Contest #3 - 2nd Place

Default

After seeing the whole graphics system and the precalc trig functions I guessed you were pursuing for speed?
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote
Old 03-17-2007, 03:23 PM   #6
Oglog
User
 
Oglog's Avatar
 
Join Date: Oct 2006
Posts: 101

Submissions (1)

Oglog has little to show at this moment (9)

Send a message via MSN to Oglog
Default

Wow looks very nice. And easy to understand and implement too. You should definatle contiue to develop it as i'm sure it will become very popular for making effects. Maybee you should check out http://www-groups.dcs.st-and.ac.uk/~...es/Curves.html if you haven't seen it allready.
__________________
Oglog is offline   Reply With Quote
Old 03-17-2007, 05:35 PM   #7
Daelin
Kelani Mage
 
Daelin's Avatar
 
Join Date: Oct 2003
Posts: 737

Submissions (48)

Daelin is a glorious beacon of light (474)Daelin is a glorious beacon of light (474)Daelin is a glorious beacon of light (474)Daelin is a glorious beacon of light (474)

Hero Contest - First place

Default

Oh yes Vex... about that, I just wanted to make certain effects as fast as possible (for example the Cos and Sin stuff).

I have a request if someone could nicely help me with it. Would anyone offer to test whether Sin is actually slower than my GS_SinQuick? Because of it isn't, I'll just drop those functions and focus on other aspects of the system.

Thanks Oglog... I was planning to implement other curves too. I remember some "flower" made out of multiple cusps I think. I may try to implement something like that too. As you find it useful I'm sure many others will, so what the heck? Time to continue with developing.

~Daelin
__________________
I am Grand Magister Daelin Silverwing not Grand Admiral Daelin Proudmoore!!!



Daelin is offline   Reply With Quote
Old 03-17-2007, 07:31 PM   #9
Oglog
User
 
Oglog's Avatar
 
Join Date: Oct 2006
Posts: 101

Submissions (1)

Oglog has little to show at this moment (9)

Send a message via MSN to Oglog
Default

Maybee a Sinusoidal where p = 2.5?
__________________
Oglog is offline   Reply With Quote
Old 03-17-2007, 07:55 PM   #10
weeg2
User
 
weeg2's Avatar
 
Join Date: Feb 2007
Posts: 67

weeg2 has little to show at this moment (4)

Default

oooooh soo preety
weeg2 is offline   Reply With Quote
Old 03-17-2007, 08:40 PM   #11
Av3n
Roar!
 
Av3n's Avatar


Project Leader: TBR
Project Member: PoC
 
Join Date: May 2006
Posts: 1,854

Submissions (7)

Av3n is a jewel in the rough (240)Av3n is a jewel in the rough (240)Av3n is a jewel in the rough (240)Av3n is a jewel in the rough (240)Av3n is a jewel in the rough (240)

Hero #4 extra-official winner2008 Spell olympics - Fire - BronzeHero Contest #3 - 3rd Place

Default

Isn't it iFraNe dummy model?

-Av3n
__________________

Thanks to FatherTime for the sig
.:
Current ProjectsSubmissions
Power of CorruptionMy Terrain
The Black RoadMy Resources
Strikeforce
Twitter
Av3n is offline   Reply With Quote
Old 03-17-2007, 10:00 PM   #12
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,898

Submissions (37)

Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)

Hero Contest #3 - 2nd Place

Default

It is my dummy model, I used INFraNe's model coordinates for animations the rest is mine (my version takes less space...)
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote
Old 03-17-2007, 10:52 PM   #13
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,898

Submissions (37)

Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)

Hero Contest #3 - 2nd Place

Default

Sin vs. DoNothing, the benchmark:

Collapse JASS:
function Trig_Melee_Initialization_Actions takes nothing returns nothing
 local integer sw=StopWatchCreate()
 local real t0
 local real t1
 local real t2
 local real t3
 local integer i

call TriggerSleepAction(5.)


    set t0=StopWatchMark(sw)
    set i=1000
    loop
        exitwhen i==0
        call Sin(GetRandomReal(0,7.283185))
        set i=i-1
    endloop
    set t1=StopWatchMark(sw)
    set i=1000

    loop
        exitwhen i==0
        call GetRandomReal(0,7.283185)
        call DoNothing()
        set i=i-1
    endloop
    set t2=StopWatchMark(sw)


    call StopWatchDestroy(sw)


call BJDebugMsg( "DoNothing: "+R2S(t2-t1)+" vs Sin: "+R2S(t1-t0) )
endfunction

"DoNothing: 0.122 vs Sin: 0.092"
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote
Old 03-17-2007, 10:54 PM   #14
Av3n
Roar!
 
Av3n's Avatar


Project Leader: TBR
Project Member: PoC
 
Join Date: May 2006
Posts: 1,854

Submissions (7)

Av3n is a jewel in the rough (240)Av3n is a jewel in the rough (240)Av3n is a jewel in the rough (240)Av3n is a jewel in the rough (240)Av3n is a jewel in the rough (240)

Hero #4 extra-official winner2008 Spell olympics - Fire - BronzeHero Contest #3 - 3rd Place

Default

So u used iFraNe animations in other words?

Lucky yr admin double poster

-Av3n
__________________

Thanks to FatherTime for the sig
.:
Current ProjectsSubmissions
Power of CorruptionMy Terrain
The Black RoadMy Resources
Strikeforce
Twitter
Av3n is offline   Reply With Quote
Old 03-18-2007, 02:02 AM   #15
Deathlust
User
 
Deathlust's Avatar
 
Join Date: Jan 2006
Posts: 401

Deathlust has little to show at this moment (1)

Send a message via AIM to Deathlust
Default

That is hawt... +rep... Even if it doesn't work correctly it's still hawt!
Deathlust is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 04:46 PM.


Affiliates
The Hubb The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2019, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services