A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: better FPS?

  1. #1
    3DFA hobby scripter LewxX²'s Avatar
    Join Date
    Jul 2006
    Location
    Germany, Karlsruhe
    Posts
    198

    better FPS?

    Hi,
    I'm on the way to create a little 2D roll game,
    but the fps sometimes goes very low,
    does anyone know a way to improve my game to get a better fps?

    Here's my game (beta version)
    http://www.lewxx.eu/games/2dp.htm

    I got in fight-mode: 15-25 / 50 fps

    I think, later when I have added the sounds & more graphics,
    the fps will become still less.


    I've already included a fps check, that switch quality:

    PHP Code:
    in StartScript:
    quu=1
    ------------------
    Every Frame Script:
    if (
    fps <= 18){
        
    this._highquality=0
    } else { // more than 18 fps:
        
    this._highquality=1

    this helps a little, but it's not very nice

    PS: the enemies in fight mode look very awesome, look at them, fantastic!
    No, just kidding. I have to create some real enemies, that stick-figures are just for testing.

    or should I just wait for the new version of 3DFA with full Flash 9 support?
    Last edited by LewxX²; 06-21-2007 at 02:42 PM. Reason: forgot a questionmark in title ^^
    sorry for my bad school English
    btw. visit my Page: projects.lewxx.de
    or lewxx.de (<= German)

  2. #2
    3DFA hobby scripter LewxX²'s Avatar
    Join Date
    Jul 2006
    Location
    Germany, Karlsruhe
    Posts
    198
    hmm, can't edit my post, just want to say, that i changed the maximum fps to 40
    and the "fps for quality-change to" 15.
    sorry for my bad school English
    btw. visit my Page: projects.lewxx.de
    or lewxx.de (<= German)

  3. #3
    Game Master ConnELITE's Avatar
    Join Date
    Apr 2005
    Location
    United States, DC
    Posts
    474
    Hmmmm, I'd have to see the code to really help you improve the fps. By the way, how did you make the FPS display in the bottom right?
    BC

  4. #4
    3DFA hobby scripter LewxX²'s Avatar
    Join Date
    Jul 2006
    Location
    Germany, Karlsruhe
    Posts
    198
    FPS Start Script:
    PHP Code:
    fra=0t=0fps=0
    Every Frame Script
    PHP Code:
    fra++; 
    if (
    getTimer()>=t){
        
    fps=fra*2.5+" FPS";
        
    fra=0;
        
    t=getTimer()+400

    sorry for my bad school English
    btw. visit my Page: projects.lewxx.de
    or lewxx.de (<= German)

  5. #5
    Game Master ConnELITE's Avatar
    Join Date
    Apr 2005
    Location
    United States, DC
    Posts
    474
    Oh ok, thanks. Sorry I couldn't help any with your game.
    BC

  6. #6
    3DFA hobby scripter LewxX²'s Avatar
    Join Date
    Jul 2006
    Location
    Germany, Karlsruhe
    Posts
    198
    hmm my start script is about 515 lines

    the every-frame-script is just:
    PHP Code:
    // ===> FPS:
    fra++
    if (
    getTimer()>=ti){
        if ((
    fra*2.5) <= 15){
            if (
    quu == 1){
                
    quu=0
                this
    ._highquality=0
            
    }
        } else {
            if (
    quu == 0){
                
    quu=1
                this
    ._highquality=1
            
    }
        }
        
    fps=fra*2.5+" FPS"fra=0ti=getTimer()+400
    }

    // ====> Enemy attack 
    if (in_fight){        //when fighting
        
    wait--             // goes about 10 -130, relative to enemy
        
    if (wait<=0){
            
    root.geg_att() // make damage
        
    }
    } else {            
    // when walking on map
        
    w_upd--         // will be set to 15
        
    if (w_upd<=0){
            
    root.upd_bars()     // add some hp to bar and update it
        
    }
    }
    // ====> Read the level data, that should be loaded from an extern file
    if (data.loaded && tt){//if loaded: read level-data (only once)
        
    tt false    //tt=true at the start
        
    clv=1        // current-level = start-level = 1
        
    root.read(data.lv1)
        
    root.lvl_info()
    }
    level "map "+clv    // just to see which level is shown (at the bottom) 
    PS:
    could the low fps be caused by included fonts, or by the gradients?


    oh 2:15 in the night (in Germany), hmmm i think I will go to sleep now, tomorrow is school ^^
    sorry for my bad school English
    btw. visit my Page: projects.lewxx.de
    or lewxx.de (<= German)

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center