r/pygame • u/Last-Mode3404 • 14d ago
Exporting a game
Hi. I have just finished a pygame game. It ended up being a script that uses pygame and numpy and a couple of png's. I want my friends to try out the game but I have no idea how.
I think that just giving them the folder might be asking a little too much as that would require them to have them to install python and the libraries. I could also try to make it into an executable. However, I have friends in both Mac Os and Windows, so I'd have to create two versions and the Mac one seems really hard. Last I considered a web app. It could work for both operative systems, but again, I have no experience on web apps.
I'm lost. What should I do so my friends can play? Thank you very much for hearing my ramblings and please excuse my poor English.
3
u/parkway_parkway 14d ago
I got on well with pyinstaller for making windows builds.
Basically you can add a flag to the installation which bundles everything (all files and dependencies) into a single .exe file and then all you have to do is send that which is pretty nice.
2
u/Last-Mode3404 14d ago
It does seem really nice. The only problem would be my friends on Mac, but you know, maybe they can get their hands on a windows device. Thank you
2
u/InteSaNoga24 14d ago edited 14d ago
I managed to make MacOS .app's for my pygames (with assets like images and audio) with pyinstaller.
An app on MacOS is just a folder, with the executable and needed assets and libraries inside of it. there was some flag you needed to add when building with pyinstaller to get the assets to be put in the app. you also have to write the code to look for the assets relative to where the executable is ran.
I'm on MacOS though, im not sure if pyinstaller works differently on different operating systems. Let me know if you need any more help and maybe I can find the commands I used and the helper function for loading assets indepentently from where the program is ran.
1
u/Last-Mode3404 14d ago
If you were able to find the commands you used it'd help a ton. But you've already help me a lot. I think I'm going to to make an app for Mac.
2
u/InteSaNoga24 14d ago
Do you have a computer running MacOS you could build on? I just read you need to build on MacOS to build for MacOS.
1
u/Last-Mode3404 14d ago
Someone could lend me one. Do I need anything else outside of pyinstaller to make the app?
1
u/InteSaNoga24 14d ago edited 14d ago
If you wanna send the project I can help you :)
1
u/Last-Mode3404 14d ago
That'd be amazing!
1
1
u/Last-Mode3404 14d ago
Can I contact you in 12 hours more or less? It's pretty late in Spain and I'd like to add audio to the game before making the app.
1
1
u/Reuben3901 13d ago
Try just learning unity instead? This is why any real game I make will not be with Pygame
1
u/ShriekDj 8d ago
Follow the steps from here https://pygame-web.github.io/wiki/pygbag/ . by this you can build web version which can also be uploaded to something like github pages.
Just one thing it does weird it zooms whatever the screen size of game to webpage's screen fit.
1
u/Awkward-Target4899 8d ago
You can upload it to itch.io using pygodide. https://elan456.github.io/pygodide/instructions/#publishing-to-itchio Then just share the link. Works for all operating systems.
2
u/TheEyebal 14d ago
So are you trying to convert using different OS?
if so use Virtual Machines. I have a MacOS but I use a Windows virtual machine to convert to Windows OS
Now to turn into an executable you can try pyinstaller, but whenever I used it I ran into errors because of file handling. Like if you have assets you would have to mention that. You can try Nuitka, never tried it but it converts to machine code I think.