First off, if there are any display or browser issues, please let me know. I’ve tested it in Safari and Chrome and it works fine on an iMac and a MacBook, as well as Safari on the iPhone. Windows/Android users, please check to see if it works on your system.
Secondly, I’m looking for advice in which direction to take this, before the program gets much larger. As it is, it has very little functionality and you can’t really do anything, the only command I programmed in is “look”. It will recognize the “go north”, “n”, “go n” commands, although it doesn’t do anything with them yet, since I am still trying to figure out how to build the world. Preferably, I am not going to hard-code in the actual worlds to explore, but have it read from another file. I don’t care about reading .z5 files or other types of story files. My goal with this is just to create my own standalone engine with good language processing.
So I probably want to build a “dictionary” file that handles all the language parsing, a different file that interprets world/story data, and a third file (maybe XML?) that contains the world/story data. Let me know any suggestions or ideas you guys might have. And please, don’t direct me to an already completed file to see how it works. I’m trying to build this from scratch.
In moments like this is when I think it’s a pitty projects like fi.js (baltasarq.github.io/fi-js/) don’t have english documentation. I’m pretty sure you could use the IF engine to handle all parsing and database work, and just concentrate in replicating the game itself.
Good luck with your work anyway, I hope you manage to do it and in the meantime create a code that can be used for other games
Thank you very much for your reply! It looks like you are much farther along in a similar project. I am mainly trying to accomplish this as a learning exercise for myself in creating web-based applications. I want to try to avoid re-using other people’s code as much as possible, but your project will be a great resource if I get stuck.
It was after learning how the JSON.parse function worked that I realized that “parsing” in general is going to be too complex for the style I was going for.
On your suggestion Victor, I cracked open the Inform source code.
There’s an insane amount of stuff going on…and that’s for a game engine that has absolutely no actual game data built in to it. Theres thousands and thousands of lines of code, spread across 20+ files. I’m going to need to build my engine slowly, case by case (not going to allow myself to copy any of their code). I may need to start over completely. It’s definitely a good idea to separate out the parts of the program. The user interface is entirely HTML/CSS/JQuery, and that functionality needs to be built separately from the core parsing engine, which needs to be separate from the game data (rooms, objects, actors, etc.).
There’s also the ZILF parser (link). Inform’s parser is more of a general pattern matching engine, where each verb and object can define its own patterns. ZILF uses heuristics to match commands to a standard ideal sentence, relying on the compiler’s knowledge of which parts of speech each word can be used as: find a verb, find up to two noun phrases consisting of adjectives and nouns connected with and/but, look for a preposition before each one.