Developing a Serious Game Application – Part 1

Summary

Development of the serious game application has hit a roadblock due to problems in creating a valid Model representation of a text-only wiki article that are preventing the Makahiki database from being initialized. Once this problem is fixed, being able to perform standard Django database operations on the Articles should allow other standard pseudo-wiki-like features like article searches or revision management to be implemented to some degree.

False Starts: django-wiki

In my previous post on this project, I had been considering trying to incorporate modules from benjaoming’s django-wiki project into Makahiki. The problem with this approach is that it would essentially amount to taking an existing, full-fledged web application with its own authentication system and trying to link this system to Makahiki’s user database. At best, Makahiki would end up serving as a glorified login screen, with its widgets needing to pull from the external wiki database and integrate this with Makahiki’s database. While the django-wiki package appears to be a useful Django add-on, it did not seem as if it lent itself well to gamified integration with Makahiki in the limited development time I had.

The Article Model

The Article model, in its present, incomplete state, does not actually create an article that the user can edit. Rather, it stores metadata about the article – title, which editors can work on it, etc. – in the database. Since it seems impractical to store a hypothetical article (possibly with embedded images in a future iteration of the project) as a text field in a database, the goal is eventually to store a link to the actual article file as a field of the Article model. The database could then be queried to retrieve all revisions of the article (revision number is another field), and links to the article as generated by Django would point to the latest version. At present, Makahiki’s initialize_instance.py script cannot initialize the database because the error TypeError: __init__() got an unexpected keyword argument ‘required’ is preventing the Article model from being validated, so it is likely that an attempt to upload the application to Heroku in its present state would also fail. Oddly enough, the initialize_instance.py script worked once and produced this error only after I navigated to the Profile page; on the second use of initialize_instance.py, the script failed to complete its run and displayed the same error.

A TypeError.

The database was able to initialize once with the Article model, but this error appeared on the Profile page. The next use of initialize_instance.py failed to initialize the database completely, with the same error.

Implementing New Models

The practice of creating and being able to revise an article is very different from what Makahiki is currently designed to do: it is equipped to measure and reward user-generated actions and content, but naturally it is not possible for users to substantially alter the site. Now that I have a better understanding of the work that needs to be done to incorporate articles into the database, the greatest potential problem is the likelihood that most of the work over the remaining two weeks will need to go towards back-end, pseudo-wiki-implementing code, rather than into making Makahiki’s Smart Grid Game able to measure and reward training scenarios and user contributions within the wiki.

Future Objectives

In the short term, the goal is to fix the current version of the Article model such that the Article model will validate, and to then upload the application to Heroku. The next goal is to make the Article model or the article_mgr manager able to maintain references to the latest version of an article and provide a link to an editable version of the article, which will use the Markdown language that Makahiki already supports. A subsequent goal would be to modify one or more SmartGrid challenges to detect that a user has created a certain number of unique articles and/or revisions, and create a badge for it; alternately, I might attempt to incorporate a ratings module as well. Once the Article model is functional, building widgets to do basic database lookups for searches by title or author or loading a list of all revisions to an article should be relatively trivial. Articles are likely to be limited to text only for the foreseeable future, as support for image and file uploads is a lower priority given the current issues with the Article model and the feasibility of its gamification.

UPDATE: Heroku Application

My compilation and initialization failure was the result of extra commas in the models.py file. Once these were removed, the database could be initialized normally.

A draft version of the create_article widget.

The form does not have line breaks between fields, resulting in form help text seeming as if it is associated with the field below it instead of the field above it.


As mentioned, the changes at this point are minimal: the article creation form is displayed on the Profile page, and it redirects to an error page instead of a confirmation page or an editing page if the Submit button is clicked. Furthermore, it is not currently possible for any user, admin or non-admin, to delete the entry the Submit button creates in the database.

While trying to set up player0 as a dummy user, I was unable to continue the setup dialog beyond the point shown below. I can only conclude that my database model changes somehow broke other aspects of the setup process.

Now I cannot set up new users. Clicking on the right button to continue does nothing.

Now I cannot set up new users. Clicking on the right button to continue does nothing.

Advertisements