Jump to content
Sign in to follow this  
Maddy

is it possible to sleep frames of a game?

Recommended Posts

Maddy

hi,

i want to make a hotkey for a beat em up game. i tried with autohotkey and it works, BUT theres one little problem. as i want to do combos with exact timing, the sleep times between attacks must be perfect. Somehow this doesnt work perfectly, as the sleep time (in milliseconds) seems to be not perfectly syncronious to the frames per second of the game (which is fluctuating). so it might be that the delay sometimes varies some milliseconds before or after than its supposed to be and the combo doesnt work anymore.

My idea now is, to not sleep in milliseconds, but let my script wait for the next frame(s) of the game. so is there any possibility to read out the frames of the game with autoit ?

thx, Maddy

Edited by Maddy

Share this post


Link to post
Share on other sites
JSThePatriot

Maddy,

It should be possible, but for anyone to actually know, they would need the name of the game. Also you will still have to do calculations on it because the sleep would still be in MS, but it could/would be flexible based upon the input it was receiving from the FPS...also with your FPS changing all the time, I don't know how feasible this will be to get down to x number of frames per second...It constantly fluxes so how would it know how many frames have actually passed? You would have to really dig into the game to see if any of that information is available. I would just do a more generic formula based on average FPS based on where you are in the game. I know you don't sit there watching the FPS to decide when to press the combo yourself. You time it in your head. Just use that timing in the scripts.

Thanks,

Jarvis


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites
Maddy

Maddy,

It should be possible, but for anyone to actually know, they would need the name of the game. Also you will still have to do calculations on it because the sleep would still be in MS, but it could/would be flexible based upon the input it was receiving from the FPS...also with your FPS changing all the time, I don't know how feasible this will be to get down to x number of frames per second...It constantly fluxes so how would it know how many frames have actually passed? You would have to really dig into the game to see if any of that information is available. I would just do a more generic formula based on average FPS based on where you are in the game. I know you don't sit there watching the FPS to decide when to press the combo yourself. You time it in your head. Just use that timing in the scripts.

Thanks,

Jarvis

the game is called Super Smash Brothers (N64 game) . and its emulated on the Project64 emulator. if its possible to read out anything of the game, can u tell me? or at least give me a tip how to face it?

thanks so far.

Share this post


Link to post
Share on other sites
JSThePatriot

the game is called Super Smash Brothers (N64 game) . and its emulated on the Project64 emulator. if its possible to read out anything of the game, can u tell me? or at least give me a tip how to face it?

thanks so far.

Maddy,

I don't have the game or the emulator, so I wouldn't know very much, but you could google for the information you're looking for. There should be something if you searched about scripting the frames per second or something along those lines.

Thanks,

Jarvis


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites
Maddy

theoretically i could send you the emulator and the game, its only few mb ^^

i actually raped google for that but with "frames" it mostly links to the frames of windows :)

Share this post


Link to post
Share on other sites
JSThePatriot

theoretically i could send you the emulator and the game, its only few mb ^^

i actually raped google for that but with "frames" it mostly links to the frames of windows :)

I still wouldn't know where to begin other than at google if I had the emulator, nor would I have the time. Try not to spell it all out. Try using 'FPS'.

Sorry I couldn't help more,

Jarvis


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites
jaberwacky

hi,

i want to make a hotkey for a beat em up game. i tried with autohotkey and it works, BUT theres one little problem. as i want to do combos with exact timing, the sleep times between attacks must be perfect. Somehow this doesnt work perfectly, as the sleep time (in milliseconds) seems to be not perfectly syncronious to the frames per second of the game (which is fluctuating). so it might be that the delay sometimes varies some milliseconds before or after than its supposed to be and the combo doesnt work anymore.

My idea now is, to not sleep in milliseconds, but let my script wait for the next frame(s) of the game. so is there any possibility to read out the frames of the game with autoit ?

thx, Maddy

Try this accurate sleep udf that I just found

;----- accurate sleep by ludocus -----
;www.autoitscript.com/forum/index.php?showtopic=74082&hl=accurate+sleep
Func _AccurateSleep($sTime)
    $timer=TimerInit()
    Do
        $tmp = TimerDiff($timer)
    Until $tmp >= $sTime
EndFunc

Share this post


Link to post
Share on other sites
Authenticity

If you don't care to spark your CPU with this _Sleep function then it's pretty accurate.

Share this post


Link to post
Share on other sites
Maddy

Try this accurate sleep udf that I just found

;----- accurate sleep by ludocus -----
;www.autoitscript.com/forum/index.php?showtopic=74082&hl=accurate+sleep
Func _AccurateSleep($sTime)
    $timer=TimerInit()
    Do
        $tmp = TimerDiff($timer)
    Until $tmp >= $sTime
EndFunc
thx !!! this works pretty well, not perfect but really close to that and much better than sleep , i think its enough

thank you for help

Edited by Maddy

Share this post


Link to post
Share on other sites
Maddy

another question, how do i make my hotkeys only work, when the window of my game is active? i tried winactive and some others but dont work... in autohotkey i got it to work with: #ifWinActive, SMASH BROTHERS - Project64k Version 0.13 Core 1.4

on top of the script.

Share this post


Link to post
Share on other sites
JSThePatriot

Try the following...

If WinActive("SMASH BROTHERS - Project64k Version 0.13 Core 1.4") Then
    HotKeySet("^!x", "_TerminateApp")
    HotKeySet("{PAUSE}", "_PauseApp")
Else
    HotKeySet("^!x", "")
    HotKeySet("{PAUSE}", "")
EndIf

Even though I didn't say it, that would obviously need to be in some sort of a loop that keeps your program alive when you're in other windows.

I hope that helps some,

Jarvis

Edited by JSThePatriot

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites
Maddy

hmmm with this, i get an error:

HotKeySet("t","")

Error: Unknown function name.

obviously cause i didnt definde the function "" ...

Share this post


Link to post
Share on other sites
Authenticity

You need to call this function without the second optional parameter to unset previous hot-key binding.

HotKeySet('t')

Share this post


Link to post
Share on other sites
azure

hmmm with this, i get an error:

HotKeySet("t","")

Error: Unknown function name.

obviously cause i didnt definde the function "" ...

Try

HoeKeySet("t")

The function parameter is optional, and if you don't specify it, it should unset the previous hotkey.

Share this post


Link to post
Share on other sites
herewasplato

Off-Topic:

Some typos are quite humorous in English/slang

HoeKeySet


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites
Maddy

thx guys, works perfectly now ! :)

Share this post


Link to post
Share on other sites
JSThePatriot

Maddy,

My bad on the HotKeySet...Glad you got it sorted.

Jarvis


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×