I’m an internet and cell app programmer. In comparison with internet and cell app supply code, I have not seen a lot sport programming supply code.
In internet purposes, all components are basically static (?), and solely the logic for pressed buttons is executed.
If a button press triggers a community request, a loading indicator (spinner) is displayed to stop person interplay, and the community request is awaited by way of a callback.
On this means, well-known patterns like callback hell and async/await are used to attend for different processes, show loading indicators to dam person enter, and be sure that conflicting operations don’t run concurrently.
Nonetheless, in sport improvement, I not often see examples of callback hell or async/await utilization.
Video games function on a sport loop the place the replace methodology of all objects is known as each body.
To attain related conduct to internet apps, one would wish to cease calling replace and disable person enter.
Associated:
What’s the distinction between set_process and flag administration?
For instance, within the following Japanese article, the code makes use of an enum to manage state:
https://2dgames.jp/godot4-memory/
Supply code from the article:
https://github.com/syun77/gd_memory
With this strategy, one would find yourself with an enormous enum and a single sport object managing it (Sport Grasp? / Sport Controller?), resulting in what I name “fats enum hell.”
This contradicts the rules of “Divide and Conquer” and “Small is Stunning” (Unix philosophy).
What patterns are generally utilized in sport improvement to deal with such conditions?
In video games, ready for community communication is just not as widespread as in internet apps. As a substitute, widespread issues contain ready for victory animations(Results), ready for a card to flip, and so forth.