| Reply | « Previous Thread | Next Thread » |
|
Hi everybody,
my and a friend of mine are trying to develop a mobile game. it is a shoot'em up plane game like 'air gallet'. i have a few questions, i ll be glad to hear your opinions or your expriences about these 1) we have lots of sprite collection. for enemy 1, for enemy 2, for missiles. There are 3 or 4 sprites in each png. for example, when game starts, i load all sprites to static variables, and whenever i need one of them, i use the static variable to create a layer. Do you do the same? 2) we draw a fullscreen white rectangle to clear the entire screen and paint the map and then flushgraphics to update the screen. Is this the best and most efficient method? |
|
Hi,
I haven't used layers much, so I can't really comment on (1), but I suspect for (2) you will find it is faster to erase and draw only the small areas on the screen that have changed, if the background is largely static. If the entire background changes for each frame, this method is not much use. If you search on google for "Dirty Rectangles" you can find various ways for implementing the above approach. M |
|
1/ this issue depends on the device you are planning to use
if it has sufficient heap, yes, it is probably better to load every thing at once 2/ also depends, as mnem said. also if you need to draw only a few images each time, it might be more interseting, but if the game is composed of hundreds of sprites, it is better not to erase/redraw every thing |
|
thnx mnem, njzk2
our game is a shoot'em up type vertical air game. so, background is not static. it always flowing. and the enemy planes and their bullets are always moving. so what method should we use now? we are targeting s60 series for our game. |
|
The easiest way to see if your method will work, is to knock together a quick demo for the way you are doing things to get a vague idea of performance. If that's too slow, then consider different overall ways to do things, or if it's fast enough, flesh it out a bit and see if there are any specific areas that need optimising.
I know that's a very vague answer, it's tricky giving specific points of improvement for a general game concept :) One bit you could probably remove - if you are redrawing the entire background, you shouldn't need to clear it to white at the beginning of each frame, unless the background has transparent areas of course. Are you using a TileLayer to draw the background? It'll likely be faster than manually drawing it. Other bits and bobs: as njzk2 mentioned, if you can, create all objects at the start of the game/level as creating objects during gameplay can cause random slowness. For displaying scores or text, you probably want to create your own character drawing routines as the MIDP drawString stuff sucks a bit. M |
|
i am using TiledLayer for the background and i insert all the new created objects in to the map. then i use map.setViewWindow(...) to redraw background and objects.
the method i use for creating object: i create a static image type variable while the game loading. then when i need to create a game element, i use that image variable to create a new sprite. should i create and images and sprite first then create instances from them, or the method i use is better? |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Thread | Thread Starter | Forum | Replies | Last Post |
|---|---|---|---|---|
| Game directly to Game Folder | JPurd | Mobile Java General | 4 | 2008-04-15 21:34 |
| Great game Wappo | geonofear | News, Announcements and Job Listings | 2 | 2007-01-03 13:00 |
| Video Game Programming forum, PKZip library | aehrath | General Symbian C++ | 0 | 2004-11-09 18:27 |
| RPG Game Programming | sodox306 | Mobile Java General | 0 | 2004-02-12 05:15 |
| Game Programming in J2ME on Nokia | Nokia_Archive | Mobile Java General | 1 | 2002-05-24 15:11 |