[Log in / Register]
| News | Chat | Pastebin | Donations | Tutorials | Rules | Forums | Starcraft II |
| Maps | Skins | Icons | Models | Spells | Tools | Jass | Packs |
(Keeps Hive Alive)
Go Back   The Hive Workshop > Warcraft III Resources > JASS Functions

JASS Functions Approved JASS functions will be located here.
Remember to submit your own resources to the submission forum.

Reply
 
LinkBack (2) Thread Tools
Old 10-07-2009, 11:07 AM   #16 (permalink)
Registered User Nestharus
User
 
Nestharus's Avatar
 
Join Date: Jul 2007
Posts: 427
Nestharus has little to show at this moment (31)Nestharus has little to show at this moment (31)Nestharus has little to show at this moment (31)Nestharus has little to show at this moment (31)
Found a bug in this ; o. It caused leaving players to not be registered except for Player 0. It was 1 line fix.

Increased the ini loop speed, so it should be faster.

Benchmark code to compare old method and new method of slot check
Jass:
include "cj_types.j"
include "cj_typesEx.j"
include "cj_print.j"
include "cj_types_priv.j"  
include "cj_typesEx_priv.j"
include "cj_order.j"  
include "cj_antibj_base.j"

scope Demo initializer Initialization {
    trigger t = CreateTrigger()
    event e = TriggerRegisterTimerEvent(t, 0, false)
    int sw, i = 5000; float mark
    
    bool Test() {
        sw = StopWatchCreate()
        do {
            if GetPlayerTeam(Player(0)) != -1 {} //.007
            //if GetPlayerSlotState(Player(0)) == PLAYER_SLOT_STATE_PLAYING {} //.011
        } whilenot --i == 0
        mark = StopWatchMark(sw)
        StopWatchDestroy(sw)
        printf(R2S(mark))
        return false
    }
    
    void Initialization() {
        TriggerAddCondition(t, Condition(function Test))
    }
}

Quote:
Player 4 left.
Player count is 5.
Highest Player number is 6.
This wasn't working right because the trigger wasn't firing ^_^. It should be ok now ; p.

If player 4 leaves
Player count is 5

it'll go from this-

1 2 3 4 5 6

to this

1 2 3 6 5

4 is removed and the last player is put in it's place. This is why you can always loop through all the current players ^_^.
Nestharus is offline   Reply With Quote
Old 11-25-2009, 11:37 AM   #17 (permalink)
Registered User Nestharus
User
 
Nestharus's Avatar
 
Join Date: Jul 2007
Posts: 427
Nestharus has little to show at this moment (31)Nestharus has little to show at this moment (31)Nestharus has little to show at this moment (31)Nestharus has little to show at this moment (31)
PlayerTracker 6.0 vJASS is up! : D

Edit
PlayerTracker 1.0 cJASS is up! : D

Last edited by Nestharus; 11-25-2009 at 02:14 PM.
Nestharus is offline   Reply With Quote
Old 12-05-2009, 03:23 PM   #18 (permalink)
Registered User MapperMalte
MapperMalte
 
MapperMalte's Avatar
 
Join Date: Nov 2007
Posts: 368
MapperMalte has little to show at this moment (29)MapperMalte has little to show at this moment (29)MapperMalte has little to show at this moment (29)
Quote:
function GetPlayer takes integer i returns player
Returns a player given an id. Exactly like the Player() native, but
slightly faster.
Wrong.
Proof:
MapperMalte is offline   Reply With Quote
Old 12-05-2009, 04:14 PM   #19 (permalink)
Registered User YourNameHere
wuts dis?
 
Join Date: Apr 2007
Posts: 594
YourNameHere has a spectacular aura about (120)YourNameHere has a spectacular aura about (120)YourNameHere has a spectacular aura about (120)YourNameHere has a spectacular aura about (120)
Maybe show us your whole testing code before claiming any proof?
Real benchmarks should use StopWatch and not some systems coded within the World Editor.
__________________
--YourNameHere
YourNameHere is offline   Reply With Quote
Old 12-05-2009, 04:34 PM   #20 (permalink)
Registered User MapperMalte
MapperMalte
 
MapperMalte's Avatar
 
Join Date: Nov 2007
Posts: 368
MapperMalte has little to show at this moment (29)MapperMalte has little to show at this moment (29)MapperMalte has little to show at this moment (29)
This uses StopWatch.

Here:
Jass:
scope Tests initializer SetUp

    globals
        private HandleTable Data
    endglobals
    
private function test takes nothing returns nothing
    local timer t
    local integer i
    call TestHelper.NextInstance()

        if TestHelper.IsFinished() then
            call PauseTimer(GetExpiredTimer())
            call DestroyTimer(GetExpiredTimer())
            call Test.Compare()
            //call Test.createTable()
            return
        endif
    
        call Test.Start("PT","GetPlayer")
            call GetPlayer(0)
        call Test.End()
        
        call Test.Start("Native","Player")
            call Player(0)
        call Test.End()

endfunction

    function TestSC takes nothing returns nothing
        call TestHelper.SetTest(170,170)
        call TimerStart(CreateTimer(),0.,true,function test)
    endfunction
    
    private function SetUp takes nothing returns nothing
        set Data = HandleTable.create()
        call Test.Declare("PT")
        call Test.Declare("Native")
    endfunction

endscope
MapperMalte is offline   Reply With Quote
Old 12-05-2009, 04:55 PM   #21 (permalink)
Registered User Element of Water
He has beautiful eyes...
 
Element of Water's Avatar
 
Join Date: Aug 2008
Posts: 2,062
Element of Water is just really nice (284)Element of Water is just really nice (284)Element of Water is just really nice (284)Element of Water is just really nice (284)Element of Water is just really nice (284)
I think a link to TestHelper is required.
Element of Water is offline   Reply With Quote
Old 12-05-2009, 05:16 PM   #22 (permalink)
Registered User MapperMalte
MapperMalte
 
MapperMalte's Avatar
 
Join Date: Nov 2007
Posts: 368
MapperMalte has little to show at this moment (29)MapperMalte has little to show at this moment (29)MapperMalte has little to show at this moment (29)
testmap attached.
Attached Files
File Type: w3x Benchmark.w3x (70.5 KB, 12 views)
MapperMalte is offline   Reply With Quote
Old 12-05-2009, 05:39 PM   #23 (permalink)
Registered User Element of Water
He has beautiful eyes...
 
Element of Water's Avatar
 
Join Date: Aug 2008
Posts: 2,062
Element of Water is just really nice (284)Element of Water is just really nice (284)Element of Water is just really nice (284)Element of Water is just really nice (284)Element of Water is just really nice (284)
Yeah... that system is a bit overkill don't you think? But whatever, it seems to work as described for the purposes of testing speeds.
Element of Water is offline   Reply With Quote
Old 12-05-2009, 09:26 PM   #24 (permalink)
Registered User Nestharus
User
 
Nestharus's Avatar
 
Join Date: Jul 2007
Posts: 427
Nestharus has little to show at this moment (31)Nestharus has little to show at this moment (31)Nestharus has little to show at this moment (31)Nestharus has little to show at this moment (31)
Actually this stuff was benchmarked on TheHelper too and there were 3 different results, none of which are what you got -.-.

Result 1: Array is 33% faster
Result 2: The same or virtually the same
Result 3: Array is faster 7 out of 10 times


What we concluded was that in general, the array method is "slightly" better, but benchmarking tests are virtually inconclusive due to the nature of the JASS language : ).

For example, strings will screw up your results... etc.

This stuff was tested thoroughly and went through 12+ pages of debate


Now... for me it's not surprising that your results were way off base in regards to everyone else's. We all coded our stuff very specifically, inlined everything, and made it as tight as possible. You didn't.

Now it's either that or wc3 has had some major changes through the patches since these tests were done (1.24a I think).
Nestharus is offline   Reply With Quote
Old 12-05-2009, 09:51 PM   #25 (permalink)
Registered User MapperMalte
MapperMalte
 
MapperMalte's Avatar
 
Join Date: Nov 2007
Posts: 368
MapperMalte has little to show at this moment (29)MapperMalte has little to show at this moment (29)MapperMalte has little to show at this moment (29)
It's your tests that failed.
I just used your function. If it's not inline friendly - not my problem.
And I ran the test 150*150 times.
MapperMalte is offline   Reply With Quote
Old 12-05-2009, 10:07 PM   #26 (permalink)
Registered User Nestharus
User
 
Nestharus's Avatar
 
Join Date: Jul 2007
Posts: 427
Nestharus has little to show at this moment (31)Nestharus has little to show at this moment (31)Nestharus has little to show at this moment (31)Nestharus has little to show at this moment (31)
It's inline friendly -.-

Last edited by Nestharus; 12-06-2009 at 11:18 AM.
Nestharus is offline   Reply With Quote
Old 12-05-2009, 11:14 PM   #27 (permalink)
Registered User MapperMalte
MapperMalte
 
MapperMalte's Avatar
 
Join Date: Nov 2007
Posts: 368
MapperMalte has little to show at this moment (29)MapperMalte has little to show at this moment (29)MapperMalte has little to show at this moment (29)
Ok.
I have redone the test.
Player Tracking is 5% faster than the native
Here is the code I used:

Jass:
call Test.Start("PT","GetPlayer")
    set p = allPlayers[0]
call Test.End()

call Test.Start("Native","Player")
    set p = Player(0)
call Test.End()

You can place the screen in the first post if you want to.
Attached Thumbnails
natives-vs-nestharus-3.jpg  
MapperMalte is offline   Reply With Quote
Old 12-05-2009, 11:44 PM   #28 (permalink)
Registered User Nestharus
User
 
Nestharus's Avatar
 
Join Date: Jul 2007
Posts: 427
Nestharus has little to show at this moment (31)Nestharus has little to show at this moment (31)Nestharus has little to show at this moment (31)Nestharus has little to show at this moment (31)
Quote:
Ok.
I have redone the test.
Player Tracking is 5% faster than the native
Here is the code I used:
I already knew that -.-

Last edited by Nestharus; 12-06-2009 at 11:17 AM.
Nestharus is offline   Reply With Quote
Old 12-06-2009, 07:44 AM   #29 (permalink)
Registered User Element of Water
He has beautiful eyes...
 
Element of Water's Avatar
 
Join Date: Aug 2008
Posts: 2,062
Element of Water is just really nice (284)Element of Water is just really nice (284)Element of Water is just really nice (284)Element of Water is just really nice (284)Element of Water is just really nice (284)
Quote:
Originally Posted by Nestharus View Post
It's inline friendly -.-

vjass just fails now... I haven't seen it inline anything since like 1 version before Zinc...


I guess we wait until Vexorian fixes inlining or we can move to cJASS definitions (which will probably never happen) since they never let you down.

This isn't even doing inline-
Jass:
call GetComputerCount()

And that is just this
Jass:
constant function GetComputerCount takes nothing returns integer
    return computerCount
endfunction

Inliner is broken atm...

So yea, all code from jasshelper going to be extra slower until vex fixes

But go ahead and continue to blame it on me Malte. I know you love that.
Lol. Of course that's not going to inline. You can't just call a variable. If it did inline it'd end up as, simply,
Jass:
computerCount
which is obviously a syntax error.
Element of Water is offline   Reply With Quote
Old 12-06-2009, 09:49 AM   #30 (permalink)
Registered User Nestharus
User
 
Nestharus's Avatar
 
Join Date: Jul 2007
Posts: 427
Nestharus has little to show at this moment (31)Nestharus has little to show at this moment (31)Nestharus has little to show at this moment (31)Nestharus has little to show at this moment (31)
well, I mean you get the point woops ><.

sec

Jass:
// scope Test begins
    function Test__hi takes nothing returns nothing
        local integer p= GetComputerCount()
        a()
    endfunction
// scope Test ends

there, happy? ;p
Nestharus is offline   Reply With Quote
Reply

Bookmarks

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


LinkBacks (?)
LinkBack to this Thread: http://www.hiveworkshop.com/forums/jass-functions-413/system-pt-player-tracking-142554/
Posted By For Type Date
Offering JASS Support Services This thread Refback 01-26-2010 01:50 AM
[System]Gcsn- Costs and States - Wc3C.net This thread Refback 09-03-2009 12:17 AM

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Unsolved] how do you place a tracking becan qazsw World Editor Help Zone 3 05-04-2009 10:03 PM
Tracking targets with the cannon tower Discipline Modeling & Animation 5 04-07-2009 01:05 PM
[Unsolved] Follow the player spawn system? Bane World Editor Help Zone 5 03-26-2009 03:30 PM
[Trigger] boot player system PrisonLove Triggers & Scripts 10 07-22-2008 09:39 PM
Tracking assists on a hero kill The_Prophet Map Development 5 07-12-2005 06:57 PM

All times are GMT. The time now is 04:19 AM.






Hosting by SliceHost 
Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.1
Copyright©Ralle