rendering, game physics and input events

I started this thread to discuss the way java handles user input ( keyboard and mouse ).

I think the render and game physics thing was discussed in other threads many times, so how do u handle keyboard input ?

When i use jdk 1.4.2 i have no choice i must handle all keyboard and mouse events in a separate thread ( i hate it ).

I was thinking about a own event loop which is filled by AWT Event Thread ( when i get keyboard or mouse event ) and this event queue is synced with main render/game physics loop where i can fetch one event from queue and handle it proper.

BUT is it worth all the effort ? Whats your opinion ? Do we need DirectInput for Java ???

Use JInput, this is exactly what it is for.

No i do not use JInput, i thought about JDK 1.4.x

Use only things and classes in sun’s jdk ( even if u use sun.* classes ), everything else would cause porting problems.

So without JInput which alternatives are out there ?

Well you asked “Do we need DirectInput for Java?” And the answer is JInput… which has been ported to Windows, Linux and Mac… so with the exception of J2ME (which doesn’t even have AWT so it must use it’s own input stuff), using it results in reasonably portable code.

Otherwise you have the right idea with using AWT Listeners to set flags indicating the state of keys. Then you poll those flags in your main loop. If this sounds like a pain… now you know why there is JInput :).
BTW… I would consider using sun.* classes at least as risky portability-wise, if not more-so, as JInput.

My Problem is, the Game MUST run on a browser without any extra installs.

If u have already installed JDK 1.4.x ( XP users must use this version ) and go to our website you can play our favorite MMORPG online, but u can also play it at home as a app.

Many users are not willing to download extra plugins and install them, we loose customers and money.

Seems my solutions is at the moment the best solution until Sun makes a JavaInput ( similiar to DirectInput).