Inventory Dilema
by Dreamer · in Torque Game Engine · 03/31/2005 (1:11 pm) · 4 replies
I am having a chicken and egg issue with inventory when in Multiplayer mode.
I want the player to have a nice looking inventory GUI, but I don't want to have to pester the server everytime a player decides to check their inventory.
My basic problem is this... In multiplayer mode at what level is the player aware of thier inventory.
Just looking at the script, I'm not seeing ANYTHING at all client specific in regards to inventory, if thats the case then all I should really have to do is add a function to the serverside Inventory script to tell a client about any updates to inventory, and then make sure that the client has a function to handle it.
Is this correct or does the client have some var already where he/she keeps a copy of thier inventory and if yes how does one access it?
I want the player to have a nice looking inventory GUI, but I don't want to have to pester the server everytime a player decides to check their inventory.
My basic problem is this... In multiplayer mode at what level is the player aware of thier inventory.
Just looking at the script, I'm not seeing ANYTHING at all client specific in regards to inventory, if thats the case then all I should really have to do is add a function to the serverside Inventory script to tell a client about any updates to inventory, and then make sure that the client has a function to handle it.
Is this correct or does the client have some var already where he/she keeps a copy of thier inventory and if yes how does one access it?
#2
I'm going to add something like CommandToClient(%client,'UpdateInventory',%item,%amount);
To the default inventory system on the server, probably in the Update Inventory function, then build a client side function to store and display inventory items. :)
04/01/2005 (6:26 pm)
Kewl I'm working on a client side inventory display, and since nothing exists already in my basecode that means I can't really hose up the current inventory system which I was afraid of.I'm going to add something like CommandToClient(%client,'UpdateInventory',%item,%amount);
To the default inventory system on the server, probably in the Update Inventory function, then build a client side function to store and display inventory items. :)
#3
I'm gonna make a resource out of it :)
04/02/2005 (4:04 pm)
Man I just made a sweet Inventory Backpack using the Array addon and the GUIObjectview.I'm gonna make a resource out of it :)
#4
04/05/2005 (1:38 pm)
Sweet dude cant wait, need more inventory resources :-)
Torque Owner Bryce "Cogburn" Weiner
The client is never aware of the current inventory, which is why you did not find it.
Allowing the client to manage inventory is NEVER recommended due to the propensity for abuse. The most I would recommend is storing an image of the inventory on the client, but passing all updates through the server for verification.
EDIT: Understand, this accomplishes nothing in the long term. The server should ALWAYS been the final word for all inventory functions.