intfiction.org

The Interactive Fiction Community Forum
It is currently Mon May 20, 2013 6:54 am

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 23 posts ]  Go to page Previous  1, 2, 3  Next
Author Message
PostPosted: Tue Mar 15, 2011 6:57 am 
Offline

Joined: Fri Jul 16, 2010 2:46 am
Posts: 93
Dannii wrote:
The problem with using character input is that you'll be emulating what interpreters do naturally, and you'll never be able to emulate it perfectly. There'll be some situation when it doesn't work as people expect, maybe you won't be able to select text, or move the cursor or copy a command. Using the Glk 0.7.1 features lets you use real line input while also intercepting it.


Line input has a couple of big wins - I like that the player could be continuing to type while in the background I'm doing some processing on what the last glimpse of the input line was. That feels smoother.

But I'm not sure how to best handle big changes between the old input line and the new, after a new "snapshot" is taken - particularly in handling the space-bar-to-accept-suggestions. What if they've deleted several characters and then pressed space? If I have to rerun the parser over the new input data it'll be harder to optimise so probably slower; it might lead to the game making invisible suggestions because they're only computed, and then written in, *after* the player has pressed the space key.

At the moment, I'm looking at using character input, and allowing command processing to be interrupted by the user pressing an additional key. Looking at it this way, it's a real shame that glk_select_poll can't recognise character input, as that would let me say "The user's pressed something, get on with handling that" but without having the pause the gameflow to do that. (I can do something similar using a 1 millisecond timer and a normal glk_select call, but I can't help feeling that introducing a deliberate delay is a weird way to speed things up.)

I'll probably get the current version stabilised and out there, and then look at a line input rewrite and see how it goes. If checking for changes in the input line is really fast, then potentially I could use it as a glorified character input anyway...

_________________
inkle: interactive stories
http://www.inklestudios.com


Top
 Profile Send private message  
 
PostPosted: Tue Mar 15, 2011 8:58 am 
Offline
User avatar

Joined: Wed Oct 14, 2009 4:02 am
Posts: 963
You could also change from space to tab and setting tab as a line input terminator. I'm not sure why space can't be a terminator too though.


Top
 Profile Send private message  
 
PostPosted: Tue Mar 15, 2011 9:03 am 
Offline

Joined: Thu Oct 22, 2009 4:31 pm
Posts: 1137
Dannii wrote:
You could also change from space to tab and setting tab as a line input terminator. I'm not sure why space can't be a terminator too though.

Tab is not available for interrupt, is it? In any case, don't most interpreters hijack the tab key to use to move focus between windows?

--Erik

_________________
Glimmr: Advanced Graphics for I7
blog | download | bug-tracker


Top
 Profile Send private message  
 
PostPosted: Tue Mar 15, 2011 9:07 am 
Offline
User avatar

Joined: Wed Oct 14, 2009 4:02 am
Posts: 963
I'm not sure.

Even if they do for character input, I think if a story file is specifically asking for tab to be a terminator they should do that rather than switch windows.


Top
 Profile Send private message  
 
PostPosted: Tue Mar 15, 2011 3:29 pm 
Offline

Joined: Fri Jul 16, 2010 2:46 am
Posts: 93
A quick update: I’ve released a version 2 of the example game, which should run substantially faster.

On Quixe I now get a few flickering/missed key-strokes, but substantially less, but running the native blorb is pretty seamless.

Let me know if you run into problems and please note, I still haven’t looked at how to handle disambiguation prompts!

Quixe
Gblorb

_________________
inkle: interactive stories
http://www.inklestudios.com


Top
 Profile Send private message  
 
PostPosted: Tue Mar 15, 2011 6:57 pm 
Offline

Joined: Mon Jun 09, 2008 8:58 pm
Posts: 679
Location: Seattle
This is really cool. :)

also, pressing the left arrow does something weird. It sticks a weird character onto the line and such. I'm on Google Chrome with your above Quixe link.

_________________
Blog at Gamasutra :: Programmer's Guide to Inform 7 :: Seattle I-F


Top
 Profile Send private message  
 
PostPosted: Tue Mar 15, 2011 7:29 pm 
Offline

Joined: Thu Oct 22, 2009 4:31 pm
Posts: 1137
joningold wrote:
A quick update: I’ve released a version 2 of the example game, which should run substantially faster.

On Quixe I now get a few flickering/missed key-strokes, but substantially less


I get a multisecond delay and spinning beachball after pressing return when running this second version in Firefox 3.6 (I've tried it on two Macs, one running 10.5.8, the other 10.6). I don't see that issue in Chrome on either machine.

joningold wrote:
I still haven’t looked at how to handle disambiguation prompts!


This post discusses ways to ascertain whether you are disambiguating or answering a yes/no question from within VM_ReadKeyboard():

viewtopic.php?f=7&t=1340&p=8175#p8175

An aside: You've already got pretty much got this completed, but if you were just starting, you might have founf the Glulx Input Loops extension useful (it lets you change the behavior of VM_ReadKeyboard pretty easily using I7 code).

--Erik

_________________
Glimmr: Advanced Graphics for I7
blog | download | bug-tracker


Top
 Profile Send private message  
 
PostPosted: Tue Mar 15, 2011 9:35 pm 
Offline

Joined: Thu Oct 22, 2009 4:31 pm
Posts: 1137
Ron Newcomb wrote:
pressing the left arrow does something weird. It sticks a weird character onto the line and such. I'm on Google Chrome with your above Quixe link.


I see the same character (the thorn) in Chrome, and also in Gargoyle. Odd characters are also added using the scroll wheel(!) in Gargoyle (latest release running on Mac OS 10.6).

--Erik

_________________
Glimmr: Advanced Graphics for I7
blog | download | bug-tracker


Top
 Profile Send private message  
 
PostPosted: Tue Mar 15, 2011 10:44 pm 
Offline

Joined: Tue Apr 27, 2010 1:02 pm
Posts: 797
Gargoyle maps the scroll wheel to keycode_PageUp / keycode_PageDown during character input. The function keys produce similar anomalies.

Also, unsurprisingly, Delete gets remapped to keycode_Delete, which then works like Backspace.

I've never understood why Glk fails to distinguish the two. Maybe I'm showing my age, but I haven't used a computer where both were available and they didn't work as expected. Of course, the Mac keyboard calls backspace 'Delete', which muddies the waters a bit, but the underlying functionality is the same: there's a key that erases input to the left of the cursor, and possibly a key that erases input to the right of the cursor. It seems like we could add a keycode_DeleteRight without causing too much trouble.


Top
 Profile Send private message  
 
PostPosted: Wed Mar 16, 2011 2:26 am 
Offline
User avatar

Joined: Thu Nov 04, 2010 6:30 am
Posts: 984
Location: Gothenburg, Sweden
On a very much less technical note:

With commands addressed to others (like "Anthuk, up"), the first word (the name of the person you address, e.g. "Anthuk"), is mapped to a verb ("attack" in the case of Anthuk). Adding a comma and a blank space will replace the comma with that verb (so "Anthuk, " results in "Anthukattack ").

"Anthuk,up" (without the blank) works as expected, though.

_________________
Man ska inte tro allt man tänker.


Top
 Profile Send private message  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 23 posts ]  Go to page Previous  1, 2, 3  Next

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group