Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This is a pretty advanced question for a beginner.</p> <p>I'd like to echo In Silico's response that you should learn C++ language basics before you tackle this subject.</p> <p>To give you a place to start, you should know about container classes (Linked Lists, Vectors, HashTables/Dictionaries, Queues etc) and how they work. Since the Standard Template Library (STL) is pretty standardized, it would be a good place <b>for a beginner</b> to start.</p> <p>You should also know about inheritance and how to build a hierarchy of classes.</p> <p>For example, you asked about inventory in a role playing game: I'd start by defining an InventoryItem class that defines or sets up an interface for all of the code necessary for an item to participate in your inventory system. Something like:</p> <pre> class InventoryItem { private: std::string description; // A description of the item bool inInventory; // True if in the players inventory, false if on the ground etc... int weight; // How much the item weighs int size; // How much space the item takes in inventory // etc... }; </pre> <p>In the InventoryItem class you'd also define the member functions and data needed for InventoryItem to be placed in your container class of choice.</p> <p>The same sort of thing holds true for triggered items, things on the ground etc. They're typically kept in a container class of some sort.</p> <p>The STL containers will take care of the variable sizes of the containers mentioned in the last part of your question(s).</p> <p>vector is a good place to start for a general list of items. HashTables/Dictionaries are good for looking things up with a key.</p> <p>I hope this is enough to get you started. Good luck.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload