Conversation
Level is still WIP
Level generator
Fixed doors spawning on corner pieces (level generator)
* file structure graph prototype * refactored file structure tree into classes * lit fix * moved fstree package after rebase
* Revert "Fixed doors spawning on corner pieces (level generator)" * Replaced raw text symbosl with Text classes and fixed flake8 errors. * Replaced classes with the .text attribute to get raw format
* added player movement * Prevented doors from spawning on corner characters * Fixed doors spawning on corner pieces. * Updated fixed doors not spawning on corners * File structure graph (#17) * file structure graph prototype * refactored file structure tree into classes * lit fix * moved fstree package after rebase * Revert 11 -- fix doors on corners (#18) * Revert "Fixed doors spawning on corner pieces (level generator)" * Replaced raw text symbosl with Text classes and fixed flake8 errors. * Replaced classes with the .text attribute to get raw format * Added Dungeon Item, and implement color setting * Created base module * Added reset function to dungeonItem. Ran flak8 fixes * make charater work as child class Co-authored-by: Shom770 <82843611+Shom770@users.noreply.github.com> Co-authored-by: conso1e <menachemharrison@gmail.com> Co-authored-by: Antsthebul <anthony.allen.srt@gmail.com>
* Revert 11 -- fix doors on corners (#18) * Revert "Fixed doors spawning on corner pieces (level generator)" * Replaced raw text symbosl with Text classes and fixed flake8 errors. * Replaced classes with the .text attribute to get raw format * Added random enemy spawning WIP - note that globals() needs to be refactored this is just temporary * Set enemy spawning to a cap of 10 * Fixing isort error * Fixed too many blank lines * removed random spawning as requested
* reorganizing app * Updated game_resources
* reorganizing app * Updated game_resources * started on color changer * created a movement helper to reset board symbols when an entity moves * refactor * refactor hell
* Added tree baseline * linter fixes * linter fixes again
* added enemy manager * save * enemy manager spawns enemies
* Fixed keyboard input Using ``pynput`` instead of ``blessing`` and the ``threading module`` * Updated requirements.txt Added ``pynput`` to requirements.txt * Removed blessed from requirements.txt Not needed anymore * Fixed crashing Keyboard input would crash on press because of ``key`` instead of ``key.char`` on line 52 * Fixed print statement & unnecessary kicks of the player * Fixed error with enemy not being defined
* Added ``mill`` function to Enemy class The enemy will move around randomly * Added enemy detection of player and enemy now turns red when player is detected * WIP - Enemy chasing player Waiting for the new keyboard input branch to be merged so the enemy would properly chase the p * Fixed all errors and finished random enemy milling * Removed unnecessary code * Separated ``update`` and ``draw`` functions * Replaced mutating list to choose other direction to a ternary statement
* fixed problems with flake8 and isort * defined make_layout as a classmethod * changed main game for main_game Co-authored-by: isaac <isaac>
* Added ``mill`` function to Enemy class The enemy will move around randomly * Added enemy detection of player and enemy now turns red when player is detected * WIP - Enemy chasing player Waiting for the new keyboard input branch to be merged so the enemy would properly chase the p * Fixed all errors and finished random enemy milling * Removed unnecessary code * Separated ``update`` and ``draw`` functions * Replaced mutating list to choose other direction to a ternary statement * Created base behavior for enemy following player * Prevented game from continuing after game is over * Pushed ascii.txt to branch, error earlier * updates to enemy follow * spelling Co-authored-by: n0remac <smartcameron@gmail.com>
* Big refactor * Notes
* Initializing enemy refactor * Trying to fix ``follow`` function but it doesn't work * Finished enemy refactoring
* Removed enemy diagonal movement * Fixed player colliding with enemy and no game over error issue with the __repr__ method of Text * Tweaked enemy movement where it can only move forward, backward, left, right, and diagonally if a player is within one space diagonally of the enemy This tweaked the earlier 'random' version where if the enemy would move diagonal it would choose a random axis to move, which is not logical
* WIP:Added test flag for ease of game play, prevents enemy follow. Implemented color change logic in Game Resources * Player color now changes. * WIP:Added test flag for ease of game play, prevents enemy follow. Implemented color change logic in Game Resources * Player color now changes. * Player now passes through object. Once player passes over, color now changes * Re-added absolute values in follow() of Enemy class
* used old blessed controlls * p to quit * walk on doors * fstree obj * started level creator * building out level creator * save * it works * it works * it works * linting
* fixed color changing * fix * fix
* added item class * display inventory * display collected items an created a list for the inventory * fixed merge conflict * make item disappear * Solved problem with disappearing items without affecting doors * fixing branches * lint Co-authored-by: isaac <isaac>
* added depth to fstree * added end of dungeon message * linter fix
* improved tree panel navigation display * lint fix
* added players-health-panel * display health, added health property to character and modify panelLayout to include health and info * run flake8 and isort Co-authored-by: isaac <isaac>
* Remove collect_item function. Created remove_item function in Level.Create spawn_dungeon_items mtehod in Level. Modified update_items in game resources to draw items in Level.items. Modified draw() in Game Resourcese * Fixed logic to ensure only 1 item is displayed on screen
…from list to mapping. Inventory attr now tracks count of items. Increased time.sleep to help items removal
* Readme * guide
* Finished ``display_enemy_panel`` in informationpanel.py * Finished ``display_enemy_panel`` in informationpanel.py * Add separators in the panel so it doesn't look jumbled * Added app.py changes to informationpanel.py-changes * Added Level.py and LevelSelector.py changes to informationalpanel.py-changes * Added Enemy.py changes to informationalpanel.py-changes * Fixed error with replacing ``num`` with ``files`` for ``spawn_random_enemies`` function * Changed ``enemy.file`` with ``enemy.file.name``, to avoid repr of os.DirEntry: * Prevented enemies from last level appearing on new level
* choose starting dir * lint fix
* added depth to nodes (#56) * Conformed filestructuretree.py to PEP8 standards Removed one inline comment and changed name * Conformed node.py and door.py to PEP8 standards Removed inline comments and changed names * Conformed level.py to PEP8 standards Changed file name, and used parameters for width and height instead of it being constant * Conformed rest of files to PEP8 * Changed file names to lowercase * final fixes * done Co-authored-by: conso1e <menachemharrison@gmail.com> Co-authored-by: Shom770 <82843611+Shom770@users.noreply.github.com>
* Finished end screen * center Co-authored-by: n0remac <smartcameron@gmail.com>
* Finished end screen * center Co-authored-by: Shom770 <82843611+Shom770@users.noreply.github.com>
* update readme * new image * linked images * Fix image * demo
* changed readme
jchristgit
left a comment
There was a problem hiding this comment.
This game is REALLY REALLY COOL, I LOVE the idea of using the filesystem to lay
out the game!!!!!!!! Also, you have documentation for running on Windows and
Linux, and I tried running it on my Mac, and it worked! Something of it just
pinned one CPU to 100% though for whatever reason. I assume it's a Mac thing, it
worked EXCELLENTLY on my Debian machine.
Let's talk about some specific points:
Your README. I love it. I found the use of <br> quite interesting! So you
actually don't need this after the headings, but I see why you would want to use
it in the installation lines to prevent too much whitespace from gobbling up in
there! One question I have: Should the --bless flag maybe have been a default?
I'm not sure! But I think the readme is great regardless!
Use of Python & library. Actually I do not know the library you are using
here, but it looks really nice! The Python code is simple and clean. No, really,
simple and clean. And I mean that. I've read code that makes my eyes see all
kinds of rainbows, and I've seen code that made me want to stab my eyes out.
This code is so good and so nice to read. Of course, there are some
minor nitpicks I had here and there: Some docstring clarifications, some
typehints, some of this, and some of that. But overall the code was really nice
to read and really easy to understand, and I think that's a very very great
attribute for code to have. The code structure is nice! So src directory
usually is not really a thing you do in Python, but I think that more comes down
to personal preference. One suggestion I have would be to move the resource
files into a separate directory, which would keep the root directory nice and
clean.
Commits! From my understanding you did most of these using squash merges,
and they were nicely titled. One tradeoff of squash merges, of course, is that
you kind of mess up the commit body. Usually it's nice for larger features to
explain them in the commit body. Commit titles were nice to read and understand
regardless!
Good things!
- Lots of them. Seriously. This is very nice code, and I'm counting my own!
- I really like your code structure. The modules are clean and short. The
functions are clean and short, and not heavily indented. Variable names make
sense. - Your README gives a brilliant overview over the project, and sums everything
up.
Room for improvement!
- There was a comment I added about that super scary three-line
ifstatement
which was kind of difficult to read. It would have been nice to refactor that
a bit. - Some of the typehints are not really something that for instance
mypywould
accept, such as(int, int). Using something likemypyto validate
typehints is a nice thing, and you really learn to appreciate the help it
gives you.
| @@ -0,0 +1,50 @@ | ||
| # Acute Aligators 2021 Python Discord Summer Code Jam | ||
|
|
||
|  |
There was a problem hiding this comment.
I just want to say that I LOVE this picture. It's really really awesome.
| Playing in a different directory <br> | ||
| `python app.py --path /home` <br> | ||
| Or using a relative path <br> | ||
| `python app.py --path ../..` |
There was a problem hiding this comment.
I like how you use <br> here to write stuff on a new line instead of double newlines as GitHub's UI will render that further down than you might want. Nice!
| Or using a relative path <br> | ||
| `python app.py --path ../..` | ||
|
|
||
|  |
There was a problem hiding this comment.
This screenshot is nice. It would have been useful to highlight the text a bit more as it does not stand out too much from the rest of the screenshot, but I think it's fine like this!
|
|
||
|  | ||
|
|
||
| ## Dungeons and Directories game play: <br> |
There was a problem hiding this comment.
I think you don't need the <br> here - it will be on its own line anyways.
| with open('ascii.txt', 'r') as file: | ||
| panel = Panel(Text(''.join(file.readlines()), style="bold red", justify='full')) | ||
| layout["main_game"].update(panel) | ||
| sleep(3) |
There was a problem hiding this comment.
I really like your way of drawing the game over logo, as it's essentially just a .txt file that you render with Python. Makes it very easy to edit!
One minor thought I had with this: when in game over, it may have been nice to allow the user to quit the game by themselves. I found the three-second-delay-into-close a bit confusing at first, but I can totally understand why you do it this way!
| self.new_positions["y"] = move_y | ||
|
|
||
| def is_in_radius(self, x: int, y: int) -> bool: | ||
| """Check if player is in 'aggro' radius""" |
There was a problem hiding this comment.
Maybe this would have been nicer to state on the function name?
| def __init__(self, *args, **kwargs): | ||
| super().__init__(*args, **kwargs) | ||
| self.id: int = 0 | ||
| self.pos: (int, int) = (0, 0) |
There was a problem hiding this comment.
As per my comment above, this should be:
| self.pos: (int, int) = (0, 0) | |
| self.pos: tuple[int, int] = (0, 0) |
|
|
||
| def spawn_random_changers(self, num: int = 3) -> None: | ||
| """Spawns color changers randomly""" | ||
| shuffle(COLOR_CHANGER_CHOICES) |
There was a problem hiding this comment.
I like to think that for constants like this, they should be kept constant and not changed over the lifetime of the application. I would personally prefer to copy it first, and shuffle it then. I understand why you did it this way, though.
| self._game_resources = game_resources | ||
| self.enemy_list = game_resources.level.enemies.values() | ||
| self.player = game_resources.player | ||
| self.ENEMY_DEFAULT_PANEL = Panel(Text("No enemies have detected you yet.", style="bold green")) |
There was a problem hiding this comment.
As per my other suggestion: Using this as a class constant / attribute would have been cleaner, since you generally don't change these uppercased variables.
| """Define panel layout""" | ||
|
|
||
| @classmethod | ||
| def make_layout(self, start: bool) -> Layout: |
There was a problem hiding this comment.
For classmethods, convention is to use cls as the first argument instead of self:
| def make_layout(self, start: bool) -> Layout: | |
| def make_layout(cls, start: bool) -> Layout: |
| if first_entity.x + 1 == second_entity.x and first_entity.y == second_entity.y: | ||
| return True | ||
| if first_entity.x - 1 == second_entity.x and first_entity.y == second_entity.y: | ||
| return True | ||
| if first_entity.y + 1 == second_entity.y and first_entity.x == second_entity.x: | ||
| return True | ||
| if first_entity.y - 1 == second_entity.y and first_entity.x == second_entity.x: | ||
| return True | ||
| return False |
There was a problem hiding this comment.
I would have implemented this as
return any([
first_entity.x + 1 == second_entity.x and first_entity.y == second_entity.y,
first_entity.x - 1 == second_entity.x and first_entity.y == second_entity.y,
first_entity.y + 1 == second_entity.y and first_entity.x == second_entity.x,
first_entity.y - 1 == second_entity.y and first_entity.x == second_entity.x
])| ## Setup (tested on linux): | ||
| Set up virtual enviroment: <br> | ||
| `python3.9 -m venv venv` <br> | ||
| Install requirements: <br> | ||
| `pip install -r requirements.txt` <br> | ||
| Start virtual environment: <br> | ||
| `source venv/bin/activate` |
There was a problem hiding this comment.
Small observation of order here. These instructions have you installing libraries with pip before you activate the virtual environment. This will install (or attempt to install) the libraries at the system site-packages and not the venv
Same observation for the Setup of Windows.
No description provided.