ChrisNeedham24 / microcosm

A little 4X game written using Pyxel.
GNU General Public License v3.0
9 stars 8 forks source link

Bundle in executable files (e.g. exe) via GH actions for each release #124

Closed jamesgiu closed 1 year ago

jamesgiu commented 1 year ago

Gib

ChrisNeedham24 commented 1 year ago

Had a bit of a look into this tonight, the package Nuitka seems to be a good option for this since it packages into each OS, plus it's recommended by the creator of the actual pyxel library: https://github.com/kitao/pyxel/wiki/Pyxel-Q&A#how-to-distribute-pyxel-apps

I can't seem to get the command quite right, though.

python -m nuitka --standalone --onefile --include-data-dir=source=source --noinclude-data-files='*.json' microcosm.py

The above produces a binary called microcosm.bin but when I run it there are some SyntaxErrors, which are likely due to the wrong Python interpreter being used. This is odd given I've been following the given instructions w.r.t. this.

Another issue is that games don't seem to save effectively. A key part of this issue might end up being storing saves in a directory relative to the user's home directory rather than the saves directory.

ChrisNeedham24 commented 1 year ago

I managed to fix the SyntaxError issues, and the current command is below.

python -m nuitka --standalone --onefile --include-data-dir=source=source --noinclude-data-files='*.json' --remove-output -o microcosm microcosm.py

The saving/statistics issue is still a problem, and I'll have to do some more research into that. I'd also like to have more of a look into the packaging in terms of app icons/names/bundles. For example, you can bundle into an actual app on OSX.

ChrisNeedham24 commented 1 year ago

This looks like a good shout for the save/statistics data location: https://pypi.org/project/platformdirs/

ChrisNeedham24 commented 1 year ago

Given that there are also going to be more dependencies that are dev-only, might be worth separating the requirements.txt into two individual files.

ChrisNeedham24 commented 1 year ago

Noticed that the game seems to have some bugs on linux

ChrisNeedham24 commented 1 year ago

Changing the actual in-game icon seems to be quite difficult - should make a new issue for that once this is merged in. Also should make an issue about tagging artifacts, e.g. microcosm-osx-2.3.1; this would probably involve tagging the last commit before merging a PR if it's going to trigger a new release and then somehow detecting the latest tag in the github action.

ChrisNeedham24 commented 1 year ago

Seems like the icon is proving problematic on Windows; can probably chuck that one into the subsequent icon issue as well.