• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Increasing Speed of a game?

 
Ranch Hand
Posts: 311
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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)....

THANX....
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi

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().

Try it..
Thanks
 
Ramender Mall
Ranch Hand
Posts: 311
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?...

Thanx....
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ramender

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.
 
Ramender Mall
Ranch Hand
Posts: 311
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Pedpano,

Thanx for the advice....
Although that problem was resolved....yet you gave me 1 more thing to check if i face similar issue again....

Ramy....
reply
    Bookmark Topic Watch Topic
  • New Topic