Making crafting recipes

Many computer games and board games feature the concept of crafting, which allows players to create new items using items they currently have in their inventory.

To support crafting in a game, we will need to equip the game with crafting recipes. In this assignment you will construct a simple FXML application that creates crafting recipes and stores them in a crafting database.

Getting started

Start by clicking this link to download an archive containing database files for our crafting database. After downloading this archive extract the database folder from the archive. To import this database into MySQL start up the MySQL workbench application and right-click in the left pane where the workbench displays a list of available databases. Select the Create Schema command and enter the name 'crafting' for the new schema name. Next, switch to the Administration tab in the left pane and click the Data Import/Restore item. In the Data Import screen click the ... button to the right of the "Import from Dump Project Folder", navigate to the folder with the database files, and then click the Start Import button.

The database I have prepared for this project has three tables: items, recipes, and ingredients. I have already put some items in the table of items. You are going to be creating recipes to craft some of these items from other items.

How the application works

The application you are going to write will look like this at startup:

To start a new recipe the user will select the item they want to create from the first choice box and click the Make Recipe button to start the recipe. This will create a new entry in the recipes table.

To add ingredients to the recipe the user will select ingredients from the second choice box, enter a quantity, and then click the Add button to add an ingredient. This will create a new entry in the ingredients table.

Code suggestions

For this project I suggest that you construct a DAO class to handle communication with the database. Here are some methods that you should write for this class: