0
\$\begingroup\$

I have been working on a game for a while and have encountered a problem stated below. I have been reading Sandi Metz's book on OOP (the Ruby one) and it made me wonder whether there is a way to visually represent all the classes of a program.

The problem: the code of the game is slowly but surely becoming harder to maintain, or should I say, to... fathom. To comprehend.

I need to know if there is a way to visually model the logical structure of the game's classes, and maybe some standalone pieces of code, and how classes interact with each other, OR a way to represent game entities from a game design point of view because it will be immeasurably easier to work on the game from both a technical and an artistic point of view if I had a visual model of the game's structure.

I do not need UML diagrams or a simple flowchart because they have too much info: knowing the fields and methods of my classes or the logical algorithm of my code is not what I need.

I have thought about using ARIS or BPMN for it, but I am not entirely sure whether the strict rules of these BPM notations would fit well with the dynamic and ever-changing nature of a game.

I apologize if this stack exchange is not the right place for this question. If no complete solution exists, then I am willing to create my own, perhaps with Qt.

Update: I have read the aforementioned book further and found out about sequence diagrams. They would fit very well, but I'm still interested whether a tool was created specifically for making games.

\$\endgroup\$
7
  • \$\begingroup\$ Interesting question. I don't know the book so an image would help. And why not create this within Godot. Maybe docs.godotengine.org/en/3.2/tutorials/misc/… is a good startingpoint. \$\endgroup\$ Feb 10, 2020 at 8:30
  • \$\begingroup\$ @ClemensTolboom You can find the book by googling, it has red cogs on the cover. The author is Sandi Metz. "Practical Object Oriented Design". \$\endgroup\$
    – selamba
    Feb 11, 2020 at 10:39
  • 1
    \$\begingroup\$ It is not really clear from your question what exactly your problem is. Can you give us a specific example of a feature of your game you would like to document and why the methods you considered (UML, ARIS, BPMN...) are not appropriate for this feature? \$\endgroup\$
    – Philipp
    Feb 11, 2020 at 15:50
  • 1
    \$\begingroup\$ By the way: I create a lot of diagrams in my day job as an application developer and in my hobby as a game developer which could be described as inspired by UML but are not really standard-compliant UML diagrams. I consider UML a recommendation for how you could visualize processes and relations, but not a strict law you need to follow. If you feel that certain features don't add to the expressiveness of your visualization (like purely technical fields in a class diagram), nobody is going to arrest you if you leave them out. \$\endgroup\$
    – Philipp
    Feb 11, 2020 at 15:54
  • 2
    \$\begingroup\$ UML diagrams (...) have too much info. Not true. You can use a UML class diagram with details suppressed. See Structural models. See also Is it possible to omit things in the class diagram. Yes, that is valid, standard, UML. You can of course define custom stereotypes and customize the diagram while keeping it standard. And who says you need to keep it standard? \$\endgroup\$
    – Theraot
    Feb 11, 2020 at 15:59

2 Answers 2

2
\$\begingroup\$

Honestly?

Just draw it.

Start at a high level view of just your game loop - draw what happens and under what circumstances.

Then, slowly go more into detail with different components of your game loop. Each game is bespoke, and no one rule fits all, so it's going to be best for you to decide in your own diagrams what you include and what you don't.

\$\endgroup\$
0
\$\begingroup\$

There have been some good responses in here about dealing with big projects, and I will only give you where my large projects are and how I handle it. Using diagrams is but one part of your toolkit for maintaining a growing code base.

For me, I don't draw that much of the layout as my project grows, but I have as a starting point. And I will say, that this can be definitely something that can be beneficial depending on the type of person you are.

I found that the best way to move forward on projects was to always implement using patterns, standard approaches and consistency that I KNOW. These might not be standard thinking for other people, but if you always do things a certain way, you know that you always structure your heirarchies in a certain way then you at least be able to revisit code knowing you have an idea of how it works or how to use it. And have some level of trust in what changes you are making, this is important and sometimes overlooked. If you know you have done something in a common way, you can trust have a level of trust.

Where something in my code is complex, or requires some detail not apparent to a dev or if I revisit sometime later, I make a comment to highlight why. In games, you're always going to have bespoke components to fulfill something specific, ensuring you capture this will assist in maintaining and growing code.

\$\endgroup\$
2
  • \$\begingroup\$ I have thought about what you said, and your answer provided the reassurance I needed as a newbie. Thanks. \$\endgroup\$
    – selamba
    Mar 15, 2020 at 13:23
  • \$\begingroup\$ Also, have confidence in yourself when developing. And don't be afraid also to say, that's not working. I will change. \$\endgroup\$
    – ErnieDingo
    Mar 16, 2020 at 2:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .