np-eazy / Pentaquad

3 stars 1 forks source link

Widespread Refactor Planning #90

Open np-eazy opened 1 year ago

np-eazy commented 1 year ago

More and more undefined errors are leaking in here or there because there are more areas I ended up resorting to referencing right after assigning and exposing the async nature of React. After beta release this must be looked into before any infrastructure scaling past the wrapper website. This issue will be a thread of all less-than-ideal fixes I'll be making before planning a more widespread refactor after beta release.

np-eazy commented 1 year ago

GameState -> CoreState -> SettingsController -> PieceProvider is a dependency chain that is simultaneously initialized, but PieceProvider will reference SettingsController upon initialization to fill up its queue of pieces.

Current solution: don't use Level 1 to initialize the PieceProvider, initialize one ghost block and four normal blocks. This is less than ideal because it has an indirect impact on the game design, deterministically initializing power-ups rather than randomly generating them. This could actually be a good thing though since it compensates for the random location of the first target.

np-eazy commented 1 year ago

To properly implement gamemodes, a lot of new coreState arguments were passed into functions here and there. However, so many arguments come from coreState dependencies and would be redundant with coreState itself, this shouldn't hurt the actual integrity of the code much but would be a nice refactor