You Are Here:

Community: Developer Discussion Boards

#1 Old Game Programming Tips - 2006-01-30, 16:24

Join Date: Dec 2005
Posts: 17
scriptr
Offline
Registered User
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?
Reply With Quote

#2 Old Re: Game Programming Tips - 2006-01-31, 15:59

Join Date: Jul 2005
Posts: 4
mnem
Offline
Registered User
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
Reply With Quote

#3 Old Re: Game Programming Tips - 2006-01-31, 16:04

Join Date: Mar 2005
Posts: 499
Location: Paris
njzk2
Offline
Regular Contributor
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
Reply With Quote

#4 Old Re: Game Programming Tips - 2006-01-31, 20:06

Join Date: Dec 2005
Posts: 17
scriptr
Offline
Registered User
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.
Reply With Quote

#5 Old Re: Game Programming Tips - 2006-01-31, 23:41

Join Date: Jul 2005
Posts: 4
mnem
Offline
Registered User
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
Reply With Quote

#6 Old Re: Game Programming Tips - 2006-02-01, 08:42

Join Date: Dec 2005
Posts: 17
scriptr
Offline
Registered User
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 With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
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

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZidentifierQSxhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomE2fforumE2fshowthreadE2ephpE3ftE3d18645X qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE44iscussionQ qdcZtypeQUqfntypeZE44iscussionContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qfnZtopicQUqfnTopicZentertainmentQ qfnZtopicQUqfnTopicZj2meQ qfnZtopicQUqfnTopicZjavaQ qfnZtopicQUqfnTopicZmediaQ qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE44iscussionQ qfnZtypeQUqfntypeZE44iscussionContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE44iscussionQ qrdfZtypeQUqfntypeZE44iscussionContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ