Skip to content

Improvements #12

@toptea

Description

@toptea

In hindsight, here is a list of things I could have done differently but haven't, due to time constraints:

Level

  • more comments/documentation in level.py. Currently the level generation code is a bit cryptic.
  • use structured numpy arrays instead of keeping them seperate. That way, I can define all the tile data on one line.
  • use a helper function that check adjacent cells in numpy arrays.
  • fix eclipse shaped room code. Sometimes it goes out of bound and crash the game.

ECS

  • find a better way to organise Esper's long self.world.get_components statement. Not sure if using generator functions to break up nested loop will help readability. Might be better if I ignore python's <80 character rule.
  • when changing level, I need to keep the player and inventory items entity in esper's world object. The current code for this in SceneManager is messy.
  • dublicate codes in MovePlayer and MoveEnemy processors.
  • instead of having an inventory component on the player (a list of item entity ids), have a "location" component on the items instead. Since I removing the item's position (x, y) component to stop it from rendering, the code will be easier if I replace it with "location" component instead of dealing with inventory list on another entity. (Note: It's harder to deleting renderable component because it will loss item's character and colour information)

UI

  • should have follow the tutorial and use Message/MessageLog class. Using collections.deque of tuples (message, colour) makes it a bit vague.
  • refactor RenderPanel and RenderMenu to use tcod api.

Input

  • replace tcod's input handler to something simplier. Hashable Key objects in dictionary is hacky.

Save/Load

  • replace pickle to something better.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions