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 > Tutorials > JASS/AI scripts tutorials
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 05-15-2007, 04:49 PM   #31
grim001
requires vJass
 
grim001's Avatar


Code Moderator
 
Join Date: Nov 2006
Posts: 1,540

Submissions (10)

grim001 is just really nice (277)grim001 is just really nice (277)

Send a message via AIM to grim001
Default

Handle vars are slow and buggy (everything that uses I2H), and if you have never experienced the need for speed you must be making very simple and boring abilities or very simple maps.
grim001 is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 05-15-2007, 04:49 PM   #32
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

Quote:
It's just that I don't see the point in all that, handle vars/attachable vars are fast enough, with a combination of CS recycling it lags less, and that's cool enough. Why do you need it to be so fast? What are you making that needs such speed? Maybe I'm crazy, but this is just too much for me.........

Structs are safer, they're faster, they're more reliable, etc.
They allow you to do much more intricate things without overloading your code with unnecessary lines.
They're really convenient and helpful if you know how to use them.
__________________
Rising_Dusk is offline   Reply With Quote
Old 05-15-2007, 07:18 PM   #33
UnMi
User
 
UnMi's Avatar
 
Join Date: Aug 2006
Posts: 213

Submissions (1)

UnMi is on a distinguished road (18)

Default

But still, you cannot ever entirely take out Handle Vars. There are always situations where you have to attach the struct data to a certain handle (doesn't have to be a timer). And here goes the question: Shouldn't SetHandleInt/Real/String/Boolean be safe enough to do that? I could swear I read somewhere that non-I2H's are not buggy at all.
UnMi is offline   Reply With Quote
Old 05-15-2007, 07:30 PM   #34
Silvenon
User
 
Silvenon's Avatar
 
Join Date: May 2007
Posts: 492

Submissions (1)

Silvenon will become famous soon enough (63)Silvenon will become famous soon enough (63)Silvenon will become famous soon enough (63)

Send a message via MSN to Silvenon
Default

If they are slow, that means they lag when called many times in a short period, right? Well, I made a spell that calls Sin and Cos both 3 times, uses about 5 handles and sets 1 handle, all that happens each 0.035 seconds for a few seconds, it didn't lag. (maybe that is simple)

Now, the buggy side, I have never experienced a bug with handles, everything always worked for me, so I can't respond to that, as for the bug related to timers, there is CSSafety for that

But it seems I don't know what I'm talking about, so my conclusion is that you're right. I would really want to know how to make complicated spells, but I don't have imagination and I would really want to learn how to work with structs, but I'm just too lazy learning another system (I'm already having trouble with CSCache)

It seems like Vexorians free time grows on trees

Sorry if I have been rude, it's because I envy you guys

Last edited by Silvenon : 05-15-2007 at 07:32 PM.
Silvenon is offline   Reply With Quote
Old 05-15-2007, 08:05 PM   #35
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

Quote:
Now, the buggy side, I have never experienced a bug with handles, everything always worked for me, so I can't respond to that, as for the bug related to timers, there is CSSafety for that
CSSafety cannot stop everything.
And just because you haven't experienced one doesn't mean they are not there.
H2I()/I2H() is the source of the bugs, since it's not safe to convert those types back and forth haphazardly and also because lots of things can corrupt the handle indicies in WC3.

And slow is relative.
If you ran 10000 iterations on a system with cache versus a system with parallel array structure (Structs, for example) you would find cache to be nearly 6 times slower.
(Or something like that, Vex posted the results awhile back)

So no, in common use with only a few hundred calls a minute there really isn't a noticeable difference.
But a difference is there, and it can add up fast.

Quote:
But still, you cannot ever entirely take out Handle Vars.
Sure you can, anything done via handles can be done just as effectively by other means.
It just generally takes more work and more code to do so, though not always.
__________________
Rising_Dusk is offline   Reply With Quote
Old 05-16-2007, 01:49 PM   #36
Silvenon
User
 
Silvenon's Avatar
 
Join Date: May 2007
Posts: 492

Submissions (1)

Silvenon will become famous soon enough (63)Silvenon will become famous soon enough (63)Silvenon will become famous soon enough (63)

Send a message via MSN to Silvenon
Default

Quote:
And just because you haven't experienced one doesn't mean they are not there.

I know.

I just wanted to say that I have never seen such complicated spells that needs so much speed

You obviously didn't the ending part of my message, it was really nice :)
(I said that you're right)
Silvenon is offline   Reply With Quote
Old 05-16-2007, 01:53 PM   #37
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

Admitting someone is right doesn't make it any nicer than kindly telling them they're wrong.
I'd feel more accomplished convining you than having you just "give in."
__________________
Rising_Dusk is offline   Reply With Quote
Old 05-16-2007, 02:51 PM   #38
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

Quote:
Originally Posted by Silvenon
I know.

I just wanted to say that I have never seen such complicated spells that needs so much speed

You obviously didn't the ending part of my message, it was really nice :)
(I said that you're right)
I've seen a massive quantity of them.

Take for instance this optical flare, it is an starcraft spell and it is supposed to have a lot of possible instances, with the previous method you would barely have 3 instances and it would make the game slow, with the new method you can have a lot of instances.

Better performance = more instances = good.

And if you ever play with people with low system specs (which are the majority in bnet since that's one of the reasons to keep playing wc3) they would have a really hard time and it will cause lag, and not make the game too comfortable.
__________________
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 05-16-2007, 08:48 PM   #39
Silvenon
User
 
Silvenon's Avatar
 
Join Date: May 2007
Posts: 492

Submissions (1)

Silvenon will become famous soon enough (63)Silvenon will become famous soon enough (63)Silvenon will become famous soon enough (63)

Send a message via MSN to Silvenon
Default

Ok, I understand why is it better, the spell I mentioned is multiinstancable so I made 3 instances of it, and it lagged, very much

It is just irritating that there is always something more I should learn, that is always better than things that I already know (tables, for example)

And the fact that I make simple spells and maps is depressing

I don't want to argue, I just explained my thought in a wrong way
Silvenon is offline   Reply With Quote
Old 05-20-2007, 01:43 PM   #40
Silvenon
User
 
Silvenon's Avatar
 
Join Date: May 2007
Posts: 492

Submissions (1)

Silvenon will become famous soon enough (63)Silvenon will become famous soon enough (63)Silvenon will become famous soon enough (63)

Send a message via MSN to Silvenon
Default

Heh, read the tutorial this time, it was far less complicated than I thought, that's why I had a negative reaction, sorry :P

I'm still not clear with one thing......I want to do something like this, but I doesn't seem to work......

Collapse JASS:
struct somedata
    integer i
endstruct

function Execute takes nothing returns nothing
    local timer t = CreateTimer()
    local somedata sd = somedata(GetAttachedInt(t, "sd"))
    //do stuff
    set sd.i = sd.i + 1
    if sd.i == 5 then
        call CleanAttachedVars(t)
        call DestroyTimer(t)
        call somedata.destroy(sd)
    else
        call AttachInt(GetExpiredTimer(), "sd", sd)
    endif
endfunction

function Blabla takes nothing returns nothing
   local timer t = CreateTimer()
   local somedata sd = somedata.create()
   set sd.i = 0
   call AttachInt(t, "sd", sd)
   call TimerStart(t, 0.01, true, function Execute)
endfunction

I think you'll understand what I want to do, it's quite self-explainatory

EDIT: And another thing, structs and tables don't go together, right?

Last edited by Silvenon : 05-20-2007 at 01:45 PM.
Silvenon is offline   Reply With Quote
Old 05-20-2007, 03:08 PM   #41
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

they "kind of " go together, as in you are free to use Get/SetTableInt to attach structs to tables.

Collapse JASS:
function Execute takes nothing returns nothing
    local timer t = CreateTimer()
    local somedata sd = somedata(GetAttachedInt(t, "sd"))
    //do stuff
    set sd.i = sd.i + 1
    if sd.i == 5 then
        call CleanAttachedVars(t)
        call DestroyTimer(t)
        call somedata.destroy(sd)
    else
        call AttachInt(GetExpiredTimer(), "sd", sd)
    endif
endfunction
__________________
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 05-20-2007, 03:39 PM   #42
Silvenon
User
 
Silvenon's Avatar
 
Join Date: May 2007
Posts: 492

Submissions (1)

Silvenon will become famous soon enough (63)Silvenon will become famous soon enough (63)Silvenon will become famous soon enough (63)

Send a message via MSN to Silvenon
Default

I did that mistake when I was posting here, not when I was testing, but thanks. Maybe I should just post my code:

Collapse JASS:
struct flamestrike_data
    unit u
    real d
    real a
    integer i
endstruct

function FlameStrikeSFX takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local flamestrike_data fd = flamestrike_data(GetAttachedInt(t, "fd"))
    local real x = GetUnitX(fd.u)
    local real y = GetUnitY(fd.u)
    local real x1 = x + fd.d * Cos(fd.a)
    local real y1 = y + fd.d * Sin(fd.a)
    call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Human\\FlameStrike\\FlameStrike1.mdl", x1, y1))
    set fd.i = fd.i + 1
    set fd.d = fd.d + 100
    if fd.i == 4 then
        call CleanAttachedVars(t)
        call ReleaseTimer(t)
        call flamestrike_data.destroy(fd)
    else
        call AttachInt(t, "fd", fd)
    endif
endfunction

function Trig_Structs_Actions takes nothing returns nothing
    local timer t = NewTimer()
    local flamestrike_data fd = flamestrike_data.create()
    set fd.u = GetTriggerUnit()
    set fd.d = 50
    set fd.a = GetUnitFacing(fd.u) * bj_DEGTORAD
    set fd.i = 0
    call AttachInt(t, "fd", fd)
    call TimerStart(t, 0.5, true, function FlameStrikeSFX)
endfunction

This should create 4 flame strike effects (maybe not 4, but that doesn't matter) when the caster casts Flame Strike, and it creates only one

If there are any leaks, please tell me

Last edited by Silvenon : 05-20-2007 at 03:41 PM.
Silvenon is offline   Reply With Quote
Old 05-20-2007, 04:10 PM   #43
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 model you used wouldn't really show anything when used like that.
__________________
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 05-21-2007, 09:32 AM   #44
Silvenon
User
 
Silvenon's Avatar
 
Join Date: May 2007
Posts: 492

Submissions (1)

Silvenon will become famous soon enough (63)Silvenon will become famous soon enough (63)Silvenon will become famous soon enough (63)

Send a message via MSN to Silvenon
Default

Oh, I didn't know that, thanks :)

EDIT: Why wouldn't it? Then how would it?

Last edited by Silvenon : 05-21-2007 at 11:05 AM.
Silvenon is offline   Reply With Quote
Old 05-21-2007, 03:36 PM   #45
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

DestroyEffect(AddSpecialEffect) is useful but it only plays the death animation of the effect, the effect you chose didn't have a death animation, not a noticeable one at least.
__________________
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
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 07:00 AM.


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