Results 1 to 4 of 4

Thread: Hints for writing MIDlets...

  1. #1

    Hints for writing MIDlets...

    Taken from http://en.wikipedia.org/wiki/MIDlet...

    * Handsets impose a limit on the .jar file size. Nokia series 40, arguably the most popular handsets for mobile gaming, has a .jar file size limit of 64kB. The MIDlet size can be reduced through application of programmatic and design optimization techniques ( J2ME Optimizations. J2ME Optimizations. URL accessed on Oct 10, 2005.) and the use of obfuscators, PNG optimizers, and J2ME optimizers.
    * Heap sizes can be very small, around 200kb. Therefore, use as few objects as possible and delete references to them when they are no longer needed. Some image formats such as png will decompress to enormous sizes when loaded so don't keep too many of them. Catching OutOfMemoryErrors exceptions will normally not work.
    * Programs can not expect more than 20kb persistent storage. Don't keep more than you need. (Newer phones support additional APIs for file storing)
    * Keep in mind that a device can have very different screen dimensions, orientations and color depths. In other words, don't use absolute position.
    * Not all devices have keypads or pointers. One should be able to use the program with both. Key layouts may vary too, so use Game Actions for up-down-left-right-action style events.
    * Don't white list devices. If the program hasn't been tested on a specific device, assume it works. Never attempt to block the user from trying it.
    * Use an obfuscator such as Proguard( http://proguard.sourceforge.net/ ) to compress the MIDlet size.

    When using MIDletPascal...
    * Dont use params passed by reference, in the Java emulator the application crushes befor start Shocked
    * Using an array of record type may be derived in a bug
    * ImageFromImage() loses transparency information when compiling for MIDP1.0
    * http://piligrim.at.tut.by/java/ - Gaming API Support 1.1 for MIDletPascal
    * http://developers.sun.com/techtopics...rence/techart/ - for Java list of MIDP articles
    <br /><br />There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.<br />-= Paulo Coelho =-

  2. #2

    Hints for writing MIDlets...

    *Try to load all resource file in the application start up, becouse the accesing to mobil flash memory may be very slow.

  3. #3

    Hints for writing MIDlets...

    * MIDletPascal supports the following if constuct...
    Code:
    if value1 <> value2 then 
      Statement1; // Note ; at end 
    else 
      statement2;
    But it also allows classic pascal syntax...
    Code:
    if value1 <> value2 then 
      Statement1
    else 
      statement2;
    <br /><br />There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.<br />-= Paulo Coelho =-

  4. #4

    Hints for writing MIDlets...

    * ReadLine has a bug where it does not find the end of file. In my case this caused an endless loop. As a work around you may want to add "END" to the end of your text files. Something similar to the following code should do the trick...
    Code:
    procedure LoadLevel&#40; aLevel &#58; string &#41;;
    var
      res               &#58; resource;
      line              &#58; string; 
    begin
      // Levels
      res &#58;= OpenResource&#40; '/' + aLevel + '.txt' &#41;; 
      if &#40;resourceAvailable&#40;res&#41;&#41; then 
      begin
        line &#58;= ReadLine&#40;res&#41; ;
        
        iCounterY &#58;= 0;    
        while line <> 'END' do
        begin
          // Populate the Array
          for iCounterX &#58;= 0 to MAP_WIDTH do
          begin
            
          end;
          // Read Next line
          line &#58;= ReadLine&#40;res&#41;; 
          iCounterY &#58;= iCounterY + 1;
        end;    
           
        CloseResource&#40;res&#41;; 
      end;
    end;
    <br /><br />There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.<br />-= Paulo Coelho =-

Bookmarks

Posting Permissions

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