# Few Game Related Questions

This topic is 3002 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

First Question Hello all. I am working on a RPG using Direct3D Sprite, win32, I am now trying to attempt to understand how a macro system in a game would work, now I know what your thinking what the hell is this noob talking about hahaha. Well we've all seen the game World of War Craft they use what I'd like to know how to do basicly you pull a spell/skill/gear/item out of whereever an place it in your GUI macro button. basicly I'd like to know how this is done. I have a idea on how this could be done which I don't think it would work properly but basicly making the macro gui part just part of the direct3D surface an making it so the macros are internal buttons using direct3D but I think there might be a little better way to go about this. Second Question the item/inventory system some people say use vectors for the items or whatever what seems to be the most popular way? I think something like this would work well for the item system
class Item
{
char Item_Name[20];
Item_Type;
int Item_Quality;//rare etc 0 = not rare ie junk, 1 = normal drop, 2 = somewhat rare, 3 = super rare droped only certain times of day or only by bosses.
vector<property>item_property //attack bonus, defense, speed, one hand, two hand, enchantment, special bonus etc etc
};


basicly thats my idea on how a item system could work but idk I'd like input on these things thank you in advanced.

##### Share on other sites
Store the items in a std::vector, don't obscure their properties by abusing a std::vector for that. Replace the char[20] by a std::string, to prevent buffer overflows - generally, to make working with text strings easier and safer. Replace the int in 'int Item_Quality' with an enum, as to avoid 'magic numbers' - values whose meaning is not directly clear.

As for the macro system, it depends a lot on the architecture of your game, but if you've set things up properly, a shortcut like that shouldn't be difficult to implement. Either way, separate the GUI from the actual game data and logic. The GUI is an interface, a way of viewing and controlling the game data. Mixing these will make many things far more difficult to manage.

##### Share on other sites
isn't std:: outdated and only used in C?

##### Share on other sites
Quote:
 isn't std:: outdated and only used in C?
std:: doesn't exist in C - you must be thinking of something else.

std:: is the namespace in which the C++ standard library resides. It's not outdated; in fact, as far as C++ development goes at least, it's probably more relevant now than ever.