Bad Apple

You can submit your maps here. Both finished and unfinished submissions are welcome.
Forum rules
Finished maps:
• Submitting your own map(s):
One map per topic please! (Or we will have a hard time finding out which comment is for which map)
You can leave your Username@Realm so people can contact you in game. (eg.: 3ICE@USEast, 3ICE@Northrend)
Write a description and don't forget to post some screenshots. (Images and videos are worth a thousand words)
• Submitting a map not made by you:
Do not claim it as yours. We'll find it out (sooner or later) anyway.
Ask the maker to submit it himself is possible.
Or at least let the maker know that his map has a topic here, so he can benefit from your comments and bug reports. (Or request the thread be deleted for whatever reason*.)

Unfinished maps:
You are welcome to post your unfinished maps here and ask for help.
We will look at the map and tell you whats wrong with it or how to continue editing it.

Projects:
Important/cool maps and big projects will have their own forum category inside. (Like the 3ICE's Maze Designer category)
Ian
Posts: 76
Joined: Fri Aug 20, 2010 7:56 pm
Realm: US East
Account: Sesamia
Clan: 3ICE
Location: Minnesota

Bad Apple

Unread post by Ian »

I'd like to say one thing first: THIS IS NOT MY MAP. I also do not wish to contact the creator of this map. Solely because it's a hassle :| . If you do not approve of this 3ICE, then I will immediately track down the owner, pray that he speaks english, and ask for his permission.
I only want to share this awesome piece of work with those that are unaware if its existence.

This map was created by Renee (a user of some chinese website I believe) and is an in-game animation of a music video. Specifically this video: http://www.youtube.com/watch?v=VzEUeWnV73U.

Also, the map script has 433,125 (holy shit? Jasscraft required almost 2 minutes to open this) lines of code when uncompressed. I'm pretty sure Vexorian's map optimizer supports somewhere around 40,000 or 50,000 lines of code, so that was probably out of the question.

The map itself can be downloaded from: mapgnome,org/map-info/443374.


Now I'm curious. What other epic feats have you seen accomplished with the Warcraft III World Editor?
Last edited by 3ICE on Wed May 04, 2016 4:06 pm, edited 2 times in total.
Reason: disabled clicking on links in this post, as it leads to spam now (RIP mapgnome, you will be missed)
ʎɐqə ɯoɹɟ pɹɐoqʎəʞ ɐ ʎnq ı əɯıʇ ʇsɐl əɥʇ sı sıɥʇ


-Currently semi-inactive

User avatar
3ICE
Admin
Posts: 2629
Joined: Sat Mar 01, 2008 11:34 pm
Realm: Europe
Account: 3ICE
Clan: 3ICE
Location: Hungary
Contact:

Re: Bad Apple

Unread post by 3ICE »

I've heard about Renee before, thanks for showing me this map of his.

The Optimizer's script limit of 300 Thousand lines is artificial. If you contact Vexorian he'll send you an uncapped version. The next limit is at 2147483647 (2000 Million+) lines but your computer will lock up way before hitting it.
Ian wrote:What other epic feats have you seen accomplished with the Warcraft III World Editor?
Physics engine by many different guys over the years, some good some not so good.
Quake conversion (TcX) by Toadcop.
ImageImageImageImageImage
Image
ImageImage

User avatar
3ICE
Admin
Posts: 2629
Joined: Sat Mar 01, 2008 11:34 pm
Realm: Europe
Account: 3ICE
Clan: 3ICE
Location: Hungary
Contact:

Re: Bad Apple

Unread post by 3ICE »

Map analysis (Because I'm interested in this kind of stuff):

The script has 433126 (400 Thousand+) lines of code, which can be reduced by 144 to 432982 lines without rewriting it. Just removing comments and double blank lines.

Most of the script (432907 lines or 99.949%) is just very inefficient data initialization, looking like this:

Code: Select all

function PreloadData429 takes nothing returns nothing
set udg_Data[82]=0x3fffffff
set udg_Data[85]=0x21ffffff
set udg_Data[86]=0x3fffffff
set udg_Data[89]=0x201fffff
set udg_Data[90]=0x3fffffff
set udg_Data[93]=0x2007ffff
set udg_Data[94]=0x3fffffff
set udg_Data[97]=0x3ffff
set udg_Data[98]=0x3fffffff
set udg_Data[101]=0x1ffff
set udg_Data[102]=0x3ffffffe
set udg_Data[105]=0x1ffff
set udg_Data[106]=0x3ffffffe
set udg_Data[109]=0xffff
set udg_Data[110]=0x3ffffffc
set udg_Data[113]=0xffff
set udg_Data[114]=0x3ffffff8
set udg_Data[117]=0x7fff
set udg_Data[118]=0x3ffffff0
set udg_Data[121]=0x7fff
set udg_Data[122]=0x3fffffe0
set udg_Data[125]=0x7fff
set udg_Data[126]=0x3fffffc0
set udg_Data[129]=0x3fff
set udg_Data[130]=0x3fffff00
set udg_Data[133]=0x3fff
set udg_Data[134]=0x3ffffe00
set udg_Data[137]=0x1fff
set udg_Data[138]=0x3ffff000
set udg_Data[141]=0x1fff
set udg_Data[142]=0x3fffe000
set udg_Data[145]=0xfff
set udg_Data[146]=0x3fff8000
set udg_Data[149]=0xfff
set udg_Data[150]=0x30800000
set udg_Data[153]=0xfff
set udg_Data[154]=0x20000000
set udg_Data[157]=0x7ff
set udg_Data[158]=0x0
set udg_Data[161]=0x7ff
set udg_Data[162]=0x0
set udg_Data[165]=0x7ff
set udg_Data[166]=0x0
set udg_Data[169]=0x7ff
set udg_Data[170]=0x20000000
set udg_Data[173]=0x7fc07ff
set udg_Data[174]=0x20000000
set udg_Data[177]=0x3fff83ff
set udg_Data[178]=0x30000000
set udg_Data[181]=0x3ffff3ff
set udg_Data[182]=0x30000001
set udg_Data[186]=0x30000003
set udg_Data[190]=0x30000007
set udg_Data[194]=0x3000000f
set udg_Data[198]=0x3f
set udg_Data[199]=0x3ffffffc
set udg_Data[202]=0xff
set udg_Data[203]=0x3ffffff8
set udg_Data[206]=0x7f
set udg_Data[207]=0x3ffffff8
set udg_Data[210]=0xc00073f
set udg_Data[211]=0x3ffffff0
set udg_Data[214]=0x3c0007ff
set udg_Data[215]=0x3ffffff0
set udg_Data[218]=0x3e000fff
set udg_Data[219]=0x3ffffff3
set udg_Data[222]=0x3f803fff
set udg_Data[223]=0x3fffffff
set udg_Data[226]=0x3fc07fff
set udg_Data[227]=0x3fffffff
set udg_Data[230]=0x3fe1ffff
set udg_Data[231]=0x3fffffff
set udg_Data[234]=0x3ff3ffff
set udg_Data[235]=0x3fffffff
set udg_Data[238]=0x3fffffff
set udg_Data[239]=0x3fffffff
set udg_Data[242]=0x3fffffff
set udg_Data[246]=0x3fffffff
set udg_Data[250]=0x3fffffff
set udg_Data[254]=0x3fffffff
set udg_Data[258]=0x3fffffff
set udg_Data[262]=0x3fffffff
set udg_Data[266]=0x3fffffff
set udg_Data[267]=0x3fffffff
set udg_Data[270]=0x3fffffff
set udg_Data[271]=0x3fffffff
set udg_Data[274]=0x3fffffff
set udg_Data[275]=0x3fffffff
set udg_Data[278]=0x3fffffff
set udg_Data[279]=0x3fffffff
set udg_Data[282]=0x3fffffff
endfunction
He has 3269 of these blocks. (Or 3222, depending on how we count it.)

udg_Data is accessed 426140 times.

I did a quick (manual search and replace) series of optimizations and successfully reduced the script size from 11.6MB to 8.6MB. That is 3145728 (3 Million) characters smaller.
ImageImageImageImageImage
Image
ImageImage

User avatar
3ICE
Admin
Posts: 2629
Joined: Sat Mar 01, 2008 11:34 pm
Realm: Europe
Account: 3ICE
Clan: 3ICE
Location: Hungary
Contact:

Re: Bad Apple

Unread post by 3ICE »

And after uncovering all this, I played the map to see what it was all about...

Well he just took the video clip, converted it into a one dimensional array of pixels stored frame-by-frame, then wrote a quick function that displays the pixels. Rather disappointing. The music isn't even synced to the video.

The majority of the script is just data storage. The actual part responsible for playing back the stored data is in here:

Code: Select all

globals
    // User-defined
    real udg_x=0
    real udg_y=0
    location udg_p=null
    real udg_d=0
    integer udg_c1=0
    image array udg_img1
    image array udg_img2
    integer udg_c2=0
    integer array udg_Data
    filterfunc array udg_datafunc
    integer array udg_stats1
    integer array udg_stats2
    force udg_f=null
    integer udg_curframe=0
    integer udg_mpx=0
    integer udg_long=0
    integer udg_width=0
    timer udg_t=null
    // Generated
    string  gg_snd_BadApple
    trigger gg_trg_Start=null
    trigger gg_trg_x1=null
    trigger gg_trg_x2=null
    trigger gg_trg_y=null
    trigger gg_trg_t2=null
endglobals

Code: Select all

function InitGlobals takes nothing returns nothing
    local integer i=0
    set udg_x=-960.00
    set udg_y=720.00
    set udg_d=16.00
    set udg_c1=0
    set udg_c2=0
    set i=0
    loop
        exitwhen(i>1)
        set udg_Data[i]=0
        set i=i+1
    endloop
    set i=0
    loop
        exitwhen(i>1)
        set udg_stats1[i]=0
        set i=i+1
    endloop
    set i=0
    loop
        exitwhen(i>1)
        set udg_stats2[i]=0
        set i=i+1
    endloop
    set udg_f=bj_FORCE_PLAYER[0]
    set udg_curframe=-1
    set udg_mpx=0
    set udg_long=120
    set udg_width=45
    set udg_t=CreateTimer()
endfunction

Code: Select all

function Trig_t1_Actions takes nothing returns nothing
    local integer i=0
    local integer j
    local integer x
    local integer y
    local integer value
    set udg_curframe=(udg_curframe+1)
    if(udg_datafunc[udg_curframe]==null)then
        return
    endif
    call ForceEnumPlayersCounted(udg_f,udg_datafunc[udg_curframe],1)
        call DestroyFilter(udg_datafunc[udg_curframe])
    loop
        exitwhen i>udg_mpx
        set j=0
        set value=udg_Data[i/30]
        loop
            exitwhen j>29
            if value!=0 then
                set x=value/2
                set y=value-x*2
                if(y!=udg_stats1[i])then
                    call ShowImage(udg_img1[i],y==1)
                    set udg_stats1[i]=y
                endif
                    set value=x
            else
                call ShowImage(udg_img1[i],false)
                set udg_stats1[i]=0
            endif
            set j=j+1
            set i=i+1
        endloop
    endloop
    call TriggerExecute(gg_trg_t2)
endfunction

Code: Select all

function WorldsEnd takes nothing returns nothing
    call DisplayTimedTextToForce(GetPlayersAll(),30,"下次再见:)")
    call EndGame(false)
endfunction
function InitData takes nothing returns nothing
endfunction

// native CreateImage                  takes string file,real sizeX,real sizeY,real sizeZ,real posX,real posY,real posZ,real originX,real originY,real originZ,integer imageType returns image
function Trig_x1_Actions takes nothing returns nothing
    set bj_forLoopAIndex=1
    set bj_forLoopAIndexEnd=120
    loop
        exitwhen bj_forLoopAIndex>bj_forLoopAIndexEnd
        set udg_img1[udg_c1]=CreateImage("px.tga",32,32,32,udg_x,udg_y,0,0,0,0,2)
        call SetImageRenderAlways(udg_img1[udg_c1],true)
        call ShowImage(udg_img1[udg_c1],false)
        set udg_x=(udg_x+udg_d)
        set udg_c1=(udg_c1+1)
        set bj_forLoopAIndex=bj_forLoopAIndex+1
    endloop
endfunction

function InitTrig_x1 takes nothing returns nothing
    set gg_trg_x1=CreateTrigger()
    call TriggerAddAction(gg_trg_x1,function Trig_x1_Actions)
endfunction

Code: Select all

function Trig_x2_Actions takes nothing returns nothing
    set bj_forLoopAIndex=1
    set bj_forLoopAIndexEnd=120
    loop
        exitwhen bj_forLoopAIndex>bj_forLoopAIndexEnd
        set udg_img2[udg_c2]=CreateImage("px.tga",32,32,32,udg_x,udg_y,0,0,0,0,2)
        call SetImageRenderAlways(udg_img2[udg_c2],true)
        call ShowImage(udg_img2[udg_c2],false)
        set udg_x=(udg_x+udg_d)
        set udg_c2=(udg_c2+1)
        set bj_forLoopAIndex=bj_forLoopAIndex+1
    endloop
endfunction

function InitTrig_x2 takes nothing returns nothing
    set gg_trg_x2=CreateTrigger()
    call TriggerAddAction(gg_trg_x2,function Trig_x2_Actions)
endfunction

Code: Select all

function Trig_y_Func014A takes nothing returns nothing
    call TriggerRegisterPlayerEventEndCinematic(gg_trg_Start,GetEnumPlayer())
endfunction
function Trig_y_Actions takes nothing returns nothing
    call Preload("px.tga")
    set bj_forLoopBIndex=1
    set bj_forLoopBIndexEnd=45
    loop
        exitwhen bj_forLoopBIndex>bj_forLoopBIndexEnd
        call TriggerExecute(gg_trg_x1)
        set udg_y=(udg_y - udg_d)
        set udg_x=-960.00
        set bj_forLoopBIndex=bj_forLoopBIndex+1
    endloop
    set bj_forLoopBIndex=1
    set bj_forLoopBIndexEnd=45
    loop
        exitwhen bj_forLoopBIndex>bj_forLoopBIndexEnd
        call TriggerExecute(gg_trg_x2)
        set udg_y=(udg_y - udg_d)
        set udg_x=-960.00
        set bj_forLoopBIndex=bj_forLoopBIndex+1
    endloop
    call InitData()
    set udg_mpx=(udg_long * udg_width)
    call ClearMapMusicBJ()
    call EnableDawnDusk(false)
    call VolumeGroupSetVolumeBJ(SOUND_VOLUMEGROUP_AMBIENTSOUNDS,0.00)
    call VolumeGroupSetVolumeBJ(SOUND_VOLUMEGROUP_MUSIC,100.00)
    call TriggerSleepAction(0.00)
    call UseTimeOfDayBJ(false)
    call DisplayTextToForce(GetPlayersAll(),"TRIGSTR_026")
    call DisplayTextToForce(GetPlayersAll(),"TRIGSTR_028")
    call ForForce(GetPlayersAll(),function Trig_y_Func014A)
    call DisplayTimedTextToForce(GetPlayersAll(),30,"TRIGSTR_027")
endfunction

function InitTrig_y takes nothing returns nothing
    set gg_trg_y=CreateTrigger()
    call TriggerAddAction(gg_trg_y,function Trig_y_Actions)
endfunction

Code: Select all

function Trig_t2_Actions takes nothing returns nothing
    local integer i=0
    local integer j
    local integer x
    local integer y
    local integer value
    loop
        exitwhen i>udg_mpx
        set j=0
        set value=udg_Data[(udg_mpx+i)/30]
        loop
            exitwhen j>29
            if value!=0 then
                set x=value/2
                set y=value-x*2
                if(y!=udg_stats2[i])then
                    call ShowImage(udg_img2[i],y==1)
                    set udg_stats2[i]=y
                endif
                    set value=x
            else
                call ShowImage(udg_img2[i],false)
                set udg_stats2[i]=0
            endif
            set j=j+1
            set i=i+1
        endloop
    endloop
endfunction

function InitTrig_t2 takes nothing returns nothing
    set gg_trg_t2=CreateTrigger()
    call TriggerAddAction(gg_trg_t2,function Trig_t2_Actions)
endfunction

Code: Select all

function InitCustomTriggers takes nothing returns nothing
    call InitTrig_Start()
    call InitTrig_x1()
    call InitTrig_x2()
    call InitTrig_y()
    call InitTrig_t2()
endfunction

function RunInitializationTriggers takes nothing returns nothing
    call ConditionalTriggerExecute(gg_trg_y)
endfunction
(It took my computer over 2 minutes to remove the data storage blocks from the script (I did a couple RegEx search&replace operations with Notepad++). Everything above is the part that is NOT data storage. A mere 219 lines. 0.051% of the script.)
ImageImageImageImageImage
Image
ImageImage

Post Reply

Who is online

Users browsing this forum: No registered users and 151 guests