[Scummvm-devel] Word completion for AGI games

Neil Millstone neil at millstone.demon.co.uk
Mon Apr 9 15:08:15 CEST 2007


Hi ScummVMers,

I want to run past you all something I've been working on over the 
Easter weekend (not much else to do but code, you see).

The AGI games require you to type commands in on the keyboard to make 
your character perform actions.  Obviously on a portable device entering 
text is not easy.  I have implemented a nice on-screen keyboard for the 
DS port, but I had an idea for making ScummVM complete words for you 
which would make it a whole lot quicker.

Basically, when I type 'ba', I get a list of options (bat, batmobile, 
basket of goodies, bedchamber) and can click on them to automatically 
type the word.  The thing I'm wondering is, do people consider this 
cheating?  It certainly removes the guesswork from finding which words 
are recognised by the game's parser.  It's a massive improvement on 
usability for devices without a keyboard though, and could be useful for 
Symbian, WinCE, etc.

The other issue is how to add this to ScummVM in a generic way.  I have 
implemented it (not checked in, obviously) by adding the three 
prototypes  below to OSystem.  This lets the engine tell the backend the 
words that can be completed, and the backend then passes simulated 
keyboard events to the engine to enter the words once they are 
selected.  Maybe this could be replaced by an extra prototype in the 
Engine class?

Please let me know your thoughts!


    /**
     *  Adds a word to the list of words the game can recognise.  This
     *  is used on backends that lack a keyboard, to give the user the 
option
     *  of clicking on a word rather than typing it in using an on-screen
     *  keyboard.
     *  @param word the word to add to the list
     */
    virtual void addAutoComplete(const char *word) { }   

    /**
     *  Clears the auto completion list
     *  @param word the word to remove from the list.  Pass NULL to clear
     *              the entire list.
     *    @see addAutoCompleteWord
     */
    virtual void clearAutoComplete() { }   

    /**
     *  Sets the number of characters from the auto completion which have
     *  already been entered by the user.
     *  @param count the number of characters already entered
     *  @see addAutoCompleteWord
     */
    virtual void setCharactersEntered(int count) { }   


- Neil





More information about the Scummvm-devel mailing list