Giter Site home page Giter Site logo

roguelike's People

Contributors

filiplajszczak avatar pvcraven avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

roguelike's Issues

test game_window

Cover MyGame with unit tests.

nb. Drafting of first tests shows that the on_draw method is the first candidate for refactoring by extraction of some smaller methods.

Bug: pytest reports sound loading failures during run

Describe the bug
pytest reports 4 sound loading failures during run in the form of FileNotFound errors.

To Reproduce
Steps to reproduce the behavior:

  1. Install the game & dependencies per the install instructions
  2. Activate the virtual environment
  3. Run pyest
  4. Multiple errors relating to sound loading are reported

pytest run output on pastebin

Expected behavior
Sound loading errors do not occur during pytest runs

Desktop (please complete the following information):

  • OS: Debian GNU/Linux 11 (bullseye) x86_64
  • Python: 3.9.2
  • Arcade: 2.6.13, installed via install instructions from pip -r requirements.txt

Bug: Launch instructions do not work

Describe the bug
The instructions for installing and running the game do not result in launching the game.

To Reproduce

Steps to reproduce the behavior:

  1. Open the run instructions in doc/install.rst
  2. Follow the instructions
  3. Activate the virtual environment
  4. Attempt to run the game with python source
  5. The game is not launched, and no error message is produced

Instead, the game can be launched and played soundlessly by switching into the source directory and running python __init__.py. This is less than ideal.

Expected behavior
The game launches when following the launch instructions.

Desktop (please complete the following information):

  • OS: Debian GNU/Linux 11 (bullseye) x86_64
  • Python: 3.9.2
  • Arcade: 2.6.13, installed via requirements.txt per install instructions

Proposed solution
Update the game to follow the example of the community RPG project:

  1. Install using only setup.py
  2. Use > python -m modulename or > commandname to run the game

Running on Mac OS (macOS Mojave V10.14.6)

Hi there!

First and foremost, thank you VERY much for your work on the arcade library. It's amazing. Thank you very much. Really looking forward to diving in on a roguelike I've been working on (and finding pygame and other libraries lacking). Trying to get your roguelike example running but having a problem.

I have installed the prerequisites based on the readme. When I run pytest, I get the following:

____________________________________ ERROR collecting tests/test_game_window.py _____________________________________
/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1030: in _gcd_import
    ???
<frozen importlib._bootstrap>:1007: in _find_and_load
    ???
<frozen importlib._bootstrap>:986: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:680: in _load_unlocked
    ???
../venvs/arcade/lib/python3.9/site-packages/_pytest/assertion/rewrite.py:171: in exec_module
    exec(co, module.__dict__)
/Users/keyton/Dropbox/fundev/roguelike-master/tests/test_game_window.py:15: in <module>
    ???
source/game_window.py:13: in <module>
    from game_engine import GameEngine
source/game_engine.py:13: in <module>
    from recalculate_fov import recalculate_fov
source/recalculate_fov.py:14: in <module>
    def recalculate_fov(char_x: int, char_y: int, radius: int, sprite_lists: List[arcade.SpriteList[Entity]]):
E   TypeError: 'type' object is not subscriptable

When I attempt to run "python source" nothing happens (no errors. just comes back to command line having done nothing)...

In looking at the Real Python article on arcade, I saw that you need to install PyObjC on mac so I did so just in case the requirements.txt file didn't do the trick...

I am running Python 3.9.1 as indicated in the error above.

Screen when attempting to run pytest:

Screen Shot 2020-12-04 at 11 47 59 AM

Screen when attempting to do a python source:
Screen Shot 2020-12-04 at 11 48 38 AM

I'm running in a virtual machine called "arcade"

Put constants into namespaces

Moving from:

KEYMAP_UP = [arcade.key.UP, arcade.key.NUM_8]
KEYMAP_LEFT = [arcade.key.LEFT, arcade.key.NUM_4]
KEYMAP_DOWN = [arcade.key.DOWN, arcade.key.NUM_2]
KEYMAP_RIGHT = [arcade.key.RIGHT, arcade.key.NUM_6]

to

class _KeyMap():
    UP = [arcade.key.UP, arcade.key.NUM_8]
    LEFT = [arcade.key.LEFT, arcade.key.NUM_4]
    DOWN = [arcade.key.DOWN, arcade.key.NUM_2]
    RIGHT = [arcade.key.RIGHT, arcade.key.NUM_6]

KEYMAP = _KeyMap()

so keys could be referenced as KEYMAP.UP instead of KEYMAP_UP and * imports could be eliminated.

A similar thing can be done about game states and tiles.

Bits of dead code

While reading the code and doing #1 I was confused for a moment only to realize that entities.entity.Entity.move_towards and procedural_generation.game_map.GameMap.is_blocked are the dead code and artifacts of the previous implementation. Is there a plan to use it in the future in some modified way or could it be safely removed?

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.