Implementing Cooking #

In this section, we’ll cook a muffin using the previously built plugins.

Start Pragma Engine #

Run Pragma Engine via one of the following methods.

Running via Make
Run make run to start the platform. Run this in a terminal with platform as the working directory.
Running in IntelliJ

From the IntelliJ toolbar in the upper right, ensure MainKt - LocalConfigured is selected, then click the play button.

If MainKt - LocalConfigured isn’t available, you will need to configure it. In the IntelliJ toolbar, click the dropdown next to the run button, then click Edit Configurations…. In the Run/Debug Configurations window that appears, expand Kotlin in the left hand side, then select MainKt - LocalConfigured. Click OK. Click the play button in the IntelliJ toolbar to start Pragma Engine.

Once the engine has started successfully, it prints the message [main] INFO main - Pragma server startup complete.

Cook the muffin with Postman #

  1. Open Postman, then send PragmaDev ➨ Public ➨ GetInQueuev1 to enter the login queue.
  2. Send authenticateOrCreateV2 for both player and operator.

Player: PragmaDev ➨ Public ➨ Player - AuthenticateOrCreateV2 Operator: PragmaDev ➨ Public ➨ Operator - AuthenticateOrCreateV2

We will be sending player and operator service calls, hence the need to log into Pragma Engine with both roles.

  1. Navigate to PragmaDev [date] ➨ Game ➨ RPC - Player ➨ Inventory ➨ Crafting Scenarios and double click Cooking A Muffin.

  2. Click the Run button to set up the muffin cooking steps.

  3. Check the Save responses box, then click Run PragmaDev [date]. The following processes will run:

    • operator: Grant Required Ingredientsobtain the required ingredients to craft
      • We use GrantItemsOperatorV1Request to give the player the required ingredients to cook a muffin.
    • test01: Set Expected Muffinsautomated test setup
      • Postman sends a GetInventoryV2Request and stores the result to validate the results of the remaining crafting steps.
    • test01: craftV1 - start baking a muffinexchange ingredients for incompletePlainMuffin
    • test01: craftV1 - not finished wait 3 secondsattempt to redeem incompletePlainMuffin for plainMuffin before cooking has finished
      • In CraftingEntries.json, we specified a 3 second cook time for our plainMuffinRecipe. We attempt to redeem our incompletePlainMuffin prior to its completion to ensure Pragma rejects our cooking attempt.
    • test01: craftV1 - finish baking muffinsuccessfully redeem incompletePlainMuffin for plainMuffin
      • We again redeem our incompletePlainMuffin after 3 seconds and receive our completed plainMuffin.

If all tests passed, you successfully implemented cooking as a plugin. More information can be found by looking at the request and response bodies of each service call.