Jump to content
  • Advertisement
Sign in to follow this  
zneic

How to create items in terms of development

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

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!

Share this post


Link to post
Share on other sites
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).

Share this post


Link to post
Share on other sites
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;
}

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!