Using Inform7 as a game state machine underneath Cocos2d?

Hey all – hopefully this is the right forum for this kind of question. :slight_smile:

I’m currently lead game designer at the GlassLab, a nonprofit game development studio with foundation funding to make educational games. (There’s a Time article out today about our work modifying SimCity: nation.time.com/2013/11/06/makin … deo-games/ )

I’m leading the development of a tablet-based adventure game intended to teach ELA argumentation (common core reasons and evidence section if you follow such things). It’s set on Mars and is in collaboration with NASA. While we were in our concepting phase, we were having difficulty recruiting a lead programmer, and so I built our initial prototype in Inform7 (it’s here: absurdly simple: erinhoffman.com/hiro/Archive-Concepting/Release/ ).

This was supposed to be a temporary measure, but (and this likely will be no surprise to you given the education links on the inform site) the kids responded so well to it in playtesting that we were honestly taken aback. They don’t have the context to find the text interface to be “old” – to them it’s completely new – and the effect was just magical, even considering all the flaws in the prototype. 10 out of 10 kids that we tested it on did not want to stop playing, and all of them cited “the typing” as one of the most interesting things about the game. Unlike other games in their lives, it made them feel empowered over their environment.

They did, however, want graphics. The original design for the game was in more of the Monkey Island tradition, and we want to stick with the basics of this (touch items to interact with them). However, I always had a natural language “talk to the ‘AI’ city computer” section based on observations we made at the Exploratorium of the magnetic draw that the Daisy chatbot had for middle school students in particular. (Again with the typing.)

This is all a long way of saying that what I’d really like to do at this point is lay Cocos2d on top of Inform7, and use Inform for the entire game state machine. There would still be touch-based interactions, but these would essentially be button shortcuts that fired commands to the Inform parser. Our world would be pulled from the Inform build, and all objects would be instantiated in the Inform database, then drawn in 2d.

Have you ever heard of this being done? Are we crazy to attempt it? Is there anything we should watch out for? Should we not try to use all of the Inform source, but bite off one of the open source components for a segment of what we’re trying to do?

The main thing that I’d like to capture/preserve if possible is the way that the kids felt so empowered to try ‘anything’ on the objects in the world and get a scripted response. I can mimic this just on a case-by-case typed command basis, but as a designer I’m also excited about the prospect of potentially using Inform as a level-building tool.

If you were going to do this, how would you go about it? Where would you start?

Any advice or thoughts EXTREMELY appreciated!

Big questions! My answers are: a lot of “hmm”. :slight_smile:

Bad news: The Inform 7 compiler is not open-source, and is in any case designed to emit a compiled VM game file. (Even if you had the source code, it would be difficult to make it do anything else or integrate the compiler with another system.)

Good news: the VM (two of them, really, but use Glulx for this) is open-source. It can be integrated with other systems. It could be extended to control a graphics display in addition to manipulating its own internal state. Interrogating the VM for object state is tedious but possible.

Bad news again: running a graphical display of an Inform world? That will probably involve a lot of compromises. I suspect it will involve so many compromises that you might as well skip the parser and Inform entirely, and just code up your own state machine.

All of Inform’s complexity is geared towards handling linguistic commands, and the world model which is itself geared towards linguistic commands. Touch UI is a completely different sphere. You can convey a sense of “empowered to try anything” in a graphical/touch game – but it’s not verbal; it’s spatial and state-based. (Dragging objects around the screen, activating tools and effects in various locations in a space.) I think that trying to translate that into parser commands is inevitably lossy.

…I realize that my answer above is net-weight discouraging. I don’t want to discourage you, especially since you tried traditional IF with kids and they enjoyed it! We always like hearing about that sort of thing.

I guess my point is that interface is always the most important thing about game design. Saying that you’re going to swap in a new UI while keeping “the same thing” under the surface is tricky at best.

You might think about a mixed approach – typed input, graphical display of the world and simple animations for the results. (Perhaps with text output in parallel.) That preserves Inform’s strengths.

This really highlights for me a need for modular, open source IF libraries, like a parser, world model, etc., with a good API that can easily be integrated with existing platforms (insert liberal hand-waving here).

You might want to check out Glimmr (code database, blog), which can do some stuff that overlays graphical interaction on top of Inform (with a parser line too). Check out the roguelike-like demo in particular, where you can mouse-click on the screen to move your character as well as enter typed commands. The author, Erik Temple, is on this forum.

Don’t know how it would scale to tablets or if that even makes sense.

Matt, thanks for the shout-out to Glimmr, but I don’t think it would fit the bill here. To get something with the range of graphics capabilities that are needed for a modern tablet game, you’d need to do as zarf suggests and create your own interpreter.

Do I remember right that the BBC’s online Hitchhiker’s Guide from a few years back was based on a custom interpreter that sent game data back and forth to the javascript/HTML layer as XML? FyreVM also might be something to look at for ideas.

The BBC’s HHGG adaption was a standard Z-code interpreter instrumented to watch the game state (by inspecting VM memory directly).

This is the easiest plan if you don’t want to customize your game at the I6 level – or, as in their case, if you’re stuck with a fixed game file and no way to recompile it. I did the same thing to add a dynamic map to my iOS port of Dreamhold.

My open source Quest system might be a better fit if you want to customise the UI, as it’s based around HTML and JavaScript.

Main site textadventures.co.uk/quest
Source quest.codeplex.com
Alpha converter to output games as pure JavaScript, allowing you to embed within PhoneGap apps etc github.com/textadventures

Wow, thanks very much, everyone. This is incredibly helpful. Emily Short pointed me in your direction and I’m very glad she did.

Apologies for the late reply – I’m traveling and have been between wifi spots. I’ve passed this thread on to my tech team and am going to digest it myself as well. It corroborates a lot of our initial suspicions and points in some very helpful directions.

zarf, your posts were not discouraging at all! What we were looking for was a realistic picture of the landscape, which you certainly gave.

George, totally agree, and curious if such a thing will ever exist. Also curious what would go into it. I worked as a developer on DragonRealms for Simutronics for five years, so I have that exposure to parser-land, and I’ve kept up with inform off and on… the parser in inform7 really seems fantastic, as is the natural language system of generating new verbs. It seems like a lot of the logic has been solved, so now the remaining pieces are accessibility…

Further thoughts certainly welcome! I’ll check back in here with any decisions or thoughts that come back from my team.

Double wow, Alex. Thanks for the pointer to your system. Will pass that along as well. And very delighted to see that the first game that comes up is an adventure game based on the life of Fred Suzuki. I’m fourth generation Japanese American – never thought about interactive fiction about the internment, and I’m super intrigued. Thanks again!

JACL is another great multiplatform and open-source IF system, with a world model (see code.google.com/p/jacl/source/br … bs.library) :

The homepage is: code.google.com/p/jacl/

You can also code extra-IF extra cools things such as this one: jacl.animats.net/fastcgi-bin/kielbasa.jacl

JACL looks interesting. Can you give a pointer to the documentation?

sorry for the late reply.

You can find the docs in the archive when you download it. It’s also there: code.google.com/p/jacl/source/br … nk%2Fguide

The pdf: jacl.googlecode.com/svn/trunk/gu … LGuide.pdf

Jacl is cool. It’s quite easy to use and customise. I’ve translated it to French and made a game with it.

Thanks!

FyreVM.