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

[Trigger] Rapid Framerate Loss, I challenge you to fix it :D

Status
Not open for further replies.
I am really having issues with this... It works on single player just fine but when I put 12 players into it the thing drops framerates faster than it shows em.
I believe it must be leaks. It runs this trigger twelve times every 0.02 seconds. That may be quite the load on the computer but it sill doesnt explain the non consistent framerate (besides consistantly dropping).

I set the period to 0.06 and it did the same thing, a lot slower, but it still did it.
With the period set to 0.06 the stats are.
Under 1000 iterations the framerate is around 30
At 3000 iterations the framerate is at 22 fps
At 8000 iterations the framerate has lowered to 17 fps
At 14000 iterations the framerate has gone as low as 8 fps

With the period set to 0.02...
The framerate drops to 6 at 5000 iterations

I haven't really patched up any leaks... Where are they?


  • Period Copy
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Here[(Integer A)] Equal to True
            • Then - Actions
              • -------- DEBUG - NEXT THREE --------
              • Cinematic - Clear the screen of text messages for (All players)
              • Game - Display to (All players) the text: ((Updating + ((String(Keystate[1])) + , )) + (State[(Integer A)] + ( + (String(DEBUG)))))
              • Set DEBUG = (DEBUG + 1)
              • -------- END DEBUG --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Keystate[(Integer A)] Equal to 1000
                • Then - Actions
                  • Set State[(Integer A)] = stand
                  • Set Timer[(Integer A)] = 0.00
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • vY[(Integer A)] Equal to 0.00
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • State[(Integer A)] Equal to fall
                    • Then - Actions
                      • Set State[(Integer A)] = stand
                      • Set Timer[(Integer A)] = 0.00
                    • Else - Actions
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • vY[(Integer A)] Greater than 0.00
                    • Then - Actions
                      • Set State[(Integer A)] = jump
                      • Set Timer[(Integer A)] = 0.00
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • vY[(Integer A)] Less than 0.00
                        • Then - Actions
                          • Set State[(Integer A)] = fall
                          • Set Timer[(Integer A)] = 0.00
                        • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • State[(Integer A)] Equal to roll
                • Then - Actions
                  • Unit - Make Unit[(Integer A)] face ((Facing of Unit[(Integer A)]) + 1.00) over 0.00 seconds
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • StunTimer[(Integer A)] Greater than 0
                    • Then - Actions
                      • Set StunTimer[(Integer A)] = (StunTimer[(Integer A)] - 1)
                    • Else - Actions
                      • Set State[(Integer A)] = stun
                      • Set StunTimer[(Integer A)] = 10
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • State[(Integer A)] Equal to stun
                    • Then - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • vX[(Integer A)] Greater than 0.00
                        • Then - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • vX[(Integer A)] Less than (Friction x 1.50)
                            • Then - Actions
                              • Set vX[(Integer A)] = 0.00
                            • Else - Actions
                              • Set vX[(Integer A)] = (vX[(Integer A)] - (Friction x 1.50))
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • vX[(Integer A)] Less than 0.00
                            • Then - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • vX[(Integer A)] Greater than (Friction x -1.50)
                                • Then - Actions
                                  • Set vX[(Integer A)] = 0.00
                                • Else - Actions
                                  • Set vX[(Integer A)] = (vX[(Integer A)] + (Friction x 1.50))
                            • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • StunTimer[(Integer A)] Greater than 0
                        • Then - Actions
                          • Set StunTimer[(Integer A)] = (StunTimer[(Integer A)] - 1)
                        • Else - Actions
                          • Set State[(Integer A)] = stand
                    • Else - Actions
              • -------- Control --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • State[(Integer A)] Not equal to fall
                  • State[(Integer A)] Not equal to jump
                  • State[(Integer A)] Not equal to stun
                  • State[(Integer A)] Not equal to roll
                • Then - Actions
                  • -------- Left/Right --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                    • Then - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Substring((String(Keystate[(Integer A)])), 1, 1)) Equal to 2
                        • Then - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Substring((String(Keystate[(Integer A)])), 2, 2)) Equal to 0
                            • Then - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • Timer[(Integer A)] Less than 5.00
                                • Then - Actions
                                  • Set State[(Integer A)] = walk
                                  • Set Timer[(Integer A)] = (Timer[(Integer A)] + 0.20)
                                • Else - Actions
                                  • Set State[(Integer A)] = run
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • vX[(Integer A)] Greater than (MoveSpeed x -1.00)
                                • Then - Actions
                                  • Set vX[(Integer A)] = (vX[(Integer A)] - 0.50)
                                • Else - Actions
                              • Set LeftFacing[(Integer A)] = True
                              • Unit - Make Unit[(Integer A)] face 180.00 over 0.00 seconds
                            • Else - Actions
                              • Set State[(Integer A)] = stand
                              • Set Timer[(Integer A)] = 0.00
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • vX[(Integer A)] Greater than 0.00
                                • Then - Actions
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • vX[(Integer A)] Less than Friction
                                    • Then - Actions
                                      • Set vX[(Integer A)] = 0.00
                                    • Else - Actions
                                      • Set vX[(Integer A)] = (vX[(Integer A)] - Friction)
                                • Else - Actions
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • vX[(Integer A)] Less than 0.00
                                    • Then - Actions
                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                        • If - Conditions
                                          • vX[(Integer A)] Greater than (Friction x -1.00)
                                        • Then - Actions
                                          • Set vX[(Integer A)] = 0.00
                                        • Else - Actions
                                          • Set vX[(Integer A)] = (vX[(Integer A)] + Friction)
                                    • Else - Actions
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Substring((String(Keystate[(Integer A)])), 2, 2)) Equal to 1
                            • Then - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • Timer[(Integer A)] Less than 5.00
                                • Then - Actions
                                  • Set State[(Integer A)] = walk
                                  • Set Timer[(Integer A)] = (Timer[(Integer A)] + 0.20)
                                • Else - Actions
                                  • Set State[(Integer A)] = run
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • vX[(Integer A)] Less than MoveSpeed
                                • Then - Actions
                                  • Set vX[(Integer A)] = (vX[(Integer A)] + 0.50)
                                • Else - Actions
                              • Set LeftFacing[(Integer A)] = False
                              • Unit - Make Unit[(Integer A)] face 0.00 over 0.00 seconds
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • vX[(Integer A)] Greater than 0.00
                                • Then - Actions
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • vX[(Integer A)] Less than Friction
                                    • Then - Actions
                                      • Set vX[(Integer A)] = 0.00
                                    • Else - Actions
                                      • Set vX[(Integer A)] = (vX[(Integer A)] - Friction)
                                • Else - Actions
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • vX[(Integer A)] Less than 0.00
                                    • Then - Actions
                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                        • If - Conditions
                                          • vX[(Integer A)] Greater than (Friction x -1.00)
                                        • Then - Actions
                                          • Set vX[(Integer A)] = 0.00
                                        • Else - Actions
                                          • Set vX[(Integer A)] = (vX[(Integer A)] + Friction)
                                    • Else - Actions
                    • Else - Actions
                  • -------- Up --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Substring((String(Keystate[(Integer A)])), 4, 4)) Equal to 1
                    • Then - Actions
                      • Set vY[(Integer A)] = Jump
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • vX[(Integer A)] Equal to 0.00
                        • Then - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • LeftFacing[(Integer A)] Equal to True
                            • Then - Actions
                              • Set vX[(Integer A)] = (MoveSpeed x -0.50)
                            • Else - Actions
                              • Set vX[(Integer A)] = (MoveSpeed x 0.50)
                        • Else - Actions
                    • Else - Actions
                • Else - Actions
              • Set Loc = (Position of Unit[(Integer A)])
              • -------- Gravity --------
              • Set vY[(Integer A)] = (vY[(Integer A)] - Gravity)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • vY[(Integer A)] Less than -128.00
                • Then - Actions
                  • Set vY[(Integer A)] = -128.00
                • Else - Actions
              • -------- Ycollision --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • State[(Integer A)] Not equal to roll
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Terrain pathing at (Loc offset by (0.00, (vY[(Integer A)] - CollisionSize))) of type Walkability is off) Equal to True
                      • vY[(Integer A)] Less than 0.00
                    • Then - Actions
                      • Set vY[(Integer A)] = 0.00
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Terrain pathing at (Loc offset by (0.00, (vY[(Integer A)] + CollisionSize))) of type Walkability is off) Equal to True
                      • vY[(Integer A)] Greater than 0.00
                    • Then - Actions
                      • Set vY[(Integer A)] = 0.00
                    • Else - Actions
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Terrain pathing at (Loc offset by (0.00, (vY[(Integer A)] - (CollisionSize x 2.00)))) of type Walkability is off) Equal to True
                      • vY[(Integer A)] Less than 0.00
                    • Then - Actions
                      • Set State[(Integer A)] = stun
                      • Set StunTimer[(Integer A)] = 70
                    • Else - Actions
              • -------- Xcollision --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Terrain pathing at (Loc offset by ((vX[(Integer A)] + CollisionSize), 0.00)) of type Walkability is off) Equal to True
                      • vX[(Integer A)] Greater than 0.00
                    • Then - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Terrain pathing at (Loc offset by ((vX[(Integer A)] + CollisionSize), 100.00)) of type Walkability is off) Equal to False
                          • State[(Integer A)] Not equal to stun
                          • State[(Integer A)] Not equal to roll
                        • Then - Actions
                          • Custom script: call MoveLocation( udg_Loc, GetLocationX( udg_Loc ), ( GetLocationY( udg_Loc ) + 64 ) )
                          • Set State[(Integer A)] = walk
                          • Set Timer[(Integer A)] = 0.00
                        • Else - Actions
                          • Set vX[(Integer A)] = 0.00
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Terrain pathing at (Loc offset by ((vX[(Integer A)] - CollisionSize), 0.00)) of type Walkability is off) Equal to True
                      • vX[(Integer A)] Less than 0.00
                    • Then - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Terrain pathing at (Loc offset by ((vX[(Integer A)] - CollisionSize), 100.00)) of type Walkability is off) Equal to False
                          • State[(Integer A)] Not equal to stun
                          • State[(Integer A)] Not equal to roll
                        • Then - Actions
                          • Custom script: call MoveLocation( udg_Loc, GetLocationX( udg_Loc ), ( GetLocationY( udg_Loc ) + 64 ) )
                          • Set State[(Integer A)] = walk
                          • Set Timer[(Integer A)] = 0.00
                        • Else - Actions
                          • Set vX[(Integer A)] = 0.00
                    • Else - Actions
                • Else - Actions
              • Custom script: call MoveLocation( udg_Position[ bj_forLoopAIndex ], GetLocationX( udg_Loc ) + udg_vX[ bj_forLoopAIndex ] , GetLocationY( udg_Loc ) + udg_vY[ bj_forLoopAIndex ] )
              • Custom script: call SetUnitX( udg_Unit[ bj_forLoopAIndex ], GetLocationX( udg_Position[ bj_forLoopAIndex ] ) )
              • Custom script: call SetUnitY( udg_Unit[ bj_forLoopAIndex ], GetLocationY( udg_Position[ bj_forLoopAIndex ] ) )
            • Else - Actions


JASS:
function Trig_Period_Copy_Copy_Func001Func001Func006C takes nothing returns boolean
    if ( not ( udg_Keystate[GetForLoopIndexA()] == 1000 ) ) then
        return false
    endif
    return true
endfunction

function Trig_Period_Copy_Copy_Func001Func001Func007Func001C takes nothing returns boolean
    if ( not ( udg_State[GetForLoopIndexA()] == "fall" ) ) then
        return false
    endif
    return true
endfunction

function Trig_Period_Copy_Copy_Func001Func001Func007Func003Func001C takes nothing returns boolean
    if ( not ( udg_vY[GetForLoopIndexA()] < 0.00 ) ) then
        return false
    endif
    return true
endfunction

function Trig_Period_Copy_Copy_Func001Func001Func007Func003C takes nothing returns boolean
    if ( not ( udg_vY[GetForLoopIndexA()] > 0.00 ) ) then
        return false
    endif
    return true
endfunction

function Trig_Period_Copy_Copy_Func001Func001Func007C takes nothing returns boolean
    if ( not ( udg_vY[GetForLoopIndexA()] == 0.00 ) ) then
        return false
    endif
    return true
endfunction

function Trig_Period_Copy_Copy_Func001Func001Func008Func001Func001Func001C takes nothing returns boolean
    if ( not ( udg_vX[GetForLoopIndexA()] < ( udg_Friction * 1.50 ) ) ) then
        return false
    endif
    return true
endfunction

function Trig_Period_Copy_Copy_Func001Func001Func008Func001Func001Func002Func001C takes nothing returns boolean
    if ( not ( udg_vX[GetForLoopIndexA()] > ( udg_Friction * -1.50 ) ) ) then
        return false
    endif
    return true
endfunction

function Trig_Period_Copy_Copy_Func001Func001Func008Func001Func001Func002C takes nothing returns boolean
    if ( not ( udg_vX[GetForLoopIndexA()] < 0.00 ) ) then
        return false
    endif
    return true
endfunction

function Trig_Period_Copy_Copy_Func001Func001Func008Func001Func001C takes nothing returns boolean
    if ( not ( udg_vX[GetForLoopIndexA()] > 0.00 ) ) then
        return false
    endif
    return true
endfunction

function Trig_Period_Copy_Copy_Func001Func001Func008Func001Func002C takes nothing returns boolean
    if ( not ( udg_StunTimer[GetForLoopIndexA()] > 0 ) ) then
        return false
    endif
    return true
endfunction

function Trig_Period_Copy_Copy_Func001Func001Func008Func001C takes nothing returns boolean
    if ( not ( udg_State[GetForLoopIndexA()] == "stun" ) ) then
        return false
    endif
    return true
endfunction

function Trig_Period_Copy_Copy_Func001Func001Func008Func003C takes nothing returns boolean
    if ( not ( udg_StunTimer[GetForLoopIndexA()] > 0 ) ) then
        return false
    endif
    return true
endfunction

function Trig_Period_Copy_Copy_Func001Func001Func008C takes nothing returns boolean
    if ( not ( udg_State[GetForLoopIndexA()] == "roll" ) ) then
        return false
    endif
    return true
endfunction

function Trig_Period_Copy_Copy_Func001Func001Func010Func002Func001Func001Func001C takes nothing returns boolean
    if ( not ( udg_Timer[GetForLoopIndexA()] < 5.00 ) ) then
        return false
    endif
    return true
endfunction

function Trig_Period_Copy_Copy_Func001Func001Func010Func002Func001Func001Func002Func001C takes nothing returns boolean
    if ( not ( udg_vX[GetForLoopIndexA()] < udg_Friction ) ) then
        return false
    endif
    return true
endfunction

function Trig_Period_Copy_Copy_Func001Func001Func010Func002Func001Func001Func002Func002Func001C takes nothing returns boolean
    if ( not ( udg_vX[GetForLoopIndexA()] > ( udg_Friction * -1.00 ) ) ) then
        return false
    endif
    return true
endfunction

function Trig_Period_Copy_Copy_Func001Func001Func010Func002Func001Func001Func002Func002C takes nothing returns boolean
    if ( not ( udg_vX[GetForLoopIndexA()] < 0.00 ) ) then
        return false
    endif
    return true
endfunction

function Trig_Period_Copy_Copy_Func001Func001Func010Func002Func001Func001Func002C takes nothing returns boolean
    if ( not ( udg_vX[GetForLoopIndexA()] > 0.00 ) ) then
        return false
    endif
    return true
endfunction

function Trig_Period_Copy_Copy_Func001Func001Func010Func002Func001Func001Func004C takes nothing returns boolean
    if ( not ( udg_vX[GetForLoopIndexA()] < udg_MoveSpeed ) ) then
        return false
    endif
    return true
endfunction

function Trig_Period_Copy_Copy_Func001Func001Func010Func002Func001Func001C takes nothing returns boolean
    if ( not ( SubStringBJ(I2S(udg_Keystate[GetForLoopIndexA()]), 2, 2) == "1" ) ) then
        return false
    endif
    return true
endfunction

function Trig_Period_Copy_Copy_Func001Func001Func010Func002Func001Func002Func003C takes nothing returns boolean
    if ( not ( udg_Timer[GetForLoopIndexA()] < 5.00 ) ) then
        return false
    endif
    return true
endfunction

function Trig_Period_Copy_Copy_Func001Func001Func010Func002Func001Func002Func004Func001C takes nothing returns boolean
    if ( not ( udg_vX[GetForLoopIndexA()] < udg_Friction ) ) then
        return false
    endif
    return true
endfunction

function Trig_Period_Copy_Copy_Func001Func001Func010Func002Func001Func002Func004Func002Func001C takes nothing returns boolean
    if ( not ( udg_vX[GetForLoopIndexA()] > ( udg_Friction * -1.00 ) ) ) then
        return false
    endif
    return true
endfunction

function Trig_Period_Copy_Copy_Func001Func001Func010Func002Func001Func002Func004Func002C takes nothing returns boolean
    if ( not ( udg_vX[GetForLoopIndexA()] < 0.00 ) ) then
        return false
    endif
    return true
endfunction

function Trig_Period_Copy_Copy_Func001Func001Func010Func002Func001Func002Func004C takes nothing returns boolean
    if ( not ( udg_vX[GetForLoopIndexA()] > 0.00 ) ) then
        return false
    endif
    return true
endfunction

function Trig_Period_Copy_Copy_Func001Func001Func010Func002Func001Func002Func005C takes nothing returns boolean
    if ( not ( udg_vX[GetForLoopIndexA()] > ( udg_MoveSpeed * -1.00 ) ) ) then
        return false
    endif
    return true
endfunction

function Trig_Period_Copy_Copy_Func001Func001Func010Func002Func001Func002C takes nothing returns boolean
    if ( not ( SubStringBJ(I2S(udg_Keystate[GetForLoopIndexA()]), 2, 2) == "0" ) ) then
        return false
    endif
    return true
endfunction

function Trig_Period_Copy_Copy_Func001Func001Func010Func002Func001C takes nothing returns boolean
    if ( not ( SubStringBJ(I2S(udg_Keystate[GetForLoopIndexA()]), 1, 1) == "2" ) ) then
        return false
    endif
    return true
endfunction

function Trig_Period_Copy_Copy_Func001Func001Func010Func002C takes nothing returns boolean
    return true
endfunction

function Trig_Period_Copy_Copy_Func001Func001Func010Func004Func002Func001C takes nothing returns boolean
    if ( not ( udg_LeftFacing[GetForLoopIndexA()] == true ) ) then
        return false
    endif
    return true
endfunction

function Trig_Period_Copy_Copy_Func001Func001Func010Func004Func002C takes nothing returns boolean
    if ( not ( udg_vX[GetForLoopIndexA()] == 0.00 ) ) then
        return false
    endif
    return true
endfunction

function Trig_Period_Copy_Copy_Func001Func001Func010Func004C takes nothing returns boolean
    if ( not ( SubStringBJ(I2S(udg_Keystate[GetForLoopIndexA()]), 4, 4) == "1" ) ) then
        return false
    endif
    return true
endfunction

function Trig_Period_Copy_Copy_Func001Func001Func010C takes nothing returns boolean
    if ( not ( udg_State[GetForLoopIndexA()] != "fall" ) ) then
        return false
    endif
    if ( not ( udg_State[GetForLoopIndexA()] != "jump" ) ) then
        return false
    endif
    if ( not ( udg_State[GetForLoopIndexA()] != "stun" ) ) then
        return false
    endif
    if ( not ( udg_State[GetForLoopIndexA()] != "roll" ) ) then
        return false
    endif
    return true
endfunction

function Trig_Period_Copy_Copy_Func001Func001Func014C takes nothing returns boolean
    if ( not ( udg_vY[GetForLoopIndexA()] < -128.00 ) ) then
        return false
    endif
    return true
endfunction

function Trig_Period_Copy_Copy_Func001Func001Func016Func001C takes nothing returns boolean
    if ( not ( IsTerrainPathableBJ(OffsetLocation(udg_Loc, 0, ( udg_vY[GetForLoopIndexA()] - ( udg_CollisionSize * 2.00 ) )), PATHING_TYPE_WALKABILITY) == true ) ) then
        return false
    endif
    if ( not ( udg_vY[GetForLoopIndexA()] < 0.00 ) ) then
        return false
    endif
    return true
endfunction

function Trig_Period_Copy_Copy_Func001Func001Func016Func003C takes nothing returns boolean
    if ( not ( IsTerrainPathableBJ(OffsetLocation(udg_Loc, 0, ( udg_vY[GetForLoopIndexA()] - udg_CollisionSize )), PATHING_TYPE_WALKABILITY) == true ) ) then
        return false
    endif
    if ( not ( udg_vY[GetForLoopIndexA()] < 0.00 ) ) then
        return false
    endif
    return true
endfunction

function Trig_Period_Copy_Copy_Func001Func001Func016Func004C takes nothing returns boolean
    if ( not ( IsTerrainPathableBJ(OffsetLocation(udg_Loc, 0, ( udg_vY[GetForLoopIndexA()] + udg_CollisionSize )), PATHING_TYPE_WALKABILITY) == true ) ) then
        return false
    endif
    if ( not ( udg_vY[GetForLoopIndexA()] > 0.00 ) ) then
        return false
    endif
    return true
endfunction

function Trig_Period_Copy_Copy_Func001Func001Func016C takes nothing returns boolean
    if ( not ( udg_State[GetForLoopIndexA()] != "roll" ) ) then
        return false
    endif
    return true
endfunction

function Trig_Period_Copy_Copy_Func001Func001Func018Func001Func001C takes nothing returns boolean
    if ( not ( IsTerrainPathableBJ(OffsetLocation(udg_Loc, ( udg_vX[GetForLoopIndexA()] + udg_CollisionSize ), 100.00), PATHING_TYPE_WALKABILITY) == false ) ) then
        return false
    endif
    if ( not ( udg_State[GetForLoopIndexA()] != "stun" ) ) then
        return false
    endif
    if ( not ( udg_State[GetForLoopIndexA()] != "roll" ) ) then
        return false
    endif
    return true
endfunction

function Trig_Period_Copy_Copy_Func001Func001Func018Func001C takes nothing returns boolean
    if ( not ( IsTerrainPathableBJ(OffsetLocation(udg_Loc, ( udg_vX[GetForLoopIndexA()] + udg_CollisionSize ), 0.00), PATHING_TYPE_WALKABILITY) == true ) ) then
        return false
    endif
    if ( not ( udg_vX[GetForLoopIndexA()] > 0.00 ) ) then
        return false
    endif
    return true
endfunction

function Trig_Period_Copy_Copy_Func001Func001Func018Func002Func001C takes nothing returns boolean
    if ( not ( IsTerrainPathableBJ(OffsetLocation(udg_Loc, ( udg_vX[GetForLoopIndexA()] - udg_CollisionSize ), 100.00), PATHING_TYPE_WALKABILITY) == false ) ) then
        return false
    endif
    if ( not ( udg_State[GetForLoopIndexA()] != "stun" ) ) then
        return false
    endif
    if ( not ( udg_State[GetForLoopIndexA()] != "roll" ) ) then
        return false
    endif
    return true
endfunction

function Trig_Period_Copy_Copy_Func001Func001Func018Func002C takes nothing returns boolean
    if ( not ( IsTerrainPathableBJ(OffsetLocation(udg_Loc, ( udg_vX[GetForLoopIndexA()] - udg_CollisionSize ), 0.00), PATHING_TYPE_WALKABILITY) == true ) ) then
        return false
    endif
    if ( not ( udg_vX[GetForLoopIndexA()] < 0.00 ) ) then
        return false
    endif
    return true
endfunction

function Trig_Period_Copy_Copy_Func001Func001Func018C takes nothing returns boolean
    return true
endfunction

function Trig_Period_Copy_Copy_Func001Func001C takes nothing returns boolean
    if ( not ( udg_Here[GetForLoopIndexA()] == true ) ) then
        return false
    endif
    return true
endfunction

function Trig_Period_Copy_Copy_Actions takes nothing returns nothing
    set bj_forLoopAIndex = 1
    set bj_forLoopAIndexEnd = 12
    loop
        exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
        if ( Trig_Period_Copy_Copy_Func001Func001C() ) then
            // DEBUG - NEXT THREE
            call ClearTextMessagesBJ( GetPlayersAll() )
            call DisplayTextToForce( GetPlayersAll(), ( ( "Updating " + ( I2S(udg_Keystate[1]) + ", " ) ) + ( udg_State[GetForLoopIndexA()] + ( " " + I2S(udg_DEBUG) ) ) ) )
            set udg_DEBUG = ( udg_DEBUG + 1 )
            // END DEBUG
            if ( Trig_Period_Copy_Copy_Func001Func001Func006C() ) then
                set udg_State[GetForLoopIndexA()] = "stand"
                set udg_Timer[GetForLoopIndexA()] = 0.00
            else
            endif
            if ( Trig_Period_Copy_Copy_Func001Func001Func007C() ) then
                if ( Trig_Period_Copy_Copy_Func001Func001Func007Func001C() ) then
                    set udg_State[GetForLoopIndexA()] = "stand"
                    set udg_Timer[GetForLoopIndexA()] = 0.00
                else
                endif
            else
                if ( Trig_Period_Copy_Copy_Func001Func001Func007Func003C() ) then
                    set udg_State[GetForLoopIndexA()] = "jump"
                    set udg_Timer[GetForLoopIndexA()] = 0.00
                else
                    if ( Trig_Period_Copy_Copy_Func001Func001Func007Func003Func001C() ) then
                        set udg_State[GetForLoopIndexA()] = "fall"
                        set udg_Timer[GetForLoopIndexA()] = 0.00
                    else
                    endif
                endif
            endif
            if ( Trig_Period_Copy_Copy_Func001Func001Func008C() ) then
                call SetUnitFacingTimed( udg_Unit[GetForLoopIndexA()], ( GetUnitFacing(udg_Unit[GetForLoopIndexA()]) + 1.00 ), 0 )
                if ( Trig_Period_Copy_Copy_Func001Func001Func008Func003C() ) then
                    set udg_StunTimer[GetForLoopIndexA()] = ( udg_StunTimer[GetForLoopIndexA()] - 1 )
                else
                    set udg_State[GetForLoopIndexA()] = "stun"
                    set udg_StunTimer[GetForLoopIndexA()] = 10
                endif
            else
                if ( Trig_Period_Copy_Copy_Func001Func001Func008Func001C() ) then
                    if ( Trig_Period_Copy_Copy_Func001Func001Func008Func001Func001C() ) then
                        if ( Trig_Period_Copy_Copy_Func001Func001Func008Func001Func001Func001C() ) then
                            set udg_vX[GetForLoopIndexA()] = 0.00
                        else
                            set udg_vX[GetForLoopIndexA()] = ( udg_vX[GetForLoopIndexA()] - ( udg_Friction * 1.50 ) )
                        endif
                    else
                        if ( Trig_Period_Copy_Copy_Func001Func001Func008Func001Func001Func002C() ) then
                            if ( Trig_Period_Copy_Copy_Func001Func001Func008Func001Func001Func002Func001C() ) then
                                set udg_vX[GetForLoopIndexA()] = 0.00
                            else
                                set udg_vX[GetForLoopIndexA()] = ( udg_vX[GetForLoopIndexA()] + ( udg_Friction * 1.50 ) )
                            endif
                        else
                        endif
                    endif
                    if ( Trig_Period_Copy_Copy_Func001Func001Func008Func001Func002C() ) then
                        set udg_StunTimer[GetForLoopIndexA()] = ( udg_StunTimer[GetForLoopIndexA()] - 1 )
                    else
                        set udg_State[GetForLoopIndexA()] = "stand"
                    endif
                else
                endif
            endif
            // Control
            if ( Trig_Period_Copy_Copy_Func001Func001Func010C() ) then
                // Left/Right
                if ( Trig_Period_Copy_Copy_Func001Func001Func010Func002C() ) then
                    if ( Trig_Period_Copy_Copy_Func001Func001Func010Func002Func001C() ) then
                        if ( Trig_Period_Copy_Copy_Func001Func001Func010Func002Func001Func002C() ) then
                            if ( Trig_Period_Copy_Copy_Func001Func001Func010Func002Func001Func002Func003C() ) then
                                set udg_State[GetForLoopIndexA()] = "walk"
                                set udg_Timer[GetForLoopIndexA()] = ( udg_Timer[GetForLoopIndexA()] + 0.20 )
                            else
                                set udg_State[GetForLoopIndexA()] = "run"
                            endif
                            if ( Trig_Period_Copy_Copy_Func001Func001Func010Func002Func001Func002Func005C() ) then
                                set udg_vX[GetForLoopIndexA()] = ( udg_vX[GetForLoopIndexA()] - 0.50 )
                            else
                            endif
                            set udg_LeftFacing[GetForLoopIndexA()] = true
                            call SetUnitFacingTimed( udg_Unit[GetForLoopIndexA()], 180.00, 0 )
                        else
                            set udg_State[GetForLoopIndexA()] = "stand"
                            set udg_Timer[GetForLoopIndexA()] = 0.00
                            if ( Trig_Period_Copy_Copy_Func001Func001Func010Func002Func001Func002Func004C() ) then
                                if ( Trig_Period_Copy_Copy_Func001Func001Func010Func002Func001Func002Func004Func001C() ) then
                                    set udg_vX[GetForLoopIndexA()] = 0.00
                                else
                                    set udg_vX[GetForLoopIndexA()] = ( udg_vX[GetForLoopIndexA()] - udg_Friction )
                                endif
                            else
                                if ( Trig_Period_Copy_Copy_Func001Func001Func010Func002Func001Func002Func004Func002C() ) then
                                    if ( Trig_Period_Copy_Copy_Func001Func001Func010Func002Func001Func002Func004Func002Func001C() ) then
                                        set udg_vX[GetForLoopIndexA()] = 0.00
                                    else
                                        set udg_vX[GetForLoopIndexA()] = ( udg_vX[GetForLoopIndexA()] + udg_Friction )
                                    endif
                                else
                                endif
                            endif
                        endif
                    else
                        if ( Trig_Period_Copy_Copy_Func001Func001Func010Func002Func001Func001C() ) then
                            if ( Trig_Period_Copy_Copy_Func001Func001Func010Func002Func001Func001Func001C() ) then
                                set udg_State[GetForLoopIndexA()] = "walk"
                                set udg_Timer[GetForLoopIndexA()] = ( udg_Timer[GetForLoopIndexA()] + 0.20 )
                            else
                                set udg_State[GetForLoopIndexA()] = "run"
                            endif
                            if ( Trig_Period_Copy_Copy_Func001Func001Func010Func002Func001Func001Func004C() ) then
                                set udg_vX[GetForLoopIndexA()] = ( udg_vX[GetForLoopIndexA()] + 0.50 )
                            else
                            endif
                            set udg_LeftFacing[GetForLoopIndexA()] = false
                            call SetUnitFacingTimed( udg_Unit[GetForLoopIndexA()], 0.00, 0 )
                        else
                            if ( Trig_Period_Copy_Copy_Func001Func001Func010Func002Func001Func001Func002C() ) then
                                if ( Trig_Period_Copy_Copy_Func001Func001Func010Func002Func001Func001Func002Func001C() ) then
                                    set udg_vX[GetForLoopIndexA()] = 0.00
                                else
                                    set udg_vX[GetForLoopIndexA()] = ( udg_vX[GetForLoopIndexA()] - udg_Friction )
                                endif
                            else
                                if ( Trig_Period_Copy_Copy_Func001Func001Func010Func002Func001Func001Func002Func002C() ) then
                                    if ( Trig_Period_Copy_Copy_Func001Func001Func010Func002Func001Func001Func002Func002Func001C() ) then
                                        set udg_vX[GetForLoopIndexA()] = 0.00
                                    else
                                        set udg_vX[GetForLoopIndexA()] = ( udg_vX[GetForLoopIndexA()] + udg_Friction )
                                    endif
                                else
                                endif
                            endif
                        endif
                    endif
                else
                endif
                // Up
                if ( Trig_Period_Copy_Copy_Func001Func001Func010Func004C() ) then
                    set udg_vY[GetForLoopIndexA()] = udg_Jump
                    if ( Trig_Period_Copy_Copy_Func001Func001Func010Func004Func002C() ) then
                        if ( Trig_Period_Copy_Copy_Func001Func001Func010Func004Func002Func001C() ) then
                            set udg_vX[GetForLoopIndexA()] = ( udg_MoveSpeed * -0.50 )
                        else
                            set udg_vX[GetForLoopIndexA()] = ( udg_MoveSpeed * 0.50 )
                        endif
                    else
                    endif
                else
                endif
            else
            endif
            set udg_Loc = GetUnitLoc(udg_Unit[GetForLoopIndexA()])
            // Gravity
            set udg_vY[GetForLoopIndexA()] = ( udg_vY[GetForLoopIndexA()] - udg_Gravity )
            if ( Trig_Period_Copy_Copy_Func001Func001Func014C() ) then
                set udg_vY[GetForLoopIndexA()] = -128.00
            else
            endif
            // Ycollision
            if ( Trig_Period_Copy_Copy_Func001Func001Func016C() ) then
                if ( Trig_Period_Copy_Copy_Func001Func001Func016Func003C() ) then
                    set udg_vY[GetForLoopIndexA()] = 0.00
                else
                endif
                if ( Trig_Period_Copy_Copy_Func001Func001Func016Func004C() ) then
                    set udg_vY[GetForLoopIndexA()] = 0.00
                else
                endif
            else
                if ( Trig_Period_Copy_Copy_Func001Func001Func016Func001C() ) then
                    set udg_State[GetForLoopIndexA()] = "stun"
                    set udg_StunTimer[GetForLoopIndexA()] = 70
                else
                endif
            endif
            // Xcollision
            if ( Trig_Period_Copy_Copy_Func001Func001Func018C() ) then
                if ( Trig_Period_Copy_Copy_Func001Func001Func018Func001C() ) then
                    if ( Trig_Period_Copy_Copy_Func001Func001Func018Func001Func001C() ) then
                        call MoveLocation( udg_Loc, GetLocationX( udg_Loc ), ( GetLocationY( udg_Loc ) + 64 ) )
                        set udg_State[GetForLoopIndexA()] = "walk"
                        set udg_Timer[GetForLoopIndexA()] = 0.00
                    else
                        set udg_vX[GetForLoopIndexA()] = 0.00
                    endif
                else
                endif
                if ( Trig_Period_Copy_Copy_Func001Func001Func018Func002C() ) then
                    if ( Trig_Period_Copy_Copy_Func001Func001Func018Func002Func001C() ) then
                        call MoveLocation( udg_Loc, GetLocationX( udg_Loc ), ( GetLocationY( udg_Loc ) + 64 ) )
                        set udg_State[GetForLoopIndexA()] = "walk"
                        set udg_Timer[GetForLoopIndexA()] = 0.00
                    else
                        set udg_vX[GetForLoopIndexA()] = 0.00
                    endif
                else
                endif
            else
            endif
            call MoveLocation( udg_Position[ bj_forLoopAIndex ], GetLocationX( udg_Loc ) + udg_vX[ bj_forLoopAIndex ] , GetLocationY( udg_Loc ) + udg_vY[ bj_forLoopAIndex ] )
            call SetUnitX( udg_Unit[ bj_forLoopAIndex ], GetLocationX( udg_Position[ bj_forLoopAIndex ] ) )
            call SetUnitY( udg_Unit[ bj_forLoopAIndex ], GetLocationY( udg_Position[ bj_forLoopAIndex ] ) )
        else
        endif
        set bj_forLoopAIndex = bj_forLoopAIndex + 1
    endloop
endfunction

//===========================================================================
function InitTrig_Period_Copy_Copy takes nothing returns nothing
    set gg_trg_Period_Copy_Copy = CreateTrigger(  )
    call TriggerRegisterTimerEventPeriodic( gg_trg_Period_Copy_Copy, 0.02 )
    call TriggerAddAction( gg_trg_Period_Copy_Copy, function Trig_Period_Copy_Copy_Actions )
endfunction

 
Level 28
Joined
Jan 26, 2007
Messages
4,789
You've used 2 Loc-variables, but you never clear them (or do you clear it somewhere else?).
That's what I think :p

Try clearing them both at the end of the trigger, see if it worked, if it didn't, I'll take another look at this massive system.

A GUI-system for this is very challenging, I hope you succeed :)
I like it though, I've only seen JASS-versions of this.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
You've used 2 Loc-variables, but you never clear them (or do you clear it somewhere else?).
I do not see any local variable, what are you on about?

Its probably string related. May I remind you that unique strings leak as WC3 never destroys them? After making 500000 odd strings, obviously it will lag. Try disabling the debug text and seeing if it still lags. Also there is no cure to leaked strings, this is a core fault with the WC3 engine and it is advisable to avoid as many unique string generations as possiable. In short do not create unique strings regually, you can however create the same strings over and over again with no worry at all of ever making lag.
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
Set Loc = (Position of Unit[(Integer A)])


(Terrain pathing at (Loc offset by (0.00, (vY[(Integer A)] - CollisionSize))) of type Walkability is off) Equal to True


(Terrain pathing at (Loc offset by (0.00, (vY[(Integer A)] + CollisionSize))) of type Walkability is off) Equal to True


(Terrain pathing at (Loc offset by (0.00, (vY[(Integer A)] - (CollisionSize x 2.00)))) of type Walkability is off) Equal to True


(Terrain pathing at (Loc offset by ((vX[(Integer A)] + CollisionSize), 0.00)) of type Walkability is off) Equal to True


(Terrain pathing at (Loc offset by ((vX[(Integer A)] + CollisionSize), 100.00)) of type Walkability is off) Equal to False


(Terrain pathing at (Loc offset by ((vX[(Integer A)] - CollisionSize), 0.00)) of type Walkability is off) Equal to True


(Terrain pathing at (Loc offset by ((vX[(Integer A)] - CollisionSize), 100.00)) of type Walkability is off) Equal to False


Is it only my browser that doesn't like displaying square braces anymore or is it the Hive?

On a side note, this shows exactly why you shouldn't create things like this in GUI, geez, just look at the huge block of ugly code that isn't even multi-instance-able (although it could be edited a little in order to be multi-instance-able, it's still all ugly and crappy).
 
Okay, so if I understand everyone correctly.
#1 Try using X and Y which GUI does not handle very well.
#2 Don't use strings that much
#3 I don't understand what you mean by multi instance able. I only need it to work with 12 instances anyway, but more would be nice.

Also no, my web browser is also showing & # 9 1 ; and & # 9 3 ; instead of brackets within jass tabs.
But GhostWolf could you be more specific as to how I could edit the code?


EDIT

Wow.. Okay.
I did not know that whole thing about unique strings, and it would seem that was the only thing wrong with my system...
I turned off the debug and suddenly the framerate is completely stable... I played the game for maybe seven minutes and the whole time the framerate depended solely on the amount of doodads in the screen >.< (I have a bit too many in certain areas...)
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
#3 I don't understand what you mean by multi instance able. I only need it to work with 12 instances anyway, but more would be nice.

Any good physics system (or any good system for this matter) should be multi instance able.
You can change the current code to register a unit every time you want, and loop through all the registered units.
This allows you to have up to 8192 units (which of course you'll never get to anyway), and it's really, really easy to make from your current code.
If you want more info about this, ask.

But GhostWolf could you be more specific as to how I could edit the code?

Every time you declare a new location, it creates a new location object in the 'background'. Your location variable points to that object, but if you create a new location with the same variable, the variable points to the new object, and the previous one is just floating there and eating a few bytes of your memory.

For a start, remove that "Loc" variable every time you stop using it (notice that it is used 12 times since it's in the loop):
  • Custom script: call RemoveLocation(udg_Loc)
Continuing from there, "point offset by X" also brings you a location, so what you need to do is "set Point2 = Point1 offset by X", and then later on remove the second location when you do not need it.

Overall you leak 96 locations every iteration, you probably have a lot of RAM to not get effected by this through 7 minutes.
 
Any good physics system (or any good system for this matter) should be multi instance able.
You can change the current code to register a unit every time you want, and loop through all the registered units.
This allows you to have up to 8192 units (which of course you'll never get to anyway), and it's really, really easy to make from your current code.
If you want more info about this, ask.
From what I gather, this is an arrow key movement system. Why would an arrow key movement system need to be MUI? Each player only has 1 set of arrow keys.
 
Status
Not open for further replies.
Top