Design Issue

I am relatively new to J2ME and wireless development, and am currently writing a game to become more familiar with the idosincracies involved. My game is cell/map-based in which each cell contains an object, and the game contains approximately 20 levels, each containing a map of 20x30 cells. Since memory is a prime issue, each level contains a 2D-array of int’s that denote the type of object in the particular cell. To save memory, I made each level a separate class that can be swapped in-and-out as needed via an interface adapter. Does anyone know of a better way to design this particular issue? As it stands, I have a MIDlet class, a GameCanvas class, a class to manage the levels, an adapter class, and possibly 20 classes for each of the levels. Right now, I have only one level completed and incorporated into the game, and wonder if the JAR file will even get loaded after adding the other 19 level classes. Any suggestions? Thanks!

Since abstraction usually implies more classes I would recommend creating somekind of generalized Level class, which can create a Level based on some input parameters which are loaded at level change.

20+ classes is a lot for a j2me implementation, at least for a Nokia series 40 phone, which has 210 kB heap and 64kB limit on jar+jad size.

Thanks. This was the answer I was (dreadfully) looking for. Is there a place on the 'net where I can get information regarding capacities (memory/jad/jar sizes) for wireless devices?

Forum Nokia provides this sort of information for Nokia phones in its device table. Other manufacturers probably have similar information available.

Forum Nokia’s device table confusingly has two kinds of information: individual pages for some devices from the ‘Select a Device’ drop-down menu, and then a table with information for pretty much every device which you access using the ‘Series 40’, ‘Series 60’, ‘Series 90’, ‘GSM’, ‘CDMA’, ‘TDMA’ and ‘W-CDMA’ links. The info you want is in the table entries, not in the individual pages.

I woudl use an abstract class for abstract concept of level…slim it down to abstract methods that appear in both levels…