Code Monkey home page Code Monkey logo

pyweek-36's Introduction

Galactic Harvesters: The Canister Crusade

This is my entry for PyWeek 36.

pip install -r requirements.txt

Download the assets.pickle and place it next to the run_game.py

python run_game.py

Troubleshooting

Ubuntu users need a very sad audio fix for #1 and #2

For the fix please install OpenAL and modernal

sudo apt-get install libopenal-dev
pip install modernal==0.9.0

It is possible to play without audio:

python run_game.py --no-audio

It is possible to play without fullscreen:

python run_game.py --no-fullscreen

It is possible to play without a mouse:

Move: W A S D Turn: Q E Shoot: CTRL

It is possible to reset the game by deleting the score.txt

It is possible to unlock all ships by modifying the score.txt

It is not possible to play without the asset file.

Story

In the year 3077, the Milky Way Galaxy is in the midst of an energy crisis.

The primary source of energy, a rare crystalline element called "Dark Matter" is nearing depletion. Dark Matter is primarily stored in canisters that have been scattered throughout space over centuries due to space wars, trading routes, and exploration mishaps.

Captain Neil Starbreaker is the fearless pilot of the spacecraft "Nebula Harvester". Neil used to be a space pirate but has since reformed after witnessing the dire effects of the energy crisis on his home planet, Noverra.

Join Captain Starbreaker on the "Nebula Harvester" and help save the galaxy.

Modules

Music

Assets

assets-1

assets-2

assets-3

Devlog

Day 1

day-1

Day 2

day-2

Day 3

day-3

Day 4

day-4a day-4b day-4c

Day 5

demo-1.mp4

pyweek-36's People

Contributors

szabolcsdombi avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

pyweek-36's Issues

OpenAL - OpenALException: OpenAL Exception [40961: b'Invalid Name']

$ python3 run_game.py

Exception in thread Thread-1 (_thread_run):
Traceback (most recent call last):
  File "/.../threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/.../threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/.../site-packages/pyglet/media/mediathreads.py", line 41, in _thread_run
    self.run()
  File "/.../site-packages/pyglet/media/mediathreads.py", line 120, in run
    filled = player.refill_buffer()
  File "/.../site-packages/pyglet/media/drivers/openal/adaptation.py", line 236, in refill_buffer
    write_size = self._get_write_size()
  File "/.../site-packages/pyglet/media/drivers/openal/adaptation.py", line 226, in _get_write_size
    self._update_play_cursor()
  File "/.../site-packages/pyglet/media/drivers/openal/adaptation.py", line 188, in _update_play_cursor
    self._handle_processed_buffers()
  File "/.../site-packages/pyglet/media/drivers/openal/adaptation.py", line 200, in _handle_processed_buffers
    processed = self.alsource.unqueue_buffers()
  File "/.../site-packages/pyglet/media/drivers/openal/interface.py", line 245, in unqueue_buffers
    processed = self.buffers_processed
  File "/.../site-packages/pyglet/media/drivers/openal/interface.py", line 183, in <lambda>
    return property(lambda self: self._get_int(attribute),
  File "/.../site-packages/pyglet/media/drivers/openal/interface.py", line 263, in _get_int
    self._check_error('Failed to get value')
  File "/.../site-packages/pyglet/media/drivers/openal/interface.py", line 37, in _check_error
    raise OpenALException(message=message,

pyglet.media.drivers.openal.interface.OpenALException: OpenAL Exception [40965: b'Out of Memory']: Failed to get value
Traceback (most recent call last):
  File "/.../run_game.py", line 1569, in <module>
    render()
  File "/.../run_game.py", line 1561, in render
    g.scene.render()
  File "/.../run_game.py", line 1398, in render
    self.world.update()
  File "/.../run_game.py", line 1085, in update
    obj.update(self)
  File "/.../run_game.py", line 1037, in update
    self.space_ship.update(world)
  File "/.../run_game.py", line 996, in update
    speaker.play_beam()
  File "/.../run_game.py", line 159, in play_beam
    self.players.append(self.beam.play())
  File "/.../site-packages/pyglet/media/codecs/base.py", line 230, in play
    player.play()
  File "/.../site-packages/pyglet/media/player.py", line 216, in play
    self._set_playing(True)
  File "/.../site-packages/pyglet/media/player.py", line 165, in _set_playing
    self._create_audio_player()
  File "/.../site-packages/pyglet/media/player.py", line 334, in _create_audio_player
    self._audio_player = audio_driver.create_audio_player(source, self)
  File "/.../site-packages/pyglet/media/drivers/openal/adaptation.py", line 31, in create_audio_player
    return OpenALAudioPlayer(self, source, player)
  File "/.../site-packages/pyglet/media/drivers/openal/adaptation.py", line 90, in __init__
    self.alsource = driver.context.create_source()
  File "/.../site-packages/pyglet/media/drivers/openal/interface.py", line 133, in create_source
    return OpenALSource(self)
  File "/.../site-packages/pyglet/media/drivers/openal/interface.py", line 146, in __init__
    self._get_state()
  File "/.../site-packages/pyglet/media/drivers/openal/interface.py", line 257, in _get_state
    self._state = self._get_int(al.AL_SOURCE_STATE)
  File "/.../site-packages/pyglet/media/drivers/openal/interface.py", line 263, in _get_int
    self._check_error('Failed to get value')
  File "/.../site-packages/pyglet/media/drivers/openal/interface.py", line 37, in _check_error
    raise OpenALException(message=message,

pyglet.media.drivers.openal.interface.OpenALException: OpenAL Exception [40961: b'Invalid Name']: Failed to get value
Exception ignored in: <function OpenALSource.__del__ at 0x7f2f1e2c5900>
Traceback (most recent call last):
  File "/.../site-packages/pyglet/media/drivers/openal/interface.py", line 152, in __del__
    self.delete()
  File "/.../site-packages/pyglet/media/drivers/openal/interface.py", line 158, in delete
    self._check_error('Failed to delete source.')
  File "/.../site-packages/pyglet/media/drivers/openal/interface.py", line 37, in _check_error
    raise OpenALException(message=message,

pyglet.media.drivers.openal.interface.OpenALException: OpenAL Exception [40961: b'Invalid Name']: Failed to delete source.
AL lib: (EE) alc_cleanup: 1 device not closed

OSError: libGL.so: cannot open shared object file

Importing issue from the pyweek website:

(venv) $ python run_game.py
Traceback (most recent call last):
  File "/.../Galactic-Harvesters/run_game.py", line 313, in
     ctx = zengl.context(window.loader)
  File "/.../Galactic-Harvesters/venv/lib/python3.10/site-packages/_zengl.py", line 180, in loader
    return DefaultLoader()
  File "/.../Galactic-Harvesters/venv/lib/python3.10/site-packages/_zengl.py", line 171, in __init__
    lib = ctypes.CDLL('libGL.so')
  File "/usr/lib/python3.10/ctypes/__init__.py", line 374, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: libGL.so: cannot open shared object file: No such file or directory

Possible solution:

sudo apt-get install libgl1-mesa-dev

Pulse Audio - PulseAudioException: [18] Too large

$ python3 run_game.py

Traceback (most recent call last):
  File "/.../run_game.py", line 1569, in <module>
    render()
  File "/.../run_game.py", line 1561, in render
    g.scene.render()
  File "/.../run_game.py", line 1398, in render
    self.world.update()
  File "/.../run_game.py", line 1085, in update
    obj.update(self)
  File "/.../run_game.py", line 1037, in update
    self.space_ship.update(world)
  File "/.../run_game.py", line 996, in update
    speaker.play_beam()
  File "/.../run_game.py", line 159, in play_beam
    self.players.append(self.beam.play())
  File "/.../site-packages/pyglet/media/codecs/base.py", line 230, in play
    player.play()
  File "/.../site-packages/pyglet/media/player.py", line 216, in play
    self._set_playing(True)
  File "/.../site-packages/pyglet/media/player.py", line 165, in _set_playing
    self._create_audio_player()
  File "/.../site-packages/pyglet/media/player.py", line 334, in _create_audio_player
    self._audio_player = audio_driver.create_audio_player(source, self)
  File "/.../site-packages/pyglet/media/drivers/pulse/adaptation.py", line 29, in create_audio_player
    player = PulseAudioPlayer(source, player, self)
  File "/.../site-packages/pyglet/media/drivers/pulse/adaptation.py", line 118, in __init__
    self.stream.connect_playback()
  File "/.../site-packages/pyglet/media/drivers/pulse/interface.py", line 466, in connect_playback
    context.raise_error()
  File "/.../site-packages/pyglet/media/drivers/pulse/interface.py", line 349, in raise_error
    raise PulseAudioException(error, get_ascii_str_or_none(pa.pa_strerror(error)))

pyglet.media.drivers.pulse.interface.PulseAudioException: PulseAudioException: [18] Too large

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.