class implementation

classic Classic list List threaded Threaded
41 messages Options
123
Reply | Threaded
Open this post in threaded view
|

class implementation

Dolan, Ryanne Thomas (UMR-Student)
As part of a research project, I've written a 3D game engine using only Lua and luaglut.  To make things easier, I've borrowed ideas from pil and implemented C++-ish classes which support multiple inheritence and polymorphism.

Basically, I have a "class" function which generates a new class whenever it is called.  Each class generated by this function can be used to instantiate objects using the __call event.

For example, I can define classes like this:

Vector = class {};

Object = class {
    Position = Vector {0, 0, 0};
    Color = Vector {1, 1, 1, 1};
};

Particle = class {
    Velocity = Vector {0, 0, 0};
    Acceleration = Vector {0, 0, 0};
};


And I can define methods as expected:

function Vector.__add (v1, v2)
    assert (#v1 == #v2, "dim error");
    local r = Vector ();
    for i = 1, #v1 do
        r [i] = v1 [i] + v2 [i];
    end;
    return r;
end;

function Particle:update ()
    self.Position = self.Position + self.Velocity;
end;


Multiple inheritence is also simple, and results in a new class:

ParticleObject = class (Particle, Object);


To instantiate objects with a class, I can just call it:

p = Particle ();
o = Object ();
po = ParticleObject ();


Here is my implementation of the class function:

function class (...)

    local c = {};
    local m = {};
    setmetatable (c, m);

    for i = 1, select ('#', ...) do
        assert (type (select (i, ...)) == "table",
            "invalid base class specified");

        for k, v in pairs (select (i, ...)) do
            c [k] = v;
        end;
    end;

    c.__index = c;

    function m:__call (obj)

        obj = obj or {};
        setmetatable (obj, c);
        return obj;
    end;

    return c;
end;


The system is reasonably simple and much easier to read than any implementation I've seen recently.  I don't have to worry about :inherit or :new methods, for example.  Also, there is an obvious difference between an object and a class under this system, which for me makes things much easier to understand.

I've tried to make the system as effecient as possible.  Although defining a class requires some iteration, instantiating an object is very fast.

I think this basic idea could be extended and become quite powerful.  Any ideas for improving this system?  Is there another implementation that is inherently faster or more flexible?  Let me know what you think.

Ryanne Thomas Dolan


Reply | Threaded
Open this post in threaded view
|

Re: class implementation

Mildred Ki'Lya
Hi,

On Mon, 3 Apr 2006 14:55:07 -0500 Dolan, Ryanne Thomas (UMR-Student)
wrote:
> As part of a research project, I've written a 3D game engine using
> only Lua and luaglut.  To make things easier, I've borrowed ideas
> from pil and implemented C++-ish classes which support multiple
> inheritence and polymorphism.

Your class functions seems very interesting ...
What about including a such function into the standard library ? in the
next release of the language.

I really like using lua, it's simple, it's small, i've heard it's also
fast. But I always have to redefine some basic functions like this
one, ... It would be really great to have these functions included in
the standard library.

Mildred

--
Mildred       <xmpp:[hidden email]> <http://mildred632.free.fr/>
Clef GPG :    <hkp://pgp.mit.edu> ou <http://mildred632.free.fr/gpg_key>
Fingerprint : 197C A7E6 645B 4299 6D37 684B 6F9D A8D6 [9A7D 2E2B]
Reply | Threaded
Open this post in threaded view
|

RE: class implementation

Kerry Thompson-4
> I really like using lua, it's simple, it's small, i've heard it's also
> fast.

It can be fast if you use it right. Just be aware of its strengths and
weaknesses.

Lua is not a true compiled language like C++. It compiles to bytecode, or
tokens, not to machine language. It relies on a virtual machine to interpret
the tokens. Old-timers will remember UCSD Pascal, one of the first
virtual-machine languages.

Lua will never be as fast as a compiled language, especially in loops,
because the tokens have to be read and the appropriate machine-language
routines called. It will be especially slow with dofile(), because it has to
take the time to convert the text to bytecode. You can kill yourself putting
a dofile() in a loop.

Lua can, however, be quite fast enough when used right, and for the right
sort of application. I wouldn't want to write a 3D shooter engine in lua,
but we use it extensively with our game engines to define rooms, for
example, and it works quite well for that.

Its strengths are that you can optimize things, writing bottleneck routines
in C++ if you need. That, and the cross-platform capabilities, are really
powerful stuff.

Cordially,

Kerry Thompson


Reply | Threaded
Open this post in threaded view
|

RE: class implementation

Dolan, Ryanne Thomas (UMR-Student)


>Lua can, however, be quite fast enough when used right, and for the right
>sort of application. I wouldn't want to write a 3D shooter engine in lua,
>but we use it extensively with our game engines to define rooms, for
>example, and it works quite well for that.
>Kerry Thompson


Funny you say that, because I used my game engine to write a simple 3d shooter, and everything is implemented in Lua with the luaglut binding.  I certianly wouldn't argue with your assertion that Lua is slower than a compiled language, but writing a 3D game engine in Lua isn't that bad of an idea.  At least in my experience, the framerate of a game is influenced most by the geometry it is trying to render, not by the language in which it was written.  For example, my engine's framerate doesn't improve at all when I use LuaJIT, because in reality there isn't much Lua code being interpretted each frame.

winmail.dat (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: class implementation

Petite Abeille
In reply to this post by Dolan, Ryanne Thomas (UMR-Student)

On Apr 03, 2006, at 21:55, Dolan, Ryanne Thomas (UMR-Student) wrote:

> I think this basic idea could be extended and become quite powerful.  
> Any ideas for improving this system?  Is there another implementation
> that is inherently faster or more flexible?  Let me know what you
> think.

Couple of things:

- It would be nice to have the class system tied with Lua's module, so
one could import a class directly:

local Vector = require( "Vector" )

- Class definition shouldn't pollute the global name space.

- A class should be flexible, supporting 'mixins' (e.g. adding methods
to the class after the class has been defined). Presently you seem to
copy the parent(s) methods, preventing any class evolutions.

- Support a bare minimum of reflection (class, className, superclass,
etc).

- Support parent method invocation when overwriting an implementation
(e.g. super.init( self ) ).

All in all, I personally much prefer Tomas recent proposal which
elegantly leverage Lua's built-in module system:

http://lua-users.org/lists/lua-l/2006-03/msg00336.html

Something along these lines:

local function extends( aSuper )
         return function( aClass )
                 setmetatable( aClass, aSuper )
                 aClass.__index = aClass

                 aClass.self = aClass
                 aClass.super = aSuper

                 return aClass
         end
end

local class = module

class( "Object", extends(), package.seeall )
class( "MyObject", extends( Object ) )

My 2ยข.

Cheers

--
PA, Onnay Equitursay
http://alt.textdrive.com/

Reply | Threaded
Open this post in threaded view
|

Re: class implementation

Lisa Parratt
In reply to this post by Mildred Ki'Lya
Mildred wrote:
> Your class functions seems very interesting ...
> What about including a such function into the standard library ? in the
> next release of the language.
>
> I really like using lua, it's simple, it's small, i've heard it's also
> fast. But I always have to redefine some basic functions like this
> one, ... It would be really great to have these functions included in
> the standard library.

What's the big deal? That's the joy of reusable software - you write it
once, then merely use the same code in each project.

I can tell you for free that I'd be aggravated if any of the class
systems floating around the list were made language standard - to my
mind, they're trivially basic, and deeply wanting for functionality. As
such, I'd dyke out the standard one and replace it with the company
standard one we've been using for a couple of years now. It'd also
introduce support problems because I'd have to fend off new users with
experience expecting them to be there.

--
Lisa
Reply | Threaded
Open this post in threaded view
|

Re: class implementation

david herviou
In reply to this post by Dolan, Ryanne Thomas (UMR-Student)


Dolan, Ryanne Thomas (UMR-Student) wrote:

>
>Funny you say that, because I used my game engine to write a simple 3d shooter, and everything is implemented in Lua with the luaglut binding.  I certianly wouldn't argue with your assertion that Lua is slower than a compiled language, but writing a 3D game engine in Lua isn't that bad of an idea.  At least in my experience, the framerate of a game is influenced most by the geometry it is trying to render, not by the language in which it was written.  For example, my engine's framerate doesn't improve at all when I use LuaJIT, because in reality there isn't much Lua code being interpretted each frame.
>  
>
When using rendering technics there is a lot of geometrical computation
done by the CPU (now lot of on  GPU) , for example the frustrum culling.
Typically eight test are done to consider an object is in the field of
view or not (bounding box checking). So eight tests (a minimum if you
have hierarchical bounding box for an object) by the number of objects
to render give a lot of numerical computation in which lua is not as
fastest as a compiled language.
I think it is interresting to write a 3D game engine in lua if you rely
on C-C++ extension to do the ''bottleneck routines'' as mentionned by kerry.
Moreover, I think there is a also good reasons for people writing
"heavy" game engine sometimes wrote in assembler.
Cordially,
dh.

herviou.vcf (590 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: class implementation

Chris Marrin
In reply to this post by Dolan, Ryanne Thomas (UMR-Student)
Dolan, Ryanne Thomas (UMR-Student) wrote:

>
>> Lua can, however, be quite fast enough when used right, and for the
>> right sort of application. I wouldn't want to write a 3D shooter
>> engine in lua, but we use it extensively with our game engines to
>> define rooms, for example, and it works quite well for that. Kerry
>> Thompson
>
>
> Funny you say that, because I used my game engine to write a simple
> 3d shooter, and everything is implemented in Lua with the luaglut
> binding.  I certianly wouldn't argue with your assertion that Lua is
> slower than a compiled language, but writing a 3D game engine in Lua
> isn't that bad of an idea.  At least in my experience, the framerate
> of a game is influenced most by the geometry it is trying to render,
> not by the language in which it was written.  For example, my
> engine's framerate doesn't improve at all when I use LuaJIT, because
> in reality there isn't much Lua code being interpretted each frame.

Emma (http:// emma3d.org) is an application engine which interfaces to
Ogre3D and uses Lua for scripting. We have done tests and have found
that Lua can warp a 20,000 triangle mesh using a sine function at over
100 fps. No other interpreted language I have ever seen can get close to
that.

These days, most 3D animation is done using algorithms built in to the
3D engine. Ogre does it this way. But it is nice to know that Lua is up
to the challenge of doing high bandwidth manipulations at frame rate!

--
chris marrin              ,""$, "As a general rule,don't solve puzzles
[hidden email]        b`    $  that open portals to Hell" ,,.
         ,.`           ,b`    ,`                            , 1$'
      ,|`             mP    ,`                              :$$'     ,mm
    ,b"              b"   ,`            ,mm      m$$    ,m         ,`P$$
   m$`             ,b`  .` ,mm        ,'|$P   ,|"1$`  ,b$P       ,`  :$1
  b$`             ,$: :,`` |$$      ,`   $$` ,|` ,$$,,`"$$     .`    :$|
b$|            _m$`,:`    :$1   ,`     ,$Pm|`    `    :$$,..;"'     |$:
P$b,      _;b$$b$1"       |$$ ,`      ,$$"             ``'          $$
  ```"```'"    `"`         `""`        ""`                          ,P`
Reply | Threaded
Open this post in threaded view
|

Re: class implementation

Lisa Parratt
In reply to this post by Dolan, Ryanne Thomas (UMR-Student)
Dolan, Ryanne Thomas (UMR-Student) wrote:
> Funny you say that, because I used my game engine to write a simple 3d shooter, and everything is implemented in Lua with the luaglut binding.  I certianly wouldn't argue with your assertion that Lua is slower than a compiled language, but writing a 3D game engine in Lua isn't that bad of an idea.  At least in my experience, the framerate of a game is influenced most by the geometry it is trying to render, not by the language in which it was written.  For example, my engine's framerate doesn't improve at all when I use LuaJIT, because in reality there isn't much Lua code being interpretted each frame.

Ah, it delights me when I see a post like this, think to myself "surely
you'd be mostly using display lists?" and then realise how hopelessly
out of touch with games programming I've become over the years.

/me grumbles something about having to make do with 8 sprites, and being
*happy* about it ;)

--
Lisa
Reply | Threaded
Open this post in threaded view
|

Re: class implementation

Javier Guerra Giraldez
In reply to this post by Lisa Parratt
On Tuesday 04 April 2006 3:04 am, Lisa Parratt wrote:
> I can tell you for free that I'd be aggravated if any of the class
> systems floating around the list were made language standard - to my

Amen!

for slightly different reasons: to me OO programming is nice; but each project
i've had where it was an advantage, sooner or later it has to do some ugly
kludges because of the OO model, and it was always a different kind of
kludge.

that's why i feel that a more basic functional model (like Lua's) is more
generic, and if you want OO, after designing your classes, it's trivial to
design a OO model to fit them, and not the other way around.

IOW: each OO implementation has it's pros and cons, it's better to build just
the one you feel better for each specific project, and not impose an
arbitrary one as "official"


--
Javier

attachment0 (207 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

RE: Lua speed (was class implementation)

Kerry Thompson-4
In reply to this post by Dolan, Ryanne Thomas (UMR-Student)
> Funny you say that, because I used my game engine to write a
> simple 3d shooter, and everything is implemented in Lua with the
> luaglut binding.  I certianly wouldn't argue with your assertion
> that Lua is slower than a compiled language, but writing a 3D
> game engine in Lua isn't that bad of an idea.  At least in my
> experience, the framerate of a game is influenced most by the
> geometry it is trying to render, not by the language in which it
> was written.  For example, my engine's framerate doesn't improve
> at all when I use LuaJIT, because in reality there isn't much Lua
> code being interpretted each frame.

Interesting. I can see from what you, David, and Chris wrote that singling
out 3D wasn't the best way to get my point across. Let me phrase it another
way: I wouldn't want to do a high-speed twitch game using Lua to do event
handling. Hard-core gamers can tell (and will complain) when a game takes
1/100th of a second to respond.

My point, which I think most people understood, is that Lua has its
strengths and weaknesses, like any language. Its weakness is that it is
inherently slower than a compiled (or assembled) language. One of its
strengths is that, if you understand how it works, you can work around, and
overcome, that inherent [relative] slowness.

Most programs spend about 90% of their time in 10% of the code (YMMV). Chris
picked up on my comment about using C++ to clear bottlenecks in that 10%.

I work for a game company, and we use Lua for things ranging from kids'
games to ITV Know those menus you get on your digital cable TV? I may have
written those in Lua. Do your preschoolers play that new game from Disney
Online? We used a lot of Lua in that. I'm not criticizing Lua when I point
out that it can be slow. Merely pointing out that you should be aware of how
Lua works, and write your code accordingly.

Cordially,

Kerry Thompson


Reply | Threaded
Open this post in threaded view
|

Re: Lua speed (was class implementation)

Chris Marrin
Kerry Thompson wrote:
>...
> Interesting. I can see from what you, David, and Chris wrote that singling
> out 3D wasn't the best way to get my point across. Let me phrase it another
> way: I wouldn't want to do a high-speed twitch game using Lua to do event
> handling. Hard-core gamers can tell (and will complain) when a game takes
> 1/100th of a second to respond.

Hmmm. I've seen UI studies that show that humans can't discriminate
events that are less than 20ms (or 1/50th of a second) apart. So I have
a feeling that gamers that make such complaints are like audiophiles who
claim to be able to tell the difference between a tube and FET amplifier
(that should get all the audio geeks out of the woodwork).

My point is that Lua can be perfectly useable in a twitch game. It
depends on how much Lua has to run between the recognition of an event
and the visual result of that action.

--
chris marrin                ,""$,
[hidden email]          b`    $                             ,,.
                         mP     b'                            , 1$'
         ,.`           ,b`    ,`                              :$$'
      ,|`             mP    ,`                                       ,mm
    ,b"              b"   ,`            ,mm      m$$    ,m         ,`P$$
   m$`             ,b`  .` ,mm        ,'|$P   ,|"1$`  ,b$P       ,`  :$1
  b$`             ,$: :,`` |$$      ,`   $$` ,|` ,$$,,`"$$     .`    :$|
b$|            _m$`,:`    :$1   ,`     ,$Pm|`    `    :$$,..;"'     |$:
P$b,      _;b$$b$1"       |$$ ,`      ,$$"             ``'          $$
  ```"```'"    `"`         `""`        ""`                          ,P`
"As a general rule,don't solve puzzles that open portals to Hell"'
Reply | Threaded
Open this post in threaded view
|

RE: Lua speed (was class implementation)

Kerry Thompson-4
> My point is that Lua can be perfectly useable in a twitch game. It
> depends on how much Lua has to run between the recognition of an event
> and the visual result of that action.

Exactly. That's my point too. Use Lua right, and it can be fast enough for
just about anything. If you have to do a lot of processing between the
recognition of an event and the visual result, though, that's likely to be a
bottleneck you need to put into C. That doesn't mean you can't use Lua--just
that you may need to take advantage of Lua's ability to call C.

The original Castle Wolfenstein on the Apple II did a lot of its animations
at machine speed (lots of 6502 assembly language), but it handled keystrokes
with interpreted Basic. It was real easy to get ahead of the machine and
lose keystrokes.

Of course, today's processors are way, way beyond the 6502. On the other
hand, we demand a lot more of them, especially in games.

One last time, then I'll drop it: Lua is fast enough if used right. My point
is simply that you need to be aware of the way Lua functions in order to use
it effectively.

Cordially,

Kerry Thompson


Reply | Threaded
Open this post in threaded view
|

Re: Lua speed (was class implementation)

Jamie Webb-3
In reply to this post by Chris Marrin
On Tue, Apr 04, 2006 at 03:48:22PM -0700, Chris Marrin wrote:

> Kerry Thompson wrote:
> >...
> >Interesting. I can see from what you, David, and Chris wrote that singling
> >out 3D wasn't the best way to get my point across. Let me phrase it another
> >way: I wouldn't want to do a high-speed twitch game using Lua to do event
> >handling. Hard-core gamers can tell (and will complain) when a game takes
> >1/100th of a second to respond.
>
> Hmmm. I've seen UI studies that show that humans can't discriminate
> events that are less than 20ms (or 1/50th of a second) apart.

We may not be able to distinguish events that close together, but we
can certainly expect to time our actions to within 10ms. For example,
when returning a serve, a top tennis player must hit a ball moving at
something like 150km/h using a racquet with a 'sweet spot' maybe 10cm
in diameter. In 10ms, that ball has moved almost half a metre!

Given one racquet that somehow had even 1ms latency, and another that
didn't, I suspect our tennis pro could readily tell them apart, even
though he couldn't actually observe any difference.

Applying the same logic to games, a player may 'feel' a 10ms delay
even though his monitor may not refresh fast enough to have much chance
of actually seeing it.

-- Jamie Webb
Reply | Threaded
Open this post in threaded view
|

Re: Lua speed (was class implementation)

Lisa Parratt
In reply to this post by Chris Marrin
On 4 Apr 2006, at 23:48, Chris Marrin wrote:
> So I have a feeling that gamers that make such complaints are like  
> audiophiles who claim to be able to tell the difference between a  
> tube and FET amplifier (that should get all the audio geeks out of  
> the woodwork).

Hmm - I thought the harmonic distribution was different between the  
two, which is what makes valves sound warmer than ICs?

Not that I'm an audiophile - if I were, I could tell you *which*  
harmonics. My girlfriend does have an awesome speaker system, though :D

--
Lisa

Reply | Threaded
Open this post in threaded view
|

Re: class implementation

Niklas Frykholm-2
In reply to this post by david herviou

>>
>> Funny you say that, because I used my game engine to write a simple
>> 3d shooter, and everything is implemented in Lua with the luaglut
>> binding.  I certianly wouldn't argue with your assertion that Lua is
>> slower than a compiled language, but writing a 3D game engine in Lua
>> isn't that bad of an idea.  At least in my experience, the framerate
>> of a game is influenced most by the geometry it is trying to render,
>> not by the language in which it was written.  For example, my
>> engine's framerate doesn't improve at all when I use LuaJIT, because
>> in reality there isn't much Lua code being interpretted each frame.
>>  
>
For simple "test" or "toy" games without animation, AI, physics,
culling, etc, this may be true. But in my experience, when you start to
push these things you quickly become CPU bound rather than GPU bound
(even with a C engine) unless you take great care and spend lots of time
optimizing your program. Using Lua instead of C for the low level stuff
means you hit the CPU-limit faster.

// Niklas
Reply | Threaded
Open this post in threaded view
|

Re: Lua speed (was class implementation)

David Jones-2
In reply to this post by Lisa Parratt

On Apr 05, 2006, at 07:17, Lisa Parratt wrote:

> On 4 Apr 2006, at 23:48, Chris Marrin wrote:
>> So I have a feeling that gamers that make such complaints are like
>> audiophiles who claim to be able to tell the difference between a
>> tube and FET amplifier (that should get all the audio geeks out of
>> the woodwork).
>
> Hmm - I thought the harmonic distribution was different between the
> two, which is what makes valves sound warmer than ICs?

Not to mention Helmholtz compound tones (the real world isn't linear).  
I'm told that there are studies that show that when noise and hiss are
added to music then lots of people prefer it.

Yes people can tell the difference between a 10ms delay and a 20ms
delay.  Maybe not everyone.

Yes Lua is fast enough to write a game engine in, it's just a matter,
as Kerry Thompson says, of specifying your performance parameters.  How
many sprites / layers / polygons / pixel shaders do you want?

drj

Reply | Threaded
Open this post in threaded view
|

Re: Lua speed (was class implementation)

Bret Victor
In reply to this post by Chris Marrin
> audiophiles who claim to be able to tell the difference between
> a tube and FET amplifier

Heh.  I worked at Alesis for a few years, and met several who
certainly could.  And I met a lot more who couldn't but
thought they could.  It makes a difference when you're
designing digital simulations of tube and FET amps.  :)

As it happens, one of my biggest regrets about my time
at Alesis was that I hadn't heard of Lua yet.  Lua would have
cut my project times in half.

-Bret


Reply | Threaded
Open this post in threaded view
|

Re: class implementation

Michael Abbott
In reply to this post by Lisa Parratt
On Tue, 2006-04-04 at 16:52 +0100, Lisa Parratt wrote:
> Dolan, Ryanne Thomas (UMR-Student) wrote:
> > Funny you say that, because I used my game engine to write a simple 3d shooter, and everything is implemented in Lua with the luaglut binding.  I certianly wouldn't argue with your assertion that Lua is slower than a compiled language, but writing a 3D game engine in Lua isn't that bad of an idea.  At least in my experience, the framerate of a game is influenced most by the geometry it is trying to render, not by the language in which it was written.  For example, my engine's framerate doesn't improve at all when I use LuaJIT, because in reality there isn't much Lua code being interpretted each frame.
>
> Ah, it delights me when I see a post like this, think to myself "surely
> you'd be mostly using display lists?" and then realise how hopelessly
> out of touch with games programming I've become over the years.
>
> /me grumbles something about having to make do with 8 sprites, and being
> *happy* about it ;)

Sprites?  Luxury.  We used to have only tiles on the screen and they
weren't even contiguous.  We'd have to write the tiles in 3 banks down
the screen, nary more than two colours per tile, come home, and Dad
would beat us around the head and neck with a broken bottle, if we were
lucky!

;),
- Mab

Reply | Threaded
Open this post in threaded view
|

Re: Lua speed (was class implementation)

Chris Marrin
In reply to this post by Jamie Webb-3
Jamie Webb wrote:

> On Tue, Apr 04, 2006 at 03:48:22PM -0700, Chris Marrin wrote:
>> Kerry Thompson wrote:
>>> ...
>>> Interesting. I can see from what you, David, and Chris wrote that singling
>>> out 3D wasn't the best way to get my point across. Let me phrase it another
>>> way: I wouldn't want to do a high-speed twitch game using Lua to do event
>>> handling. Hard-core gamers can tell (and will complain) when a game takes
>>> 1/100th of a second to respond.
>> Hmmm. I've seen UI studies that show that humans can't discriminate
>> events that are less than 20ms (or 1/50th of a second) apart.
>
> We may not be able to distinguish events that close together, but we
> can certainly expect to time our actions to within 10ms. For example,
> when returning a serve, a top tennis player must hit a ball moving at
> something like 150km/h using a racquet with a 'sweet spot' maybe 10cm
> in diameter. In 10ms, that ball has moved almost half a metre!
>
> Given one racquet that somehow had even 1ms latency, and another that
> didn't, I suspect our tennis pro could readily tell them apart, even
> though he couldn't actually observe any difference.
>
> Applying the same logic to games, a player may 'feel' a 10ms delay
> even though his monitor may not refresh fast enough to have much chance
> of actually seeing it.

But typical video games only refresh at 60Hz, which is 17ms. Even a
great card might hit 120fps, which is around 8.5ms. The worst case
system response, if an event is received right after a frame starts
rendering, is double that, or 17ms. That means 17ms between the time a
button is pressed and the response is seen on the screen, assuming 0
event latency and 0 time to process the event. So I just don't see the
"gamers will notice a 10ms delay" argument. That's way below the
theoretical limit.

--
chris marrin              ,""$, "As a general rule,don't solve puzzles
[hidden email]        b`    $  that open portals to Hell" ,,.
         ,.`           ,b`    ,`                            , 1$'
      ,|`             mP    ,`                              :$$'     ,mm
    ,b"              b"   ,`            ,mm      m$$    ,m         ,`P$$
   m$`             ,b`  .` ,mm        ,'|$P   ,|"1$`  ,b$P       ,`  :$1
  b$`             ,$: :,`` |$$      ,`   $$` ,|` ,$$,,`"$$     .`    :$|
b$|            _m$`,:`    :$1   ,`     ,$Pm|`    `    :$$,..;"'     |$:
P$b,      _;b$$b$1"       |$$ ,`      ,$$"             ``'          $$
  ```"```'"    `"`         `""`        ""`                          ,P`
123