3
Masta
7y

A question to game devs : which design/architecture patterns do you use ?

Everytime I try to take a look at game development, I feel like there is a lack of guidelines, mostly about architecture.

It's something strange to me as a web dev, as we use much of these patterns on a daily basis. Of course I think about the near omnipresence of MVC and its variants, but not just that. Most of frameworks we do use are essentially focused on architecture, and we litterally have access to unlimited tutorials and resources about how to structure code depending on projects types ans needs.

Let's say I want to code a 2D RPG. This has been done millions of time across the world now. So I assume there should be guidelines and patterns about how to structure your code basis and how to achieve practical use-cases (like the best way to manage hero experience for example, or how to code a turn-based battle system). However I feel these are much harder to find and identify than the equivalent guidelines in the web dev world.

And the old-school RPG case is just an example. I feel the same about puzzle games or 3D games... Sure there are some frameworks and tools but they seems to focus more on physics engine and graphic features than code architecture. There are many tutorials too, but they are actually reinforcing my feeling : like if every game developer (at least every game company) has his on guidelines and methods and doesn't share much.

So... Am I wrong ? Hope to.

What are the tools and patterns you can reuse on many projects ? Where can I find proper game architectures guidelines that reached consensus ?

Comments
  • 2
    In my experience, you can use a lot of patterns regular software would use (some examples, good read http://gameprogrammingpatterns.com/...), at least in terms of code.

    It's more of a matter of figuring out if an existing pattern is applicable to the specific game. For example, you might not be able to use automated or unit tests very easily because, more often than not, gameplay requires random elements or unpredictable inputs.

    I think code architecture for typical game mechanics like inventory management or experience handling are things that are not patternized in an universally recognizable way, but it's not so different conceptually to, say, an e-commerce shopping cart or a loyalty program's point system, respectively.
  • 1
    @Shodan @console
    Thanks for these advices and sorry for the delay since your messages, I was busy working on other things.

    I understand that "conceptually" games systems are not so different that any other application, and to be honnest I feel like I'm capable of coding these systems my own way. But I was essentially looking for something like bests practises to avoid starting from scratch and making common errors. For now I still feel like there is a lack of that sort of guidelines, but I will definitely look at the resources you both gave me and see if I can make progress from there ! Thanks guys :)
  • 1
    @Masta Well, any type of guidelines I can suggest would be high level concepts not necessarily related to code, but here's one rationale that might help:

    A game is only a game if it has a player; otherwise, it is a movie. The player’s interactions with the simulation and its objects/tokens are a core part of making a game a game.

    This tells us that games tend to require thinking in terms of interactions - discrete events that can happen at undetermined points in time, especially if the player is human (because you can't control him/her) and that change the state of the simulation.

    Which leads us to the possibly obvious hypothesis that it's worthwhile to know how to use any kind of finite state machine or other automata-based programming for modeling the game state and an asynchronous event-driven paradigm for handling the transitions between states.

    Is this the kind of guidelines you seek? Sorry I can't be more specific, but this is as much game design as software architecture.
  • 0
    @Shodan OMG yeah that's exactly the kind of advice and ideas I was looking for ! This does help for sure, it's a good start for me to do a better job at thinking about how a game should "work". Thanks :)

    Now I just wish I have more time to really experiment this. Unfortunately for the moment it's essentially curiosity and thoughts ^^
  • 1
    @Masta If you happen to use Discord, I find it interesting hanging out in GameDevLeague's chat: https://gamedevleague.com//...

    Plenty of realtime discussion about things simple and complex, conceptual and concrete, from newbie hobbyists and professional veterans. It's a great resource for me.
  • 0
    @Shodan That seems to be a very active community ! Now I wish I have even more time ^^
Add Comment