-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Item support #137
Comments
I have been thinking about how to represent items for a little bit, and I think I have a pretty good idea for an item/inventory system that will be both flexible and powerful. If things about this design aren't clear please let me know and I can work on clarifying and possibly draw out a diagram that outlines the main classes and their interactions. I am working on my Technical Communications skills in general, so I would appreciate any feedback either way. Anyways, onto my actual idea ... Overview
Synchronizing DataSince Open-Builder is a networked, multiplayer game, I made sure to think about how we can serialize the both the items that a server is using as well as the inventory of a player. The following schemas are json-like objects that are meant to show the structure of how we could send the data. Inventory Schema:
Item Schema
|
In terms of a technical post, I think this is really well and neatly laid out, so that's all good :) For the ideas posted, it's really good. Love the idea of having items keeping a list of attributes, like as you said that would be very scalable. Also like how you thought about ways the sort of "base data" is separated from the individual item data. Only thing I can really think of is if there is a way to define attributes in the Lua code itself, but that might be complicating things a bit too much so the current ideas are perfectly fine. So as far as I can tell this is what we have so far in terms of data, using all caps to show the different struct/schema more clear ITEM - defines the data associated with a type of item, as well as a list of ITEM ATTRIBUTE ITEM STACK - Contains an Id for an ITEM, the amount in this stack, and a list of ITEM ATTRIBUTE DATA, corresponding to the ITEM ATTRIBUTE list of the ITEM INVENTORY - Managed list of ITEM STACK, could also be used to store things like the items in chest, etc ITEM ATTRIBUTE - Contains info about a property of the item, such as it has durability etc ITEM ATTRIBUTE DATA - Metadata about an attribute of an invidvial ITEMSTACK, such as how much durability is left in it, etc Have a flight to catch soon so not sure if managed to list everything, please let me know if I did, but the ideas you have posted are looking great so far :) Thanks! |
It seems like you summarized what I said pretty well! I don't have a lot of experience with Lua, but my initial thought is that there would be a specific script that is run when the server starts up that defines the items. I am not too familiar with Lua, but I would think the script to define the items would look something like this (written in Python syntax because I am more familiar with Python):
Defining all of these things in Lua could get overly verbose, so we could also define them in some file in a standardized format then have Lua read the input from the file. The addAttribute function should basically just call a factory function that returns an Attribute/Component pointer. |
Describe your suggestion
Adds support for items in the game, as in things the player is able to store in their inventory and hold.
This is a pretty huge thing covering a lot of areas
As far as I can work out, there are 6 item types (Anyone think of anymore?)
However, some items would have some overlap in these categories (Eg a "wood" block is both a material and a voxel), so would need some way to deal with this.
On top of this, every time would need to have some kind of "GUI" representation as well, so the player is able to see it in their inventory.
Some item types would be able to be automatically created from other things, for example adding a new voxel type to the game would add a corresponding item.
Implementations ideas [optional]
Create/ Register item types in Lua, somehow automatically does the rest behind the scenes? Not sure
The text was updated successfully, but these errors were encountered: