• 🏆 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!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

KB3D - Knock back 3D

Status
Not open for further replies.
Level 16
Joined
Jul 31, 2012
Messages
2,217
I pushed tests to their limits, results:
4vHQnLL.png

and i finally had 5000 counter before the loop triggered the clear (no more instances)
The lag occurred ed exactly when instances reached 200
note that they were all on the screen, and not spread on the map
So, i thought of what could be the solution, in indexing, or whatever it's name is, when you replace an inactive instance with another could be THE solution
of a reducement for the huge lag
I think the system can lag less if it wasn't Hashtable based, i will see what will come up with both of us, chobibo

Till now, i will change all required stuff, and will see what happens

I hope and think that tomorrow will be the release date :D
 
Level 22
Joined
Sep 24, 2005
Messages
4,821
Yo Jad, lemme see the new code, I won't use the GUI indexing, I'm going to use a linked list.
 
Level 22
Joined
Sep 24, 2005
Messages
4,821
God, I'm having trouble with linked list, it's been so long since I've used one that I forgot how to, LAWL, I'm going back to arrays lol.
 
Level 22
Joined
Sep 24, 2005
Messages
4,821
JASS:
globals
    integer ListLast = 8190
    integer array List
    
    integer InstanceCount = 0
endglobals


function List_add takes integer index returns boolean
    set List[index]=ListLast
    set ListLast=index
    set InstanceCount=InstanceCount+1
    return (InstanceCount<8190)
endfunction

function List_delete takes integer index returns nothing
    set ListLast = List[index]
    set InstanceCount=InstanceCount-1
endfunction

function List_iterate takes nothing returns nothing
    local integer i
    local integer last = ListLast
    loop
        set i = last
        exitwhen i==8190
        call BJDebugMsg(I2S(i))
        set last=List[i]
    endloop
endfunction

function InitTrig_List takes nothing returns nothing
    call List_add(9)
    call List_add(8)
    call List_add(7)
    call List_add(6)
    call List_add(5)
    call List_add(4)
    call List_add(3)
    call List_add(2)
    call List_add(1)
    call List_add(0)
    call TimerStart(CreateTimer(),1.00,false,function List_iterate)
endfunction
Oh sorry wrong edit!
This implementation lacks proper removal. lol.
EDIT: INFO: You don't need the mathematical operation to loop through the elements on the list.
EDIT 2: This is called a singly linked list.
 
Level 22
Joined
Sep 24, 2005
Messages
4,821
Oh sorry Jad, I was just showing chief Rheiko what linked lists looked like, you don't need that lol.
 
Level 22
Joined
Sep 24, 2005
Messages
4,821
Jass doesn't do that for locals, only global variables are properly initialized to null without user intervention. The declaration local unit caster will not initialize caster with a null value. It's undefined.
 
Level 22
Joined
Sep 24, 2005
Messages
4,821
YAHAHAHAHA! I managed to remember how to remove links properly dafuq!
JASS:
function List_iterate takes nothing returns nothing
    local integer i
    local integer last = ListLast
    local integer p = (-1)
    loop
        set i = last
        exitwhen i==8190
        if (i==5) then
            set List=List[i] @<-- This one removes the current link@
        endif
        call BJDebugMsg(I2S(i))
        set p=last
        set last=List[i]
    endloop
    call TimerStart(GetExpiredTimer(),1.00,false, function List_iterate)
endfunction
 
Level 22
Joined
Sep 24, 2005
Messages
4,821
Somethings wrong with the z ordinate manipulation, sometimes the unit doesn't go down, add a hashtable entry, a boolean to check if the unit already has a knockback, and if it does, to ignore it. You can also make an additive knockback but you'll need to overhaul those computations. I can't help you there, we need a mathematician here fast LOL!

EDIT: Wait, maybe Jad could do it, he studied physics after all lol!
 
Level 16
Joined
Jul 31, 2012
Messages
2,217
I AM working on it
14 of the hashtable is for something called Ztot, total height gained during the spell/instance giving us the possibility to know the amount of Z that should be automatically be removed after the spell, note that it is in BETA stage in your current version of the system and on the thread
 
Level 22
Joined
Sep 24, 2005
Messages
4,821
Hm, I think you could submit this already, I mean if you used arrays (as I was suggesting) for this then importing it would be messier, since you'll be needing 15 arrays. What do you guys think Malhorne-sama? Rheiko-sama?
 
Status
Not open for further replies.
Top