LaurierCS / PHI-TextBasedGameEngine

A text based game engine for creating games
4 stars 1 forks source link

reorganized util module/yaml loading framework #9

Closed jbheard closed 4 years ago

jbheard commented 4 years ago

I think that having a single list of data objects would be a bit limiting, so I came up with a framework that shouldn't be too difficult to extend, and will be easy to break things into smaller pieces.

@Knifesurge I would like your input on this change, since you were the one to originally set up the Util class.

Knifesurge commented 4 years ago

I would include the layout for the EnemyTemplate objects before fully committing this, or at least write up a description on what your idea for the flow of the object creation will be in Enemy.py so other people can work on it.

I would suggest documentation but the method signatures seem to do the job (I honestly really like the extended function format stuff). My only suggestion on docs would be to document the get_yaml_filename method, as it can raise a GameError (we could even autogenerate docs like java has javadocs with a python library. I just forget the name right now!).

All in all, your work definitely makes the Util module a bit neater (I've never worked with YAML so you definitely seem to be the person to do so).

I like all of the ideas presented here :)

jbheard commented 4 years ago

I like the idea of adding docs so we know what to expect the enemies.yaml / EnemyTemplate stuff to look like, I will something to the /docs folder.

I don't usually like docstrings in code since (for me) they tend to make the code harder to read, and often just end up out of date (since changes to the code aren't always reflected in the docstring). But I can see the value of generating documentation that way. I'll add an issue for it and address it in a future PR.