Navigation

    forum

    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    1. Home
    2. Astro_angelfish
    • Flag Profile
    • block_user
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Groups
    • Blog

    Astro_angelfish

    @Astro_angelfish

    1
    Posts
    693
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    Astro_angelfish Follow

    Posts made by Astro_angelfish

    • My WebAssembly module is unable to be properly loaded in node10, and manual destruction is not logged by `Room.getEventLog()`

      Shard effected:

      mainly shard3, but all shards are affected in theory

      Things went wrong:

      My compiled WebAssembly code can only be loaded randomly by randomly changing code. (Source code is in: https://github.com/astro-angelfish/chocomint/blob/main/natives/flowfield.c and other C files in the natives/libs directory.)

      I compiled the C code in my submitting script by using command (Can be found in https://github.com/astro-angelfish/chocomint/blob/main/commit.py#L40-L53)

      Note that I'm using emscripten v3.1.24 and Python v3.10.8

      emcc -s WASM=1 -s SIDE_MODULE=1 -O3 "files" -o "output.wasm"
      

      What I have done:

      1. the type of distance_map in parameters of generate_distance_map was u_int8_t. I performed an invalid comparison with value -1. The module was successfully loaded.
      2. I changed the -1 to 0xff, then the module was unable to be loaded.
      3. I have changed the type of distance_map to int, and changed 0xff to -1, it still could not be loaded.
      4. I have changed the first assignment of node_to_visit. This line was changed from int node_to_visit[2500] = {0}; to int * node_to_visit = malloc(sizeof(int) * 2500);. The module was successfully loaded but reports there is no anything like malloc or memcpy.
      5. I copied a malloc implementation and memcpy implemention from github and glibc, pasting them into one file called flowfield.c. It was successfully loaded and was ready to run.
      6. I moved the library code into separate files and made some header files. the WebAssembly was unable to load.

      All error occurred in things I've done above is just WebAssembly.Module(): Wasm decoding failed: mutable globals cannot be imported @+119.

      And I've tested in newer nodejs after v12 LTS, it can be loaded normally and nothing went wrong. So I guess it's the problem of nodejs and Screeps are running on nodejs 10 which I'm unable to put my code on. So I wonder is there any plan to upgrade nodejs? Maybe most player don't need to upgrade it but I do need.

      It might be something wrong deep in nodejs and WebAssembly internals. I don't have enough knowledge about it and tried to download the source code but failed to build an analysis environment. If someone know why this happens I would appreciate to know about.

      The second one is that the object destruction like creep's death and structure destruction, the latter can only be logged when it is triggered by a creep attack or dismantle. I've already opened this issue in github (https://github.com/screeps/engine/issues/139) but I didn't receive any response. I need event log to save my CPU ;w;

      posted in Technical Issues and Bugs
      Astro_angelfish