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. We have recently started the 16th edition of the Mini Mapping Contest. The theme is mini RPG. Do check it out and have fun.
    Dismiss Notice
  4. Choose your ride to damnation in the 5th Special Effect Contest Poll.
    Dismiss Notice
  5. The winners of the 13th Techtree Contest have been announced!
    Dismiss Notice
  6. Vote for the best entries in the 13th Music Contest Poll.
    Dismiss Notice
  7. 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.

SC2's jass replacement (preview)

Discussion in 'StarCraft I & II' started by Pyritie, Feb 18, 2010.

  1. BlinkBoy

    BlinkBoy

    Joined:
    Nov 11, 2004
    Messages:
    2,108
    Resources:
    12
    Models:
    4
    Icons:
    1
    Tools:
    1
    StarCraft II Resources:
    1
    Tutorials:
    3
    JASS:
    2
    Resources:
    12
    why the hell would you return an struct directly!? if it's big enough, you would fill the CPU's stack. I think it's quite smart to force people to return and insert struct pointers rather than the struct itself. After all, JAVA classes work that way and every good programmer knows that blocks bigger than a 'double word' should be referenced when passed. Plus, wc3 types were actually pointers/handles rather than the object itself.

    About methods:

    a method is nothing more than a function which takes the reference to the class and does some action. They can be easily implemented.

    here's an example of a C list object header:

    Code (Text):

    #ifndef LISTINT_H_INCLUDED
    #define LISTINT_H_INCLUDED
            //Note: I tried translating most, however I left some hoare
            //triplets on spanish. I'll translate them if requested.
        typedef struct ListInt * ListInt;
        //Pre there's space in memory;
        //Post resultado != NULL && resultado->inic == NULL;
        ListInt ListIntCreate();
        //Pre l != NULL;
        //Post all the space taken by the list has been freed;
        void ListIntDestroy(ListInt l);
        //Pre l != NULL;
        /*Post The resulting list it's the old(list) with one more node at the end
        * which has the value a;
        */
        void ListInt_add(ListInt l, const int a);
        //Pre l != NULL;
        /*Post la lista resultante es la misma que la de entrada excepto a que
        * carece del primer nodo en la lista que tenia el valor a.
        */
        void ListInt_eliminateVal(ListInt l, const int a);
        //Pre l != NULL && 0 <= p;
        /*Post la lista resultante es la misma que la de entrada excepto a que
        * carece nodo en la p-esima posicion.
        */
        void ListInt_eliminatePos(ListInt l, const int p);
        //Pre l != NULL;
        //Post 1 == a esta en lista, 0 == a no esta en lista;
        int  ListInt_search(ListInt l, const int a);
        //Pre l != NULL;
        /*Post la lista resultante posee todos los elementos de la lista de entrada
        * y ademas estos se encuentran en orden inverso.
        */
        void ListInt_revert(ListInt l);
        //Pre l != NULL;
        //Post se han imprimido todos los elementos de la lista l.
        void ListInt_print(ListInt l);

    #endif
     
    As of now only 3 things are for granted which bother me:
    • We can't make recursive types unless we can typecast pointers.
    • Apparently we "can't" allocate memory (Obviously if we haven't a natives list yet).
    • Adding a garbage collector. As nice as it is, a serious programmer should always clean his own mess.
     
  2. Mooglefrooglian

    Mooglefrooglian

    Joined:
    Nov 28, 2008
    Messages:
    701
    Resources:
    0
    Resources:
    0
    I agree. Except you cant even return a structs pointer because the struct is destroyed when the function ends by the garbage collector, which is what I was referring to. I apologise for not making that clear.

    This means that making a PERSISTANT struct which you can get with a hashtable or something suddenly becomes impossible. Which brings us back to vJass.
     
  3. BlinkBoy

    BlinkBoy

    Joined:
    Nov 11, 2004
    Messages:
    2,108
    Resources:
    12
    Models:
    4
    Icons:
    1
    Tools:
    1
    StarCraft II Resources:
    1
    Tutorials:
    3
    JASS:
    2
    Resources:
    12
    yeah that's called "dynamic allocation" you must wait for the main native API to be revealed before we can deduce if it's possible or not. I imagine that they atleast implemented some sort of function for memory allocation. I think we will have to wait until release before making any assumptions.
     
  4. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    25,816
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    Has anyone actually checked the bytecode of the game for any possible native list imbeded in them? For example from the game.dll in WC3 you can get all native lists, both AI and main as well as or all order strings.
     
  5. BlinkBoy

    BlinkBoy

    Joined:
    Nov 11, 2004
    Messages:
    2,108
    Resources:
    12
    Models:
    4
    Icons:
    1
    Tools:
    1
    StarCraft II Resources:
    1
    Tutorials:
    3
    JASS:
    2
    Resources:
    12
    Zoxc already made a native injecting plugin for his personal 'launcher', but I doubt he has dissambled the game and looked for the native subroutines, that would indeed be a tedious work and a waste, specially since thlly e editor will be released before the end of April.

    here's the list of all known natives:

    http://www.sc2mapster.com/api-docs/functions/

    It includes some natives discovered by trial and error like IntToFixed and StringWord.
     
  6. lelyanra

    lelyanra

    Joined:
    Sep 4, 2007
    Messages:
    380
    Resources:
    25
    Icons:
    25
    Resources:
    25
    so i suppose i'm not going to get obsolete for knowing jass, right...
     
  7. vjeux

    vjeux

    Joined:
    Dec 16, 2003
    Messages:
    19
    Resources:
    0
    Resources:
    0
    Those are all natives exported by the game at the moment. There is no trial and error in their findings but disassembling the sc2.exe file :)

    As you can see, a lot of functions are missing, they will be added when Galaxy Editor comes out!
     
  8. BlinkBoy

    BlinkBoy

    Joined:
    Nov 11, 2004
    Messages:
    2,108
    Resources:
    12
    Models:
    4
    Icons:
    1
    Tools:
    1
    StarCraft II Resources:
    1
    Tutorials:
    3
    JASS:
    2
    Resources:
    12
    wow so you really did dissamble the exe? well nice, keep up the great work. I just hope blizzard adds the rest soon.
     
  9. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    25,816
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    Its not hard, you just seach for strings inside the dlls/exes.

    Anyway, that list was largly exposed by my searching through the script files someone sent me a few pages pack or maybe in another thread.
     
  10. BlinkBoy

    BlinkBoy

    Joined:
    Nov 11, 2004
    Messages:
    2,108
    Resources:
    12
    Models:
    4
    Icons:
    1
    Tools:
    1
    StarCraft II Resources:
    1
    Tutorials:
    3
    JASS:
    2
    Resources:
    12
    nope, just try using a hex editor with all the PE files that make Sc2, you won't find natives that way. Plus he admitted that he dissambled the code, it would be logical. If it would be me, I would start searching for all the subroutines which are runned when galaxy is read and from there on I would keep going.