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

[System] PlayerManager

Level 11
Joined
Nov 4, 2007
Messages
337
This is the only code I saw...

http://www.youtube.com/watch?v=nFEGSv4XKSU&feature=related

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.

That doesn't change the fact that those benchmarks are not done in separate threads.
In seperate threads? You mean seperate functions?
 
Level 8
Joined
Oct 3, 2008
Messages
367
Then explain that NextInstance() nonsense. Each benchmark must be in totally different functions in totally different threads. You do some checks before each benchmark, and some benchmarks have more checks than others, making it broken. If I am reading your system correctly.

Try reversing the order of your benchmarks, please. If you get the exact same results, then your system is not broken.
 
Level 8
Joined
Aug 4, 2006
Messages
357
function GetHumanId takes integer i returns integer
Returns a player id given an indexed human id. The indexed ids do
not refer to the player ids and order is not maintainted.
This is used for iteration

example- (use ploops instead)
local integer x = GetHumanCount()
loop
set x = x -1
call CreateUnit(GetHumanId(x), 'hpea', 0, 0, 270) //human 0 might be player 11
exitwhen x == 0
endloop
For all the Get...Id functions, your examples are wrong. You are using an integer as a player parameter. GetHumanId returns an integer, but CreateUnit requires a player for the first argument.

The good news is that is the only thing I see wrong. Good work and +rep. I will use this in my map.
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
lol, nice spotting : ), haha. I shall change them.

GetHuman would be the appropriate thing for CreateUnit(). GetPlayerId would be uhm... not sure, hm...

don't know of an example for that /cry


edit
Updated to 7.3, 2.2/2.3-
Removed an extra trigger that was useless
Removed an extra useless function
Removed a few extra operations
Fixed a syntax error for vJASS version
Fixed 2 bugs for vJASS version (fixed it in cJASS long ago but forgot about doing it for vJASS).
Fixed a cJASS bug (missing if statement)

Documentation fix on two wrong examples will be done eventually
 
Last edited:
Level 31
Joined
Jul 10, 2007
Messages
6,306
Updated to 2.4 and 7.4

Added 2 functions for removing code events, return triggercondition for adding code for events

Made cjass version auto include necessary files

Changed GetPlayerTeam method of player checking back to GetPlayerSlotState as GetPlayerTeam is very unstable ^_-.

Fixed documentation errors
 
Last edited:
Level 31
Joined
Jul 10, 2007
Messages
6,306
cJASS now at 3.4 with the latest cJASS release.


I'd also like to take this moment to go over why to use the cJASS version over the vJASS version.

1. The cJASS version works off of linked lists for faster iteration speeds and each id on the list corresponds with the player id for random access

2. The cJASS version has way less global variables with the use of definitions and uses #ifs to remove more, thus increasing the speed of the map.

And that about sums it up ; ).


The last cJASS version just removed some extra code by using the || and && statement added to #ifs for cJASS. I also remember optimizing one specific mode by removing an else statement.

The vJASS version will probably never be updated to follow suit with the cJASS version as static ifs do not control the adding in of global variables. The cJASS version is also superior to the vJASS version.
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
Updated to v9.0.0.0

Scripts is way smaller ;D. A few globals were removed. Operations are a bit faster.

All of the static ifs and global constants were removed. Remove Units on Ini and Remove Units on Leave were entirely removed.

Now has a player leave event since JASS doesn't have one.

Players.LEAVE.register(boolexpr)
Players.LEAVE.registrTrigger(t)


What I would love to do is remove all of the method operators and make everything readonly, but that appears to be impossible : (.
 
Top