I'm taking over these internetz

Posted by Astryl on April 12, 2011, 2:31 a.m.

Looks like my clones are training on 64digits again. >_>

So.. I had a screenshot of my Roguelike's inventory system… but I forgot to put it on my USB Flash Drive (I'm using another computer to access the internet).

So I will describe it to you; it looks kinda like Minecraft's inventory grid, and can hold 20 items. The armor/weapons you have equipped have their own slots.

I'm still messing around with the Game Maker prototype, and slowly getting the C++ engine ready for use. SO BE HAPPY. I'm working on it.

Comments

Quietus 13 years, 7 months ago

inventory systems are awesome, i've never successfully made one lol.

Astryl 13 years, 7 months ago

It's surprisingly easy using the concept of polymorphism (Can treat child objects as the base object; put simply, but it goes a lot deeper than that). In GM though… I have to use a list data structure, and a single item type that changes it's data based on variables stored in the list.

Quietus 13 years, 7 months ago

oh yeah i see what you mean, i remember needing data structures for something recently and couldn't figure them out then, idk what the difference is now lol. lists seem fairly simple though, i'll have to remember this for my own Pokemon-ish game i'm planning to make =P

Undeadragons 13 years, 7 months ago

I did an inventory system (for someone on GMG) in GM using lists and maps, storing name and quantity and also allowing for a sprite to be associated with an item type, as well as having per item type stack limits and such like.

I should really put a prettier example on it and submit it (or not w/e).

Mayhap I should try to do one in C++, given that I have been looking to do an RPG for a while, it could come in handy.

Castypher 13 years, 7 months ago

For inventory, I use a 1D array for the slots, 2D array for item data (name, item type, etc), and a DS map to check if the item is in inventory, and how much, to avoid duplicating items.

Inventory systems are very satisfying to make.

Cesque 13 years, 7 months ago

You guys remind me how ridiculous and ritualised my coding is. I always used arrays for inventories in GM, I never used lists or DS maps, despite that being a pretty intuitive idea, because I never used lists or DS maps in GM at all. For comparison, when learning Python, lists and libraries and tuples were the first thing I got a hold of while having completely no clue about arrays.

I'll need to check how those "lists" work in GM one day, I guess, I just never felt the need because I never got stuck so much I would require to use lists or maps or grids or the for statement to go around a problem.

Juju 13 years, 7 months ago

Lists are slower compared to arrays anyway. I find lists/grids/maps are useful when I'm doing similar operations over many instances - I find it easier/neater to reference variables in instances rather than using with() to access arrays in other instances.

Undeadragons 13 years, 7 months ago

@Cesque: O rly? Do you use any data structures in GM?

I personally love the data structures in GM (well I guess just data structure in general), especially maps and grids. Since I program uCs a lot, usually all I get to play around with are stacks, so other data structures seem really convenient to me.

Scott_AW 13 years, 7 months ago

Arrays are win.

aeron 13 years, 7 months ago

A 2d inventory grid sounds cool, but make sure you can still do selection from the keyboard (I hate being forced to use a mouse for anything in a roguelike). I like being able to "d5a" or "ako4L" or "Du*" all from the keyboard.