1. Music Contest #10 - Results are finally published! Drop by to check some retro songs and congratulate the winners!
    Dismiss Notice
  2. Join Terraining Contest #19 and witness the aftermath!
    Dismiss Notice
  3. The 3rd Melee Mapping Contest is ON! Join in on a ride of a 4v4 melee experience!
    Dismiss Notice

Best of the Wurst 7

Discussion in 'Latest Updates and News' started by Frotty, Jul 30, 2018.

  1. Frotty

    Frotty

    Wurst Reviewer

    Joined:
    Jan 1, 2009
    Messages:
    1,290
    Resources:
    9
    Models:
    3
    Tools:
    1
    Maps:
    3
    Tutorials:
    1
    Wurst:
    1
    Resources:
    9
    [​IMG]

    After a small summer break we return this month with many bugfixes and improvements to WurstScript quality of life and overall user experience.

    Make sure your wurst setup tool is up to date and then update your wurst installation to get improved handling of wc3 patch versions, some new code inspection warnings, and new optimizer features.

    Tool updates

    • The VSCode runmap command now more reliably detects patch level - fixes several cases of "black screen" when starting the game.
    • Warnings and errors about *improper usage of
      @compiletime
      * have been added, which aids in avoiding some user level programming issues.
    • A handful of new wurst optimizer features (see below).
    • Valid function names in Wurst, such as 'set' and 'debug' no longer generate invalid output Jass.
    • We have updated JMPQ once again to improve performance and compatibility of wurst with maps not built with the vanilla world editor, e.g. YDWE and w3x2ini (Thanks to @WaterKnight)
    • Shoutout to users @dulingzhi and @DengSir for contributions to the VSCode editor experience: Highlighting improved (PR #36), and language-server now better starts automatically (PR #37)

    Standard library

    Many new features and many merged pull requests! The standard library is doing great - here are some notable changes:

    • The Upgrade Object Editing package has been improved and completed by #77
    • Missing extension functions and tuple wrappers have been added by #79, #80, #81, #82, #84, #85, #86, #87, #88, #89, #90, #91
    • The
      TerrainUtils
      package has been refactored for better integration and advanced functionality by #67
    • LinkedList#sort
      has been fixed to not have exponential performance anymore
    • ClosureEvents
      have been added to the standard library. A new package for easy encapsulated event listening.
      Code Sample:
      Code (WurstScript):
      EventListener.onPointCast(hero, MY_SPELL) (caster, target) ->
         forUnitsInRange(target, 256) victim ->
            caster.damageTarget(victim)
      Big thanks to all the amazing contributors!

     
    Last edited: Aug 1, 2018
  2. Frotty

    Frotty

    Wurst Reviewer

    Joined:
    Jan 1, 2009
    Messages:
    1,290
    Resources:
    9
    Models:
    3
    Tools:
    1
    Maps:
    3
    Tutorials:
    1
    Wurst:
    1
    Resources:
    9
    Spotlight: Code Optimizations

    Did you know that the wurst compiler supports a number of automatic optimizations that keep your map script small & fast? (Discussed further in Wurst for vJass Users).

    This month we have added numerous new optimizer improvements, making this feature of wurst more powerful than ever. Here's a summary:

    • The wurst package initialization now only uses one trigger for all
      init
      s.
    • Duplicate initial branch statements without side effects are now merged outside the branch.
    • Consecutive statements of
      set
      and
      exitwhen
      are now merged into one if applicable.
    • Sums of the same variable or function are now rewritten (
      a + a => a*2
      ) which improves the effectiveness of other optimizations.
    The great thing about new optimizations is that they cause something like an avalanche effect. Meaning that due to these 'minor' changes in the output code, other already existing optimizations can now be applied over again successfully, where they didn't change anything before.

    You can always check the output code in the
    _build/output.j.txt
    file. Here is a small example:
    Code (WurstScript):
    let g = CreateGroup()
    for u from g
        u.addHP(100)
    Turns into:
    Code (vJASS):
    local group from = CreateGroup()
    local unit iterUnit
    loop
        exitwhen FirstOfGroup(from) == null
        set iterUnit = FirstOfGroup(from)
        call GroupRemoveUnit(from, iterUnit)
        call SetUnitState(iterUnit, UNIT_STATE_LIFE, GetUnitState(iterUnit, UNIT_STATE_LIFE) + 100.)
    endloop
    set from = null
    set iterUnit = null


    Thanks for reading, we hope you enjoy these posts - and as usual, let us know what you think.

    p.s.: If you haven't starred the Wurst repository yet, please do so to help us get to 100 stars!

    Cheers!

    -Frotty
     
  3. BlueSaint

    BlueSaint

    Joined:
    Jun 18, 2012
    Messages:
    2,664
    Resources:
    3
    Tools:
    1
    Spells:
    2
    Resources:
    3
  4. Chaosy

    Chaosy

    Joined:
    Jun 9, 2011
    Messages:
    10,387
    Resources:
    17
    Maps:
    1
    Spells:
    10
    Tutorials:
    6
    Resources:
    17
  5. BlueSaint

    BlueSaint

    Joined:
    Jun 18, 2012
    Messages:
    2,664
    Resources:
    3
    Tools:
    1
    Spells:
    2
    Resources:
    3
    is dead
     
  6. MyPad

    MyPad

    Spell Reviewer

    Joined:
    May 9, 2014
    Messages:
    1,081
    Resources:
    2
    Models:
    1
    Icons:
    1
    Resources:
    2
    Frotty vs MindWorX (Wurst Vs vJASS)...

    That is .. surreal, now that vJASS is officially supported in the latest PTR patch, although not likely to be maintained unless issues spring up otherwise (such as default 8190 allocation).
     
  7. PurgeandFire

    PurgeandFire

    Code Moderator

    Joined:
    Nov 11, 2006
    Messages:
    7,399
    Resources:
    18
    Icons:
    1
    Spells:
    4
    Tutorials:
    9
    JASS:
    4
    Resources:
    18
    awesome stuff! I love seeing these news batches.

    about the "for u from g"--that is pretty neat--although i wonder if it should be more explicit that the group is being mutated. Unless you guys only compile it that way if g isn't referenced later in the scope?
     
  8. Frotty

    Frotty

    Wurst Reviewer

    Joined:
    Jan 1, 2009
    Messages:
    1,290
    Resources:
    9
    Models:
    3
    Tools:
    1
    Maps:
    3
    Tutorials:
    1
    Wurst:
    1
    Resources:
    9
    Uhm..?

    Thanks Paf :) It's mostly for the example's sake.
    For in
    copies the group, keeping the original intact,
    For from
    mutates it.
    Me personally I prefer lambda syntax and thus usually use closure variants like
    .forEach() element ->
    or
    .removeIf() element ->
    etc.
    But the output code gets a bit more complex.
     
  9. PurgeandFire

    PurgeandFire

    Code Moderator

    Joined:
    Nov 11, 2006
    Messages:
    7,399
    Resources:
    18
    Icons:
    1
    Spells:
    4
    Tutorials:
    9
    JASS:
    4
    Resources:
    18
    oo got it. That makes sense.
     
  10. Fingolfin

    Fingolfin

    Joined:
    Jan 11, 2009
    Messages:
    3,097
    Resources:
    152
    Models:
    142
    Icons:
    1
    Packs:
    4
    Skins:
    2
    Maps:
    1
    Spells:
    1
    Tutorials:
    1
    Resources:
    152
    Exponential performance? Why, that sounds like a good thing! Performance increasing exponentially with N! O(N^2) performance would be worse. ;)
     
  11. nnnnnnoT_T

    nnnnnnoT_T

    Joined:
    Feb 10, 2018
    Messages:
    5
    Resources:
    0
    Resources:
    0
    Hi!
    I use a lot of closure and war3 crashed, why:confused:
     
  12. Frotty

    Frotty

    Wurst Reviewer

    Joined:
    Jan 1, 2009
    Messages:
    1,290
    Resources:
    9
    Models:
    3
    Tools:
    1
    Maps:
    3
    Tutorials:
    1
    Wurst:
    1
    Resources:
    9
    "Using lot of closure" alone doesn't cause any crashes. Paste the code that causes the crash wurstbin
     
  13. karaulov

    karaulov

    Joined:
    Jun 17, 2010
    Messages:
    196
    Resources:
    3
    Tools:
    3
    Resources:
    3
    Here only WURST language syntax? Can't support C language ?
     
  14. MyPad

    MyPad

    Spell Reviewer

    Joined:
    May 9, 2014
    Messages:
    1,081
    Resources:
    2
    Models:
    1
    Icons:
    1
    Resources:
    2
    Well, it is called Wurst for a reason.
     
  15. karaulov

    karaulov

    Joined:
    Jun 17, 2010
    Messages:
    196
    Resources:
    3
    Tools:
    3
    Resources:
    3
    Sad :( Looks interesting, but ... I do not want to jam the head with junk, Jass vJass cJass wUrst ... (
     
  16. Frotty

    Frotty

    Wurst Reviewer

    Joined:
    Jan 1, 2009
    Messages:
    1,290
    Resources:
    9
    Models:
    3
    Tools:
    1
    Maps:
    3
    Tutorials:
    1
    Wurst:
    1
    Resources:
    9
    Wurst also supports a vJass-ish dialect Jurst and vanilla Jass.

    Don't worry, you just need to get rid of your jass junk once.
    But if a mere syntax stops you from using or learning something, you might not be ready to embrace the Wurst yet ;)
     
  17. Donach

    Donach

    Joined:
    Jan 12, 2011
    Messages:
    95
    Resources:
    1
    Tutorials:
    1
    Resources:
    1
    Syntax of Wurst is the best part - it's auto-completed in the VSCode! You just start writing andit gets to you by it self!
    Wurst has very steep learning curve compared to plain JASS or vJass.
     
  18. karaulov

    karaulov

    Joined:
    Jun 17, 2010
    Messages:
    196
    Resources:
    3
    Tools:
    3
    Resources:
    3
    Wurst not support C++ style syntax?