Home   About   Contact   Log in

Archive for May 29th, 2007

Processing Weirdness

May 29th, 2007 | No Comments | Filed in Programming, Projects

Today I came across a rather frustrating problem with Processing. I had the idea to start writing a little platform game to test some ideas out that I have. After Googling around for a bit I couldn’t find any sprite libraries, so decided I’d probably have to write my own.

Wanting to get something working with minimal fuss I knocked up a simple class that tracked the location of a circle on the screen. There was a “move” function and a “draw” function. A bit of test code was created and I told the circle to follow my mouse pointer. This is where the frustration began. When I moved the mouse there was a noticeable lag and jerky movement as the circle moved around. Thinking it was probably my code I removed it all and had a simple piece of code that drew a circle where the mouse was - that’s all it did. One line.

And the jerkyness persisted. Now, I had arbitrarily decided that a screen of 800×480 would be good and it seems this is the problem. If I make the screen 200×200 things work well, but that’s a completely useless screen size for anything. Also, it seems the Processing IDE randomly decides it doesn’t want to run my code, but wants to show a 200×200 grey application instead.

No idea what’s going on, I find it hard to believe Java is so bad that it can’t draw a circle on the screen at my current mouse position. Something else has to be getting in the way. I might boot Windows tomorrow and have a play in the Windows version. I want to make this work, it’ll be much better releasing little test pieces of code that run in a browser, rather than hoping people can be bothered to compile my source up. It spits out ready made applets and webpages that just need uploading to a webserver.

It’s going to work, it has no choice. Maybe the circle drawing routine isn’t very quick, and maybe I should try with a real image.

Visit my other sites: Photo Gallery | Insane in the Membrane | Main website