What class structure is best?

What class structure is best to create when making an RPG?

What do you mean by what class structure is best when making an RPG? Do you mean the classes and sub classes?

  • Player Base
    • Character
    • NPC

Could you provide an example?

This includes subclasses as well as others.

I want to make everything flexible.

What you are talking about is dependencies and dependency cycles and if you are folllowing the RPG course its one of the first thing they talk about. I would read more about this if you are confused.

Its one of them things you think about on a project by project bases like my example shows

Player Base
    Character
    NPC

Both Characters will want movement so the character and NPC can inherit that from player base
But i dont want to control the enemy wih my input(maybe you do) So that will go into the Character class.

I little think will help, but there is going to be times were you create a class and then later you release you have a dependcy cycle or something else could inherit from it this is were you can refactor your code to match, dont think you will be able to create all the classes perfectly you will have to refactor at some point.

Hope this helps.

I looked for related information.
I saw that I could create code flexibly with SOLID and design patterns.

You said you can’t make every class perfect.
Is it real?

You can make code flexible with solid design patterns, Im not saying you can’t what you are trying to achieve is come up with class structure before you even implent the systems. This makes no sense in the long run. Sure I could decided ok I need NPC and a player and sturcture it like before they inherit from the base class.

My question is to you how are you going to come up with the base classes for things you have not even implemented in your game this is why refactoring comes into play. You will move stuff about in your code during refactoring. I understand you want clean solid code and it can be achieved but guessing what “structure” is best for your game is not going to happen.

The reason the course already has classes structured as they have made it before the class and had done iterations and refactoring so they know what classes they need and what they inherit from.

In coding, perfection is more of a journey than a destination. You’re constantly having to balance performance, and often things like changes Unity has made, etc.
You just keep tweaking and it gets better and better, but the perfect does not exist. You can see that in practice by all the Important Update messages you get in your Browser, Phone, Operating System, etc.

Yes, this was actually the 2nd public version of the course. and technically the 4th version overall because of our process.
We always build a prototype of the course before recording a single word. We find what works, and what doesn’t, and consider along the way what things the student would have already learned for each section. Then, once the prototype is built, we record, building the game again from the ground up, having the structure basically figured out.

Even then, though, we sometimes come across things we have to change in the middle, because a fundamental truth of war that can be applied to life and certainly to course rollouts is that No plan survives first contact with the enemy. There’s always something we didn’t think of, and there always will be, because that’s how life is. You really want to know if your game is water tight? Ask your 5 year old nephew to play it. Guarantee you he’ll do something you never ever thought of and break the game.

I’ll be really honest, like LaniganDev pointed out, this question may be too broad/vaugue for a great answer.
We’ll be showing you our vision of a good namespace / class structure for a massive project like the RPG project which is one of the most comprehensive projects (spanning 4 courses) in our catalogue. That same structure may be overkill for other games or projects, depending on the size and scope of the project.

Privacy & Terms