Implementing Cooking #

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


Start Pragma Engine #

Run make run to start Pragma Engine. Run this in a terminal with platform as the working directory.

  • Alternatively, Pragma Engine can be run from IntelliJ. From the IntelliJ toolbar in the upper right, ensure MainKt - LocalConfigured is selected, then click the play button.
  • If not, click Add Configuration…. 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 and send authenticateOrCreateV2 for both player and operator.

Player: PragmaDev [date] ➨ Social ➨ Player ➨ Account ➨ authenticateOrCreateV2 Operator: PragmaDev [date] ➨ Social ➨ Operator ➨ Account ➨ 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.