Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Android Game Dev

Name: CodeZombie 2010-09-04 3:58

>Start android game project
>make a cool little base for a simple game project
>impliment touch screen events
>lags like a motherfucker whenever i touch the screen
>research the problem, and find out that google doesnt have any kind of threshold to touch events, so the listener is completely flooded and the only thing you can do is put it in a highly controlled thread.
>I don't even know how to threading
>get discouraged

Fuck you, google.

Name: Anonymous 2010-09-04 17:15

>>1
Haha oh wow. Android really is the new J2ME, isn't it.

When we did J2ME games (and ported to Android), we ran the whole game on a separate thread and wrote our own event queue so that you're never blocking the hardware event thread. Only store the last touch position and action in some variables, and poll it from your thread. This way you won't be blocking on any touch events and all the touch events between each tick/paint will get compounded together. You'll probably lose some precision in your touch events this way but it's better than being flooded with them.

We actually did something a bit more complicated; we'd store a queue of touch events, and when receiving a new touch, there was a distance threshold from the last one for whether or not it would create a new event or just ignore it. This way if a touch goes down and back up while a frame is painting, you'll still get it.

I hate Java so god damn fucking much. I know this isn't specifically due to Java, but I still blame Java because the language encourages this sort of design.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List