Correct Way To Implement My Inventory
by Todd Johnson · in Technical Issues · 11/22/2004 (1:51 pm) · 4 replies
Ok, I'll try to make this quick here.
My character has 6 inventory bays. In these bays can contain any of my in game objects. Each of these objects can do various things. Seperate bays can contain similar objects but they may have different properities (etc bay 1 could have a pistol with 6 rounds while bay 2 has a pistol with 3). My character activates a bay to use the object.... sounds easy enough.
Now what I want to do is make a moduleInventory class. I would do it like this to start...
My character has 6 inventory bays. In these bays can contain any of my in game objects. Each of these objects can do various things. Seperate bays can contain similar objects but they may have different properities (etc bay 1 could have a pistol with 6 rounds while bay 2 has a pistol with 3). My character activates a bay to use the object.... sounds easy enough.
Now what I want to do is make a moduleInventory class. I would do it like this to start...
function moduleInventory::create(%objectName)
{
%this = new ScriptObject(%objectName)
{
class = moduleInventory;
};
%this.Ammo = 0;
%this.Activated = false;
return %this;
}
function moduleInventory::delete(%this)
{
parent::delete(%this)
}...ammo and activated are just some experimental properties. Problem is where do I make this class? Would this go into moduleInventory.cs and I'll add it to the game.cs loading? Shouldn't this be client side? I want to create six of these, would I create these objects when I create my player in game.cs? Wouldn't that get complicated client side?
#2
For the most part, follow the examples given and you should be good to go, but your instincts were correct--the objects get created server side, and then ghosted to the clients as necessary. It's very complicated once you start digging into it, but you can use it in a "black box" manner without going into the details for the most part until you want to do unusual things.
11/22/2004 (2:58 pm)
@Todd: Your right, and the concept is net ghosting. When you create an object on the server (as you always should, you should just about never create objects client side without solid thought behind it), part of the properties you set (or are already set due to inheritence and/or underlying code) is how and when to "ghost" these objects to the players.For the most part, follow the examples given and you should be good to go, but your instincts were correct--the objects get created server side, and then ghosted to the clients as necessary. It's very complicated once you start digging into it, but you can use it in a "black box" manner without going into the details for the most part until you want to do unusual things.
#3
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=1962
11/22/2004 (9:19 pm)
I don't know if this helps, but just in case:www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=1962
#4
11/25/2004 (3:00 pm)
Unfortuntaly that code was not for multiplayer. The more I talk to people about it the more they say that it's a C++ thing. Are there any resources on altered inventory structures through C++? (Beffy's is not an alteration to the structure)
Torque Owner Todd Johnson