System PUI - Perfect Unit Indexing

Jesus4Lyf

Good Idea™
Reaction score
397
Jesus4Lyfe, what in the world could you want from unit indexing that neither PUI nor AutoIndex does?
AIDS structs, of course. :)
It is imperative that indexes always be as low as possible because of the way jass arrays allocate memory.
>I believe in "don't fix if it is not broken" phylosophy.
>PUI works as it should and it works well, I have no intention of wasting my time on maybe-improvements.

What are you talking about? PUI is broken as hell by your logic. And it DOESN'T free indexes after 5 seconds. See demo map. Your algorithm vs mine.

By the way, that's only the average index. Would you like to see the max?
Edit: If so...
JASS:
library TestPUI initializer test uses PUI, Mod
    private function periodic takes nothing returns nothing
        globals
            private integer PUI_Max=0
            private integer Mod_Max=0
            private integer Index
            
            private unit u
        endglobals
        
        set u=CreateUnit(Player(0),'hfoo',0,0,0)
        set Index=GetUnitIndex(u)
        if Index>PUI_Max then
            set PUI_Max=Index
        endif
        call RemoveUnit(u)
        
        set u=CreateUnit(Player(0),'hfoo',0,0,0)
        set Index=Mod_GetUnitIndex(u)
        if Index>Mod_Max then
            set Mod_Max=Index
        endif
        call RemoveUnit(u)
        
        call BJDebugMsg("Max Indexes: PUI: "+I2S(PUI_Max)+" | Modded: "+I2S(Mod_Max)+".")
    endfunction
    private function test takes nothing returns nothing
        call TimerStart(CreateTimer(),0.02,true,function periodic)
    endfunction
endlibrary

Shows that PUI with your algorithm breaks when my algorithm is only on about index 3300. (Yes, 8100 to 3300, roughly.)
 

Attachments

  • test3.w3x
    24.3 KB · Views: 368

Cohadar

master of fugue
Reaction score
209
What are you talking about? PUI is broken as hell by your logic. And it DOESN'T free indexes after 5 seconds. See demo map. Your algorithm vs mine.
It frees indexes after 5-10 seconds, big deal.
PUI was the first indexing system out there, and by my logic it was and still is the best indexing system ever made.
A lot of really good map makers seems to agree with me on that one too.

I really don't care about your test maps because I have previous experience with you tiliting the results in your favour (TT vs KT2 thing)
so I am not going to waste any more of my time with this.

Please go develop your system in your own thread.
 

Jesus4Lyf

Good Idea™
Reaction score
397
I really don't care about your test maps because I have previous experience with you tiliting the results in your favour (TT vs KT2 thing)
Don't even try that. We ran your tests and had the same results as mine.

If I say PUI is broken, you know what I'm talking about. Your index recycling is wrong, as shown in the above test maps.

All the same, thanks for your time. I do value it more than a couple of nanoseconds from my computer. :)
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
Huh? I downloaded the map and put my unit indexing system as competitor. At early stage, moded PUI had lowest value.. But after 1 minute, I found my one has lowest value! lol. I had same decay time, recycler period....
 

Romek

Super Moderator
Reaction score
963
@kingkingyyk3:
Chances are, your indexing system is crap.
 

Cohadar

master of fugue
Reaction score
209
If I say PUI is broken, you know what I'm talking about. Your index recycling is wrong, as shown in the above test maps.
Ye you are talking about imaginary world in your head.

Because what you say must be true and the fact that me and Builder Bob have tested PUI extensively and that PUI had been used in all kinds of maps for almost 4 years without any errors/performance issues does not really matter.

It also does not matter that I explained to you (for the third time now) that optimizing property A of the system does not necessarily make the system better because it can fuck up properties B and C and D...

It also does not matter that you make your test maps in such a way as to compare one property of the system while disregarding others (intentionally) and thus giving a false impression of the entire sys.

Really I don't get why people who make modified/alternate versions of my systems always feel the need to prove to me that they are better somehow.
Prove it to yourself and prove it to the people who might want to use it and leave me alone.

If I see anyone else talking about their indexing system in my thread I am reporting him for trolling.
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
kingkingyyk3 owns PUI?

No, that test map was a demonstration of recycling algorithms, not unit indexing systems.

Actually, if you recycled faster than Modded PUI, on the same period, then your recycler is probably doing too much work. :p

My system only went up to 255 when PUI was full.

My recycle here. (similar with TT callback) :p
JASS:
        if GetUnitUserData(INDEXED_UNITS[Index]) == 0 then
            if DECAY_TICK[Index] > 0 then
                set DECAY_TICK[Index] = DECAY_TICK[Index] - 1
            else
                set INDEXED_UNITS[Index] = INDEXED_UNITS[COUNTER]
                set DECAY_TICK[Index] = DECAY_TICK[COUNTER]
                set INDEXED_UNITS[COUNTER] = null
                set DECAY_TICK[COUNTER] = 0
                set COUNTER = COUNTER - 1
                set LAST_FREE_INDEX = COUNTER
            endif
        endif
//Crap recycling <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite8" alt=":D" title="Big Grin    :D" loading="lazy" data-shortname=":D" />
 

Jesus4Lyf

Good Idea™
Reaction score
397
@kingkingyyk3
Your system is broken, you recycle more than 32 indexes per second.
Your code is horrible. :( You should switch to a real system, it will do significantly less processing in the background, and you don't have to write it yourself.

freeride.jpg


Also, your code has nothing to do with TT.
 

Joker(Div)

Always Here..
Reaction score
86
There must be a bug of some sort b/c I am getting units with the same index and the CHECK value also becomes bugged with it.
JASS:
scope Checkpoint initializer Init

    //! runtextmacro PUI_PROPERTY( &quot;&quot;, &quot;integer&quot;, &quot;CHECK&quot;, &quot;-1&quot; )

    globals
        private constant integer MAX_CHECKPOINTS = 8
    endglobals
    //======================================================
    
    globals
        private integer array CHECKPOINTS[MAX_PLAYERS] 
        
        public rect array AREA[MAX_CHECKPOINTS]
    endglobals
    //======================================================
    
    private function Conditions takes nothing returns boolean
        return CHECK[GetTriggerUnit()] &gt; -1
    endfunction
    
    private function Actions takes nothing returns nothing
        local unit a = GetTriggerUnit()
        local player p = GetOwningPlayer( a )
        local integer c = CHECK[a] + 1
        local real x = GetRectCenterX( AREA[c] )
        local real y = GetRectCenterY( AREA[c] )
        
        if IsPointInRegion( GetTriggeringRegion(), x, y ) then
        
            if (c + 1) &gt;= MAX_CHECKPOINTS then
                set c = GetPlayerId( p )
                set CHECKPOINTS[c] = CHECKPOINTS[c] + 1
                call BoardUpdateText( 2, c + 1, &quot;  &quot; + I2S( CHECKPOINTS[c] ) )
                
                set c = 0
                set CHECK[a] = c
                set x = GetRectCenterX( AREA[c] )
                set y = GetRectCenterY( AREA[c] )
            endif
            
            set CHECK[a] = -1
            call ShowUnit( a, false )
            call SetUnitExploded( a, true )
            call UnitApplyTimedLife( a, &#039;BTLF&#039;, 1. )
            //Pretty sure its PUI b/c it does not bug if I do not kill the entering unit.
            
            set a = CreateUnitEx( p, x, y )
            set CHECK[a] = c
            
            if p == GetLocalPlayer() then
                call ClearSelection()
                call SelectUnit( a, true )
                call PanCameraToTimed( x, y, 0. )
            endif
        endif
        
        set a = null
    endfunction
    //======================================================
    
    private function Init takes nothing returns nothing
        local integer i = 0
        
        set AREA[0] = Rect( -2624., -1888., -704.,   32. )
        set AREA[1] = Rect( -830.,   575.,   415.,   1760. )
        set AREA[2] = Rect( -4225.,  670.,  -3135.,  1790. )
        set AREA[3] = Rect( -4225., -3138., -3232., -2496. )
        set AREA[4] = Rect(  1092., -3171.,  1543., -2624. )
        set AREA[5] = Rect(  1230.,  2264.,  1550.,  2688. )
        set AREA[6] = Rect( -5056.,  2464., -4632.,  2688. )
        set AREA[7] = Rect( -5056., -3232., -4732., -3096. )
        
        loop
            call UnitEnterEvent( Condition( function Conditions ), function Actions, AREA<i> )
            set i = i + 1
            exitwhen i &gt;= MAX_CHECKPOINTS
        endloop
    endfunction

endscope</i>
 

Cohadar

master of fugue
Reaction score
209
Tell me how am I goint to reproduce your error from that script?
Please make me a demo map that demonstrates the bug.

Are you using UnitUserData directly somewhere?
 

Joker(Div)

Always Here..
Reaction score
86
Test map.

Maybe I'm doing something really weird with the unit replacement. Made a Demo of the bug.

EDIT: I found that the "BUGGED" msg gives out false-positives every once in a while when you don't kill the entering units.
 

Attachments

  • PUI BUG.w3x
    25.9 KB · Views: 364

Cohadar

master of fugue
Reaction score
209
Very strange thing, it really is an PUI error.
It was introduced with 5.2, version 5.1 works fine.

I have reattached 5.1 to first post, use that until I release 5.3
Thanks for finding this Joker(Div)

EDIT:
fixed, version 5.3 is out.
In case someone cares the problem was that I forgot to shift one index from free index section to used index section when indexes are recycled.
This was a problem because used and free indexes were kept in same array "to save space"..
This was very stupid of me because it complicated algorithm and thus caused me to miss this bug.
And I am the one that always tells people that they overdo with optimization...:banghead:
 

NetherHawk

New Member
Reaction score
26
hi.. pui only recycles indexes when a unit is removed right? that means that an index set for a hero will nvr become 0. Is that right?
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Varine Varine:
    I ordered like five blocks for 15 dollars. They're just little aluminum blocks with holes drilled into them
  • Varine Varine:
    They are pretty much disposable. I have shitty nozzles though, and I don't think these were designed for how hot I've run them
  • Varine Varine:
    I tried to extract it but the thing is pretty stuck. Idk what else I can use this for
  • Varine Varine:
    I'll throw it into my scrap stuff box, I'm sure can be used for something
  • Varine Varine:
    I have spare parts for like, everything BUT that block lol. Oh well, I'll print this shit next week I guess. Hopefully it fits
  • Varine Varine:
    I see that, despite your insistence to the contrary, we are becoming a recipe website
  • Varine Varine:
    Which is unique I guess.
  • The Helper The Helper:
    Actually I was just playing with having some kind of mention of the food forum and recipes on the main page to test and see if it would engage some of those people to post something. It is just weird to get so much traffic and no engagement
  • The Helper The Helper:
    So what it really is me trying to implement some kind of better site navigation not change the whole theme of the site
  • Varine Varine:
    How can you tell the difference between real traffic and indexing or AI generation bots?
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top