iivchenko / nano-tic-tac-toe

Yet another project to learn game development and functional paradigm.
MIT License
0 stars 0 forks source link

Refine Elm architecture #18

Open iivchenko opened 3 years ago

iivchenko commented 3 years ago

Looks like unintentionally followed Eml arch (not 100% bug still). And I like my Elm modification even more =)

Remove draw method

Remove draw method from the Game at all and convert draw calls to commands which shold be executed in MonoGame.Game.Draw so MonoGame still will decide if draw commands should appear or not in the Game.Draw method

Rename Update method to process

For game dev it have more sense to have update of process method but if we going to skip draw method than it woudl be wise to rename update to process as update initially corresponds to the logic itself.

Group related commands and events

Commands like

Can be grouped into Load Command Category

Into Sound Command Category And same for events.

Refine input

Move out input related stuff (mouse input; keyboard input; etc.) from the Game module to separate appropriate modules. Make Game configurable on what input to track (e.g. on mobile devices monitoring mouse might be unnecessary)

Split Flame abstraction from Flame.MonoGame

Well it seems I dream about cross platform and tech agnostic F# game framework so I will try to keep Flame as much as possible abstract. It also might be a good idea to create simple Flame implementation for other lib like SDL or SFML

Example: I can have Texture in Flame that a record with name or id or file path, width, height and other meta stuff but initial texture with pixels can be stored in the main MonoGame class which will have a map of Flame textures to real data Textures.

Move Commands and Events out of the Game as Game will be Lib specific and Commands/Events are Flame specific

In Game.run replace init function with initial state or NOT?? or may be it is better to leave init function by provide it with input parameters that Game can pass to the function.

:warning: It might be a separate issue

Make Random functional

Random needs a seed. So lets MonoGame by default provide the code with a random seed or we can specify this seed during game startup.

Refactor GameScene

Well remove draw method and remove init method from all the game scenes. Make init state explicit in process functions of the scenes

iivchenko commented 3 years ago

process is a key word in F# - stay with update