I'm making a small Turn Based Combat game. I have the spells Fireball and FreezeEnemy, You start with 500 Mana and 100 Health. What spells should I add to the game, specify like so:
Spell Name:
What it does:
Power Levels:
Damage each Power Level:
Other:
Anyone can contribute if interested, PM me or email me at rakafattah@yahoo.com GitHub Repo coming soon!
Yeah you definitely want to be using classes if you're making a game. For a game like this, you can make some base class and inherit from them and it will make things so much more simple!
I also strongly suggest to avoid using namespace std; and instead to use using <only what you are using> e.g. using std::cout; using std::cin; , otherwise, you might find some naming conflicts appearing in your game. It's also just plain bad to use namespace std;
I see, but that is more of a composition versus inheritance statement rather than about design patterns. Some design patterns implemented in C++ can use inheritance and others use composition. I was pointing out that saying "design patterns are more suited than inheritance" is not the right thing to state.
I think what giblet meant by design patterns is using a Component Based Entity System which is a "design pattern" commonly used in game development or other design patterns like it.
Basically what he is saying is that components based systems and other designs like it are much better suited for game entities then inheritance trees because of the massive inheritance trees that result over time. Another problem with inheritance with entities is that your trees are usually very top heavy since over the course of development you will continue to push features up the tree just so a few sub classes can make use of them features, while most don't need it.
Component based designs tend to be a bit harder to implement if you are not familiar with them but in the long run I have found they produce much more modular code and greatly ease the development process in the long run.