BGE how check/uncheck Frame Limit at runtime?

Can check/uncheck Frame Limit at runtime?
i wish if possible to change easy to hard or hard to easy
game in runtime like csgo zombie mod speed

Thanks in advance

Done!

import bge

def main():

cont = bge.logic.getCurrentController()
own = cont.owner
scene = bge.logic.getCurrentScene()

T = cont.sensors["T"]
F = cont.sensors["F"]


if T.positive:
    #you can change by toogle key with logic bricks in to the Current Camera ;)
    frame_max = bge.logic.setLogicTicRate(100.0)    # key T the value 100.0 you can test your graphics card if work more set to max.To get max value set vsync off and uncheck frame rate in system game_settings. Remember after test back to check frame rate to script work property
    
if F.positive:
    #you can change by toogle key with logic bricks in to the Current Camera ;)
    
    frame_default = frame = bge.logic.setLogicTicRate(60.0) # Key F

main()

just use bge.setLogicTicRate() it work at runtime :slight_smile:

or

import bge

def main():

cont = bge.logic.getCurrentController()
own = cont.owner
scene = bge.logic.getCurrentScene()

T = cont.sensors["T"]
F = cont.sensors["F"]


if T.positive:
   
    #you can change by toogle key with logic bricks in to the Current Camera ;)
    
    # get the render module
    rend = bge.render

    # set Vsync mode to OFF
    rend.setVsync(rend.VSYNC_OFF)
if F.positive:
    rend = bge.render
    #you can change by toogle key with logic bricks in to the Current Camera ;)
    rend.setVsync(rend.VSYNC_ON)

main()

tic rate is not the FPS! read the quote. it is used to update logic.
Not sure if this is an actual fps limiter/scaler.

bge.logic.setLogicTicRate(ticrate)Sets the logic update frequency.
The logic update frequency is the number of times logic bricks are executed every second. The default is 60 Hz.
[TABLE=“class: docutils field-list”]
[TR=“class: field-odd field”]
[TH=“class: field-name, bgcolor: #EEDDEE, align: left”]Parameters:[/TH]
ticrate (float) – The new logic update frequency (in Hz).
[/TR]
[/TABLE]

Can check/uncheck Frame Limit at runtime?

Not sure if you can limit it like 40 fps instead of 60 fps, but you can toggle vsync.


render.VSYNC_ON # _OFF or _ ADAPTIVE


also post your code between

your code[/code*] (remove the *)