What is UML - Unified Modelling Language
The Unified Modeling Language is a general-purpose, developmental, modeling language in the field of software engineering that is intended to provide a standard way to visualize the design of a system. Wikipedia
In This Post we are going to Show how to Design Activities within the Inventory System such as Adding an Item to a specific Inventory and make a Drag and Drop with the Mouse System to Move Items between the Inventories.
The following UML Diagrams are designed to work with the Zeus Unite – Item Database Management System. However They should be also useable for any type of Inventory since they are on a Basic Level and shows the Activity of a Inventory when adding an Item.
Add Item to Inventory UML Activity Diagram
- Add Item to Inventory
- Decision: Has Inventory Enough Space?
- No: Return False and Remining Items
- Yes: Continue to Check Item Exist
- Decision: Is Item Existing in New Inventory?
- No: Add Item to New Slot
- Yes: Add Item to Existing Item
- Decision: Check If Max Stack Reached
- No: Increase Existing Item
- Yes: GoTo Add Item to New Slot
- Decision: Check if More Items need to be Added
- No: Return True, Item Succesful Added
- Yes: GoTo Add Item to Inventory
- Return True or False
Inventory Drag and Drop UML Activity Diagram
- Start Drag Item
- Reference Old Inventory
- Copy Item To Mouse
- End Drag
- Decision: Is End Drag Over Inventory?
- No: Place Item Back To Old Inventory
- Yes: Place Item In New Inventory
- Decision: Has Inventory Enough Space?
- No: Place Remaining Amount of Items in Old Inventory
- Yes: Add Item
- Decision: Is Item Existing in New Inventory?
- No: Add Item to New Slot
- Yes: Add Item to Existing Item
- Decision: Check if More Items need to be Added
- No: GoTo Clean Parameters, Item Adding is Done
- Yes: GoTo Place Item In Inventory and Add Item again.
- Clean Parameters
This is the Basic Idea of a Drag and Drop System inside a Inventory
“The Player starts Dragging a Item”
and we End always with
“Clean Parameters”
on the way we will ask a bunch of different Questions to the System in order to proceed correctly with our following Logic.
The Question if the Inventory has enough Space is also based on the Inventory Space System you are using. The Logic will be different between Grid Based, Slot Inventories, Grid Size Based and other Inventory Types.
You need to Check for Limitations such as: Check If the Item can be Stacked and whats the Maximum Stack Size, if you have Limitations on that. There also the possibilitie for Endless Inventories. Without Weight or anything.
Inventory Add Item and Inventory Start Drag In One UML Activity Diagram
This Diagram shows how to Combine Two Actitivities together and is extendet with a Max Stack Action and should give you the Direction how to solve the Logic of a Drag and Drop Item Slot Inventory System with 2 Different Functions.
Join us on Discord
For Feedback, Suggestions, Questions or Bug Report, please Join us on our Discord Server.
https://discord.com/invite/t9peX8dCDa
The End
We hope we have been able to give you some ideas for designing your own inventory system. There may be more or less things to consider when creating an inventory system and is based on the Project.
Using UML in game projects can be very handy. It is easy to understand and gives you an overview of the logic you are about to create.