Hi all, I am developing a game for some samsung and LG mobiles...The problem I am facing is that the speed of the game is quite low....
I tried a few things which are--> 1. There is one Timer in my game, I made its value as low as possible(even upto 5).... 2. There were some "System.gc();" statements, I removed them (except ofcourse the necessary ones).... 3. I made it sure that there were absolutely no new Image creation in between the Game Screen(where I need speed).....
Kindly tell me if there are any other ways by which we can increase the speed...(I agree that it is project specific thing, but still there may be some tried and tested ways which may prove useful)....
use system.gc one time is ok... but call it whenever ur game level change to another level... so it's clear prev.level mem. and make ur own fuction which just assign null value to the variable that is no longer in use.. by this it's it's mem. will be recover by internal system.gc().
Hi Ashish, Thanx for ur reply....in fact the problem was solved..and as a matter of fact the cause of the problem was these System.gc()'s.....
yaar I have 1 query... my game was stopping coz, I was creating the sound files in b/w the game...So i tried to load all the sounds in the very beginning...And after creating sounds from the streams..I made the intermediate variables(like inputStream arrays and byte arrays) equal to null.....The program ran fine..... But when I exited from the MIDlet and then opened it again...NullPointerException came(while those variables are declared in the class definitions and then in the constructor of my Canvas class they are initialized properly..).......... Could u plz tell me Why did this happen?...
By chance are you loading yours sounds in a constructor, or in the method StartApp? If yes, try to load yours sound in other method, maybe in the method that you use to create the new game. If no, debug your program, the Eclipse has a good debuger.