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

Zephyr Challenge #6 - AOE Summon

Status
Not open for further replies.
Level 23
Joined
Nov 29, 2006
Messages
2,482
Anyway, would be great if someone just took a look at the code.

Well yeah, I looked at the code through jasscraft since I currently have a newly installed pc. It looks okay I guess, mainly, I'd probably do it more vJassy (but yeah maybe it wasn't needed). I just don't like the extreme amount of used locals (in such way that I think it looks ugly:p), but if that is how it increases the efficiency, nvm. I couldn't really complain more on the code, except that the spell really, and I mean really, should have configurable constants in the header. Right now the spell is not userimportingfriendly at all :/
 
Level 15
Joined
Dec 18, 2007
Messages
1,098
Right now the spell is not userimportingfriendly at all :/
Not really sure how to do that in JASS :p Should I use functions that return a value or some other thing?
Sometimes I see spells using the function method, some others (in vJASS) use globals. So which is more efficient?

Thread still not closed. Hanky is probaly inactive or he forgot about the contest :p
 
Level 23
Joined
Nov 29, 2006
Messages
2,482
Well, the only way of making it in 'pure' Jass, is to declare functions like
JASS:
(constant) function dmg takes integer lvl returns integer
    return 30*(lvl-1) + 50
endfunction
(constant makes it faster, but it isn't always possible for all functions)

Normally this is not a good way, as I've heard returning strings like that is bad or unsafe (dont remember why though)

In vJass, the compiler is built exactly in the way that you can declare globals freely of your choice, and the compiler will then input them in the main global block which is created by default. This method is definitly faster. The only reason I'd make a function is when I am initializing different setups of the level, eg
JASS:
(private) function InitDmg takes nothing returns nothing
    set dmgarr[0] = 50
    set dmgarr[1] = 60
    set dmgarr[2] = 70
endfunction
(pobably private if it is in vjass)
 
Level 10
Joined
Jun 1, 2008
Messages
485
Anyway, would be great if someone just took a look at the code. I want to know how to make this spell better :)
um, Zack, Is your code a GUI-converted one? The method you use in that code is very similar to GUI ones. It look like you convert a GUI spell to custom text, put all function to one trigger, get rid of all BJs, optimize it with local variable, then re-optimize it a bit.

well, btw, When I try to open RaiN. submission, the WE will send me an error that read: 'Trigger Function does not exist in database: DisplayTextToPlayer' then it crashes. when I see the function list (in trigger editor, TESH -> function list) there's a native DisplayTextToPlayer with exact same name.
So, what's wrong? Is it my WE that error or what? only RaiN. submission that can't opened by me.

btw (again), Eccho, your spell seemed to overpowered. it summon a lot invisible mine, each deal minor damage though, that doesn't have any expiration timer. well, you can cast it many time at one place (after cooldown passes ofc) then just lure enemy's main army to that place, and it will fall quickly. maybe some expiration timer is good for that mines.
 
Last edited:
Level 10
Joined
Jun 1, 2008
Messages
485
His function is missing one letter?



He is missing a t, : DisplayTextToPlayer
sorry, it's my typo. the real error is this:'Trigger Function does not exist in database: DisplayTextToPlayer'
well, I attach the screenshot to clear any confuse.
70945d1260187928-zephyr-challenge-6-error1.jpg

then when I click ok, it send this error
70946d1260187928-zephyr-challenge-6-error2.jpg

then the WE closed


btw, anybody here can open RaiN. submission? Is it just me that can't open it?
 

Attachments

  • error1.jpg
    error1.jpg
    7.9 KB · Views: 183
  • error2.jpg
    error2.jpg
    17.6 KB · Views: 212
Last edited:
Level 28
Joined
Jan 26, 2007
Messages
4,789
Yeah, I guess it has something to do with your JNGP...

here is the code:

JASS:
library HandleData

    //====================================================================================================
    globals
        private constant integer MAX_HANDLE_ID_COUNT = 408000
    endglobals

    //==================================================================================================
    globals
        private integer array csdata[MAX_HANDLE_ID_COUNT]
        private constant integer MIN_HANDLE_ID=0x100000
    endglobals

    function SetData takes handle h, integer v returns nothing
        debug if(GetHandleId(h)-MIN_HANDLE_ID>=MAX_HANDLE_ID_COUNT) then
        debug     call BJDebugMsg("SetData: Handle id too big, increase the max handle id count or use gamecache instead")
        debug endif
        set csdata[GetHandleId(h)-MIN_HANDLE_ID]=v
    endfunction

    function GetData takes handle h returns integer
        debug if(GetHandleId(h)-MIN_HANDLE_ID>=MAX_HANDLE_ID_COUNT) then
        debug     call BJDebugMsg("GetData: Handle id too big, increase the max handle id count or use gamecache instead")
        debug endif
        return csdata[GetHandleId(h)-MIN_HANDLE_ID]
    endfunction

endlibrary


JASS:
library UtliltyFunctions initializer Init

//==================================================================================================
// Geometry
function ABU takes unit a, unit b returns real // Angle between units
    return Atan2(GetUnitY(b) - GetUnitY(a), GetUnitX(b)- GetUnitX(a))
endfunction
function DBU takes unit a, unit b returns real // Distance between units
    local real dx = GetUnitX(b) - GetUnitX(a)
    local real dy = GetUnitY(b) - GetUnitY(a)
    return SquareRoot(dx * dx + dy * dy)
endfunction
function DBPXY takes real x1, real y1, real x2, real y2 returns real // Distance between coords
    local real dx = x2 - x1
    local real dy = y2 - y1
    return SquareRoot(dx * dx + dy * dy)
endfunction
globals
    private location LOC = Location(0.,0.)
endglobals
function GetXYZ takes real x, real y returns real
    call MoveLocation(LOC,x,y)
    return GetLocationZ(LOC)
endfunction


//==================================================================================================
// Returns true or false where a boolexpr is needed; usesful for avoiding null leak
globals
    boolexpr B_TRUE=null
    boolexpr B_FALSE=null
endglobals
private function rettrue takes nothing returns boolean
    return true
endfunction
private function retfalse takes nothing returns boolean
    return false
endfunction


// Unit group manipulation
globals
    private group GNear = CreateGroup()
endglobals
function GetNearestUnit takes group source, real x, real y returns unit // Name says it all
    local unit dum
    local unit current = null
    local real dist = 999999.
    local real r
    
    call GroupClear(GNear)
    call GroupAddGroup(source,GNear)
    loop
        set dum = FirstOfGroup(GNear)
        exitwhen dum==null
        call GroupRemoveUnit(GNear,dum)
        
        set r = DBPXY(x,y,GetUnitX(dum),GetUnitY(dum))
        if r<dist then
            set dist = r
            set current = dum
        endif
    endloop
    
    return current
endfunction

//==================================================================================================
private function Init takes nothing returns nothing
    set B_TRUE = Condition(function rettrue)
    set B_FALSE = Condition(function retfalse)
endfunction

endlibrary


JASS:
library UtliltyFunctions initializer Init

//==================================================================================================
// Geometry
function ABU takes unit a, unit b returns real // Angle between units
    return Atan2(GetUnitY(b) - GetUnitY(a), GetUnitX(b)- GetUnitX(a))
endfunction
function DBU takes unit a, unit b returns real // Distance between units
    local real dx = GetUnitX(b) - GetUnitX(a)
    local real dy = GetUnitY(b) - GetUnitY(a)
    return SquareRoot(dx * dx + dy * dy)
endfunction
function DBPXY takes real x1, real y1, real x2, real y2 returns real // Distance between coords
    local real dx = x2 - x1
    local real dy = y2 - y1
    return SquareRoot(dx * dx + dy * dy)
endfunction
globals
    private location LOC = Location(0.,0.)
endglobals
function GetXYZ takes real x, real y returns real
    call MoveLocation(LOC,x,y)
    return GetLocationZ(LOC)
endfunction


//==================================================================================================
// Returns true or false where a boolexpr is needed; usesful for avoiding null leak
globals
    boolexpr B_TRUE=null
    boolexpr B_FALSE=null
endglobals
private function rettrue takes nothing returns boolean
    return true
endfunction
private function retfalse takes nothing returns boolean
    return false
endfunction


// Unit group manipulation
globals
    private group GNear = CreateGroup()
endglobals
function GetNearestUnit takes group source, real x, real y returns unit // Name says it all
    local unit dum
    local unit current = null
    local real dist = 999999.
    local real r
    
    call GroupClear(GNear)
    call GroupAddGroup(source,GNear)
    loop
        set dum = FirstOfGroup(GNear)
        exitwhen dum==null
        call GroupRemoveUnit(GNear,dum)
        
        set r = DBPXY(x,y,GetUnitX(dum),GetUnitY(dum))
        if r<dist then
            set dist = r
            set current = dum
        endif
    endloop
    
    return current
endfunction

//==================================================================================================
private function Init takes nothing returns nothing
    set B_TRUE = Condition(function rettrue)
    set B_FALSE = Condition(function retfalse)
endfunction

endlibrary
 
Level 5
Joined
Oct 26, 2009
Messages
161
Eccho said:
Normally this is not a good way, as I've heard returning strings like that is bad or unsafe (dont remember why though)
I'm sorry, but you're incorrect. It is a very good method of doing function spell values. The constant keyword makes it so Vexorian's Map Optimizer will inline the function call (If you only use the level variable once, then even jasshelper will inline it), which means you're doing the raw math in the function as needed. If you use the global method, you're doing an array set in a function call (slowish) and then an array lookup to get the value (fastish). The difference is so negligible between the two cases at the end of the day that it can be ignored. They are effectively the same in speed.
 
Level 8
Joined
Nov 20, 2008
Messages
445
Yeah, I guess it has something to do with your JNGP...

here is the code:

JASS:
library HandleData

    //====================================================================================================
    globals
        private constant integer MAX_HANDLE_ID_COUNT = 408000
    endglobals

    //==================================================================================================
    globals
        private integer array csdata[MAX_HANDLE_ID_COUNT]
        private constant integer MIN_HANDLE_ID=0x100000
    endglobals

    function SetData takes handle h, integer v returns nothing
        debug if(GetHandleId(h)-MIN_HANDLE_ID>=MAX_HANDLE_ID_COUNT) then
        debug     call BJDebugMsg("SetData: Handle id too big, increase the max handle id count or use gamecache instead")
        debug endif
        set csdata[GetHandleId(h)-MIN_HANDLE_ID]=v
    endfunction

    function GetData takes handle h returns integer
        debug if(GetHandleId(h)-MIN_HANDLE_ID>=MAX_HANDLE_ID_COUNT) then
        debug     call BJDebugMsg("GetData: Handle id too big, increase the max handle id count or use gamecache instead")
        debug endif
        return csdata[GetHandleId(h)-MIN_HANDLE_ID]
    endfunction

endlibrary


JASS:
library UtliltyFunctions initializer Init

//==================================================================================================
// Geometry
function ABU takes unit a, unit b returns real // Angle between units
    return Atan2(GetUnitY(b) - GetUnitY(a), GetUnitX(b)- GetUnitX(a))
endfunction
function DBU takes unit a, unit b returns real // Distance between units
    local real dx = GetUnitX(b) - GetUnitX(a)
    local real dy = GetUnitY(b) - GetUnitY(a)
    return SquareRoot(dx * dx + dy * dy)
endfunction
function DBPXY takes real x1, real y1, real x2, real y2 returns real // Distance between coords
    local real dx = x2 - x1
    local real dy = y2 - y1
    return SquareRoot(dx * dx + dy * dy)
endfunction
globals
    private location LOC = Location(0.,0.)
endglobals
function GetXYZ takes real x, real y returns real
    call MoveLocation(LOC,x,y)
    return GetLocationZ(LOC)
endfunction


//==================================================================================================
// Returns true or false where a boolexpr is needed; usesful for avoiding null leak
globals
    boolexpr B_TRUE=null
    boolexpr B_FALSE=null
endglobals
private function rettrue takes nothing returns boolean
    return true
endfunction
private function retfalse takes nothing returns boolean
    return false
endfunction


// Unit group manipulation
globals
    private group GNear = CreateGroup()
endglobals
function GetNearestUnit takes group source, real x, real y returns unit // Name says it all
    local unit dum
    local unit current = null
    local real dist = 999999.
    local real r
    
    call GroupClear(GNear)
    call GroupAddGroup(source,GNear)
    loop
        set dum = FirstOfGroup(GNear)
        exitwhen dum==null
        call GroupRemoveUnit(GNear,dum)
        
        set r = DBPXY(x,y,GetUnitX(dum),GetUnitY(dum))
        if r<dist then
            set dist = r
            set current = dum
        endif
    endloop
    
    return current
endfunction

//==================================================================================================
private function Init takes nothing returns nothing
    set B_TRUE = Condition(function rettrue)
    set B_FALSE = Condition(function retfalse)
endfunction

endlibrary


JASS:
library UtliltyFunctions initializer Init

//==================================================================================================
// Geometry
function ABU takes unit a, unit b returns real // Angle between units
    return Atan2(GetUnitY(b) - GetUnitY(a), GetUnitX(b)- GetUnitX(a))
endfunction
function DBU takes unit a, unit b returns real // Distance between units
    local real dx = GetUnitX(b) - GetUnitX(a)
    local real dy = GetUnitY(b) - GetUnitY(a)
    return SquareRoot(dx * dx + dy * dy)
endfunction
function DBPXY takes real x1, real y1, real x2, real y2 returns real // Distance between coords
    local real dx = x2 - x1
    local real dy = y2 - y1
    return SquareRoot(dx * dx + dy * dy)
endfunction
globals
    private location LOC = Location(0.,0.)
endglobals
function GetXYZ takes real x, real y returns real
    call MoveLocation(LOC,x,y)
    return GetLocationZ(LOC)
endfunction


//==================================================================================================
// Returns true or false where a boolexpr is needed; usesful for avoiding null leak
globals
    boolexpr B_TRUE=null
    boolexpr B_FALSE=null
endglobals
private function rettrue takes nothing returns boolean
    return true
endfunction
private function retfalse takes nothing returns boolean
    return false
endfunction


// Unit group manipulation
globals
    private group GNear = CreateGroup()
endglobals
function GetNearestUnit takes group source, real x, real y returns unit // Name says it all
    local unit dum
    local unit current = null
    local real dist = 999999.
    local real r
    
    call GroupClear(GNear)
    call GroupAddGroup(source,GNear)
    loop
        set dum = FirstOfGroup(GNear)
        exitwhen dum==null
        call GroupRemoveUnit(GNear,dum)
        
        set r = DBPXY(x,y,GetUnitX(dum),GetUnitY(dum))
        if r<dist then
            set dist = r
            set current = dum
        endif
    endloop
    
    return current
endfunction

//==================================================================================================
private function Init takes nothing returns nothing
    set B_TRUE = Condition(function rettrue)
    set B_FALSE = Condition(function retfalse)
endfunction

endlibrary

You've posted the Util Funcs 2 times instead of the spells code. Sadly i dont have the code on me so I can't post it too...
 
Level 23
Joined
Nov 29, 2006
Messages
2,482
I'm sorry, but you're incorrect. It is a very good method of doing function spell values. The constant keyword makes it so Vexorian's Map Optimizer will inline the function call (If you only use the level variable once, then even jasshelper will inline it), which means you're doing the raw math in the function as needed. If you use the global method, you're doing an array set in a function call (slowish) and then an array lookup to get the value (fastish). The difference is so negligible between the two cases at the end of the day that it can be ignored. They are effectively the same in speed.

That's true, but what about the case where you don't have JNGP and doesn't use vJass. Nothing will inline those functions in those cases.
 
Level 5
Joined
Oct 26, 2009
Messages
161
Eccho said:
That's true, but what about the case where you don't have JNGP and doesn't use vJass. Nothing will inline those functions in those cases.
The WC3 Map Optimizer will, which is (should) be used on every map these spells get used in. In that light, they are equally efficient and should be judged equally.
 
Level 17
Joined
Sep 8, 2007
Messages
994
Official Announcement

Since Hanky is quite busy he wanted me to post this.
Both Hanky and I are having a busy time in our RL right now. We already have begun preperations for the rating of all spells but it will call upon some time giving all of our results.
We sincerely ask you to not fulling this thread with messages like "When do the results finally come?" and alike. We do the best we can in our situations so please be patient and fair to us.

Greetings,
xxdingo93xx
Hanky

Edit:
The poll concludes after our judge. We've determined that already.

Edit 2:
Obviously Pyritie is going to start the poll before. Well, whatever...
 
Last edited:
Level 5
Joined
Oct 26, 2009
Messages
161
The poll isn't a very difficult or time-consuming part of the contest to put up. The contestants are also conveniently located in a previous post made by someone in this thread. It would be nice to have that going while judging commences*.

*..or, rather, doesn't.
 
Level 5
Joined
Oct 26, 2009
Messages
161
Why multiple choice? I was under the impression that in voting you picked your favorite submission, not favorite(s)? In the long run it really doesn't have a huge impact on anything, so I don't really care, it's just an odd choice since there's really nothing to gain from it. The more entries you vote for, the less net effect your vote has, so it's always more efficient for your favorite to only vote for one entry. Whether you enable mult-voting or not, I'll still only vote for one entry.

If you want to try it, though, why not?
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Why multiple choice? I was under the impression that in voting you picked your favorite submission, not favorite(s)? In the long run it really doesn't have a huge impact on anything, so I don't really care, it's just an odd choice since there's really nothing to gain from it. The more entries you vote for, the less net effect your vote has, so it's always more efficient for your favorite to only vote for one entry. Whether you enable mult-voting or not, I'll still only vote for one entry.

If you want to try it, though, why not?

Well, if 2 people choose 3 submissions and of those 3 choises there is 1 choice the same for both of them, that submission is probably the "better" one and it will have 1 vote more than the others.

It'll be a bit more precise I think, there were times it was really hard for me to choose between 2 submissions, but the poll only let me vote for one, so I just randomly picked one.
If you have any doubts, you can just choose the submissions you really like.

Of course, everything depends on the amount of people who are going to vote... I hope there are going to be plenty, but who knows?
 
Why multiple choice? I was under the impression that in voting you picked your favorite submission, not favorite(s)? In the long run it really doesn't have a huge impact on anything, so I don't really care, it's just an odd choice since there's really nothing to gain from it. The more entries you vote for, the less net effect your vote has, so it's always more efficient for your favorite to only vote for one entry.

18 entries means the votes tend to get spread out a lot, meaning the poll has less of an effect since it's based on (number of votes you got) / (number of votes cast)
 
Level 5
Joined
Oct 26, 2009
Messages
161
Ah, I see. It should really be scaled to whomever got the highest score, not the number of votes cast. That way someone always gets a 100% on the voting section (makes sense) and there's no need for multi-vote nonsense.
 
Level 5
Joined
Oct 26, 2009
Messages
161
The WIP one is almost entirely incomplete, so maybe that one shouldn't be considered. The one that was posted a little late is no problem at all, however.
 
Ah, I see. It should really be scaled to whomever got the highest score, not the number of votes cast. That way someone always gets a 100% on the voting section (makes sense) and there's no need for multi-vote nonsense.

Actually, come to think of it judging is done the same way. It isn't scaled to the highest score. So polls aren't either.

Anyway, poll's up so this gets archived. Thanks for participating everyone!

http://www.hiveworkshop.com/forums/arena-226/zephyr-challenge-6-poll-152067/
 
Status
Not open for further replies.
Top