I'm making a simple RPG which I'm currently working on a class structure for items.
I'm not sure if this is the best way of doing it and I would appreciate if anyone has any suggestions for improving it. Each of the classes will certainly have more members/functions in the future, but as of right now they are pretty empty. Right now I have the code split up into multiple files as show below.
1 2 3 4 5 6 7 8 9 10
// main.cc
#include <memory>
#include "weapon.hh"
#include "armor.hh"
int main() {
// Examples of item creation
auto sword = std::make_unique<Weapon>("Iron Sword");
auto chestplate = std::make_unique<Armor>("Iron Chestplate");
}
Using templates are great for this sort of thing- it allows you to focus more on the result. What kind of game are you thinking of making? Don't forget to actually make the game- it's easy to get caught up in making an engine! (I spent years of my life making engines instead of games)
What sort of template? It's an open world RPG; I wanted to make my own engine from scratch since I'm just doing this for fun. I plan on waiting for the Vulkan API to come out before I do any graphics.