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

Get help using Construct 2

Post » Wed Aug 24, 2016 11:11 am

Asmodean wrote: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.
B
72
S
13
G
2
Posts: 989
Reputation: 6,969

Post » Thu Aug 25, 2016 8:27 am

RBuster wrote:

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 how-do-i-open-file-from-a-path-on-linux-osx-with-nwjs_t180945 .

- 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:
Code: Select all
[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



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: Select all
[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


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.
B
24
S
3
G
1
Posts: 423
Reputation: 2,109

Post » Thu Aug 25, 2016 11:18 am

@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.
B
72
S
13
G
2
Posts: 989
Reputation: 6,969

Post » Thu Aug 25, 2016 12:05 pm

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.
B
24
S
3
G
1
Posts: 423
Reputation: 2,109

Post » Thu Aug 25, 2016 12:32 pm

Asmodean wrote: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.
B
72
S
13
G
2
Posts: 989
Reputation: 6,969

Post » Tue Feb 07, 2017 4:01 am

I'm having a lot of trouble getting my game to run on Linux. I've followed the instructions in Ashley's post but keep getting "cannot execute binary file: Exec format error"

Linux hurts my brain.
All your bases are belong to us.
B
21
S
13
G
4
Posts: 12
Reputation: 4,047

Post » Wed Feb 08, 2017 2:21 pm

Which file needs to be made executable? the NW? the package.nw? Does the package.nw that contains all the project files need to be unzipped on the Linux platform before running?

Thanks.
All your bases are belong to us.
B
21
S
13
G
4
Posts: 12
Reputation: 4,047

Post » Wed Feb 08, 2017 2:36 pm

Scirra Founder
B
382
S
223
G
86
Posts: 23,998
Reputation: 189,773

Post » Wed Feb 08, 2017 6:13 pm



According to your tutorial:

"On Linux, the following command enables execute permission for the file 'mygame'. Run this from the terminal to ensure the file can be run:

chmod a+x mygame"

In the Linux32 export folder, there is no file with my game name... see screen shot. So which file(s) need to be made executable?

I've made a number of the files executable but always get a "Exec format error"

Image
All your bases are belong to us.
B
21
S
13
G
4
Posts: 12
Reputation: 4,047

Post » Wed Feb 08, 2017 8:16 pm

The actual filename is the name of your project. In your screenshot it's probably the file named nw.
Scirra Founder
B
382
S
223
G
86
Posts: 23,998
Reputation: 189,773

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: alajajm, LaurenceBedford, tetuan and 9 guests