Skip to content

This is a simple trivia quiz game designed in BPMN and executable with Camunda 8 Saas.

License

Notifications You must be signed in to change notification settings

camunda-community-hub/TriviaGameExample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Trivia Game

This is a simple trivia quiz game designed in BPMN and executable with Camunda 8 Saas.

There are two processes, a very basic "plug and play" process that doesn't really require anything to get it up and running and a more complicated and more interesting process that includes a bunch of cool extra features.

The BPMN Processes

The Basic Process

process model

The process shows that a contestant picks from a list of categories and is then asked to answer a trivia question on that category. If they get it right they collect a prize. If wrong they have 2 more chances and after that they lose the game.

The Advanced Process

advanced Process

The process does the same as the basic process with some cool extra features.

  • Publicly start form.
  • Translate the question in a language of your choice.
  • Get a hint to the answer to the question.
  • Have ChatGPT check if you're answer is correct.
  • Time limit to answer the question
  • OpenAI generated inspirational messages!

The Execution

The basic process uses Camunda forms rendered in tasklist as a front end for the player and uses a Camunda Rest Connector to call a service that returns a trivia question along with the answer.exectu

The advanced model uses the same stuff as the basic one with the addition of a number of OpenAI connectors which contact ChatGPT at various points in the process.

How FEEL is used

FEEL is used to do some nice stuff in this example. Firstly it's used to easily parse the results of the rest call and create local variable for the.

The important part of the response looks like this:

	
"body": [{
    {"category":"geography",
    "question":"Name the desert located in south-east california. ",
    "answer":"Mojave"}
]}

to create the variables we need to show the the question and compare the answer we just need use the following FEEL expression

{
  question: response.body.question[1],
  answer: response.body.answer[1]
}

FEEL is also used to decrement the lives of player after getting a question wrong. This is done by simply adding a non-intermediate event and added an output expression like this:

lives - 1

How to deploy and run

The easiest way to run this is to create a free account for Camunda 8 SaaS and upload the BPMN models and forms to a folder in the web modeler and then deploy them to a cluster

For the basic model, You just need to get an API Key for the trivia service by creating an API Ninjas account. Once you do create a secret with the key called ApiNinja

Then you can start an instance from the modeler and follow complete the tasks in tasklist.

For the advanced model you will also to create an OpenAI account and generate a API key to be used by the OpenAI connectors the key can be stored as a secret called OpenAI

About

This is a simple trivia quiz game designed in BPMN and executable with Camunda 8 Saas.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published