Discussion Board

Results 1 to 3 of 3

Hybrid View

  1. #1
    Registered User
    Join Date
    May 2003

    architecture performance designpatterns


    I don´t have much experiences in gamedevelopment on devices with low computing power, and I wonder if there are some good designpaterns or rules for the software architeture to write a fast animation loops.

    In my first try my canvas class get´s very big and complex, because I did not realy use obj orientated programming, it was more structurised -> a very long if else branche

    now I think about using something like mvc -> architecture, but I don´t know what this will effect on performance, especially because I have to do a lot of collision detection..



  2. #2
    Registered User
    Join Date
    Mar 2003

    don't think Gamma et al

    OO design patterns won't help you much on such small platforms like mobile phones.

    On the smaller phones (series 30/40), memory is the primary constraint. The size of the jar file is limited to usually 32k or 64k, and the phones memory varies between 150 and 200k.

    Code is executed from the heap as well, therefore also takes up heap space.

    Performancewise it is a good idea not to leave up too much by-pixel rendering to java; however, most drawing code you can call from the Nokia UI API is native so that works pretty fast.

    In my first project, I designed too much in the OO way, and that became a problem after some time. However, some OO where you need it is not too bad of an idea, but that's probably something poeple will start to argue about with me

    However, you can also structure your project the procedural (modular) way by making each module a class, and all functions are static methods.

    But mind you: the more classes you have, the more overhead you get.

    Another problem is the ZIP file format used in JAR files. For small files like in a j2ME project, ZIP wastes around 20% and more on internal structures. (I had around 50 files in my project, and lost around 20% of the 64k of the jar file to ZIP overhead).
    What you can do about this is to use in "internal" archive, which works a bit like GNU tar - it does not compress, just makes one big file out of the many small ones, so that you get as a result less files in the JAR file.
    In your program, you will have to write special archive-reading code in order to load the assets from there, of course.

    Hope that helped for the start,



  3. #3
    Registered User
    Join Date
    May 2003
    Thank you Uwe,

    maybe you can give me some more advise if I tell you some more details of my problem..

    I write a pinball for a nokia series 60 phone. On its table I have a lot of things on wich I have to do collision detection (boarders, bumpers, paddles, roundings).

    In my first try as I wrote before, I used a long if- else- branch to decide wether or not my ball hits a "hot region" and if I have to do collision detection or not.

    Now my Idea is to create objects for all things on the table and store them in a vector, each time now when I move the ball I have to iterate about the whole vector, and have to call for each obj something like myobj.isHit(myBall)

    Now my question is if you have done something like this before, or if you think something like this can be handelt by the kvm inbetween the calls of paint of the paint loop..

    Especially because the collison detection needs some floating point math and trigonometric computing.. for this I use the jsciens.mathFP class wich is, as I asume, not the fastest..

    In your mailing you told me something about "internal" archive
    this sounds interesting to me, even if I hope that on a series 60 phone I will not have any memory problems, maybe you can tell me a good link where I can find out some more..



Posting Permissions

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