-
Notifications
You must be signed in to change notification settings - Fork 20
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
Add an inventory system #397
Comments
To start with, we must define a data model. A simple and flexible in-memory data model is a plain
Left to future work. Future work could annotate the
We already have a material selection scheme, albeit a primitive one. It could be easily extended to scan the inventory to find an
As a component, inventory should be encoded into a column of the The stored block entities themselves are a bit of a funny case, since they don't necessarily have a location in world space. For serialization purposes, we might as well deem them part of the same
Thanks to redb, all save file updates are transactional, so this requires no effort beyond choosing not to gratuitously split the transaction. |
The choice to represent resources as first-class entities may seem strange, but is deliberate. It is certain that we'll want to store things other than raw materials, and those will have additional state (i.e. components) attached. By embracing this model from the start, we can reduce the number of special cases, without any real drawbacks. |
That makes sense to me. The only potential downside I can think of is efficiency, but to fix that, for simple materials, if we needed to in the future, we could always if we needed to add the optimization of the |
As a first step to adding actual gameplay, the player should be able to obtain, organize, and use resources, so to allow that, we will need to give the player an inventory. Implementing this is somewhat involved, as it has several moving parts:
To avoid needing to implement "item entities" or an equivalent feature, breaking blocks should immediately put them in the player's inventory. This might also be a good quality-of-life feature in general to keep long-term. However, for now, if the player's inventory is full, the fallback should be the simplest to implement: The block should be erased from existence.
It shouldn't matter exactly what the inventory controls are or how certain selections are made, as long as the code is written in such a way that tweaks are feasible. Just having this feature exist at all should be the priority.
The text was updated successfully, but these errors were encountered: