FAQ:Is it possible to write your own IF engine

From IFWiki

This is a loose translation from Russian IFWiki.

Is it possible to write a game in your own engine?

Answer for common people

No, until you become a programmer.

Answer for programmers

Text games seem easy to code. But it's not quite like that.

Doing a game in your own engine is much harder than taking one of the existing platforms and doing something on this base. Why is it a sane answer?

First, consider the programming speed and difficulty. Writing a game from scratch is nothing like writing a game in some specialized program. A lot of systems let you make something from a single phrase. Without an engine you'll have to spend several weeks to make basic stuff that doesn't directly correlate to your game: for example, figuring out the text output or game saving/loading.

It's worse in parser games because they need good standard library. Are you ready to write your own 234 verb reactions like in TADS? A bad parser library can be a very big hindrance to the player.

Popular platforms had a lot of months of work on them, because you don't have to repeat this.

Second, it's reliability. In a cozy interpreter the bugs in your game won't be catastrophic. The game won't break saving or die unexpectedly during an important moment. Worst case, it will just become impassable. When you are writing your own engine, a bug in your game is same thing as bug in your engine.

Third, it's portability. A lot of IF interpreters support several systems - it's not just Windows, Linux and Mac, but also can be Playstation, Android, old PSPs and other devices. Do you want to make that kind of support on your own?

Finally, the community support. If you are stuck and don't know how to do something, you can ask other authors who write games on this platform and probably one of the authors of the platform itself. They will be able to give you tips and fixes. When you are using a custom engine - you are always on your own.

If you write your own IF engine that targets a VM (such as Z-machine or Glulx), then the game will run on any computer that has an implementation of that VM; in this case, some (although not all) of the considerations above are already taken care of, and more players may be willing/able to try it.

Answer for very cool programmers

If you are such a genius coder, why don't you take the source code of existing platforms and work on it? Perhaps you can fix a pair of bugs or make it better overall. And you'll see how other IF platforms work in the process.

Some of the popular open source platforms and interpreters are:

  • Inform 6 (C) (targets Z-machine or Glulx)
  • Ink (C# + ports to Javascript, Lua and other languages)
  • ChoiceScript (Javascript) open under non-free license
  • Twine (Javascript)

Semi-popular:

Less popular (but targets popular VMs):

  • ZIL (targets Z-machine)
  • ZAP (assembly language; targets Z-machine)
  • Glasm (assembly language; targets Glulx)

If you still don't like all of these, there's the Engine List. Even old and deprecated programs can be given a second life.