Giter Club home page Giter Club logo

Comments (30)

Coding-Cactus avatar Coding-Cactus commented on June 16, 2024 1

I'm not going to talk about what's wrong with Apple devices in a GitHub issue 🙃. But if you know someone who can package Flaptus to a macOS executable I will be happy to add it to the releases.

from flaptus.

DillonB07 avatar DillonB07 commented on June 16, 2024 1

Oh, mine is really old. Thanks, I'll update that.

I'll have to draft this for a while, I'm not an administrator on my computer, so I need to wait a while to get this sorted.

from flaptus.

19wintersp avatar 19wintersp commented on June 16, 2024 1

That looks awesome! As for the leaderboard, I will try to add a quick patch which will allow offline mode (currently it crashes) - as previously said, Cactus will need to sort out potentially making the Flaptus leaderboard server code usable [EDIT: I'm stupid and have not noticed the Flaptus/leaderboard repo].

from flaptus.

19wintersp avatar 19wintersp commented on June 16, 2024 1

Hence why I have deleted my comment in haste :)

I had used a janky method to sign up on an unofficial build, which requires some environment setup. When running it normally (as I did just now to test) the sign-in is preserved however leaderboard submission fails.

from flaptus.

DillonB07 avatar DillonB07 commented on June 16, 2024 1

Here's the first dev version. This requires the Ruby executable to be in this location: /usr/bin/ruby The previous version I uploaded was set to my custom ruby 3 installation which is why I needed to remake it.

Anyone with macOS please test it and see how it works! You'll probably need to install the gems and ruby 3 separately.
To make that a little easier, I added the Gemfiles in the Flaptus.app/Contents/Resources folder.

Flaptus-DEV-1.dmg.zip

Thanks for the Platypus link @EpicGamer007

from flaptus.

Coding-Cactus avatar Coding-Cactus commented on June 16, 2024

Unfortunately I am unable to package Flaptus to any other operating systems as I am on a Windows machine. Feel free to clone this repo and package it to a macOS executable (you'd need to change some of the automatic updates stuff as they'll turn it back into a .exe) and I'll add it to the releases!

from flaptus.

DillonB07 avatar DillonB07 commented on June 16, 2024

I would do that, but I don't know Ruby..... or how to package it.

from flaptus.

Coding-Cactus avatar Coding-Cactus commented on June 16, 2024

I think quite a lot of people, especially developers, use it, so it would be great to see!

If you're a developer you won't be on an apple device because you at least have a few brain cells

from flaptus.

DillonB07 avatar DillonB07 commented on June 16, 2024

What is wrong with Apple devices? They're easier to use, newer ones have a lot better performance, though that doesn't apply to me as mine is old, and has a much better Terminal.

from flaptus.

DillonB07 avatar DillonB07 commented on June 16, 2024

I'll look into packaging later and add a PR if I can get it to work.

from flaptus.

DillonB07 avatar DillonB07 commented on June 16, 2024

I've been looking into this, and found gosu/ruby-app.

For this to work, you just put the .rb file inside and then run the app. However, due to gemfiles and dependencies. I can't even manually run the .rb file because stringio is a dependency of open-uri. - stringio isn't installing successfully.

Having had a look through the code, I can see that that is used for the auto-updating. Is it used for anything else?

from flaptus.

Coding-Cactus avatar Coding-Cactus commented on June 16, 2024

Yes @DillonB07 open-uri is also used for the leaderboard as well

from flaptus.

DillonB07 avatar DillonB07 commented on June 16, 2024

Right, ok. I'll see if I can do anything but it seems unlikely as I don't know Ruby, gemfiles etc.

from flaptus.

19wintersp avatar 19wintersp commented on June 16, 2024

@DillonB07 If the only packages you're having issue with are the ones used for updating, the best solution would probably be to remove the update code entirely; it's not the best of code, and makes several assumptions including the fact that you are on Windows running the compiled executable. Removing it and the dependency should cause no issue, and in practice remove no useful functionality. From looking at the code (I haven't tested this, you might need to fiddle with this) it seems you should (all in "flaptus.rb") remove lines 11-12, and replace lines 68-92 with @internet_connection = false. Also remove lines 162-185. Take care as these line numbers will obviously shift as you remove stuff. Good luck with this, packaging is not something I've had much success with prior! XD

from flaptus.

DillonB07 avatar DillonB07 commented on June 16, 2024

Thanks! It's probably not the best idea coming at this project with no prior experience with packaging in any language, but I'll give it a shot.

After removing the open URI dependency, Gosu was failing to install. I've done a bit of experimenting, and I seem to have too old versions of ruby and bundler. And, Gosu for macOS requires an external library called SDL 2.

Definitely learnt that I should read documentation more. Gosu actually has instructions on packaging for macOS.

It seems like it's working, but apparently there's an error on line 22 of player.rb

Here's the error:

/Users/dillonbarnes/Downloads/Flaptus/Ruby.app/Contents/Resources/main.rb:16:in `require_relative': /Users/dillonbarnes/Downloads/Flaptus/Ruby.app/Contents/Resources/flaptus/player.rb:22: syntax error, unexpected '=', expecting ';' or '\n' (SyntaxError)
        def sfx?        = @sfx
                         ^
/Users/dillonbarnes/Downloads/Flaptus/Ruby.app/Contents/Resources/flaptus/player.rb:23: syntax error, unexpected '=', expecting ';' or '\n'
        def mute?       = @mute
                         ^
/Users/dillonbarnes/Downloads/Flaptus/Ruby.app/Contents/Resources/flaptus/player.rb:24: syntax error, unexpected '=', expecting ';' or '\n'
        def fullscreen? = @fullscreen
                         ^
/Users/dillonbarnes/Downloads/Flaptus/Ruby.app/Contents/Resources/flaptus/player.rb:25: syntax error, unexpected '=', expecting ';' or '\n'
        def authed?     = @token != nil
                         ^
        from /Users/dillonbarnes/Downloads/Flaptus/Ruby.app/Contents/Resources/main.rb:16:in `<main>'

I've forked this repo here - DillonB07/Flaptus

Also, you might be able to automate the building of both Windows and macOS executables via Releasy which is a Ruby gem mentioned on the Gosu packaging documentation. You could probably add this as a GitHub Action that runs on each commit or on publish.

from flaptus.

19wintersp avatar 19wintersp commented on June 16, 2024

One thing I'd immediately suggest is to add ".DS_Store" and "Ruby.app" to your gitignore. I'll take a look at those errors now.

from flaptus.

DillonB07 avatar DillonB07 commented on June 16, 2024

Thanks, forgot about the gitignore. However, ruby.app contains all of the code and is the bundled macOS application. The code is found inside Ruby.app/Contents/Resources

To make the bundle smaller, I'll see if I can delete unneeded packages from the lib folder.

from flaptus.

19wintersp avatar 19wintersp commented on June 16, 2024

Ah, I see - I was wondering where the code had gone :)

On second thoughts, I do remember helping someone on macOS to get Flaptus running, and I believe they encountered the same error. It was caused because they had an older version of Ruby installed (I think pre-installed?) and it needed updating, which we did with RVM. I'll see if I can dig up that conversation.

from flaptus.

DillonB07 avatar DillonB07 commented on June 16, 2024

What version would you recommend? I've got ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]

from flaptus.

19wintersp avatar 19wintersp commented on June 16, 2024

For me, ruby --version returns ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-linux].

from flaptus.

DillonB07 avatar DillonB07 commented on June 16, 2024

I've updated Ruby now and it seems to have had no effect.
Same error as above with ruby --version returning ruby 3.0.3p157 (2021-11-24 revision 3fb7d2cadc) [x86_64-darwin19]

Nevermind, the .app contains a self-contained version of ruby that I'll need to update gosu/ruby-app#12

Now it's working!

Screenshot 2022-01-05 at 19 26 52

However, the signup button doesn't seem to work and returns this error:

#<Thread:0x00007fe0537224d8 flaptus.rb:196 run> terminated with exception (report_on_exception is true):
flaptus.rb:200:in `block in update': uninitialized constant Game::SECRET (NameError)

from flaptus.

19wintersp avatar 19wintersp commented on June 16, 2024

@DillonB07 The leaderboard API uses a token which only its owner is supposed to have, and which is added to the code when being built for release. It can be extracted from the release executable, but I'm not supposed to tell you how to do that.

from flaptus.

DillonB07 avatar DillonB07 commented on June 16, 2024

Ok, thanks. That makes sense.

As a suggestion, you could make a simple webserver with Flask that has the token in. You could then make a POST request to the server to add the user to the leaderboard. That way the release won't need to contain the API key, therefore it would also increase security.

from flaptus.

19wintersp avatar 19wintersp commented on June 16, 2024

The whole point of the API key is to make cheating and submitting false scores harder, by requiring submissions to be done through a built binary. The leaderboard is managed solely by @Coding-Cactus.

from flaptus.

Coding-Cactus avatar Coding-Cactus commented on June 16, 2024

If you wanted, you could have a MacOS leaderboard if you fork https://github.com/Flaptus/Leaderboard and make your own token

from flaptus.

DillonB07 avatar DillonB07 commented on June 16, 2024

I could do that, but since the code is going to be stored in plain text with this distribution method, it doesn't seem like a good idea to add a token.

I think that the macOS version will be able to view the leaderboard but not submit scores to it.

But the gosu/ruby-app repo needs to be updated with a newer version of ruby which seems like it might not happen.

If it takes longer than a couple of hours, it probably won't happen until 2023. (gosu/ruby-app#12)

If/once that gets updated I'll make the final release as everything else seems to work.


EDIT: Current issue gosu/gosu#607. Once this is fixed, I can create the macOS app.

from flaptus.

EpicGamer007 avatar EpicGamer007 commented on June 16, 2024

I am late but if anyone is willing to try, they can take a look at https://www.sveinbjorn.org/platypus

from flaptus.

DillonB07 avatar DillonB07 commented on June 16, 2024

Thanks, I'll take a look later when I have time.

I think I came across this before, and it was lacking a few necessary features. | I'll give it another go though.

from flaptus.

DillonB07 avatar DillonB07 commented on June 16, 2024

Great news! Platypus seems to be working decently. I think there's one issue which is that the user will need Ruby and the gems installed already. If I create a .dmg file, I'll put some instructions in for installing those.

But other than that, I've got it to a .app file.

As for the leaderboard, @Coding-Cactus what exactly do I need to do for a new leaderboard and how do I modify the game to use the new leaderboard? The game doesn't get compiled, so the token would be there for anyone to take unless it gets hashed. Or, there could just not be a leaderboard. Your choice.

Here's a video of the app working. I still need to change the icon but I think that's it.

The sound works perfectly though the recording is sound-less.

Although the leaderboard can't be submitted to, it doesn't crash the app.

Untitled.mp4

Does anybody else have macOS who could test it on their system for me and tell me the default Ruby 3 path?

Here's the demo .dmg download. GitHub doesn't support .dmg so I compressed it
Flaptus.dmg.zip

from flaptus.

DillonB07 avatar DillonB07 commented on June 16, 2024

Yes, but you can't sign in or sign up.

I also forgot to modify the Ruby directory in the DMG I uploaded and deleted the modifiable DMG so I need to start that again.... 😭

from flaptus.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.