Tool Storm Modding API

Discussion in 'Mods' started by Handsome Matt, Mar 7, 2016.

  1. Acrimonia

    Acrimonia Subatomic Cosmonaut

    Absolutely. I'm extremely excited for Storm, but I'm also very cautious.
    My day job has ground it into me, ahaha.
    There are mods that add content to the game as is using XNBs; SgtPineapp1e's farming mod, for example, and depending on my capriciousness we'll see what happens.
    Storm simply makes a LOT of the operations modders are calling easier, just as SMAPI made a lot of the earlier mechanical work possible.
    It just needs to survive to that point, and hopefully not get sniped by official tools the moment a release is pushed.

    There's no doubt from looking at it that Storm has the potential to cut through a lot of the tedium that modding currently has; I suppose I'm just innately glum.
    That doesn't change the fact I'll be trying to figure of events that could be useful, or watching development and encouraging it; mostly just that I felt I had to chime in.
     
    • Afterscore

      Afterscore Weight of the Sky

      I don't blame you, it's good to see two different sides of things - I simply think that promoting creation here whether it be through mods or tools should be encouraged as it will only help to further the modding community to create bigger and better things. The fact that CA is on board with it is nothing but a massive boon too as I can imagine things taking off very well when he gets to that stage of his post-development timeline.
       
        Acrimonia likes this.
      • ClxS

        ClxS Pangalactic Porcupine

        My only worry with Storm, other than being killed by modding being built into the game, would be it being very unfriendly for people who aren't experienced programmers.
        It's my day-job, and I still find MSIL Injection to add hooks to events a bit arcane. The whole thing will need good documentation, though a lot of that can be auto-generated.
         
          Acrimonia likes this.
        • Afterscore

          Afterscore Weight of the Sky

          Cantorsdust's quote from earlier in the thread seems to suggest that it should be easier rather than more difficult to create mods:

          Would need someone with more experience working with Storm to confirm.
           
          • ClxS

            ClxS Pangalactic Porcupine

            Oh definitely, even for smaller projects like take the FreezeTime ones:
            SMAPI:
            Code:
            void Events_TimeChanged(object sender, EventArgs e)
            {
                StardewValley.GameLocation location = StardewValley.Game1.currentLocation;
                int time = StardewValley.Game1.timeOfDay;
                if ((location != null) && (!location.isOutdoors && (!((location is StardewValley.Locations.MineShaft) || (location is StardewValley.Locations.FarmCave)) || FreezeTimeInMines)) && ((time - lasttime)==10))             
                { 
                    if (time != 600)
                        //that is, if a new day didn't start
                    {
                        Command.CallCommand("world_settime " + lasttime.ToString());
                        //we set the current time to the last time
                    }
                  
                }
                else
                {
                    lasttime = time;
                    //so if the above conditions are true, then time should be advancing with each tick, and we should update our lasttime
                }
            }
            
            Storm:
            Code:
            [Subscribe]
            public void PerformClockUpdateCallback(PerformClockUpdateEvent @event)
            {
                 var loc = @event.Root.CurrentLocation;
                 @event.ReturnEarly = (loc != null && !loc.IsOutdoors);
            }
            
            Not only is the Storm one a lot tidier, it's easier to understand for someone who already gets what is going on with ReturnEarly and gets that it's called just prior to a clock update. (I'd suggest it should specify that in the name though...)

            The advantage with SMAPI is that the code is more descriptive and easier to follow for someone who's relatively new.

            But yeah, lots of documentation and it's not as much of an issue.
             
            • Handsome Matt

              Handsome Matt Aquatic Astronaut

              Storm is far easier to create mods with, both Zoryn and me who originally worked on SMAPI ditched it for this because we knew it was better. There are huge limitations with what SMAPI can actually do compared to Storm.
               
              • Pinkishu

                Pinkishu Phantasmal Quasar

                Last edited: Mar 7, 2016
              • mdbell

                mdbell Seal Broken

                CA never said he was going to include modding into the game, only that he wouldn't go out of his way to stop or break modding.

                MSIL injection is also the preferred way to do about modding, if one were to do things the way that SMAPI does, the mod would have direct interaction with the game itself. Doing that would mean that every update to the game is liable to actual breaking every single mod out there. Whereas with Storm the layer of abstraction (that you guys seem to hate for whatever reason) places the updating needs onto the API itself, not the mods. Not to mention that anyone who actually just wants to write mods would never even need to understand that at all.

                Not to mention that this style of API isn't that difficult to deal with at all, provided one has any prior experience with any sort of event based api.
                 
                • ghillielead

                  ghillielead Intergalactic Tourist

                  I don't hate it, I use MSIL injection and abstraction in my private Stardew API. I'm wary of Storm's implementation however. It seems cumbersome. There's lots I like about it! I'm just interested in finding out more and seeing how quickly it can handle an update. I'm still curious if I will be able to cancel/alter events or just be notified that they happened.
                   
                    Last edited: Mar 7, 2016
                  • Pinkishu

                    Pinkishu Phantasmal Quasar

                    Nothing really super arcane about bytecode injection
                     
                    • Rune Sparrow

                      Rune Sparrow Scruffy Nerf-Herder

                      I am excited for Storm to be finished, and as a very beginner programmer, I am hopeful that we will be able to come up with documentation for those who are not only new to modding with the Storm API, but to programming and modding in general. If that is possible, of course. If I were to be told how much knowledge I need before using Storm, I would gladly do what studying I can to get up to speed.
                       
                      • mdbell

                        mdbell Seal Broken

                        What do you mean by cancel events? like prevent them from being fired to any more mods?

                        Also how would you recommend doing MSIL injection then? Both Demmonic and I actually have more of a background in Java and are more used to using objectweb's ASM library, so we are open to suggestions! Our current approach is far better then what SMAPI was/is doing, as they would be even more liable for broken mods then ours would as ours relies upon a single json file, and that is (relatively) easy to keep updated.
                         
                        • demmonic

                          demmonic Seal Broken

                          Yes, I'm aware it's convoluted. I wrote the injection system the same way I'd write one for a heavily obfuscated MMO, where they wouldn't want people to be doing this to their game (hence the json file, which should be auto generated via an IL updater.). It has all of the essential injection methods you need (invokers, setters, getters, interfaces), but also allows you to define your own if absolutely necessary.

                          Depends on the kind of update we're talking about. If the game gets obfuscated, I'll need to write an IL updater to output the json file for me. That could takes days/weeks. If we're talking minimal structure changes, or method/field name changes, then a few minutes at most.

                          Yes, you'll be able to cancel/altar them. The project is still in early stages, and I'm handling a bulk of the core work. That along with having to go back and refactor stuff because I'm in a rush half of the time is making progress slow-ish.
                           
                          • bdawson1993

                            bdawson1993 Tentacle Wrangler

                            after looking at storm it has some huge potential but when this is released some mod makers may stick with SMAPI so it may be the case of supporting both SMAPi and storm. Or if both of them stay supporting them both so nobody gets left out
                             
                            • mdbell

                              mdbell Seal Broken

                              Over the long term (and short) SMAPI is un-maintainable, so in an ideal world Storm would totally replace it. Oh course people will stick with it because it "came first".
                               
                                Ragnar6645 and SgtPineapple1st like this.
                              • bdawson1993

                                bdawson1993 Tentacle Wrangler

                                it will Just be the case of persuading mod makers to switch. Storm is cleaner, and I'm a lover for clean documented code so to me its a match made in heaven.
                                 
                                • darkmdbeener

                                  darkmdbeener Aquatic Astronaut

                                  grass grow fast mod and custom tool mod 404'd
                                   
                                  • Svered

                                    Svered Astral Cartographer

                                    Is there an event that triggers when entering dialogue with another character? I was looking through the API and didn't see anything in my relatively brief search. I'm looking into if it's possible to override the typing noise with something that is more dynamic.
                                     
                                    • ThatNorthernMonkey

                                      ThatNorthernMonkey Aquatic Astronaut

                                      Great looking API. It's been a while since I last programmed and I seem to have fallen at the first hurdle! Lots of mod ideas but yeah.. I've cloned the repo, built the libraries and they're loading the game fine. However, with all of the mods I've checked (all 3 example mods and Pinkishu's Healthbar mod above) the Mod attribute is giving me red squigglies.

                                      [Mod(Author = "Zoryn Aaron", Name = "Movement Speed Modifier", Version = 1.0d)]

                                      Author, Name and Version could not be found, so the mods won't build - and I'm assuming they're essential attributes for the mod loader to "catch" them and inject them when loading. Any ideas?

                                      Also, in the Freeze Time mod "PerformClockUpdateEvent" could not be found either. MSVS2015, latest Storm clone. Thanks!
                                       
                                      • Handsome Matt

                                        Handsome Matt Aquatic Astronaut

                                        We're still renaming and changing a lot of things before release. We dropped [Mod(...)] to just [Mod] and you put your stuff in the manifest.json (it's shown in the examples directory)

                                        PerformClockUpdateEvent was renamed to Before/After10MinuteClockUpdate or something similar.
                                         

                                        Share This Page