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 10-14-2007, 03:22 PM   #31
TheSpanishInquisition
User
 
Join Date: Sep 2007
Posts: 8

TheSpanishInquisition has little to show at this moment (2)

Default

It would be a lot more efficient to store the x/y of the movement (i.e. a 2D vector) rather than the distance and angle, recalculating x/y every time.
TheSpanishInquisition is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 10-15-2007, 09:56 AM   #32
Pyrogasm
Lackadaisically Absent.
 
Pyrogasm's Avatar


Respected User
 
Join Date: Sep 2006
Posts: 4,523

Submissions (9)

Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)

Hero Contest - Fourth place

Send a message via ICQ to Pyrogasm Send a message via AIM to Pyrogasm Send a message via MSN to Pyrogasm Send a message via Yahoo to Pyrogasm
Default

Only if there was no decay in the knockback and you never wanted it to change angle. But yes, that would be a smarter way to do it.

In case you have no idea what he's talking about, instead of doing this:
Collapse JASS:
set dat.Cos = Cos(Angle)
set dat.Sin = Sin(Angle)
//...
set NewX = OldX+Distance*dat.Cos
set NewY = OldY+Distance*dat.Sin
You'd do this:
Collapse JASS:
set dat.XIncrement = Distance*Cos(Angle)
set dat.YIncrement = Distance*Sin(Angle)
//...
set NewX = OldX+dat.XIncrement
set NewY = OldY+dat.YIncrement

I do think, however, that the performance improvement over such a thing is extremely negligible.
__________________
Quote:
Originally posted by Rising_Dusk
Your spells are mostly ignored because they are not very cool so we aren't very excited to review/approve them, but you are incredibly persistent and won't give us an excuse to graveyard it. That is generally what results in a resource being ignored for a long time.

The Spell Request Thread Done for, unless someone else wants to revive it...
It lasted a damn long time.

Please; Ask for Help Appropriately














Quote:
Originally posted by Kyrbi0
Huh. Almost makes me wish I had a girlfriend, to take advantage of today (wait, no, that's not what I meant... I mean, take advantage of the fact that it is international women's day... gah, never mind).
Quote:
Originally posted by Pyrogasm
Rome may not have been built in a day, but the Romans sure as hell didn't say "look at this great city we built guys!" when they had nothing more than a bit of stone and some cottages.

Last edited by Pyrogasm : 10-15-2007 at 09:56 AM.
Pyrogasm is offline   Reply With Quote
Old 10-15-2007, 06:20 PM   #33
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

Love your examples Pyro :P

Quote:
I do think, however, that the performance improvement over such a thing is extremely negligible.

I totally agree.

Only one problem guys: the distance changes with each execution
__________________
Cascading Style Shit
Silvenon is offline   Reply With Quote
Old 10-15-2007, 08:18 PM   #34
Pyrogasm
Lackadaisically Absent.
 
Pyrogasm's Avatar


Respected User
 
Join Date: Sep 2006
Posts: 4,523

Submissions (9)

Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)

Hero Contest - Fourth place

Send a message via ICQ to Pyrogasm Send a message via AIM to Pyrogasm Send a message via MSN to Pyrogasm Send a message via Yahoo to Pyrogasm
Default

Quote:
Originally Posted by Me
Only if there was no decay in the knockback...
__________________
Quote:
Originally posted by Rising_Dusk
Your spells are mostly ignored because they are not very cool so we aren't very excited to review/approve them, but you are incredibly persistent and won't give us an excuse to graveyard it. That is generally what results in a resource being ignored for a long time.

The Spell Request Thread Done for, unless someone else wants to revive it...
It lasted a damn long time.

Please; Ask for Help Appropriately














Quote:
Originally posted by Kyrbi0
Huh. Almost makes me wish I had a girlfriend, to take advantage of today (wait, no, that's not what I meant... I mean, take advantage of the fact that it is international women's day... gah, never mind).
Quote:
Originally posted by Pyrogasm
Rome may not have been built in a day, but the Romans sure as hell didn't say "look at this great city we built guys!" when they had nothing more than a bit of stone and some cottages.
Pyrogasm is offline   Reply With Quote
Old 10-15-2007, 11:12 PM   #35
Themerion
Brahms-fan
 
Themerion's Avatar
 
Join Date: Jan 2006
Posts: 642

Submissions (2)

Themerion has a spectacular aura about (114)Themerion has a spectacular aura about (114)Themerion has a spectacular aura about (114)Themerion has a spectacular aura about (114)

Default

Quote:
Originally Posted by Pyro
Only if there was no decay in the knockback and you never wanted it to change angle.

At least in this tutorial, the angle is constant. If it's a linear movement; what prevents you from adding decay-x and decay-y? (thus avoiding angle-storage)

Collapse JASS:
// for each update
set xspeed=xspeed-xdecay
set yspeed=yspeed-ydecay
Attached Images
File Type: png linear movement.png (27.7 KB, 128 views)
__________________
Submissions::
(v)JASS Tutorial
Covers how to make fast and safe coding for common tasks in vJASS/JASS.
Creep Respawn System
It has never been easier to respawn creep groups...

Last edited by Themerion : 10-16-2007 at 12:20 PM.
Themerion is offline   Reply With Quote
Old 10-16-2007, 08:55 AM   #36
Themerion
Brahms-fan
 
Themerion's Avatar
 
Join Date: Jan 2006
Posts: 642

Submissions (2)

Themerion has a spectacular aura about (114)Themerion has a spectacular aura about (114)Themerion has a spectacular aura about (114)Themerion has a spectacular aura about (114)

Default

Two possible issues:

PauseUnit
I think you should mention in the tutorial that PausedUnits also have the duration of their buffs paused. This is critical if you script a spell and want the effect to stop when the buff goes away. That is otherwise a very convenient way of coding; because it will automatically stack with purge/dispel/etc.

(Check Funny Bunny's Egg Hunt for an example of a Pause+Buff bug. If you cast Shadow Egg Strike just before a minigame; the targeted player will lose like 150 eggs (over time) instead of 15)

Item Check
As far as I know; items can slip through very small spaces. For instance; if you have a single line of trees diagonally aligned; the item check might let a unit pass through there. I'd check some adjacent locations with the item too.
__________________
Submissions::
(v)JASS Tutorial
Covers how to make fast and safe coding for common tasks in vJASS/JASS.
Creep Respawn System
It has never been easier to respawn creep groups...

Last edited by Themerion : 10-16-2007 at 12:21 PM.
Themerion is offline   Reply With Quote
Old 10-16-2007, 01:41 PM   #37
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

Isn't this double-posting?

Quote:
PauseUnit
I think you should mention in the tutorial that PausedUnits also have the duration of their buffs paused. This is critical if you script a spell and want the effect to stop when the buff goes away. That is otherwise a very convenient way of coding; because it will automatically stack with purge/dispel/etc.

I'll add that in about an hour.

Quote:
Item Check
As far as I know; items can slip through very small spaces. For instance; if you have a single line of trees diagonally aligned; the item check might let a unit pass through there. I'd check some adjacent locations with the item too.

I was just trying to prevent the unit to get stuck in the trees.

Quote:
Quote:
Originally Posted by Me
Only if there was no decay in the knockback...

:P

Quote:
At least in this tutorial, the angle is constant. If it's a linear movement; what prevents you from adding decay-x and decay-y? (thus avoiding angle-storage)

This is the part I don't understand. Can you please explain it? And your attachment, delta x/delta y is the distance how much the unit moved, right? Then it is not constant.

Anyways, isn't this one of those tiny performance improvements that actually don't change anything since the code is efficient enough? But since I want to make it perfect, I want to understand what you're trying to tell me.
__________________
Cascading Style Shit
Silvenon is offline   Reply With Quote
Old 10-16-2007, 02:34 PM   #38
Themerion
Brahms-fan
 
Themerion's Avatar
 
Join Date: Jan 2006
Posts: 642

Submissions (2)

Themerion has a spectacular aura about (114)Themerion has a spectacular aura about (114)Themerion has a spectacular aura about (114)Themerion has a spectacular aura about (114)

Default

Quote:
Isn't this double-posting?

Um... yeah. Sorry about that.

Quote:
This is the part I don't understand. Can you please explain it? And your attachment, delta x/delta y is the distance how much the unit moved, right? Then it is not constant.

Anyways, isn't this one of those tiny performance improvements that actually don't change anything since the code is efficient enough? But since I want to make it perfect, I want to understand what you're trying to tell me.

Since you talk some about maths in the tutorial; may I suppose that you know the linear equation?

y=kx+m

In this case; m doesn't matter, so the equation can be written y=kx. The straight line in which we want the unit to move has the rake k.

Then, with pythagoras statement; we can find out what the x-speed and y-speed should be; since the x-speed and y-speed must have the same k-value (x/y quote).

Dunno if it adds any performance; but it feels better without the trig-functions :)
__________________
Submissions::
(v)JASS Tutorial
Covers how to make fast and safe coding for common tasks in vJASS/JASS.
Creep Respawn System
It has never been easier to respawn creep groups...
Themerion is offline   Reply With Quote
Old 10-16-2007, 06:57 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

Quote:
Since you talk some about maths in the tutorial

Actually, my dad helped me on that, but nevermind. Don't worry, as I'll take a look at all of this later, and I will understand it and implement it in the tutorial.

Quote:
Dunno if it adds any performance; but it feels better without the trig-functions :)

Yeah, I tend to that too. In Daelin's tutorial it is explained how to make movement towards a point without trig funcs, I will take a look at that too. It probably doesn't make any difference, since the trig funcs are just called at the beginning of the function.

EDIT: I decided not to make that improvement because it would really take many units to make the already existing code lag, I don't think it would make much difference if I do that. If people are complaining that the code is laggy, then I will implement it (as soon as I figure it out).
__________________
Cascading Style Shit

Last edited by Silvenon : 10-20-2007 at 11:21 AM.
Silvenon 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:33 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