Attendees at the recent FME user conference took part in an FME-based version of the TV game show Jeopardy! Using a web interface they could sign up to the FMEeopardy! game and submit answers to questions.
But not only were the questions based on FME, the entire contest was run using workspaces hosted on an FME Server installation.
Because it was such an interesting project, and because you might find some of the techniques useful this post is all about how the game worked. In fact, what I’ll do is describe it in a series of short posts.
So, firstly, here’s some information on the background to the game and details of the sequence of play. I expect the following post will show one part of the sequence and demonstrate the workspaces used.
Obviously the first software on the list was FME Server 2009. But as with any such project I needed to first install a web server, in this case Apache Tomcat. This nicely acts as both web server and servlet engine. To keep a record of all information I used a relational database; in this case Oracle XE.
The setup, as used at the conference, was installed on a quad-core system with four FME engines running. The amount of data being passed back and forth was very (very) minimal compared to the usual spatial data distribution, so we figured this setup was more than adequate to handle the hundred simultaneous requests we could expect as a maximum.
The only tweaking we had to do was with the OS (Windows XP). We found that Windows XP has fewer available ports and manages TCP connections differently by keeping ports in a TIME_WAIT state. This caused Oracle to fail to initialize when hit on by multiple FME processes. We tweaked the registry and all was OK – but I guess that’s why you should deploy enterprise-level software on Windows Server and not Desktop!
Here (below – click to enlarge) is a graphic representation of the setup:
A few of the web pages used were hard-coded HTML files. The remainder were automatically generated by FME workspaces in response to user actions, and streamed to the web browser with a data streaming service (more on that in the next post).
There were actually two interfaces; one for contestants and one for the game administrator.
Below (click to enlarge): The FMEIdol Administrator Interface. This was one of the hard-coded HTML pages:
Almost every link on a page ran a workspace, and was in a form similar to:
On input forms, where we want to submit information to server, then we used syntax like this:
To pass a value to a workspace published parameter we simply use:
…where “ppteamname” is the name of the published parameter within the workspace. So the above accepts a team name from the entry form, and passes it to the TeamRegistration workspace as a published parameter.
The one mistake I made was to have mixed-case URLs. It caused a bit of havoc with people accessing the system via Unix or Macs. Keep everything lower case was the advice I was given.
All data was non-spatial in nature and stored in a set of Oracle tables:
QUESTIONS: All of the questions with their points value and correct answer.
PEOPLE: All of the registered players; name, team name and password
ANSWERS: All of the answers submitted by players
CURRENTQUESTION: Details of the currently active question
The ANSWERS table (below – click to enlarge) has a timestamp field so we know who answers the fastest.
The database also has a SEQUENCE defined (FMETEAMID) through which to assign each player a unique ID. We found that retrieving the max ID, incrementing it, and writing it back did not work, because it did not lock the database and so multiple teams could end up with the same ID.
Sequence of Play
Step 1: Each contestant opened http://fmeidol/ in a web browser and used the link “Register for the Fun and Games” to register in the contest (below – click to enlarge).
- Each registration added a new record into the PEOPLE table in the database.
Step 2: When ready, the administrator chose the option “Go to FME-Jeopardy Board” (below – click to enlarge) and clicked on a question to activate it.
- This action copied the chosen question into the CURRENTQUESTION table in the database.
Step 3: Contestants then used the link “View Current FME Jeopardy Question” to view the question and submit an answer (below – click to enlarge)
- Submitting an answer inserted a record into the ANSWERS table in the database.
Step 4: After a chosen period of time (say 30 seconds) the administrator chose the option “De-activate Question” to close the question down.
- This updated a status flag in the CURRENTQUESTION table, to prevent any answers after the question is closed (below – click to enlarge)
Step 5: The administrator now chose the option to “Show Answer”.
- This retrieved the answer from the QUESTIONS table and displays it on screen (below – click to enlarge)
Step 6: The administrator now chose the option “Show Who Was Right”
- This retrieved a list of records from the ANSWERS table where the QuestionID matched that in CURRENTQUESTION and where the QuestionAnswer matched that in the QUESTIONS table (below – click to enlarge)
Step 7: The administrator now chose the option “Calculate Scores”
- This retrieved a list of records from the PEOPLE table and cross-referenced their records in the ANSWERS table to calculate a total score for each contestant (below – click to enlarge)
Step 8: The administrator now chooses the option “Return to Board” to select the next question.
Step 9: At the end of the game the administrator activates the Final FMEeopardy question. This special question lets the users wager any amount of their current points against the chance they answer correctly (below – click to enlarge)
So that’s the process and how the game was operated. Next time I’ll look at one aspect of this process: submitting an answer. I’ll examine the workspace to show how it worked and how the results were streamed back from FME Server as HTML documents.
This Edition of the FME Evangelist…
…was written to the sound of British cycling having a great start to the Tour de France. If you want to know what British cycling sounded like in the 80’s, this link is it!