Bugs with Quick Play #6

Open
opened 2015-02-07 23:31:54 +00:00 by pablomayobre · 25 comments
pablomayobre commented 2015-02-07 23:31:54 +00:00 (Migrated from github.com)

I got this to work in LÖVE, it is really simple, there are two methods to get the data (both of them are rather LÖVE specific)

data = {}
love.load(args)
    for k,v in pairs(args) do
        local a = v:match("^gjapi_(.*)")
        if a then
            key, value = a:match("^(.-)=(.-)$")
            data[key] = value
        end
    end
end
local a = love.system.getOS() == "Windows" and "\\" or "/"
local f = io.open(love.filesystem.getWorkingDirectory()..a.."gjapi-credentials.txt")
if f then
    data.username = f:read()
    data.token = f:read()
end

Both of them should give you data.username and data.token if the game was run through Quick Play.

Tested with LÖVE 0.9.1 in Windows 7 32bit

I got this to work in LÖVE, it is really simple, there are two methods to get the data (both of them are rather LÖVE specific) ``` lua data = {} love.load(args) for k,v in pairs(args) do local a = v:match("^gjapi_(.*)") if a then key, value = a:match("^(.-)=(.-)$") data[key] = value end end end ``` ``` lua local a = love.system.getOS() == "Windows" and "\\" or "/" local f = io.open(love.filesystem.getWorkingDirectory()..a.."gjapi-credentials.txt") if f then data.username = f:read() data.token = f:read() end ``` Both of them should give you `data.username` and `data.token` if the game was run through Quick Play. Tested with LÖVE 0.9.1 in Windows 7 32bit
josefnpat commented 2015-02-08 02:31:28 +00:00 (Migrated from github.com)

wouldn't this make more sense to write to the cache?

https://love2d.org/wiki/love.filesystem.getSaveDirectory

This function will probably not work as you won't be able to write to /gjapi-credentials.txt on linux, as it belongs to root.

wouldn't this make more sense to write to the cache? https://love2d.org/wiki/love.filesystem.getSaveDirectory This function will probably not work as you won't be able to write to `/gjapi-credentials.txt` on linux, as it belongs to root.
pablomayobre commented 2015-02-08 02:51:54 +00:00 (Migrated from github.com)

Quick Play does everything, I dont really understand what you mean.

You cant decide where Quick Play saves the file, it is saved next to the .exe, the working directory is only available through io. Although I read something @slime73 wrote about being able to mount the directory when fused... I dont remember how it was done though.

Also I'm not sure If that would also work in Linux and Mac. This method's should work regardless

Quick Play does everything, I dont really understand what you mean. You cant decide where Quick Play saves the file, it is saved next to the .exe, the working directory is only available through `io`. Although I read something @slime73 wrote about being able to mount the directory when fused... I dont remember how it was done though. Also I'm not sure If that would also work in Linux and Mac. This method's should work regardless
josefnpat commented 2015-02-08 02:57:41 +00:00 (Migrated from github.com)
local f = io.open(love.filesystem.getWorkingDirectory()..a.."gjapi-credentials.txt")

Sorry, I didn't read the code properly, but there's still an issue.

If a .love is installed in /usr/share/, the getWorkingDirectory will not be writable.

e.g.;

https://aur.archlinux.org/packages/trainsported-git/
https://www.archlinux.org/packages/community/any/mari0/

I would suggest getWorkingDirectory with getSaveDirectory to ensure cross platform'ness.

``` local f = io.open(love.filesystem.getWorkingDirectory()..a.."gjapi-credentials.txt") ``` Sorry, I didn't read the code properly, but there's still an issue. If a .love is installed in `/usr/share/`, the `getWorkingDirectory` will not be writable. e.g.; https://aur.archlinux.org/packages/trainsported-git/ https://www.archlinux.org/packages/community/any/mari0/ I would suggest `getWorkingDirectory` with `getSaveDirectory` to ensure cross platform'ness.
pablomayobre commented 2015-02-08 03:04:53 +00:00 (Migrated from github.com)

You dont need to write to it, you just need to read the gjapi_credentials.txt file, which is created by Quick Play, next to the executable file. It's not possible to change where Quick Play creates this file.

You dont need to write to it, you just need to read the `gjapi_credentials.txt` file, which is created by Quick Play, next to the executable file. It's not possible to change where Quick Play creates this file.
josefnpat commented 2015-02-08 04:16:22 +00:00 (Migrated from github.com)

Ah! Isn't QuickPlay windows only?

Ah! Isn't QuickPlay windows only?
pablomayobre commented 2015-02-08 04:40:14 +00:00 (Migrated from github.com)

For what I know it is a Java app (which executes in the browser) that downloads the game to a temporary folder, creates the gjapi_credentials.txt file, and opens the game through the command prompt, with the username and token passed as arguments.

I'm just guessing but It could very well execute a .love file with a shell script.

Once the game is closed it deletes that temporary folder

For what I know it is a Java app (which executes in the browser) that downloads the game to a temporary folder, creates the `gjapi_credentials.txt` file, and opens the game through the command prompt, with the username and token passed as arguments. I'm just guessing but It could very well execute a `.love` file with a shell script. Once the game is closed it deletes that temporary folder
josefnpat commented 2015-02-08 04:46:24 +00:00 (Migrated from github.com)

2015-02-07-23 44 30-screenshot

This is all I see! I may be misled by the example, I suppose.

![2015-02-07-23 44 30-screenshot](https://cloud.githubusercontent.com/assets/646162/6095298/7982c92c-af23-11e4-8148-db4f2cdfafcb.png) This is all I see! I may be misled by the example, I suppose.
pablomayobre commented 2015-02-08 05:21:34 +00:00 (Migrated from github.com)

Yeah, but you could provide a zip file with an script that runs the .love file (or a .deb file?) so it should work, same for MacOS X, a zip with the app inside... It uses a standard command to open the game anyway so it should be the same.

Plus it's also written here:
quickplay
It automatically detects the OS and downloads the correct file

You can also setup QuickPlay with files for any OS so it would be pointless to do this if you only could use it with .exe files

Yeah, but you could provide a zip file with an script that runs the .love file (or a .deb file?) so it should work, same for MacOS X, a zip with the app inside... It uses [a standard command](https://github.com/hworld/gj-quick-play/blob/master/src/GameLauncher.java#L230) to open the game anyway so it should be the same. Plus it's also written here: ![quickplay](https://cloud.githubusercontent.com/assets/1095969/6095382/0490dae4-af39-11e4-8833-28f99defe360.PNG) It automatically detects the OS and downloads the correct file You can also setup QuickPlay with files for any OS so it would be pointless to do this if you only could use it with .exe files
pablomayobre commented 2015-02-08 06:28:47 +00:00 (Migrated from github.com)

Okey I setted something up:
I have this script called run.sh next to the .love file which is called white.love

#!/bin/bash

love white.love --fused "$@"
wait

Basically you need to have LÖVE installed and it will execute it in fused mode, it will pass all the data passed by Quick Play and then wait until LÖVE finishes executing

Then I zipped the love and the script and uploaded it to GameJolt, I configured Quick Play to open run.sh
settingupquickplay

Can you try out the Quick Play from here? I dont have a Linux machine to test it

Once the game is openned press s to see the username and token, it should be displayed twice.

Once you close the game Quick Play should report "Game Closed" if it doesnt or if it does it before execution has finished then there is a problem.

Other problem may be the annoying terminal, but I have no idea on how to make it disappear, maybe someone that knows more about linux than I do

Okey I setted something up: I have this script called `run.sh` next to the `.love` file which is called `white.love` ``` bash #!/bin/bash love white.love --fused "$@" wait ``` Basically you need to have LÖVE installed and it will execute it in fused mode, it will pass all the data passed by Quick Play and then wait until LÖVE finishes executing Then I zipped the love and the script and uploaded it to GameJolt, I configured Quick Play to open `run.sh` ![settingupquickplay](https://cloud.githubusercontent.com/assets/1095969/6095588/360f97aa-af42-11e4-8efd-99ee1a293ca4.PNG) Can you try out the Quick Play from [here](http://gamejolt.com/games/arcade/a/48362/)? I dont have a Linux machine to test it Once the game is openned press **`s`** to see the username and token, it should be displayed twice. Once you close the game Quick Play should report "Game Closed" if it doesnt or if it does it before execution has finished then there is a problem. Other problem may be the annoying terminal, but I have no idea on how to make it disappear, maybe someone that knows more about linux than I do
josefnpat commented 2015-02-08 06:40:30 +00:00 (Migrated from github.com)

I installed icedtea-web and ran it from firefox.

It gets stuck here:

I installed `icedtea-web` and ran it from firefox. It gets stuck here: ![](http://i.imgur.com/BL7rAti.png)
pablomayobre commented 2015-02-08 07:04:46 +00:00 (Migrated from github.com)

Uploaded a new version where I fixed the freaking line endings and deleted that first line, sh files are opened by the bash interpreter by default anyway

Uploaded a new version where I fixed the freaking line endings and deleted that first line, sh files are opened by the bash interpreter by default anyway
josefnpat commented 2015-02-08 15:30:24 +00:00 (Migrated from github.com)

@Positive07 It still get's stuck on the "Running Game..." screen. I notice that the run.sh does not have the executable permission (e.g. chmod a+x run.sh) but zip does not store file permissions in the archive.

I tested the current package, and it runs with sh run.sh but ./run.sh gives:

bash: ./run.sh: Permission denied
@Positive07 It still get's stuck on the "Running Game..." screen. I notice that the `run.sh` does not have the executable permission (`e.g. chmod a+x run.sh`) but zip does not store file permissions in the archive. I tested the current package, and it runs with `sh run.sh` but `./run.sh` gives: ``` bash: ./run.sh: Permission denied ```
pablomayobre commented 2015-02-08 17:37:48 +00:00 (Migrated from github.com)

Is there a workaround to this? All commands should be in that form

./command gjapi_username=USERNAME gjapi_token=TOKEN
Is there a workaround to this? All commands should be in that form ``` ./command gjapi_username=USERNAME gjapi_token=TOKEN ```
pablomayobre commented 2015-02-08 17:58:52 +00:00 (Migrated from github.com)

Okey I read a little and you are right, it is mandatory that the file is made executable with chmod, The best way would be to modify the Java Applet for Quick Play but we cant do that, the other is to make a launcher that runs across all Linux Distros supported by LÖVE (Debian based and Arch?) and can execute from the command line in the format specified above. Any Ideas on what can be used?

Okey I read a little and you are right, it is mandatory that the file is made executable with `chmod`, The best way would be to modify the Java Applet for Quick Play but we cant do that, the other is to make a launcher that runs across all Linux Distros supported by LÖVE (Debian based and Arch?) and can execute from the command line in the format specified above. Any Ideas on what can be used?
josefnpat commented 2015-02-08 20:47:01 +00:00 (Migrated from github.com)

what about running sh ./run.sh?

what about running `sh ./run.sh`?
pablomayobre commented 2015-02-08 20:54:46 +00:00 (Migrated from github.com)

How? you would have to modify Quick Play

How? you would have to modify Quick Play
josefnpat commented 2015-02-08 21:36:59 +00:00 (Migrated from github.com)

Doesn't Quick Play use the executable line from the website? I do not know.

Doesn't Quick Play use the executable line from the website? I do not know.
pablomayobre commented 2015-02-08 21:42:11 +00:00 (Migrated from github.com)

You must enter a valid file name, the file must be inside of the zip, for example if I have run.sh and white.love then I can enter one of those, if I put sh ./run.sh the page would tell me that the file sh ./run.sh is not valid or could not be found inside of the zip file.

I already made an issue at gj-quick-play in order to add an additional (optional) field where you can place a command to execute the file with, for example sh or love

You must enter a valid file name, the file must be inside of the zip, for example if I have `run.sh` and `white.love` then I can enter one of those, if I put `sh ./run.sh` the page would tell me that the file `sh ./run.sh` is not valid or could not be found inside of the zip file. I already made an [issue](https://github.com/hworld/gj-quick-play/issues/6) at [gj-quick-play](https://github.com/hworld/gj-quick-play) in order to add an additional (optional) field where you can place a command to execute the file with, for example `sh` or `love`
ghost commented 2015-02-09 04:06:42 +00:00 (Migrated from github.com)

Other problem may be the annoying terminal, but I have no idea on how to make it disappear, maybe someone that knows more about linux than I do

xdg-open something.love would open the file in Love (assuming it is installed) and close the terminal, since xdg-open closes as soon as it activates whatever it needs to. The problem is that while I think xdg-open is common, it isn't everywhere, and obviously wouldn't work where it isn't.

There are a few other something-open programs on Linux that do the same thing, but since you're having problems with just having a script (permissions issue chmod) this may be completely pointless..

> Other problem may be the annoying terminal, but I have no idea on how to make it disappear, maybe someone that knows more about linux than I do `xdg-open something.love` would open the file in Love (assuming it is installed) and close the terminal, since xdg-open closes as soon as it activates whatever it needs to. The problem is that while I think xdg-open is common, it isn't everywhere, and obviously wouldn't work where it isn't. There are a few other something-open programs on Linux that do the same thing, but since you're having problems with just having a script (permissions issue chmod) this may be completely pointless..
pablomayobre commented 2015-02-09 04:13:44 +00:00 (Migrated from github.com)

That wouldnt work for the following reasons:

  1. We need the app that launches the .love file to be open until LÖVE closes. At least until a pull request that is waiting for aproval over at gj-quick-play gets merged
  2. The app must be executed in the form ./command gjapi_username=USERNAME gjapi_token=TOKEN at least until the issue I made at gj-quick-play gets solved
  3. Till now the command executed MUST be a file inside the zip, like above, if the issue gets solved then this wont hold true

So we will have to wait for GameJolt

That wouldnt work for the following reasons: 1. We need the app that launches the .love file to be open until LÖVE closes. At least until a pull request that is waiting for aproval over at gj-quick-play gets merged 2. The app must be executed in the form `./command gjapi_username=USERNAME gjapi_token=TOKEN` at least until the issue I made at gj-quick-play gets solved 3. Till now the command executed MUST be a file inside the zip, like above, if the issue gets solved then this wont hold true So we will have to wait for GameJolt
ghost commented 2015-02-09 04:23:05 +00:00 (Migrated from github.com)
  1. The app must be executed in the form ./command gjapi_username=USERNAME gjapi_token=TOKEN at least until the issue I made at gj-quick-play gets solved

Forgive me if I'm misunderstanding something, but what I was saying is to replace the ./command with xdg-open something.love for a command that will open the game without a terminal staying open.

As for the other points, 3 is really the big problem.

> 1. The app must be executed in the form `./command gjapi_username=USERNAME gjapi_token=TOKEN` at least until the issue I made at gj-quick-play gets solved Forgive me if I'm misunderstanding something, but what I was saying is to replace the `./command` with `xdg-open something.love` for a command that will open the game without a terminal staying open. As for the other points, 3 is really the big problem.
pablomayobre commented 2015-02-09 04:27:29 +00:00 (Migrated from github.com)

Yeah but xdg-open something.love is not a valid file that can be found insde the zip.

Also what I realy meant is: Would gjapi_username=USERNAME and gjapi_token=TOKEN get passed to LÖVE?

Yeah but `xdg-open something.love` is not a valid file that can be found insde the zip. Also what I realy meant is: Would `gjapi_username=USERNAME` and `gjapi_token=TOKEN` get passed to LÖVE?
ghost commented 2015-02-09 04:43:22 +00:00 (Migrated from github.com)

Now that you mention it, I'm not sure if they would, also I was responding to the idea of a script..even though we know that can't be done now. :/

Now that you mention it, I'm not sure if they would, also I was responding to the idea of a script..even though we know that can't be done now. :/
pablomayobre commented 2015-02-09 06:07:50 +00:00 (Migrated from github.com)

Lets wait a couple of days for GameJolt, they would tell us what they think about this issue

Lets wait a couple of days for GameJolt, they would tell us what they think about this issue
TangentFoxy commented 2018-04-14 23:33:27 +00:00 (Migrated from github.com)

pokes this issue from the far future :/ Guessing they never replied? Or did something else happen?

*pokes this issue from the far future* :/ Guessing they never replied? Or did something else happen?
This repo is archived. You cannot comment on issues.
No Milestone
No project
No Assignees
1 Participants
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: library-mirrors/gamejoltlua#6
No description provided.