ChrisNeedham24 / microcosm

A little 4X game written using Pyxel.
GNU General Public License v3.0
11 stars 8 forks source link

MCR 84 - Refactor game.py #111

Closed jamesgiu closed 1 year ago

jamesgiu commented 1 year ago

Did a bit of work on this one today, let me know what you think of it so far, still a WIP!

Basically focused on slimming down the responsibility of game.py and allowing some of its more important aspects to be easily shared.

Not sure if GameState should live within GameController or be a sibling of it (currently it's a sibling, both created in game.py and passed around as needed). The API kinda looks like function(game_state, game_controller) which is hopefully easy to springboard new functionality from with less conflicts or overhead

Still left: ~Pydoc, polish, pylint~

ChrisNeedham24 commented 1 year ago

Are the __init__.py files actually necessary?

jamesgiu commented 1 year ago

Are the __init__.py files actually necessary?

I don't think so! The IDE made it for me, maybe it's some backwards-compatibility thing?

EDIT: Apparently there's a bit more to it: https://stackoverflow.com/questions/448271/what-is-init-py-for

jamesgiu commented 1 year ago

Have added pydoc + ensure lint passes.

ChrisNeedham24 commented 1 year ago

I believe there will need to be a change to the CI for the lint too, I don't think the existing command will cover sub-directories. A command I used for a different project was pylint $(git ls-files '*.py'), that should probably work here too.

ChrisNeedham24 commented 1 year ago

Also I'm probably going to block this on #108 and #109 just so those two don't have to deal with potential conflicts (will still review though).

ChrisNeedham24 commented 1 year ago

From a quick playthrough, I haven't noticed anything immediately game-breaking, which is a good sign! Taking a closer look at the diff now.

ChrisNeedham24 commented 1 year ago

Having looked through the previous game.py, everything in there is still around, with some nice improvements made. This should be good to go once the above threads are addressed.