Page 1 of 2

Maze of PPF 2

Posted: Tue Apr 03, 2012 1:47 pm
by FaMoUs
Finally finish the new slide map that people were asking for. Should be the hardest slide map out. Let me know if you find any bugs.

Re: Maze of PPF 2

Posted: Tue Apr 03, 2012 1:48 pm
by 3ICE
Taking a look now.

Edit: I got half way on my first try, woot!

...Then I killed myself 5 times to check if the continues system was working. One issue is that it says "Continues: -1", which isn't right. It should be changed to something like "you ran out of continues". (Both on the multiboard and in the teal colored message.)

My compliments on using Region kill instead of the lazy approach that is terran kill. Scratch that, I found the terran kill code. :P The number of regions was suspiciously low so I went and looked for it.
JASS JASS
        if HM==GetTerrainType(x+hM,y)and HM==GetTerrainType(x-hM,y)and HM==GetTerrainType(x,y+hM)and HM==GetTerrainType(x,y-hM)and GetUnitState(u,UNIT_STATE_LIFE)>0 then             call KillUnit(u)         endif
Although it feels smooth and without issue in game, the sliding calculations could be improved. You use Location(GetLocationX(ap)+np*Cos(Vp*bj_DEGTORAD),GetLocationY(ap)+np*Sin(Vp*bj_DEGTORAD)), which is slow due to the Location(GetLocationX(),GetLocationY()) call. You are unpacking and then repacking the (X,Y) unit positions into a location wrapper for no reason. Use the units' X and Y coordinates directly, for a speed boost. You can cannibalize the code from my Sliding System.

I'm on a quad core so I don't feel the effects of wasted CPU power, but try your map on a PC that just barely meets WC3's system requirements and you will feel the lag.

Re: Maze of PPF 2

Posted: Wed Apr 04, 2012 4:06 am
by FaMoUs

Code: Select all

    local real x = GetUnitX(u)
    local real y = GetUnitY(u)
    local real a = GetOrderPointX()
    local real b = GetOrderPointY()

    if Ice[i] == true and IsUnitInGroup(u, Heroes) then
        call SetUnitFacing(u,Rad2Deg(Atan2(b-y,a-x)))
    endif
For example... do you mean instead of using b a and x y to just put the inside the code so it look like this

Code: Select all

call SetUnitFacing(u,Rad2Deg(Atan2(GetOrderPointY()-GetUnitY(u),GetOrderPointX()- GetUnitX(u))))
And btw for some reason I think optimizers changes the triggers might have to stop using it. I send the map unprotected by pm so you can look at the triggers better plus I don't think that i use GetLocationX for the slide system if I remember right or unless your telling me to use that. Don't know why you just didn't ask me for the map unprotected. I'm guessing you like to unprotect maps for fun. I never got to fully unprotect a map with out using xdept don't know how you do it.

Re: Maze of PPF 2

Posted: Wed Apr 04, 2012 4:32 am
by 3ICE
I can read the protected code, but thanks for the PM. I'll be able to tell you which trigger the Location() call is. Yeah, it is nowhere to be seen...

The code you posted looks good. It uses GetUnitX() (good) and not Location(GetlocationX(),GetlocationY()) (bad)

I don't deprotect maps, I just look inside the mpq archive. My main focus is war3map.j and I check every other file too.

Optimizer only changes triggers for the better. For example it gets rid of BJ calls (not all), inlines code for you, etc.

Re: Maze of PPF 2

Posted: Wed Apr 04, 2012 4:40 am
by FaMoUs
Okay, Anyways about the example I said is that what you meant? And about the terrain kill actually my friend suggested for me to use terrain kill because its more adjustable then Regions and so we can finish the map faster as well.

Re: Maze of PPF 2

Posted: Wed Apr 04, 2012 4:41 am
by 3ICE
I'm reprotecting your map and comparing it to the original right now...

Edit: Found my mistake. The code I complained about is not in the sliding trigger, it is only used a couple times in the Checkpoint function:
call PanCameraToTimedLocForPlayer(p, PolarProjectionBJ(GetRectCenter(r), grid * 3, d), .3)
I associated it with sliding because first generation sliding systems use PolarProjectionBJ. Which is translated to
Location(GetLocationX(ap)+np*Cos(Vp*bj_DEGTORAD),GetLocationY(ap)+np*Sin(Vp*bj_DEGTORAD)) by the Optimizer, a pattern I have come to recognize.
By the way that translation by the Optimizer is actually an improvement over using a BJ function, but it's still quite bad.

You can ignore the problem because it is only used once per checkpoint per player (33 times total). An amount we can calmly overlook.

Re: Maze of PPF 2

Posted: Wed Apr 04, 2012 4:43 am
by FaMoUs
Alright, I was just confuse about the locationX i was wondering were that came from.

Re: Maze of PPF 2

Posted: Wed Apr 04, 2012 4:48 am
by 3ICE
Edited it into my above post.

Re: Maze of PPF 2

Posted: Wed Apr 04, 2012 4:54 am
by FaMoUs
I was actually gonna remake that pan cam but totally forgot about it. I'll be probably be fixing it anyway if I make another version.
Anyways good night heading to bed.

Re: Maze of PPF 2

Posted: Wed Apr 04, 2012 4:59 am
by 3ICE
Personally, I wouldn't bother. Your time is more important than all the computers in the world.

Only optimize a function if it is running on a tight loop. Otherwise, prefer readability, maintainability, and as a general guideline: write what takes the shortest time.