How to create items in terms of development

Started by
1 comment, last by dpadam450 12 years, 5 months ago
Hy, I am new in game development and I have a little thinking problem. Lets say that I am developing a 3d game in witch is a 3d player. The player can wear 3d items. My problem is how do i create these 3d items.
Each tipe of item showld be a class and when i need(ex: gloves) i create a instance of that class or a class showld initialize all items and keeps them in a array or somethink like that? The ideea of this question is: gloves = class or gloves = item in a array of all items. Thank you for your time!
Advertisement
There are many ways to skin a cat, as they say.

First, I would recommend starting off with a small 2D game rather than a 3D game. It sounds as though you do not have a grasp of basic programming concepts so you will be overcomplicating things by trying to learn the language itself and the graphical APIs at the same time.

To be honest, I would truly recommend starting with something simple like SDL or Allegro to make a 2D game so you can concentrate on the basics.

If you are using an object oriented language, you can organize your items into classes.

You would want to take all your items and determine what they share in common and what is unique.

If it is common, you would place it in a base class. If it is unique, you would place it in a class that inherits from the base class. Don't worry, if you need to do something special you can override the base class information within the inherited class.

For example, the position and size of the item would be a common attribute that all items could reasonably be expected to have. So, you would put those in a base class (Say, Item).
Well you have to ask yourself what do the gloves do? How are they different? Most items in rpgs you equip them, and they increase a statistic.

class WearableItem
{
Vec3 position;
int damageBonus;
...etc
};

So you only should have a glove class if it is truly unique compared to say a sword.

class Player
{
vector<WearableItems> invetory;
vector<WearableItems> equippedInventory;
}

NBA2K, Madden, Maneater, Killing Floor, Sims http://www.pawlowskipinball.com/pinballeternal

This topic is closed to new replies.

Advertisement