Inventory System?
Moderator: InsideQC Admins
10 posts
• Page 1 of 1
Inventory System?
Can anyone take the time to explain an inventory system to me?
-

ceriux - Posts: 2223
- Joined: Sat Sep 06, 2008 3:30 pm
- Location: Indiana, USA
yesterday I took a look at THC's one.
It seems very interesting (collecting items, assigning an item to left/right hand, switching items, etc.).
You can grab the source code there and test it
It seems very interesting (collecting items, assigning an item to left/right hand, switching items, etc.).
You can grab the source code there and test it
- toneddu2000
- Posts: 1352
- Joined: Tue Feb 24, 2009 4:39 pm
- Location: Italy
I'm sorry I can't be more of help, but I'm not a coder. For what I understood, Chris Page, the author of the code, made a massive work on csqc for the inventory part, maybe to lighten the ssqc amount of work.
I don't if source code reveals it, but in youtube videos Chris posted, there's a fantastic part where objects hovered with mouse became "glowish" and, clicking on it, the item appears on the inventory. Superb.
I don't if source code reveals it, but in youtube videos Chris posted, there's a fantastic part where objects hovered with mouse became "glowish" and, clicking on it, the item appears on the inventory. Superb.
- toneddu2000
- Posts: 1352
- Joined: Tue Feb 24, 2009 4:39 pm
- Location: Italy
a lot of it ill have to do in csqc i'm already assuming. i just wonder if i will have to make items differently than how quake does and how might i store their values with in the inventory. hopefully some of his source has the answers and i can find them.
-

ceriux - Posts: 2223
- Joined: Sat Sep 06, 2008 3:30 pm
- Location: Indiana, USA
prydon gate has an inventory without csqc, but if you want it friendly and usable then you need something clientside.
even with a csqc gui, you need the info to be valid and known on the server or you open yourself to huge cheats.
the simplest way to get a robust inventory system is to put the swapping/obtaining/dropping code all on the server, and have the client code fairly stupid with it just drawing the slots/etc as the server tells it, and sending all commands to change various slots off to the server. its viable to leave the client code as purely a ui (note that in internet games, you might get some lag, but it shouldn't be unplayable, assuming any drag/drop is drawn fully clientside, with generated requests validated by the server).
even with a csqc gui, you need the info to be valid and known on the server or you open yourself to huge cheats.
the simplest way to get a robust inventory system is to put the swapping/obtaining/dropping code all on the server, and have the client code fairly stupid with it just drawing the slots/etc as the server tells it, and sending all commands to change various slots off to the server. its viable to leave the client code as purely a ui (note that in internet games, you might get some lag, but it shouldn't be unplayable, assuming any drag/drop is drawn fully clientside, with generated requests validated by the server).
- Spike
- Posts: 2892
- Joined: Fri Nov 05, 2004 3:12 am
- Location: UK
thanks spike. i was thinking that the inventory HAD to be server side. some frikfile i'm assuming is needed. The only thing i thought csqc would be used for is the UI. i'm hoping i can look at this source code and prydons and see how the information for the items is made and stored. i'v never touched anything like this. but i really want to try. if i can successfully get this working. i'll defiantly be continuing my project.
-

ceriux - Posts: 2223
- Joined: Sat Sep 06, 2008 3:30 pm
- Location: Indiana, USA
Prydon's inventory/item system is SICK!!!!!
It's the most ridiculously insanely QC I've found. (though twig deserves a very honorable mention)
It's the most ridiculously insanely QC I've found. (though twig deserves a very honorable mention)
-

Error - InsideQC Staff
- Posts: 865
- Joined: Fri Nov 05, 2004 5:15 am
- Location: VA, USA
lol, yeah, you really don't want to be using prydon gate's inventory as a base, it merely demonstrates that it can be done with no extensions at all, not that its an ideal way to do it.
both frikqcc and fteqcc support arrays. make an array of 30 fields, assosiate each field with a csqc stat, get the csqc to draw those stats. when the ssqc changes the stats, they'll get automatically replicated to the client and can just be drawn directly there. the exception is with any drag+drop functionality, but it might be enough to just track source slot and show whatever image is in that slot.
presumably if you have item attributes, you should encode that in each slot. decide on a number of bits for each attribute of a slot (like item id, ammo count, etc) and write some small functions to read/write the parts you need.
there are a lot of ways to write an inventory system. you could use csqc ents instead of stats, for instance, which would remove any limits associated with array elements or limited stat space. Which may also give benefits for lag free manipulation before the server responds.
if you use stats, you'll be limited to a specific number of slots (diablo-like). If you use ents, you can get much more items in there (fallout1/2-like), and more info per slot.
stats are simpler. :)
for reference, hexen2's inventory is split between two things. powerups and stuff take one stat slot per type, saying how much of each specific type you have. the puzzle pieces consist of a string stat per slot, naming the image to show
both frikqcc and fteqcc support arrays. make an array of 30 fields, assosiate each field with a csqc stat, get the csqc to draw those stats. when the ssqc changes the stats, they'll get automatically replicated to the client and can just be drawn directly there. the exception is with any drag+drop functionality, but it might be enough to just track source slot and show whatever image is in that slot.
presumably if you have item attributes, you should encode that in each slot. decide on a number of bits for each attribute of a slot (like item id, ammo count, etc) and write some small functions to read/write the parts you need.
there are a lot of ways to write an inventory system. you could use csqc ents instead of stats, for instance, which would remove any limits associated with array elements or limited stat space. Which may also give benefits for lag free manipulation before the server responds.
if you use stats, you'll be limited to a specific number of slots (diablo-like). If you use ents, you can get much more items in there (fallout1/2-like), and more info per slot.
stats are simpler. :)
for reference, hexen2's inventory is split between two things. powerups and stuff take one stat slot per type, saying how much of each specific type you have. the puzzle pieces consist of a string stat per slot, naming the image to show
- Spike
- Posts: 2892
- Joined: Fri Nov 05, 2004 3:12 am
- Location: UK
i'm thinking ill use 'stats' because i wanted to limit the amount of items each person could hold either way. and im pretty sure i dont want too much of the item code handled with csqc. so that as mentioned above it's harder to cheat.
-

ceriux - Posts: 2223
- Joined: Sat Sep 06, 2008 3:30 pm
- Location: Indiana, USA
10 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest