RMMV PRO TIPS: How to compress your ressource (one files exectuable)

Discussion in 'Learning Javascript' started by Jonforum, Jun 26, 2018.

  1. Jonforum

    Jonforum Veteran Veteran

    Messages:
    1,568
    Likes Received:
    1,324
    Location:
    Canada / Québec
    First Language:
    French
    Primarily Uses:
    RMMV
    Using ENIGMA VIRTUAL BOX are
    • not easy
    • performance issue

    This method is extremely easy and keep performance
    • keep speed game

    related to: http://docs.nwjs.io/en/latest/For Users/Package and Distribute/#package-option-2-zip-file
    Nw.js Standard file packaging

    First, copy the latest version of Nw.js folder and give it a name appropriately.
    ex: on desktop name it "distribution"


    1. *deploy the project rmmv [distributed]
    2. * Merge Compress the package.json and www folder [.zip] from project
    3. * rename zip to package.nw
    4. *move package.nw in your distribution folder
    5. * Combine and merge the zip [package.nw] and [nw.exe] to create a new executable [game.exe] with your terminal: "cmd or powershell"
    6. Edit your executable [game.exe] with resource hacker for hack your icons, informations, copyright ....
    7. delete unnecessary files: [package.nw] [nw.exe]

    cmd
    Code:
    cd C:\Users\user\Desktop\distribution
    copy /b nw.exe+package.nw games.exe
    powerShell
    Code:
    cd C:\Users\user\Desktop\distribution
    New-Item -ItemType file "game3.exe" -force
    $file1 = Get-Content "package.nw"
    $file2 = Get-Content "nw.exe"
    Add-Content "game3.exe" $file1
    Add-Content "game3.exe" $file2



    enjoy

    i made here screen for help

    [​IMG]

    [​IMG]

    [​IMG]
     
    Last edited: Jun 26, 2018
    #1
    caethyril, Mifey, Schade and 5 others like this.
  2. Sauteed_Onion

    Sauteed_Onion Mmm Tasty Veteran

    Messages:
    554
    Likes Received:
    3,658
    Location:
    Perhaps on a steak or cheeseburger
    First Language:
    English
    Primarily Uses:
    RMMV
    Meow, I'm reading this over and over and it just doesn't make sense to me. I'm drinking coffee too, I wish I could share some meow.
     
    #2
    Eliaquim, Marsigne and Alanood like this.
  3. Jonforum

    Jonforum Veteran Veteran

    Messages:
    1,568
    Likes Received:
    1,324
    Location:
    Canada / Québec
    First Language:
    French
    Primarily Uses:
    RMMV
    what your are not understand , may i can help you
     
    #3
    Sauteed_Onion and Marsigne like this.
  4. Mrs_Allykat

    Mrs_Allykat Failsauce Veteran

    Messages:
    406
    Likes Received:
    1,879
    Location:
    Dixie Land
    First Language:
    English
    Primarily Uses:
    RMMV
    Thank you for posting this! It's appreciated!
     
    #4
    Sauteed_Onion likes this.
  5. Isabella Ava

    Isabella Ava Veteran Veteran

    Messages:
    636
    Likes Received:
    751
    First Language:
    English
    Can i have a copy to try to decrypt?
     
    #5
    Sauteed_Onion and Jonforum like this.
  6. Jonforum

    Jonforum Veteran Veteran

    Messages:
    1,568
    Likes Received:
    1,324
    Location:
    Canada / Québec
    First Language:
    French
    Primarily Uses:
    RMMV
    well it also easy to decompile with command extract :stache:

    Assuming that the person is aware that you compile the file necessary file in the nodejs executable.
    You can also protect your image and script by changing the internal extensions of the pixi loader and by using a script to crypted your js files.
    this should further discourage the application thief.
    it creates a real mess in all files.
    PHP:
    Resource._loadTypeMap = {
        
    // images
        
    gifResource.LOAD_TYPE.IMAGE,
        
    pngResource.LOAD_TYPE.IMAGE,
        
    bmpResource.LOAD_TYPE.IMAGE,
        
    jpgResource.LOAD_TYPE.IMAGE,
        
    jpegResource.LOAD_TYPE.IMAGE,
        
    tifResource.LOAD_TYPE.IMAGE,
        
    tiffResource.LOAD_TYPE.IMAGE,
        
    webpResource.LOAD_TYPE.IMAGE,
        
    tgaResource.LOAD_TYPE.IMAGE,
        
    svgResource.LOAD_TYPE.IMAGE,
        
    'svg+xml'Resource.LOAD_TYPE.IMAGE// for SVG data urls

        // audio
        
    mp3Resource.LOAD_TYPE.AUDIO,
        
    oggResource.LOAD_TYPE.AUDIO,
        
    wavResource.LOAD_TYPE.AUDIO,

        
    // videos
        
    mp4Resource.LOAD_TYPE.VIDEO,
        
    webmResource.LOAD_TYPE.VIDEO
    };

    Resource._xhrTypeMap = {
        
    // xml
        
    xhtmlResource.XHR_RESPONSE_TYPE.DOCUMENT,
        
    htmlResource.XHR_RESPONSE_TYPE.DOCUMENT,
        
    htmResource.XHR_RESPONSE_TYPE.DOCUMENT,
        
    xmlResource.XHR_RESPONSE_TYPE.DOCUMENT,
        
    tmxResource.XHR_RESPONSE_TYPE.DOCUMENT,
        
    svgResource.XHR_RESPONSE_TYPE.DOCUMENT,

        
    // This was added to handle Tiled Tileset XML, but .tsx is also a TypeScript React Component.
        // Since it is way less likely for people to be loading TypeScript files instead of Tiled files,
        // this should probably be fine.
        
    tsxResource.XHR_RESPONSE_TYPE.DOCUMENT,

        
    // images
        
    gifResource.XHR_RESPONSE_TYPE.BLOB,
        
    pngResource.XHR_RESPONSE_TYPE.BLOB,
        
    bmpResource.XHR_RESPONSE_TYPE.BLOB,
        
    jpgResource.XHR_RESPONSE_TYPE.BLOB,
        
    jpegResource.XHR_RESPONSE_TYPE.BLOB,
        
    tifResource.XHR_RESPONSE_TYPE.BLOB,
        
    tiffResource.XHR_RESPONSE_TYPE.BLOB,
        
    webpResource.XHR_RESPONSE_TYPE.BLOB,
        
    tgaResource.XHR_RESPONSE_TYPE.BLOB,

        
    // json
        
    jsonResource.XHR_RESPONSE_TYPE.JSON,

        
    // text
        
    textResource.XHR_RESPONSE_TYPE.TEXT,
        
    txtResource.XHR_RESPONSE_TYPE.TEXT,

        
    // fonts
        
    ttfResource.XHR_RESPONSE_TYPE.BUFFER,
        
    otfResource.XHR_RESPONSE_TYPE.BUFFER
    };

    // We can't set the `src` attribute to empty string, so on abort we set it to this 1px transparent gif
    Resource.EMPTY_GIF 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==';
     
    #6
    Sauteed_Onion and Isabella Ava like this.
  7. Isabella Ava

    Isabella Ava Veteran Veteran

    Messages:
    636
    Likes Received:
    751
    First Language:
    English
    : O hmm i think this is not for an amateur dev like me. Btw i watched some other posts of you, you seem made several really cool tools & stuffs for fully customized RPGMV games, it's just they all too hard for me to understand so i can't use any : | )
     
    #7
    Sauteed_Onion likes this.
  8. Tome571

    Tome571 Veteran Veteran

    Messages:
    110
    Likes Received:
    87
    Location:
    Michigan
    First Language:
    English
    Followed all steps, got to the Game.exe file. Run it and a window pops up, header bar is correct, icon is correct. Just a black screen. Does this require 1.6.1 or above to work correctly? Do I need to have web m4a sound files like in web deployment?
     
    #8
  9. Jonforum

    Jonforum Veteran Veteran

    Messages:
    1,568
    Likes Received:
    1,324
    Location:
    Canada / Québec
    First Language:
    French
    Primarily Uses:
    RMMV
    pack with the nwjs SDK to allow you call the debug terminal
    and give the error code.
    If you window are black , you have maybe a bug somewhere in your projet.
     
    #9
  10. Mifey

    Mifey Villager Member

    Messages:
    11
    Likes Received:
    1
    First Language:
    Deutch
    Primarily Uses:
    RMMV
    @Jonforum It works flawlessly, thank you for making this.
    There is one problem for me, I can't figure out how to access the savefile, is there any way to have a folder where the player can access his savefile, it's important in my game! Thank you!
     
    #10
  11. Jonforum

    Jonforum Veteran Veteran

    Messages:
    1,568
    Likes Received:
    1,324
    Location:
    Canada / Québec
    First Language:
    French
    Primarily Uses:
    RMMV
    did you try pack only resources in `package.nw`, and leave saveFile file in the root www ?
    If is not work, you will need hack rmmv core and how is get save from root `www`
     
    #11
    Mifey likes this.
  12. Jonforum

    Jonforum Veteran Veteran

    Messages:
    1,568
    Likes Received:
    1,324
    Location:
    Canada / Québec
    First Language:
    French
    Primarily Uses:
    RMMV
    i add more info here
    https://github.com/djmisterjon/pixi-nwjs-starter
    look for `CREATE DIST YOUR ONE CLICK APP.EXE x64`
    So yes you can package only ressource you want and leave outside ressource you want people have access.
    But this will depending on how rmmv package the distribution, am not remember how the software create distribution hierarchy.
     
    #12
    Eliaquim and Mifey like this.
  13. Eliaquim

    Eliaquim Raze: The Rakuen Zero's Guardian! Veteran

    Messages:
    570
    Likes Received:
    167
    Location:
    Brazil - Rio de Janeiro
    First Language:
    Portuguese - Br
    Primarily Uses:
    RMMV
    Hi! @Jonforum
    I'm trying to do this, but I can't figure it out when I go wrong.
    Using this version: "nwjs-sdk-v0.39.2-win-x64"
    After I merge the files package.nw with nw.exe with CDM command, the file game.exe is created(PT-BR).
    It says: "1 file(s) copy."
    [​IMG]


    But when I try to open that, it shows me this screen, instead of opening the game:

    [​IMG]

    [​IMG]
     
    Last edited: Jul 13, 2019
    #13
  14. Jonforum

    Jonforum Veteran Veteran

    Messages:
    1,568
    Likes Received:
    1,324
    Location:
    Canada / Québec
    First Language:
    French
    Primarily Uses:
    RMMV
    Last edited: Jul 13, 2019
    #14
    Eliaquim likes this.
  15. Eliaquim

    Eliaquim Raze: The Rakuen Zero's Guardian! Veteran

    Messages:
    570
    Likes Received:
    167
    Location:
    Brazil - Rio de Janeiro
    First Language:
    Portuguese - Br
    Primarily Uses:
    RMMV
    Hi! I see the video, and it has something in 13:43 that made me think:
    The package.json of the project don't come with the field of name completed.

    "name": "", < it come like this.
    Maybe I have to put the mygame.exe name here before make all single executable?
     
    #15
  16. Jonforum

    Jonforum Veteran Veteran

    Messages:
    1,568
    Likes Received:
    1,324
    Location:
    Canada / Québec
    First Language:
    French
    Primarily Uses:
    RMMV
    the video are very old , a lot of thing change, but yeah the name it the name showed in the bar when you minimize your window,mac app.
    upload_2019-7-15_13-41-7.png
    You will not see this in fullscreen.
     
    #16
    Eliaquim likes this.
  17. Eliaquim

    Eliaquim Raze: The Rakuen Zero's Guardian! Veteran

    Messages:
    570
    Likes Received:
    167
    Location:
    Brazil - Rio de Janeiro
    First Language:
    Portuguese - Br
    Primarily Uses:
    RMMV
    No luck at all =/

    I made a little video from the process. Maybe I'm doing something it is obviously wrong, but can't see it.
     
    #17
  18. Jonforum

    Jonforum Veteran Veteran

    Messages:
    1,568
    Likes Received:
    1,324
    Location:
    Canada / Québec
    First Language:
    French
    Primarily Uses:
    RMMV
    i see you use sdk, so if you push f12 when you open app, do you have error in log ?
     
    #18
  19. Dungeonmind

    Dungeonmind Lvl 4000 Humanoid Veteran

    Messages:
    418
    Likes Received:
    238
    Location:
    Canada,Ontario
    First Language:
    English
    Primarily Uses:
    RMMV
    Looks pretty neat I’ll have to check this out when I get the chance.
     
    #19
  20. Eliaquim

    Eliaquim Raze: The Rakuen Zero's Guardian! Veteran

    Messages:
    570
    Likes Received:
    167
    Location:
    Brazil - Rio de Janeiro
    First Language:
    Portuguese - Br
    Primarily Uses:
    RMMV
    As soon i hit f12 it shows me the console in "Source" with this things write:
    Code:
    <html>
    <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <title>nw.js</title>
    <style>
    body, div, h1, h2, h3, h4, h5, h6, p, ul, ol, li, dl, dt, dd, img, form, fieldset, blockquote {
        margin: 0; padding: 0; border: 0;
    }
    
    body {
        background: #eee;
    }
    
    #nwjsver {
        background: #474747; display: table; color: #ccc;
        text-align: right;
        position: absolute;
        bottom: 0;
        width: 100%;
    }
    
    #inset {
        width: 100%; height: 100%; background: #474747; display: table;
    }
    
    #inset h1 {
        text-align: center;
        vertical-align: middle;
        font-family: "League-Gothic", Courier;
        font-size: 100px; text-transform: uppercase;
        text-shadow: 0px 2px 3px #222;
            display: table-cell;
    
    }
    
    .shimmer {
      text-align: center;
      color: rgba(55,55,55,0.1);
      background: -webkit-gradient(linear, left top, right top, from(#222), to(#222), color-stop(0.5, #fff));
      -webkit-background-size: 125px 100%;
      -webkit-background-clip: text;
      -webkit-animation-name: shimmer;
      -webkit-animation-duration: 10s;
      -webkit-animation-iteration-count: infinite;
      background-repeat: no-repeat;
      background-position: 0 0;
      background-color: #222;
    }
    
    @-webkit-keyframes shimmer {
      0% {
        background-position: top left;
      }
      20% {
        background-position: top right;
      }
      100% {
        background-position: top right;
      }
    }
    </style>
    </head>
    <body>
    <div id="inset">
        <h1 class="shimmer">NW.js</h1>
    </div>
    <div id="nwjsver">
      nw.js v<script>document.write(nw.process.versions['nw']);</script><br/>
      Node v<script>document.write(nw.process.versions['node']);</script><br/>
      Chromium <script>document.write(nw.process.versions['chromium']);</script><br/>
      commit hash: <script>document.write(nw.process.versions['nw-commit-id']);</script><br/>
    </div>
    </body>
    </html>
    

    [​IMG] [​IMG]

    Just for you to know: I just want to do this because I have problems when I make a single executable file with Enigma Virtual Box. It somehow made the Yep_EventCopier don't work properly, or is some sort of incompatibility. I made a thread for this, here. And also, if it has some performance improvements, why not? xD

    Hope this prints can help.
     
    #20

Share This Page