• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Gabriel Marincu

RPG Inventory HUD

9 posts in this topic

Hello again gentlemen!

As the title of the topic suggests I have a bit of a problem with a drag-and-drop,Diablo 2-like inventory HUD/GUI.
I figured out how to handle the data part of the inventory (using an array) but my main problem is Linking the data part to a GUI.
Any ideas on that?

I am just asking for ideas,suggestions (not plain solutions, i want something to challenge my brain not take them by granted)...i can accept pseudocode, Python,Java,and C++ ideas because i can relate the solutions to my language of choice.

Thank you in advance!
0

Share this post


Link to post
Share on other sites
Actually, your title *doesn't* suggest anything. Perhaps if you present an actual problem and answerable question, you might get a better response.

I'll help you get started...

What language are you working in? Graphics library? GUI library?
What have you tried?
What is the result?
0

Share this post


Link to post
Share on other sites
Ahem...i'm sorry if I didn't make myself clear (i still think i did).

[quote name='Djfix' timestamp='1346420236' post='4975139']
I have a bit of a problem with a drag-and-drop,Diablo 2-like inventory HUD/GUI.
[/quote]

I said [quote name='Djfix' timestamp='1346420236' post='4975139']
.i can accept pseudocode, Python,Java,and C++ ideas
[/quote]
Still my language of choice is Python (PyGame library) but i honestly think this does not make any difference because i can handle myself in each language
so i would have been able to port anything you gave me to Python.

What have you tried?
[quote name='Djfix' timestamp='1346420236' post='4975139']
I figured out how to handle the data part of the inventory (using an array)
[/quote]

The result: A working inventory system...only that it accepts string commands (it's all text)

My Main problem: Linking my already working inventory system to a Heads Up Display (If you have played Diablo 2 you know what kind of inventory i am looking for)
0

Share this post


Link to post
Share on other sites
I am having difficulty with handling the UI interaction (like arranging items in the inventory, equiping them and so forth)
As i have told you before i've already made an inventory but it works with string commands...Now i want to Make all that into a GUI.
0

Share this post


Link to post
Share on other sites
In all honesty, it's still limited subject information for anyone to work with.

It sounds like (to me personally) that you don't even have a handle on displaying graphical images on the screen which, as basic as it sounds, you won't understand any of the possible suggestions provided.

Let's try and start again: You say you have a data based inventory using an array to store the objects (string representations if I gather correctly) which is effectively a list of words. What does your current logic allow you to do with this?[list]
[*]Does your inventory allow for items to be added/removed on the fly.
[*]Are your items made from class derived objects, or are they literally just string names?
[*]Is it a fixed size inventory?
[/list]

This is just some of the information needed to be able to help present a suggestion that might work with your current system.

Now, secondly, Graphics related:[list]
[*]What is your experience with graphics thus far?
[*]How much experience have you had with Pygame?
[*]What are your attempts in combining Pygame and your current Inventory?
[*]Does your current implementation display (even as words) in a visual environment? (SCREENSHOTS are incredibly useful here!)
[/list]

Again, this is just some of the information needed to be able to help. With a question such as yours, it helps to break it down, not just for us, but for you to be able to actually think about different portions of such a system. Like you said, you are having problems with a drag and drop (which is ONE component of a Diablo 2 style system) and I'm sure you mentioned equipping, which would be different as it could deal with Inventory to character, as opposed to Inv to Inv. Other parts to consider: stackable items, being able to remove items in favor of new. There are so many potential components that it really does help to break down what you want the system to do.

I hope this helps,

Regards,

Stitchs Edited by stitchs
1

Share this post


Link to post
Share on other sites
Ok...I'll try my best explaining my current situation (I am not a native english speaker so that could make it harder for me).

To begin with...I have implemented a 2d top-down tile based game. It works perfectly until now (basic tilemaps,a bit of AI for mosters, Random map generation using Perlin Noise)

So to describe the logic behind my inventory:
- It currently allows adding, and removing items (when the character walks over the sprite of a dropped item and presses P the item is picked up and added to the inventory.If the player presses I a list of items shows up and he can select the item he wishes to drop and presses R to drop it)
- My items are class based (references of a base Item class which passes a Use() (a sword gets and attack function,a potion a healing function and so on) function which i load from a .txt file for every item i want.
- Yes it is a fixed sized inventory system (16 items)

Graphics experience:
Now I think I was harshly misinterpreted at this part...i think i may have expressed myself wrongly and that led to wrong conclusions (in my head I thought that you must have read my previous posts but now I realise that I must provide the necessary details).


- My experience with graphics (+1 year of 2d graphics programming)
- My experience with PyGame: about 9 months
I'll try to attach a screenshot of my first level
.[attachment=11026:screen.png]
0

Share this post


Link to post
Share on other sites
Hi Djfix,

You should have some classes with inheritance I suppose?
Class Item -> Class ItemSword, class ItemRing, class ItemPotion which all use the class Item.

If you have this I should recommend you to make 2 classes, class ItemList, class Inventory.

The ItemList class keeps every item, a dropped item and an item in the inventory. So all your items will be stored in this class using a vector.
The Inventory class only hold what you have picked up. To receive all the picked up items you want to say something like:

[CODE]
m_pInventory = m_pItemList->GetAllStoredItems();
[/CODE]

So what this means if each item needs to have a bool which says it is stored or not stored.
Then to receive all the stored items you do something like this:
[CODE]
vector<Items*> ItemList::GetAllStoredItems()
{
vector<Items*> tempVec;
for(/* look through the vector */)
{
if(m_VecItems.at(i)->IsStored() {
tempVec.pushback(m_VecItems.at(i));
}
}
}
[/CODE]

This is how I should do it. Certainly there are better ways but this should do also.

[u][b]EDIT:[/b][/u] Ah you are working in Python? I have no idea how it works so I'm doubting Python uses classes. But you say you can handle each language so I won't edit the code I've written. :D Good luck.

~EngineProgrammer Edited by EngineProgrammer
1

Share this post


Link to post
Share on other sites
rather than use a flat array of inventory tiles, use a linked-list of items. Since the inventory will presumably be small like in Diablo (fitting maybe 50 small items, max); iteration will not be a bottleneck. This not only probably saves on memory usage, but will prevent from having to update each inventory tile occupied by an item when adding or removing it.

From there, items in the inventory will need a position and size, measured in inventory tiles. This will allow you to detect whether or not you can add the item to the inventory.

[code]
class InventoryItem
{
[...]

Sprite* m_visual;
int m_x;
int m_y;
int m_w;
int m_h;
};
[...]
std::vector<InventoryItem*> inventory;
[...]
bool AddItemToInventory(Item* item, int x, int y)
{
InventoryItem* iitem = new InventoryItem(item, x, y);
for(std::vector<InventoryItem*>::iterator it = inventory.begin(); it != inventory.end(); ++it)
{
if(Rects_Intersect(make_rect((*it), make_rect(item))
return false;
}
inventory.push_back(iitem);
return true;
}[/code] Edited by nfries88
1

Share this post


Link to post
Share on other sites
Thanks for your help...I've managed to put together an algorithm and i've also integrated a small GUI for the inventory.

Cheers!
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0