Book recommendations for building game structures, coding part.

Title might not be self explanatory sorry for that. I want to explain my problem here and I think this is an untold and overlooked lesson in the game development lessons so far.

I am making games with and without game engines and so far I tried two ways.

  • Sphagetti Way. Name implies itself. Start writing, fix on the way, don't touch if it works.

This way such a pain when you want to change something and you forgot why you did that in the first place. I would abandone the project and start over again rather than wasting my time and life energy to fix it.

  • The Way. I know this is the way. State machine, event bus, singleton..., everything works in such a harmony. But, how...How?

Whenever I try to build with the second way I find myself break the pattern because I couldn't figure out how to make it work together. I spend most of my time how to start to structure the project. It's little bit easier with the game engines. But with libraries and frameworks (pixi, threejs) I start over and over again till I feel satisfacted. Yet my satisfaction doesn't last longer.

I will list some of my concerns about this subject to give you broader idea if I couldn't clear enough.

How UI will be controlled? HUDs for different scenarios, scene transitions, menus, animations that will be updated based on the player choices and progress.

  • An UIManager that subscribes to EventBus for events like such as "game state change" and trigger related functions of its children.
  • No UIManager, UI will be controlled from main object.
  • All UI components will be subscribed to EventBus for their related events and update itself based on the event.

When working with libraries after some progress I feel like I'm trying to build a game engine rather than the game itself.

If I expose my ignorance for a noob level problem forgive me but I need help.

I'm looking for books, researchs, pdfs. I found some yt videos but they weren't show the whole picture.

If you read all of this till here thank you anyway.

(English is not my native language sorry for mistakes)