How do I massive inventory?

0 favourites
  • 7 posts
From the Asset Store
Template for maintaining an inventory with crafting possibilities. Completely documented in text and video.
  • Hey there! ^_^

    So my big question here is; How could Final Fantasy 7, Castlevania, Breath of Fire etc, have endless inventory spaces?

    U can store up so ridicously many items, how does that not lag the game?

    Alsow hen u open inventory in these RPG games, is it counted as a new Layout?

    How can these old games on these old systems handle it?

  • Hey there! ^_^

    So my big question here is; How could Final Fantasy 7, Castlevania, Breath of Fire etc, have endless inventory spaces?

    U can store up so ridicously many items, how does that not lag the game?

    Alsow hen u open inventory in these RPG games, is it counted as a new Layout?

    How can these old games on these old systems handle it?

    There are a couple of ways to do inventory:

    You can use an array which is a little complicated to set up and you need to study the array tutorials but works well and can store massive amounts of items.

    OR you can use a separate layer or layout and use sprite place holders for items stored.

    I have used both and prefer the sprite inventory for most games because I can see the items as I create them and place them as needed on the inventory screen but both work well.

    You also want to study families to keep items organized.

    As for lag, once the game is loaded there should not be a lag with inventory but you probably remember some of those old games had a long load time. That was a result of large inventories and music . Today's systems operate much faster so the lag time is negligible and there are a few tricks to reduce lag time on loading using streaming music and loading images only as used.

  • > Hey there! ^_^

    > So my big question here is; How could Final Fantasy 7, Castlevania, Breath of Fire etc, have endless inventory spaces?

    > U can store up so ridicously many items, how does that not lag the game?

    > Alsow hen u open inventory in these RPG games, is it counted as a new Layout?

    >

    > How can these old games on these old systems handle it?

    >

    There are a couple of ways to do inventory:

    You can use an array which is a little complicated to set up and you need to study the array tutorials but works well and can store massive amounts of items.

    OR you can use a separate layer or layout and use sprite place holders for items stored.

    I have used both and prefer the sprite inventory for most games because I can see the items as I create them and place them as needed on the inventory screen but both work well.

    You also want to study families to keep items organized.

    As for lag, once the game is loaded there should not be a lag with inventory but you probably remember some of those old games had a long load time. That was a result of large inventories and music . Today's systems operate much faster so the lag time is negligible and there are a few tricks to reduce lag time on loading using streaming music and loading images only as used.

    Hey! Thanks for the answer, but if ''pin to object'' is used for items, when pick up to pin them to the inventory space, wont the game lag if there are 100 items running around in the background, all pinned to spaces and slots?

  • >

    > > Hey there! ^_^

    > > So my big question here is; How could Final Fantasy 7, Castlevania, Breath of Fire etc, have endless inventory spaces?

    > > U can store up so ridicously many items, how does that not lag the game?

    > > Alsow hen u open inventory in these RPG games, is it counted as a new Layout?

    > >

    > > How can these old games on these old systems handle it?

    > >

    >

    > There are a couple of ways to do inventory:

    >

    > You can use an array which is a little complicated to set up and you need to study the array tutorials but works well and can store massive amounts of items.

    >

    > OR you can use a separate layer or layout and use sprite place holders for items stored.

    >

    > I have used both and prefer the sprite inventory for most games because I can see the items as I create them and place them as needed on the inventory screen but both work well.

    >

    > You also want to study families to keep items organized.

    >

    > As for lag, once the game is loaded there should not be a lag with inventory but you probably remember some of those old games had a long load time. That was a result of large inventories and music . Today's systems operate much faster so the lag time is negligible and there are a few tricks to reduce lag time on loading using streaming music and loading images only as used.

    >

    Hey! Thanks for the answer, but if ''pin to object'' is used for items, when pick up to pin them to the inventory space, wont the game lag if there are 100 items running around in the background, all pinned to spaces and slots?

    You can use pin but it isn't necessary and you create an icon sprite in your inventory and only create the inventory item as used so it does not exist at all until created in the game and causes no lag.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Depends on the target device and what you do with the objects and how often. I found out the hard way why using sprites as tiles for a game with Z-levels is bad, especially when you have a couple thousand of them. But I digress. And you want infinite inventories anyway.

    But generally I would recommend against having such a thing as an item object for each item when not necessary and that is the approach I took when doing inventory systems in some of my attempts at such.

    What I do instead is the following. Store items only in an array, they exist only as a columns in arrays. An array with many rows mind you as it contains general information such as item type, sub-type, weight, size, sprite, name and description. It also has a bunch of rows dedicated to "special" data. In those rows I store coma separated value strings that are different for each item type. For example weapons have different strings, armor has differently formatted strings etc.

    So how do I fire a gun a with that or equip body armor? There are two approaches I am considering now but I will most likely use the second one (I used the first in the past):

    1) Have a weapon object created and assigned to the player, just one. It is in reality a container, a shapeshifter that takes the properties of whatever weapon is currently equipped by the assigned parent player or NPC object. Whenever the weapon is changed, a function will reset all its variables and load new values. The new values will be taken from the "special" data strings. The logic of the function will retrieve the special string and next, using the tokenat expression, load the weapon properties into the weapon object. Next I use the weapon object in the events as I please.

    2) Do not have a separate object altogether, store all equipped weapon data as variables of the NPC object. Otherwise it will work the same as approach 1.

    Now you asked how Final Fantasy etc. manage infinite items. They don't use object obviously for each item. When you look at an inventory you are looking at a graphical representation of an array. What they do, what I do and indeed what even such advanced business software such as SAP do (at least for multiple single value selection fields) is that they have a set number of list position objects or slot objects. Each slot is assigned an ordered position from 0 to X.

    Next what they do is store the index of the first object in the table/inventory they are showing, let's call it "i" for short. When you scroll the list a function is called updating the index of the currently displayed first object. Next the list is refreshed and the code uses a loop to put the data of item "i" into the first slot object, "i"+1 into the second slot object etc. i=4 would mean that object with index 4 (so the 5th row) of the inventory array would be shown first (top of the list/first slot).

    So you only need slot objects to show the item, as many as fit in the inventory window you designed. They will never change position, they will only change their appearance.

    Bah, if you are using only a text based inventory without any item icons or anything like earlier FF games did, you could do it with a single text object. You would just need to know how many rows you can fit in the text and how much text in a row (I recommend using monospace fonts for that, which is also what systems displaying lots of lists and tables such as SAP do).

    It would look like:

    set text as array.at(i,0) [0 would be the y index of the item name in this example]

    loop for 1 to number of rows

    append text [newline&array.at(i+loopindex(),0)]

    However making things such as highlighting the selected item, selecting it with clicking etc. would require additional objects.

    tl;dr version store the data that is needed as an object now as an object, keep everything that you need later in arrays.

  • But those classic RPG's used layout yes?

  • But those classic RPG's used layout yes?

    I assume you meant to ask if they had a separate layout/screen/scene for the inventory or if the inventory window.

    Now that is a good question, but overall in the case of here and now with construct 2 I think how they handled it is not really relevant. We are not bound by the same limitations of the hardware and tools but have different limitations due to the nature of construct 2. I think that at least for the PS1 games it was not a separate scene, because they would have to load it from the CD each time then load back the actual game world scene from the CD. But that's just a guess.

    If you can make it work you can use a separate layout, however you need to consider that:

    1) you will need to make sure the objects you interact with (such as the player or party members) get transferred between the layouts.

    2) the state of the game layout after you switch back is exactly the same. IIRC if you switch to a layout the initial objects and their placing is restored in addition to any objects that had persistent behaviour.

    If you do it on the same layout but as a different layer that is invisible when the inventory is closed:

    1) you will need to "pause" all enemy movement etc.

    2) you will need to make sure player input events for movement or other actions does not trigger when doing something in the inventory. For example I needed to make sure that if I click on an item in my inventory window, the player character will not start moving to the tile hidden behind the inventory window.

    All of the issues in both approaches can be overcome, but you will need to think or look for the solutions and decide what you want to use. There is no universal "best" way to do this, there is one that is best for you and finding out what it is might take trying and experimenting and even failing. But do not get discouraged, Rome was not built in a single day and knowing what doesn't work and why is important to know what works

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)