1. Melee Mapping contest #3 - Poll is up! Vote for the best 4v4 melee maps!
    Dismiss Notice
  2. The 30th edition of the Modeling Contest is finally up! The Portable Buildings need your attention, so come along and have a blast!
    Dismiss Notice
  3. We have a new contest going on right now! Join the 11th Music Contest! You are to make a Cinematic modern sound-track for this contest, so come and compete with other people for fun.
    Dismiss Notice

Best of the Wurst 9

Discussion in 'Latest Updates and News' started by Frotty, Dec 27, 2018.

  1. Frotty

    Frotty

    Wurst Reviewer

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

    In the last couple of months, we have reached over 100 stars on GitHub, updated our homepage, and as usual caught up with support for Warcraft 3 patches
    1.30.2
    and beyond.


    Tool updates


    • The wurst family of tools now supports the latest battle.net stable patch (1.30.2).
    • The wurst language was updated to allow
      class
      es to contain tuple array members.
    • Improper usage of generic types now throws proper compilation errors
    • Attempting to access objects that are known to have already been destroyed now fails at compile time
    • Attempting to access objects that are known to have already been destroyed now fails at compile time
    • Fixed a bug in local optimizations which caused unexpected behavior.
    • Wurst no longer requires JavaFX, which enables wurst builds in a wider range of java distributions.

    Standard library highlights


    • Merged over a dozen awesome pull requests.
    • Added
      DummyCaster
      in addition to
      InstantDummyCaster
      for channel based spells, and spells with delayed effects.
    • Fixed some critical bugs in
      HashList
      ,
      HashSet
      and
      Knockback3D
      .
    • We have newly-added code conventions - go align your formatting!
    • We have begun writing in-depth package documentation

    >> Read more <<
     

    Attached Files:

    Last edited: Jan 8, 2019
  2. Frotty

    Frotty

    Wurst Reviewer

    Joined:
    Jan 1, 2009
    Messages:
    1,323
    Resources:
    9
    Models:
    3
    Tools:
    1
    Maps:
    3
    Tutorials:
    1
    Wurst:
    1
    Resources:
    9

    Spotlight: Stack traces


    Did you know that WurstScript generates stack traces for calls of
    error(string msg)
    from the
    ErrorHandling
    package?
    You might have seen this from a wurst error before - it will show you which lines in your code were executed in what order before the error occured.

    Take a look at this example:

    Code (WurstScript):
    package Test
    import ErrorHandling

    function foo()
        new A().bar()

    class A

        function bar()
            error("This is an error message")

    init
        foo()

    It produces the following stacktrace ingame:

    [​IMG]

    As you can see the most recent line comes at the top and the oldest at the bottom. Stack traces help tremendously with debugging errors, as it gives you a history of what happened before the error. Naturally they cause quite a performance hit. If you verified your map working well, you can disable them via the corresponding runarg
    -stacktraces
    , which is enabled by default.
     
  3. Lake

    Lake

    Joined:
    Mar 5, 2015
    Messages:
    53
    Resources:
    0
    Resources:
    0
    I suppose it only causes a performance hit if the error actually occurs, or have I misunderstood something? :O
     
  4. Frotty

    Frotty

    Wurst Reviewer

    Joined:
    Jan 1, 2009
    Messages:
    1,323
    Resources:
    9
    Models:
    3
    Tools:
    1
    Maps:
    3
    Tutorials:
    1
    Wurst:
    1
    Resources:
    9
    No, they always do since the stacktrace is built at any time to be available when the error occurs. You can easily see this in the generated code.
    It is usually negliable, hence default on. But it doess add quite a few lines, and you can notice this in heavy or performance critical operations in single digit FPS differences or so.
     
  5. DoctorGester

    DoctorGester

    Joined:
    Dec 6, 2009
    Messages:
    72
    Resources:
    3
    Maps:
    2
    JASS:
    1
    Resources:
    3
    Any plans to target lua once the support is supposedly implemented in the game?
     
  6. yxq1122

    yxq1122

    Joined:
    Jun 5, 2018
    Messages:
    65
    Resources:
    0
    Resources:
    0
    Good job as always!
     
  7. Lake

    Lake

    Joined:
    Mar 5, 2015
    Messages:
    53
    Resources:
    0
    Resources:
    0
    Holy moly - here I thought I finally knew what I was doing, haha :D That's really good to know, thank you! Glad you made a spot on it, otherwise I would never have given it a thought ;) Have to learn something new every day, eh? :)

    Really love these tips/tricks/mini tutorials btw! Thank you for being awesome
     
  8. Astrella

    Astrella

    Joined:
    Oct 3, 2008
    Messages:
    125
    Resources:
    1
    Maps:
    1
    Resources:
    1
    This just does full to Jass compilation right? So should have no issues with new World Editor patches that you wouldn't have otherwise anyway?
     
  9. Frotty

    Frotty

    Wurst Reviewer

    Joined:
    Jan 1, 2009
    Messages:
    1,323
    Resources:
    9
    Models:
    3
    Tools:
    1
    Maps:
    3
    Tutorials:
    1
    Wurst:
    1
    Resources:
    9
    We reopened our Lua backend ticket that was oroginally intended for dota2, so yes, it's kinda planned.

    Thanks, glad you like it.

    What is full jass compilation? World editor patches don't affect existing maps and the editor is only to be used for terrain with wurst, so I'm not sure what you're asking.
     
    Last edited: Jan 5, 2019
  10. Astrella

    Astrella

    Joined:
    Oct 3, 2008
    Messages:
    125
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Oh I'm just a bit confused as to how it interacts with the World Editor itself.
     
  11. Sir Moriarty

    Sir Moriarty

    Joined:
    Jun 13, 2016
    Messages:
    248
    Resources:
    2
    Spells:
    1
    Tutorials:
    1
    Resources:
    2
    Is there any actual confirmation from Blizzard that it is ever going to happen? I'm rather skeptical we'll ever see it.
     
  12. Ybco

    Ybco

    Joined:
    Mar 3, 2018
    Messages:
    10
    Resources:
    0
    Resources:
    0
    Wurst seems awesome, I'm really enjoying using it and I'm starting a map based on it.
    However, I wonder: being a language (or whatever is the appropriate classification for Wurst) not directly coming from blizzard, is there a chance that my project will become unusable or incompatible with future Wc3 patches?
     
  13. Frotty

    Frotty

    Wurst Reviewer

    Joined:
    Jan 1, 2009
    Messages:
    1,323
    Resources:
    9
    Models:
    3
    Tools:
    1
    Maps:
    3
    Tutorials:
    1
    Wurst:
    1
    Resources:
    9
    Thanks. And I don't think your project will be come unusable. Rather it will stay usable even if the backend changes (e.g. lua) without you having to change your code, since wurst can simply output something else.
    IIRC Regarding map compatibility, blizzard has stated that most "old maps" that don't do anything crazy will continue working.
    Wurst only outputs maps that could also be replicated with the normal editor, and therefore not be distinguished by the game unless by malicious intention.
     
  14. MiniMage

    MiniMage

    Joined:
    Jun 5, 2008
    Messages:
    1,740
    Resources:
    22
    Models:
    21
    Skins:
    1
    Resources:
    22
    What editor do you guys use to save your map then? JNGP doesn't work anymore as far as I know and whenever I tried to save old maps with vjass code on them using the new default map editor, it shattered everything but the GUI code. I'm not sure how hard it would be to tweak my code into wurst though.

    If wurst would be able to save my map code, I'd embrace it with open arms. That would mean that I wouldn't have to start over from scratch and I'd be pleased as punch for such a result.
     
  15. Frotty

    Frotty

    Wurst Reviewer

    Joined:
    Jan 1, 2009
    Messages:
    1,323
    Resources:
    9
    Models:
    3
    Tools:
    1
    Maps:
    3
    Tutorials:
    1
    Wurst:
    1
    Resources:
    9
    For terrain and minor other stuff we use the vanilla world editor. JNGP resp. our derivative Wurstpack can still work, but you need the old wc3 files.

    I haven't used the recent world editor's jasshelper - in theory it should work I suppose. You just need to get the output jass from jasshelper and feed it into wurst. For a workflow see Compiling vJass and Wurst using VSCode . Also WurstScript • Legacy Map Guide
    Most vjass code can be easily converted to Jurst.

    It should work, but of course there are some drawbacks.
     
  16. Fingolfin

    Fingolfin

    Joined:
    Jan 11, 2009
    Messages:
    3,140
    Resources:
    152
    Models:
    142
    Icons:
    1
    Packs:
    4
    Skins:
    2
    Maps:
    1
    Spells:
    1
    Tutorials:
    1
    Resources:
    152
    I have a question about the native function wrappers... Are they compiled into wrapper functions, or are they inlined to natives?
     
  17. Frotty

    Frotty

    Wurst Reviewer

    Joined:
    Jan 1, 2009
    Messages:
    1,323
    Resources:
    9
    Models:
    3
    Tools:
    1
    Maps:
    3
    Tutorials:
    1
    Wurst:
    1
    Resources:
    9
    If you have inlining enabled, anything that makes sense to be inlined will be.
    What is your concern?
     
    Last edited: Jan 10, 2019
  18. Fingolfin

    Fingolfin

    Joined:
    Jan 11, 2009
    Messages:
    3,140
    Resources:
    152
    Models:
    142
    Icons:
    1
    Packs:
    4
    Skins:
    2
    Maps:
    1
    Spells:
    1
    Tutorials:
    1
    Resources:
    152
    I was just thinking whether the amount of function calls would be basically doubled, considering how comparatively slow function calls are in Jass. Good to know though!
     
  19. Sir Moriarty

    Sir Moriarty

    Joined:
    Jun 13, 2016
    Messages:
    248
    Resources:
    2
    Spells:
    1
    Tutorials:
    1
    Resources:
    2
    Wurst's inliner is relatively aggressive, and coupled with the optimizer, is extremely efficient at both inlining and performing lots of cool optimizations. Emitted JASS code is usually on par with what you'd have written by hand, if not better.

    One particular neat feature I love about it, is that it can often detect a constant argument in a function call, and upon inlining the function, eliminate dead code that would never be called with that (known) argument.

    For example, this:
    Code (Text):

    package Hello

    function test(int a, string b)
      if a == 0
        print("0: " + b)
      else if a == 1
        print("1: " + b)
      else
        print(a.toString() + ": " + b)

    init
      let number = GetRandomInt(0, 10)

      test(0, "zero")
      test(1, "one")
      test(2, "two")
      test(number, "random number")
     
    Will compile into this:
    Code (vJASS):

    function init_Hello takes nothing returns boolean
        local integer number = GetRandomInt(0, 10)
        call DisplayTimedTextToPlayer(Player_localPlayer, 0., 0., 45., "0: zero")
        call DisplayTimedTextToPlayer(Player_localPlayer, 0., 0., 45., "1: one")
        call DisplayTimedTextToPlayer(Player_localPlayer, 0., 0., 45., I2S(2) + ": " + "two")
        if number == 0 then
            call DisplayTimedTextToPlayer(Player_localPlayer, 0., 0., 45., "0: random number")
        elseif number == 1 then
            call DisplayTimedTextToPlayer(Player_localPlayer, 0., 0., 45., "1: random number")
        else
            call DisplayTimedTextToPlayer(Player_localPlayer, 0., 0., 45., I2S(number) + ": " + "random number")
        endif
        return true
    endfunction
     
     
  20. Frotty

    Frotty

    Wurst Reviewer

    Joined:
    Jan 1, 2009
    Messages:
    1,323
    Resources:
    9
    Models:
    3
    Tools:
    1
    Maps:
    3
    Tutorials:
    1
    Wurst:
    1
    Resources:
    9
    So basically BJ and Swap functions from Blizzard.j from GUI ? :) I think most people overestimate the effects.

    @Sir Moriarty Cool example snippet :thumbs_up: