[comp.sys.mac.programmer] Game Input -- thanks & quick summary

davet@cmi.com (David Temkin) (05/03/91)

I'd like to thank everyone who responded to my question about game input, 
both through the newsgroup and via email. To recap, here's what people had 
to say about getting input in an action game:

- GetNextEvent and WaitNextEvent are indeed slow, and others have found it 
necessary to bypass these in order to attain maximum performance in action 
games. A number of people suggested presenting the player with an option 
(perhaps "suspend background processing"), and leave it up to them as to 
whether the game will behave cooperatively.

- Larry Rosenstein pointed out that the GetOSEvent does pretty much the 
same as the aforementioned calls, except that it does no background 
processing and is therefore much faster. I can verify this, having tested 
it out with profiling. (Because of the functional difference, occaisional 
jerkiness or pauses in the program have been eliminated). There is also no 
particular need to call GetKeys or GetMouse when using this routine, 
unless one is interested specifically in the state of the modifier keys 
when pressed alone.

- Nobody knew of any lower-level interface to the mouse, i.e., one which 
does not return its results in terms of the screen coordinates of the 
pointer. 

- Using a dBoxProc window (modal dialog) prevents context changes. With 
this kind of window frontmost, an application cannot be switched out under 
MultiFinder -- whether or not the menu bar has been hidden. 

- Screen dimmers are a bit more problematic, especially when they have 
"sleep corners", but only when calling GNE/WNE -- GetOSEvent seems to 
bypass After Dark, at least, even with the sleep corner enabled. Juri 
suggested posting occasional events to prevent a screen-saver from kicking 
in when the game is unattended. He also suggested that this might be a 
problem best handled by the user -- i.e., they ought to shut off the 
screen saver first.

Once again, thanks to everyone who took the time to respond -- Juri Munkki 
(jmunkki@hila.hut.fi) (again!), Jon W{tte (d88-jwa@byse.nada.kth.se), 
David Hairston (hairston@henry.ece.cmu.edu), Larry Rosenstein 
(lsr@Apple.com),  Tim Endres (time@ice.com), and John Calhoun 
(2fmlcalls@kuhub.cc.ukans.edu). You folks have been very helpful.

p.s. -- I'm still wondering about that INIT that reserves the alternate 
screen.... Anyone up on this?


David Temkin
Center for Machine Intelligence, EDS Corp.
davet@cmi.com