HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Some Max Limits Questions

04-07-2008, 08:06 AM#1
TEC_Ghost
Ok so I'm making a tactics battle system, and I use a custom grid made with trackables, and to get trackables to work with multiplayer I have to create one at every grid spot for each player. I'm using GC to store my information because of the 2D array capability. I'm also creating an image at each location for display purposes and storing some info in GC. Now this brings me to my problem and my question.

Problem: My grid wont fully complete now it's a 13x13 grid only fills up to like 9,2 now.

Question: Am I hitting a max handle count or something? Do GC's add to this number? Anything I can do to fix this if that is the problem? :(
Attached Files
File type: w3xBattleTactics0.01.w3x (96.9 KB)
04-07-2008, 08:21 AM#2
Silvenon
Quote:
Question: Am I hitting a max handle count or something?

Depends on how big your map is. JNPG would probably say if the handle limit is reached (if you have it implemented), I think you made a mistake in the calculations, post the trackable-creation code.

Personally, I hate trackables, they don't work for me and nobody knows why and I hate them and I hate them.

My suggestion: use RtC for clicking detection, it's far more flexible (can detect both right and left click), you don't have to create a trackable in every grid, and it's more accurate (it can detect exactly where you clicked, while trackable method can only round it up to the closest grid).
04-07-2008, 08:27 AM#3
TEC_Ghost
I would use RtC but I don't want people to have to run a separate program to play the map. Everything is working fine except that it seems like I'm running out of space for information storage which is absurd with the 8k limit. But here's a snip-it of my Trackable Code.

Collapse JASS:
function NewTrackable takes string path, real x, real y, integer TempX, integer TempY, player owner returns trackable
    local trackable T
    local string invisible = ""
    if GetLocalPlayer() != owner then
        set path = invisible
    endif
    set T = CreateTrackable(path,x,y,0)
    call StoreInteger(gc, I2S(TempX),I2S(TempY), H2I(T))
    call StoreInteger(gc, I2S(H2I(T)),"X", TempX)
    call StoreInteger(gc, I2S(H2I(T)),"Y", TempY)
    call StoreReal(gc, I2S(H2I(T)),"RealX", x)
    call StoreReal(gc, I2S(H2I(T)),"RealY", y)
    call StoreInteger(gc, I2S(H2I(T)), "Player", GetPlayerId(owner))
    call TriggerRegisterTrackableTrackEvent(Hover,T)
    call TriggerRegisterTrackableHitEvent(Click,T)
    return T
endfunction

That's run for players 1-4. I'm also using alot of Structs to hold unit Class data, so I'm not sure if that's part of the problem to?

Hidden information:
Collapse JASS:
struct Fighter
    real X
    real Y
    integer GridX
    integer GridY
    real Z
    unit    Unit
    string  name
    real    damage
    real    life
    real    lifemax
    real    exp
    integer strength
    integer agility
    integer inteligence
    integer level
    player  owner
    real facing
    real armor
    integer speed
    real mana
    real manamax
    string array inventory[6]
    string array skills[6]
    integer attackrange
    integer critchance
    integer critmultiplier
    boolean hasAttacked
    boolean isAttacking
    boolean hasMoved
    boolean isMoving
    boolean hasFaced
    boolean isFacing
    string type
    integer index
    
       static method setupWarrior takes unit u returns nothing
                local integer i = GetIndex()
            call SetUnitUserData( u, i )
            set PlayerFighter[i] = Fighter.create()
            
            set PlayerFighter[i].type = "Warrior"
            set PlayerFighter[i].index = GetUnitUserData(u)
            set PlayerFighter[i].owner = GetOwningPlayer(u)
            set PlayerFighter[i].Unit = u
            set PlayerFighter[i].X = GetUnitX(u)
            set PlayerFighter[i].Y = GetUnitY(u)
            set PlayerFighter[i].name = GetUnitName(u)
            set PlayerFighter[i].strength = 7
            set PlayerFighter[i].agility = 4
            set PlayerFighter[i].inteligence = 2
            set PlayerFighter[i].lifemax = 300 + (PlayerFighter[i].strength * LIFE_PER_STR)
            set PlayerFighter[i].manamax = 100 + (PlayerFighter[i].inteligence * MANA_PER_INT)
            set PlayerFighter[i].life = PlayerFighter[i].lifemax
            set PlayerFighter[i].mana = PlayerFighter[i].manamax
            set PlayerFighter[i].armor = 0.30 + (PlayerFighter[i].agility * ARMOR_PER_AGI)
            set PlayerFighter[i].damage = 38
            set PlayerFighter[i].critchance = 30
            set PlayerFighter[i].critmultiplier = 2
            set PlayerFighter[i].level = GetUnitLevel(u)
            set PlayerFighter[i].attackrange = 4
            set PlayerFighter[i].speed = 3
            set PlayerFighter[i].GridX = 1
            set PlayerFighter[i].GridY = 1
            
                set PlayerFighter[i].skills[1] = "Block"
            
            call SetUnitMaxState(u, UNIT_STATE_MAX_LIFE, R2I(PlayerFighter[i].lifemax ))
            call SetUnitMaxState(u, UNIT_STATE_MAX_MANA, R2I(PlayerFighter[i].manamax ))

            call SetHeroAgi( u, PlayerFighter[i].agility, true )
            call SetHeroInt( u, PlayerFighter[i].inteligence, true )
            call SetHeroStr( u, PlayerFighter[i].strength, true )
 
            
        endmethod
        

endstruct

04-07-2008, 10:11 AM#4
Pyrogasm
Mayhaps you're hitting the OP limit. Can you post your code that places all the trackables, please?
04-07-2008, 08:09 PM#5
TEC_Ghost
Quote:
Originally Posted by Pyrogasm
Mayhaps you're hitting the OP limit. Can you post your code that places all the trackables, please?

Collapse JASS:
set p = 0
loop
exitwhen p > 3
set T = NewTrackable("Doodads\\Terrain\\InvisiblePlatform\\InvisiblePlatform.mdl",GetRectCenterX(GridSquare),GetRectCenterY(GridSquare),TempX,TempY,Player(p))
set p=p+1
endloop
04-07-2008, 10:21 PM#6
Here-b-Trollz
You need another loop other than that. Where's the loop that calls that function/loop? Since making a grid requires more than one position...

How many of these things are you creating?
04-07-2008, 10:48 PM#7
TEC_Ghost
Quote:
Originally Posted by Here-b-Trollz
You need another loop other than that. Where's the loop that calls that function/loop? Since making a grid requires more than one position...

How many of these things are you creating?

As I said I have a 13x13 grid, so it's calling this at every position.

So that's 4 tracakbles at each grid position, 169 grid positions (13*13), 676 trackables.
04-07-2008, 11:13 PM#8
Toadcop
~ may hit the limit BUT run war3 with war3err it will tell you if you have some problems... if not so post the map/code.
04-08-2008, 12:44 AM#9
TEC_Ghost
Hmm it looks like I hit the op limit...

Is there anyway around this, what all counts towards the op limit?
04-08-2008, 12:59 AM#10
Rising_Dusk
Quote:
Originally Posted by TEC_Ghost
what all counts towards the op limit?
Absolutely everything your code executes or sets counts towards it.
04-08-2008, 01:07 AM#11
TEC_Ghost
Damn....what is the limit, cause I get this error right at the start and I'm not even half done with my system.

Ive attached the map to the first post, maybe someone can find somewhere I can tidy up some functions or something :(
04-08-2008, 01:09 AM#12
Rising_Dusk
What you should do is outsource the bulk of your system's work to different threads. Try using call ExecuteFunc("...") and get most of the trackables organized in those callbacks. You can pass anything you want to those functions by temp globals.
04-08-2008, 09:14 AM#13
Toadcop
Collapse JASS:
globals
    integer TempX_BX=0
    integer TempY_BX=0
 
    rect GridSquare_BX=null

    real startx_BX=0
    real starty_BX=0
endglobals


function setup_exec takes nothing returns nothing
    local integer TempX = TempX_BX
    local integer TempY = TempY_BX
    local real gridx
    local real gridy
    local unit U
    local trackable T
    local integer Index
    local integer p

                
                set gridx = startx_BX + (GRID_SIZE * (TempX-1))
                set gridy = starty_BX + (GRID_SIZE * (TempY-1))
                
            
                call MoveRectTo(GridSquare_BX,gridx + (GRID_SIZE / 2) , gridy + (GRID_SIZE / 2) )
                    if (GetPathable(gridx,gridy) == true ) then
                    
                    set p = 0
                    loop
                    exitwhen p > 1
                    set T = NewTrackable("Doodads\\Terrain\\InvisiblePlatform\\InvisiblePlatform.mdl",GetRectCenterX(GridSquare_BX),GetRectCenterY(GridSquare_BX),TempX,TempY,Player(p))
                    set p=p+1
                    endloop
                    
                    set Index = GetIndexImage()

            set Image[Index] = CreateImage("tile.blp", GRID_SIZE, GRID_SIZE, 0, gridx,gridy, 0, 0, 0, 0, 2)
            call SetImageColor( Image[Index], 0, 0, 100, 95 )
            call SetImageRenderAlways(Image[Index], true)
            call ShowImage(Image[Index], false)

            //Setup GC Holders===================================================        
            call StoreInteger(gc, I2S(TempX)+"Image",I2S(TempY)+"Image", Index)
            call StoreBoolean(gc, "Image",I2S(Index), false) 
 
            //===================================================================
                   endif

                set U = null
endfunction



struct Grid
    real X
    real Y
    static integer MaxX
    static integer MaxY
    //static unit array Pos[255]
   
 
    
    static method setup takes integer cellwidth, integer cellheight, real startx, real starty returns nothing
    local rect GridSquare = Rect(startx,starty,startx + GRID_SIZE, starty + GRID_SIZE)
    
    local integer TempX = 1
    local integer TempY = 1
    local real gridx
    local real gridy
    local unit U
    local trackable T
    local integer Index
    local integer p
    
    set GridArena[1] = Grid.create()
    
     set Grid.MaxX = cellwidth
     set Grid.MaxY = cellheight
     set startx_BX=startx
     set starty_BX=starty
     set GridSquare_BX=GridSquare
    loop
        exitwhen TempX > cellwidth

        loop
            exitwhen TempY > cellheight

                set TempX_BX=TempX
                set TempY_BX=TempY
                call ExecuteFunc("setup_exec")
                    
        set TempY = TempY + 1
        endloop
        
        set TempX = TempX + 1
        set TempY = 1
    endloop

    set GridSquare = null
    
    endmethod

endstruct

fixed... at least it doesnt hit the op limit (and it does)