Posted: 8th Nov 2011 3:20
Hi, I'm starting a new app using AGK(trial). I'm going to buy AppGameKit in awhile, so please don't hate. The app only goes to a menu for now, only the quit option works when you click on it.

I'm not sure if its my computer or the app itself but i get really low FPS. It starts out fine in the beginning, but then the FPS drops low a 7-8.

Can some one help me out and check if its the apps code or my computer?

Ill include the app in my post so anyone can download and try it.
Here is the Download link:
http://www.yourfilelink.com/get.php?fid=722908

And here is the app code: There are some unused stuff in there so just never-mind it.
+ Code Snippet
rem AGK Application
//Author: Shawn W. Benson
//Game based on the mysterious substance known as starjelly
//A spaceshooter game, simple yet fun.
//Date of creation: Septemper 01, 2011
//Ported to AGK on: November 06, 2011

//Begin main scoure code

//*******************************Initailize the game*******************************

startgame() `call function to start the game and load everything nessesary

//*******************************Start the main game loop*******************************

repeat

select gamestate$

    case "menu":
    menu() //call function to load the menu screen
    endcase

    case "play":

    endcase

endselect





sync()
until gamestate$ = "quit" //only quit when the play chooses to do so

`endscreen() //call function to display a end message whne the player chooses to quit the game

end

//*******************************************Functions section****************************************

//This function sets up the game to ready it for play
function startgame()

setsyncrate (60, 0)

//*******************Figure out which device this game is being played on*****************************
if getdevicename() = "windows"
    setvirtualresolution (640, 480)
    global mousex# as float
    global mousey# as float
    global pointer$ as string = "mouse"

    endif

if getdevicename() = "Bada"
    setvirtualresolution (800, 480)
    global pointerX# as float
    global pointery# as float
    global pointer$ as string = "touch"
endif



//**************************************Declare all global variables***********************************
global gamestate$ as string = "menu" //set the main menu to appear after the splash screen



endfunction

//this fuction creates a menu screen for player to pick what they want to do next
function menu()

starjelly = createtext("STARJELLY")
settextposition ( starjelly, 320, 50)
settextsize (starjelly, 75)
settextalignment ( starjelly , 1)
settextcolor (starjelly, 96, 0, 191, 255)

if mousex# > 224 and mousey# > 155 and mousex# < 416 and mousey# < 177
    play = createtext("PLAY GAME")
    settextposition ( play, 320, 150)
    settextsize (play, 35)
    settextalignment ( play , 1)
    settextcolor (play, 255, 255, 255, 255)
else
    play = createtext("PLAY GAME")
    settextposition ( play, 320, 150)
    settextsize (play, 35)
    settextalignment ( play , 1)
    settextcolor (play, 96, 0, 191, 255)
endif

if mousex# > 243 and mousey# > 251 and mousex# < 395 and mousey# < 278
    options = createtext("OPTIONS")
    settextposition ( options, 320, 250)
    settextsize (options, 35)
    settextalignment ( options , 1)
    settextcolor (options, 255, 255, 255, 255)
else
    options = createtext("OPTIONS")
    settextposition ( options, 320, 250)
    settextsize (options, 35)
    settextalignment ( options , 1)
    settextcolor (options, 96, 0, 191, 255)
endif

if mousex# > 276 and mousey# > 352 and mousex# < 360 and mousey# < 378
    help = createtext("HELP")
    settextposition ( help, 320, 350 )
    settextsize (help, 35)
    settextalignment ( help , 1)
    settextcolor (help, 255, 255, 255, 255)
else
help = createtext("HELP")
    settextposition ( help, 320, 350 )
    settextsize (help, 35)
    settextalignment ( help , 1)
    settextcolor (help, 96, 0, 191, 255)
endif

if mousex# > 9 and mousey# > 449 and mousex# < 59 and mousey# < 470
    quit = createtext("QUIT")
    settextposition ( quit, 35, 450 )
    settextalignment ( quit , 1)
    settextsize (quit, 20)
    settextcolor (quit, 255, 255, 255, 255)
    if getrawmouseleftreleased() = 1 then gamestate$ = "quit"
else
    quit = createtext("QUIT")
    settextposition ( quit, 35, 450 )
    settextalignment ( quit , 1)
    settextsize (quit, 20)
    settextcolor (quit, 96, 0, 191, 255)
endif

if mousex# > 537 and mousey# > 451 and mousex# < 622 and mousey# < 464
    credits = createtext("CREDITS")
    settextposition ( credits, 580, 450 )
    settextsize (credits, 20)
    settextalignment ( credits , 1)
    settextcolor (credits, 255, 255, 255, 255)
else
    credits = createtext("CREDITS")
    settextposition ( credits, 580, 450 )
    settextsize (credits, 20)
    settextalignment ( credits , 1)
    settextcolor (credits, 96, 0, 191, 255)
endif

if mousex# > 256 and mousey# > 450 and mousex# < 380 and mousey# < 466
    highscore = createtext("HIGHSCORES")
    settextposition ( highscore, 320, 450 )
    settextsize (highscore, 20)
    settextalignment ( highscore , 1)
    settextcolor (highscore, 255, 255, 255, 255)
else
    highscore = createtext("HIGHSCORES")
    settextposition ( highscore, 320, 450 )
    settextsize (highscore, 20)
    settextalignment ( highscore , 1)
    settextcolor (highscore, 96, 0, 191, 255)
endif

mousex# = getpointerx()
mousey# = getpointery()

print (screenfps())
print (mousex#)
print (mousey#)



endfunction
Posted: 8th Nov 2011 4:21
Is your game running on device or simulator?

in simulator, 7-8 FPS ,is just the common number.

in device , 60 FPS, is common number.

They are different.
Posted: 8th Nov 2011 4:46
Oh, I didnt know there was a difference. I just started off with AppGameKit so im getting used to all the new commands and etc. Can you switch between simulator and device using the trial? If so how do you do it?
Posted: 8th Nov 2011 7:41
Can you switch between simulator and device using the trial?

Halley is talking about the AppGameKit iviewer...I think but either way I don't think that it's your problem.

If I'm reading your code correctly you call the CreateText() command multiple times each loop and so you accumulate a large amount of text objects so after a couple of seconds you will have 1000+ individual text objects. So you'll need to find away to only create each text object once and not every loop.
Posted: 8th Nov 2011 8:08
I see.
Posted: 8th Nov 2011 20:02
I see Hodgey has hit the nail on the head. You are recreating text objects every cycle, so it will slow down the longer you leave it. If you put a simple check for if the text exists around the create text code that should fix it.
Posted: 9th Nov 2011 19:57
Thanks guys, instead of using automatically assigned ID for my text, I declared global variables, and then checked if the text exists on the screen in the beginning of my Menu() function. Just a simple logical error, Im so used to coding with DBPro that I thought the createtext() command was the same as the center text command and only displayed the text on screen and did not actually create an object in the game world.

Thats something the AppGameKit documentation should explain.