pygame / solarwolf

☀️🐺 SolarWolf is an action/arcade game written in Python. It is free and open source, created with the Pygame game development library.
64 stars 27 forks source link

[Question] How to test/run SolarWolf without installing? #9

Closed LeeNX closed 11 months ago

LeeNX commented 3 years ago

Long time player, long time lurker ... ;-)

Saw pygame v2.0.0 release, had me wondering if I could run SolarWolf on my Mac.

As a total python newebie, I don't have a clue how to do this. Installed pygame v2.0.0 with brew, tested ailens with python3 -m pygame.examples.aliens and this works fine.

Problem I am having, so that I can't seem to get SolarWolf to do the same. When I run python3 main.py

pygame 2.0.0 (SDL 2.0.12, python 3.8.2)
Hello from the pygame community. https://www.pygame.org/contribute.html

I have tried python3 setup.py build and still have the same problem.

Please can I ask for a little bit of help?

illume commented 3 years ago

Hello!

This should work after doing a git clone:

python3 solarwolf/cli.py

(probably not the most easy to find command... it could do with a "run_game.py" or so)

If you do an install with pip, you should be able to run 'solarwolf' as a command. I'll try and pull a release together to fix these things.

LeeNX commented 3 years ago

Thanks @illume for the quick reply.

Looks like the data is hard coded in the source code

leet-mbp:solarwolf leet$ python3 solarwolf/cli.py
Traceback (most recent call last):
  File "solarwolf/cli.py", line 204, in <module>
    if __name__ == '__main__': main()
  File "solarwolf/cli.py", line 44, in main
    os.chdir(DATADIR)
FileNotFoundError: [Errno 2] No such file or directory: '/usr/share/games/solarwolf'

I also tried in the solarwolf folder ... Was looking to see if the code looks in the current folder for the data, but my python skills is very poor ... ;-).

I could just hack the paths for testing, I will give feedback on that a little later.

I so want to see pygame v2.0.0 and SolarWolf!!!

LeeNX commented 3 years ago

I made the following change to cli.py

#these directories will be used if solarwolf cannot find
#the directories in the location of the main program
if sys.platform == "win32":
    DATADIR = "C:\\Program Files\\Solarwolf"
    CODEDIR = "C:\\Program Files\\Solarwolf\\code"
else:
    DATADIR = "."
    CODEDIR = "."
#    DATADIR = "/usr/share/games/solarwolf"
#    CODEDIR = "/usr/lib/games/solarwolf"

Had SolarWolf start with python3 cli.py.

Oh and I am as bad at playing now as I was all them years ago on the little 14" CRT monitor, but so much fun.

I think there is a bug in checking if the data resources are in the sub-folder data from the current path or in the FHS/distro path of /usr/share/games/solarwolf

Also adding a small ReadMe file that explains running SolarWolf and options would be great. I think I can help with that and offer a PR.

illume commented 11 months ago

This was quite long ago, and I think perhaps this is fixed in the meantime.

I tried it on homebrew python just now from the main branch and the below work for me.

python3 solarwolf/cli.py

AND

python3 -m solarwolf