How do I run a game on Linux (exported via NW.js) ?

0 favourites
From the Asset Store
Full game Construct 2 and Construct 3 to post on Google Play
  • Hello,

    It might sound like a silly question but I can't figure out how to launch a game exported via NW.js on Linux.

    I read the tutorial and it says "On Linux, the following command enables execute permission for the file 'mygame'.". So I understand that I have to give the execute permission to that file. The problem is that the exporter doesn't output any file with the name of my game ("supertimer"). Here are the files / directories inside my linux64 directory :

    lib (dir)

    locales (dir)

    icudtl.dat

    nacl_helper

    nacl_helper_bootstrap

    natives_blob.bin

    nw

    nw_100_percent.pak

    package.nw

    resources.pak

    I made the export with the latest build of Construct (r221) and the latest release of NW.js v0.13.0-beta4 (01/18/2016). Is there something I'm missing, or is that a bug caused by the "significant changes" to NW.js support included in r221 update ?

    Thanks for your help.

    P.S. : The exported game runs fine on Windows though.

  • Hello everyone,

    Is there an obvious answer to my question or nobody has any clue ?

    Bye !

  • You have to make 'nw' executable. Sometimes it's enough to make a double click on it and you will be asked if you want to make it executable.

  • Hmm, try:

    1) Run terminal in the linux game directory

    2) chmod a+x nw

    3) run the file, either through your file manager or terminal ("nw" without the quotes)

  • Thanks for your answers.

    I already tried to make "nw" executable with the command "chmod a+x nw", but when I try to run nw, the terminal says :

    "The program 'nw' is currently not installed. You can install it by typing:

    sudo apt-get install netrw".

    I thought there was a conflit with an existing packet, so I tried to rename "nw" to the name of my game and make it executable again, but it then says that the program does not exist.

    I am stuck !

  • First look with ls -la if the file permissions of your game looks something like that:

    -rwxr--r-- 1 me me 166864 Jan 18 06:11 Mygame

    the x means executable. Then start this with ./Mygame

    If your game is named nw type ./nw

  • Yes it works !

    Thanks a lot for your help.

  • Sorry to reopen this thread but I'm having this same issue. I have already checked the file permission and it's everything ok but the system continues to warning me that there is no application installed for "shared library" files and asking me if want to search one. I try to execute the app through the terminal and I got the message: "The program 'nw' is currently not installed. You can install it by typing sudo apt install newtrw. So, I did it and now, when I try to open the nw in the terminal, it shows a lot of options (nw [udp] <options> <host> <port>) . In the file manager, all remains the same (Could not display 'nw'. There is no application installed ...). I really need to show this demonstration for a possible client that only use linux. Any help, please?

  • Asmodean

    Could you help me with this, please?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Sorry RBuster I saw your post only now. Does it work now, or do you still need help?

  • Sorry RBuster I saw your post only now. Does it work now, or do you still need help?

    Thanks for the reply.

    The problem was that I tried to use a 32 bits executable in a 64 bits Linux.

    But I still have problems:

    • I'm using a xml to load images, text and a sound file that I 've imported to the Project Files and that are in the folder's root with the "nw" file. When I click to load one of these assets, nothing happens.
    • I really need that the "nw" file can be executed through the file manager. Now the application opens only through the terminal.

    Thanks in advance.

  • But I still have problems:

    - I'm using a xml to load images, text and a sound file that I 've imported to the Project Files and that are in the folder's root with the "nw" file. When I click to load one of these assets, nothing happens.

    If it works in Windows maybe the path setting is wrong in Linux. Linux needs a leading '/'. But im not really into XML on Construct. Maybe there is someone more advanced with loading files in Linux. It seems vikuserro has the same problem .

    [quote:2o0j2ujs]

    • I really need that the "nw" file can be executed through the file manager. Now the application opens only through the terminal.

    For that you need a .desktop file.

    Make a textfile with the exact name of your program and the suffix desktop, like when your program is called myApp a myApp.desktop. Now copy this in a text-file:

    [Desktop Entry]Type=Application
    
    # The version of the desktop entry specification to which this file complies
    Version=1.0
    
    # The name of the application
    Name=
    
    # A comment which can/will be used as a tooltip
    Comment=
    
    # The path to the folder in which the executable is run
    Path=
    
    # The executable of the application.
    Exec=
    
    # The name of the icon that will be used to display this entry
    Icon=
    
    # Describes whether this application needs to be run in a terminal or not
    Terminal=false
    
    [/code:2o0j2ujs]
    
    Only mandatory is Type, Name, Exec. You can choose any name you want, in path and Exec you need the exact path to your program. 
    If the program is in /home/me/Documents/linux64 and called myApp.
    You have to set it to:
    Path=/home/me/Documents/linux64
    Exec=/home/me/Documents/linux64/myApp
    
    The same is with icon. If you want an icon you can use a png, svg, ico, icns. Put it in folder with your program and set the path to. 
    Icon=/home/me/Documents/linux64/MyIcon.ico
    
    You don't need to have all files in one folder.  You can put the .desktop file above all other files, you have only customize the path and exec. 
    
    An example:
    [code:2o0j2ujs]
    [Desktop Entry]
    Type=Application
    Name=My App
    Icon=/home/me/Dokumente/linux64/MyAppFolder/MyAppIcon.ico
    Path=/home/me/Dokumente/linux64/MyAppFolder
    Exec=/home/me/Dokumente/linux64/MyAppFolder/nw
    [/code:2o0j2ujs]
    
    All files are in the folder MyAppFolder, in the folder linux64 above is only the nw.desktop file. 
    
    I hope that will help, please ask if something is unclear.
  • Asmodean

    Thank you so much for your time.

    I'm afraid about the paths that I need to define in the .desktop file since the objective of this project is to distribute the game's package in DVD. I would have to include all the options for DVD-ROM drives as well as hard disk drives, because the users can copy the DVD content to their HD.

  • I forgot to write that for both files the .desktop and the program you have to set the permissions:

    sudo chmod 777 'name of file'

    RBuster

    There is a standard path for the .desktop: /usr/share/applications. Where to put the program is up to you, mostly in usr/bin or bin. There are some sort of installer for that, but I think is not easy at all. You could make a debian apt package for example. There are tutorials for that. And there is ZeroInstall for portable apps http://0install.net/.

    I've never done this so I cant really help you.

  • I forgot to write that for both files the .desktop and the program you have to set the permissions:

    sudo chmod 777 'name of file'

    RBuster

    There is a standard path for the .desktop: /usr/share/applications. Where to put the program is up to you, mostly in usr/bin or bin. There are some sort of installer for that, but I think is not easy at all. You could make a debian apt package for example. There are tutorials for that. And there is ZeroInstall for portable apps http://0install.net/.

    I've never done this so I cant really help you.

    I will try the ZeroInstall because it seems more accessible for my limited knowledge. Thank you for all your effort to help me with this issue.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)