1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. Travel to distant realms and encounter scenes unknown to the common folk. The Greatest of Adventures is upon us with the 8th Cinematic Contest. Join in on a fun ride.
    Dismiss Notice
  4. The 18th Icon Contest is ON! Choose any ingame unit and give him/her Hero abilities. Good luck to all.
    Dismiss Notice
  5. The Secrets of Warcraft 3 have revealed interesting works. The RESULTS for Abelhawk's Mini-Mapping Contest #15 have come out!
    Dismiss Notice
  6. Contestants are to create a scene set in the Stone Age. Come and see what you can come up with. We wish you the best of luck!
    Dismiss Notice
  7. Colour outside the lines! Techtree Contest #13 is a go. The contest is optionally paired.
    Dismiss Notice
  8. Night Rider gained several songs for his journey. The poll for the 12th Music Contest has started. Check it out!
    Dismiss Notice
  9. Greetings cerebrates, our Swarm needs new spawners that will have numerous children. Join the HIVE's 31st Modeling Contest - Spawners and Spawned! The contest is optionally paired.
    Dismiss Notice
  10. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

SharpCraft, a managed replacement for Reinventing the Craft

Discussion in 'Warcraft Editing Tools' started by MindWorX, Nov 15, 2013.

  1. MindWorX

    MindWorX

    Joined:
    Aug 3, 2004
    Messages:
    690
    Resources:
    5
    Tools:
    1
    Tutorials:
    4
    Resources:
    5
    Background
    Some of you might have heard about Reinventing the Craft. It's an old project I initially started in 2007 and worked extensively on for several years along with SFilip. Reinventing the Craft changed goals several times, but in the end, the idea was that we wanted to provide a stable API for extending Warcraft III with new natives and features. Sadly, due to limited coding experience and time, the project ended up collecting dust.

    Since we stopped working on it, I've been contacted several times by people asking for the source, but I was reluctant to release because of the mess it was and all the experimental features it had. On top of that, it was nearly impossible to maintain if an update were released.

    This got me to slowly work on a replacement. The new goal for the replacement was that it should be easier to use and it should prioritize maintainability in favor of features, and above all, it should be open source. Over the past few years I've worked on and off on project SharpCraft.

    SharpCraft is written from scratch in C# and using EasyHook to inject into Warcraft III, I'm able to do what Reinventing the Craft did. Likewise as Reinventing the Craft only worked with Windows, so does SharpCraft. If enough interest is shown in the future, I might be able to look into how to make a version for Mac. For the time being, the whole project relies heavily on Windows APIs though.

    I've finally reached a point where I feel confident in calling it usable and as such, I wanted to announce it.

    Credits
    • MindWorX - for all initial development of SharpCraft
    • SFilip - for coding and research for our old project Reinventing the Craft.
    • PipeDream - for making Grimoire which have been used as reference and help on multiple occasions
    • xttocs - for making jAPI without which this probably wouldn't be possible

    Changelog
    Code (Text):
    v4.0.0.179
     * Fixes error with -loadfile paths.

    v4.0.0.160
    * Fixed error with passing zero arguments to the launcher.
    * Added some path based error checking.
    * Improved error handling when loading plugins.
    * More stuff, check the commit log.

    v4.0.0.152
    * Made it possible to enable/disable auto-scroll in the DebuggerWindow.
    * Made the DebuggerWindow more efficient with large amounts of text.
    * Minor aesthetic changes to the DebuggerWindow.
    * Removed faulty Mono.CSharp reference.

    v4.0.0.145
    * Updated EasyHook.
    * Fixed bugs related to the EasyHook update.

    v4.0.0.137
    * Updated for 1.27a.

    v4.0.0.136
    * Added support for placing SharpCraft in a Warcraft III folder. It'll search the parent folder for war3.exe and use that if possible.
    * Changed the plugin system a bit again. Sorry. <3

    v3.0.1.135b
    * Fixed .zip reading error.

    v3.0.0.133
    Everything is back to basics. SharpCraft now only has the core plugin functionality. All the advanced features will come as separate plugins.

    v2.2.5.124b
    * Expanded the managed JASS type wrappers.
    * Implemented script-side events (issue #4)
    * Implemented new method for calling natives with strings, resulting in more speed, since we're avoiding conversion.
    * Implemented a better method for adding trigger actions.
    * Implemented a few more Jass types.
    * Minor improvement for the InternalNatives.JassStringHandleToString if check.
    * Added missing DelegateAction type.
    * Included commit number in the version number.
    * Fixed a bug with returned JassStrings when calling natives directly.

    v2.2.4
    * Giant refactor. Too many changes to list them all.
    * Added three new base classes for scripting.
    * * FullPluginBase; // This class is for plugins that need full access, which means file writing and more.
    * * SafePluginBase; // This class is for plugins that only need safe access.
    * * MapScriptBase;  // This class is for internal war3map.cs scripts. It is similar to SafePluginBase.
    * The sandbox milestone reached 100%, meaning more safety.
    * Interplugin usage it possible through simple dependency.

    v1.2.4a
    * Fixed type return bug in CDestructable, CItem and CUnit.

    v1.2.4
    * Fixed a directory launcher issue.
    * Fixed version reporting.
    * Added several unmanaged classes to tinker with at your own risk.
    * Improved launcher error reporting.

    v1.2.3
    * Refactored the API. It will be backwards compatible until v2.
    * Added Input API for detecting keyboard and mouse input.
    * Added Interface API for detecting FPS and writing messages.
    * Added events for initializing systems that needs the JASS virtual machine ready.
    * Improved on various Jass types.
    * Improved on core functionality.

    v1.1.3
    * Improved the missing assembly loader.
    * Added casting from Int32 to JassUnitId.
    * Fixed WarcraftIII.IsMouseOverUI inverted return values.

    v1.1.2
    * Fixed issue with inferring return types of natives.

    v1.1.1
    * Fixed an issue with multiple plugins.
    * Fixed an issue with loading Lidgren.Network.

    v1.1.0
    * Added Lidgren networking support.

    v1.0.0
    * First stable release

    v0.1pre
    * Initial prerelease

    Tutorials
    The tutorials assume a basic understanding of programming.
    SharpCraft Development Environment (basic), shows how to setup Visual Studio and use SharpCraft.
    SharpCraft Native Tutorial, shows how to add custom natives using the JassAPI plugin. This assumes you've followed the tutorial above.


    SharpCraft binaries and source can be found on GitHub.
     

    Attached Files:

    Last edited: Sep 26, 2016
  2. MindWorX

    MindWorX

    Joined:
    Aug 3, 2004
    Messages:
    690
    Resources:
    5
    Tools:
    1
    Tutorials:
    4
    Resources:
    5
    Attached to this post are all the plugins that contain all the old features from v2 and below.

    WarAPI is the core API that interacts with the game.
    JassAPI(requires WarAPI) is the core API that allows you to add new natives and use JASS types.
    InputAPI(requires WarAPI) is the core API that allows you to get advanced user input.
    InterfaceAPI(requires WarAPI) is the core API that allows you to interact with the interface.

    JassDebugger(requires WarAPI, JassAPI and InterfaceAPI) allows you to get debug information from JASS, like OpLimit, DivideByZero, etc, and what function caused the error.
    Also gives Cheat callback features.
    Code (vJASS):

    // The following dumps the function code to a text file name "out.txt" in the "logs" folder in SharpCraft.
    call Cheat("scdbg funcdump txt main out.txt")
    // The following dumps the function code to a csv file name "out.csv" in the "logs" folder in SharpCraft.
    call Cheat("scdbg funcdump csv main out.csv")
     


    Lidgren.Network is a UDP powered network library.

    Stopwatch is a basic Stopwatch toolset with the following self-explanatory natives
    Code (vJASS):
    native StopwatchGet takes nothing returns integer
    native StopwatchFree takes integer return nothing
    native StopwatchElapsedMilliseconds takes integer returns real
    native StopwatchElapsedSeconds takes integer returns real

    Also includes the source code to show a basic example of how to make plugins.
     

    Attached Files:

    Last edited: Sep 3, 2016
  3. TriggerHappy

    TriggerHappy

    Code Moderator

    Joined:
    Jun 23, 2007
    Messages:
    3,654
    Resources:
    22
    Spells:
    11
    Tutorials:
    2
    JASS:
    9
    Resources:
    22
  4. PurgeandFire

    PurgeandFire

    Code Moderator

    Joined:
    Nov 11, 2006
    Messages:
    7,427
    Resources:
    18
    Icons:
    1
    Spells:
    4
    Tutorials:
    9
    JASS:
    4
    Resources:
    18
    Awesome. Perhaps this will have more potential now that it is on a stable patch (not stable in the sense of being bug-proof, but stable in the sense that Blizz won't patch it).

    Thanks for the update!
     
  5. Nestharus

    Nestharus

    Joined:
    Jul 10, 2007
    Messages:
    6,149
    Resources:
    8
    Spells:
    3
    Tutorials:
    4
    JASS:
    1
    Resources:
    8
    We should make a lobby map that allows users to download maps online and stuff and go through games (maybe similar to the sc2 arcade). It should have a chatroom and people should be able to pick an avatar too.

    The big thing ofc is dling maps. If we're going down full c#, they'll have to download the dll or w/e for the map + the map itself. Could also have automatic patching ^)^. On b.net, we could advertise sharpcraft. When they download the map, we tell them to start the map on their own and tell it what drive they want to put the installer on. From here, when they click the shell script, it will download the lobby map + SharpCraft to their computer. At this point, they just start wc3 through SharpCraft, go to single player, and run the lobby map =), then they are in.


    Who wants to code this awesomness? Also, what server should host the lobby + provide the maps? I don't think that we'd get away with asking Ralle to do this, that's starting to ask too much, heh. Also, what server will host these maps? We'd have to have instanced maps and constant state maps (mmo vs like a fps).
     
  6. MindWorX

    MindWorX

    Joined:
    Aug 3, 2004
    Messages:
    690
    Resources:
    5
    Tools:
    1
    Tutorials:
    4
    Resources:
    5
    It can be. :p

    Even if we get a patch, the settings.xml file comes with extensive instructions on relocating the addresses. One of the requirements of any core feature added is stability, so no adding random things found by pure luck. If it can't be documented, it won't get added. :)

    SharpCraft will stay as a 3rd party library downloaded manually. What you're talking about will very likely result in a CnD from Blizzard. The current state of SharpCraft is harmless which means Blizzard wont interfere.
     
  7. MindWorX

    MindWorX

    Joined:
    Aug 3, 2004
    Messages:
    690
    Resources:
    5
    Tools:
    1
    Tutorials:
    4
    Resources:
    5
    New release!

    Changelog
    Code (Text):
    v1.1.0
     * Added Lidgren networking support.
     
  8. chobibo

    chobibo

    Joined:
    Sep 24, 2005
    Messages:
    2,692
    Resources:
    0
    Resources:
    0
    Cool, this here too!

    I hope they do. They tend to mess thing up and provide no information, that sucks.
     
  9. Daffa the Mage

    Daffa the Mage

    Map Moderator

    Joined:
    Jan 30, 2013
    Messages:
    7,616
    Resources:
    27
    Packs:
    1
    Maps:
    8
    Spells:
    16
    Tutorials:
    2
    Resources:
    27
    Great job MindWorX!
    This will be pretty amusing, only thing in my mind, what patches does SharpCraft support?
     
  10. MindWorX

    MindWorX

    Joined:
    Aug 3, 2004
    Messages:
    690
    Resources:
    5
    Tools:
    1
    Tutorials:
    4
    Resources:
    5
    Right now, it just supports the most recent patch. It also comes with extensive guides to update it, which can be done 99% of the time simply by changing the settings file, with no need to recompile the binaries.
     
  11. MindWorX

    MindWorX

    Joined:
    Aug 3, 2004
    Messages:
    690
    Resources:
    5
    Tools:
    1
    Tutorials:
    4
    Resources:
    5
    New release!

    Changelog
    Code (Text):
    v1.1.1
     * Fixed an issue with multiple plugins.
     * Fixed an issue with loading Lidgren.Network.
     
  12. moyackx

    moyackx

    Joined:
    Feb 15, 2006
    Messages:
    789
    Resources:
    7
    Maps:
    4
    Spells:
    2
    Tutorials:
    1
    Resources:
    7
    Hmmm, I like this impolementation. Could we work together to make it integrated to JNGP 2.0.X?
     
  13. chobibo

    chobibo

    Joined:
    Sep 24, 2005
    Messages:
    2,692
    Resources:
    0
    Resources:
    0
    I hope this gets impolemented in JNGP.
     
  14. Nestharus

    Nestharus

    Joined:
    Jul 10, 2007
    Messages:
    6,149
    Resources:
    8
    Spells:
    3
    Tutorials:
    4
    JASS:
    1
    Resources:
    8
    I don't think that you'd get a CnD. Consider Garena.
     
  15. TriggerHappy

    TriggerHappy

    Code Moderator

    Joined:
    Jun 23, 2007
    Messages:
    3,654
    Resources:
    22
    Spells:
    11
    Tutorials:
    2
    JASS:
    9
    Resources:
    22
    Is there a way to access/modify the unit or ability structs like in RtC?

    Also, IsMouseOverUI returns the opposite of what it's supposed to. In other words..

    Code (C#):

    return !WarcraftIII.IsMouseOverUI; // returns correct value
     
     
    Last edited: Nov 22, 2013
  16. MindWorX

    MindWorX

    Joined:
    Aug 3, 2004
    Messages:
    690
    Resources:
    5
    Tools:
    1
    Tutorials:
    4
    Resources:
    5
    Not right now, but it's easy to implement. The reason I haven't is because there's a lot of testing to do to make it even remotely stable.
    I've added the WarcraftIII.IsMouseOverUI bug to the issue tracker.

    It's pretty straight forward to implement since SharpCraft.exe can be used just like you'd launch war3.exe. All parameters that are not SharpCraft specific gets passed along.

    Well, in any case, it's beyond the scope of SharpCraft. How people go on to use SharpCraft is up to them. All this is is a modding API.
     
  17. Lambdadelta

    Lambdadelta

    Joined:
    Jul 6, 2009
    Messages:
    720
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Cool.

    It's impressive to see people work on Warcraft III after so many years.
     
  18. MindWorX

    MindWorX

    Joined:
    Aug 3, 2004
    Messages:
    690
    Resources:
    5
    Tools:
    1
    Tutorials:
    4
    Resources:
    5
    New release!

    Changelog
    Code (Text):
    v1.1.3
     * Improved the missing assembly loader.
     * Added casting from Int32 to JassUnitId.
     * Fixed WarcraftIII.IsMouseOverUI inverted return values.

    v1.1.2
     * Fixed issue with inferring return types of natives.
     
  19. MindWorX

    MindWorX

    Joined:
    Aug 3, 2004
    Messages:
    690
    Resources:
    5
    Tools:
    1
    Tutorials:
    4
    Resources:
    5
    New release!

    Changelog
    Code (Text):
    v1.2.3
     * Refactored the API. It will be backwards compatible until v2.
     * Added Input API for detecting keyboard and mouse input.
     * Added Interface API for detecting FPS and writing messages.
     * Added events for initializing systems that needs the JASS virtual machine ready.
     * Improved on various Jass types.
     * Improved on core functionality.
     
  20. Darkshooter1986

    Darkshooter1986

    Joined:
    Nov 10, 2009
    Messages:
    69
    Resources:
    0
    Resources:
    0
    Hey MindWorX, awesome mod you got here. is it able to work on a multiplayer level or do we need to wait for someting like Triggerhappy's WarCom to be released?