Archived

This topic is now archived and is closed to further replies.

rizwanahmed24

[java] do threads increase efficiency in mobile games?

Recommended Posts

rizwanahmed24    122
hi i want to develop a game for mobiles using MIDP (remember this is my first try), should i use threads or go without it, how does the threads effect the efficiency, will the use of thread will have positive effect? if yes then how? bye

Share this post


Link to post
Share on other sites
OrangyTang    1298
Unless you actually do have multiple CPUs, multiple threads cannot possibly speed up your app (in fact context switching between threads will slow you down slightly).

Multi-threading *may* increase how responsive your app looks to the user, but thats going to depend on what you''re doing.

Share this post


Link to post
Share on other sites
markr    1692
Threads are not used to increase efficiency, but so you can do something else while one thread''s blocked. It would not be productive to have more than one thread trying to run at once.

No phone has SMP (some have multiple processors, but only one will be running Java code, the others for special tasks)

It''s normal to have one thread (timer) besides any threads which are created for you.

What I do, is do all the processing inside the timer thread, then call repaint().

Your drawing may get done in another thread. Events (like button pushes) might get done in yet another thread, or perhaps the same one as the drawing.

In any case, you will need to create a timer thread.

A useful way of doing this is using java.util.Timer

Mark

Share this post


Link to post
Share on other sites