WEEK 1: Building the Crafting System for Delicious Dungeon
Welcome to the first ever devlog for Delicious Dungeon! I’ll be sharing weekly updates on our progress. Let’s dive in!
What is Delicious Dungeon?
Delicious Dungeon is a dungeon crawler heavily inspired by the anime Dungeon Meshi. In this game, you’ll interact with dungeon dwellers, learn their culinary preferences, and prepare dishes to help you advance through the dungeon.
A basic Crafting System
For this first devlog, I aimed to tackle something straightforward—or so I thought. To make development manageable, I split the game into smaller chunks. Given the importance of crafting in our game, I decided to start there.
The crafting system’s simplest form is reminiscent of Little Alchemy, where players combine components to create new items (e.g. Fire + Water = Steam). A tree structure is perfect for visually representing these connections, avoiding the complexity of massive JSON structures with arbitrary IDs.
Building the Crafting System with Godot
Godot’s GraphEdit is our tool of choice. It allows us to create nodes and connect them, forming a neat relational model that we can export as JSON for the game.
-
Setting Up GraphEdit:
- We start with a parent GraphEdit node serving as our canvas.
- GraphNodes, representing Ingredients, are attached as children.
- Various signals trigger actions like connecting, disconnecting, and deleting nodes.
-
Creating Nodes:
- A button press calls the
_on_add_node_request()
function, instantiating a new GraphNode. - Internally GraphEdit uses Node StringName to form connections between Nodes, so we assign each node a unique identifier (UUID) using Godot-UUID for easy reference.
- A button press calls the
-
Connecting Nodes:
- The
connection_request
signal callsconnect_node(from_node, to_node)
. -
The UUID is passed to the inheritor node for future reference. The corresponding Node data can be retrieved using
get_node(StringName)
- The
-
Removing Components:
- We get all inbound connections of a node and check for the specific component UUID to remove.
- A helper function filters connections as outbound (right) or inbound (left) and disconnects them as needed.
-
Deleting Nodes:
- Similar to removing components, we iterate over outbound connections of the target node and remove its component UID from each inheritor node.
- All connections of the target node are then removed.
Editing Node Information
Each GraphNode holds information about its ingredient (title, description, and component UUIDs). A Popup node allows users to edit this information.
- The
edit_node
signal calls_on_edit_node_request()
, passing the relevant node UUID. - After edits, the
ingredient_updated
signal (on_popup_edit_confirmed),
updates the GraphNode's text boxes with the new information.
Saving and Loading the GraphEdit
Displaying data is all well and good, but it doesn't really benefit our game in any way. So, to make our application functional, we need to export and import our crafting trees:
-
Saving:
- We add all GraphNodes to the same Node-group and create a snapshot of the editor.
- A save function serializes node fields into a dictionary, including ingredient fields.
- We save the serialized data and connection information to a file.
-
Loading:
- We clear the canvas and instantiate nodes with the same name field (UUID) as before.
- Nodes are connected using the saved connection data.
The Result
Future Plans
With the basics in place, I plan to expand the system to allow ingredients to inherit properties like flavours from their components, creating greater ingredient variety.
I hope this wasn’t too technical! Feel free to ask any questions below. I’ll be uploading the project to GitHub after a few adjustments.
- See you next week!
Delicious Dungeon
A project inspired by Dungeon Meshi
Status | Prototype |
Author | BriocheVanilla |
Genre | Role Playing |
Tags | Anime, Dungeon Crawler, Fantasy, Godot, Singleplayer |
More posts
- WEEK 2: Stat ShaderMay 25, 2024
Leave a comment
Log in with itch.io to leave a comment.