CodyBarrett Posted March 3, 2011 Author Share Posted March 3, 2011 UPDATE!! added a picture & put in a stupid and very inefficient way of deleting a character from the grid, just removes all the graphics, and redraws everything except the deleted player. anyone have a better idea? [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size] Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted March 3, 2011 Share Posted March 3, 2011 I don't know if it's better, but one thing you could do is draw every player to his own "buffer", then when a player dies you just stop drawing that buffer to screen. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
CodyBarrett Posted March 3, 2011 Author Share Posted March 3, 2011 i'll try it in an hour or so... might be faster than before considering i'm recreating every player and every grid line when a player crashes. just deleting a single graphic for each player would work? can there be multiple graphics on the same window? are they transparent and overlapable? hmmm..... [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size] Link to comment Share on other sites More sharing options...
CodyBarrett Posted March 8, 2011 Author Share Posted March 8, 2011 Fixed the GDI graphics spasms. however i thinks its even slower... updated at the top. [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size] Link to comment Share on other sites More sharing options...
CodyBarrett Posted July 12, 2011 Author Share Posted July 12, 2011 NEW VERSION completely rewritten, updated at the top, i've left the other scrips ive written for people to know how many attempts i've made with this, and how far its come along. let me know if the new version has any bugs or needs improvements! BTW, networking is still under development. [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size] Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted July 12, 2011 Share Posted July 12, 2011 draw_main() says "Use The Arrow Keys To Navigate:" but it listens to WASD! Confusing! Also the menu is almost uncontrollable because you have no Sleep() there, you only do it in the 'match' state! It's a bit slow too, I would have preferred a smaller Sleep()! You have some things to work on, but it's getting better! And some extra exclamation marks for good measure: !!!!! .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
CodyBarrett Posted July 12, 2011 Author Share Posted July 12, 2011 Oops. Forgot about that lol had the controls reversed then realized the players would be crossing over eachother to play. Im not sure how to dynamically make the sleep() so it runs well on all machines. I had sleeps in the main and pick bike funcs and not in the match func but i couldnt navigate the bike at all without crashing. Too fast. More tweaking. Thanks admiral! [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size] Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted July 12, 2011 Share Posted July 12, 2011 You could use a timer-based approach.Example using Sleep():$iFPS = 60 ;FPS you want $iColor = 0 ConsoleWrite("Asked for FPS: " & $iFPS & @LF) ;Calculate needed sleep $iFPS = 1000 / $iFPS AdlibRegister("_Exit", 5000) $iTimer1 = TimerInit() ;For calculationg actual fps $iTimer2 = TimerInit() ;For sleep $iLoopCount = 0 While 1 Do Sleep(10) Until TimerDiff($iTimer2) > $iFPS $iTimer2 = TimerInit() $iLoopCount += 1 If TimerDiff($iTimer1) > 1000 Then $iTimer1 = TimerInit() ConsoleWrite("Actual FPS: " & $iLoopCount & @LF) $iLoopCount = 0 EndIf WEnd Func _Exit() Exit EndFuncNot very good as it only works in 10ms steps._HighPrecisionSleep() (<--- link) is a lot better in this situation as it can go a lot lower (but 1ms is probably good enough, don't you agree? ):expandcollapse popup$iFPS = 60 ;FPS you want $iColor = 0 $hDll = DllOpen("ntdll.dll") ConsoleWrite("Asked for FPS: " & $iFPS & @LF) ;Calculate needed sleep $iFPS = 1000 / $iFPS AdlibRegister("_Exit", 5000) $iTimer1 = TimerInit() ;For calculationg actual fps $iTimer2 = TimerInit() ;For sleep $iLoopCount = 0 While 1 Do _HighPrecisionSleep2(1000, $hDll) Until TimerDiff($iTimer2) > $iFPS $iTimer2 = TimerInit() $iLoopCount += 1 If TimerDiff($iTimer1) > 1000 Then $iTimer1 = TimerInit() ConsoleWrite("Actual FPS: " & $iLoopCount & @LF) $iLoopCount = 0 EndIf WEnd Func _Exit() DllClose($hDll) Exit EndFunc ; Original Name...........: _HighPrecisionSleep() ; Parameters .............: $iMicroSeconds - Amount of microseconds to sleep ; Original Author ........: Andreas Karlsson (monoceres) ; Heavely edited by ......:Alexander Samuelsson (AdmiralAlkex) Func _HighPrecisionSleep2($iMicroSeconds, $hDll) Local $hStruct $hStruct=DllStructCreate("int64 time;") DllStructSetData($hStruct,"time",-1*($iMicroSeconds*10)) DllCall($hDll,"dword","ZwDelayExecution","int",0,"ptr",DllStructGetPtr($hStruct)) EndFunc .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
CodyBarrett Posted July 14, 2011 Author Share Posted July 14, 2011 thats interesting, both of them, the first would be usefull for games, and the second, wow, a NANOseconds? thats impressive... but, i'm still looking for, say a dynamic sleep-speed optimized for pcs, depending on the CPU speed? it runs (currently) fine on my 3ghz single core x86, but on my buddies machine its much faster, dual-core 2.6ghz x64. i'd like to make the run-time speeds equal for any machine. [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size] Link to comment Share on other sites More sharing options...
wraithdu Posted July 14, 2011 Share Posted July 14, 2011 Maybe run some kind of system benchmark when the game starts to dynamically adjust your sleep? Like do some mathematical calculation, see how long it takes, and use that to guestimate how fast the machine is. It won't be perfect, but might get you close. Link to comment Share on other sites More sharing options...
CodyBarrett Posted July 14, 2011 Author Share Posted July 14, 2011 i've updated the Download link with some minor changes, including a simple? sleep calculation. is that what you've been looking for? [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size] Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted July 14, 2011 Share Posted July 14, 2011 Why are you basing the speed on @CPUArch? That makes no sense. Granted, x64 apps are faster, but you need x64 AutoIt (@AutoItX64) for that, a x64 cpu is irrelevant as the user could be on a x86 OS or run x86 AutoIt. And I gave you dynamic sleep above. Did you look at the scripts I posted? .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
CodyBarrett Posted July 14, 2011 Author Share Posted July 14, 2011 i did, the first one slowed it down so much that a sleep wasn't necessary while getting the timer diffs in its own DO LOOP. and the second didn't seem usefull as i need a dynamic, not a precise sleep. [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size] Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted July 14, 2011 Share Posted July 14, 2011 You are missing my point! $iTimer2 = TimerInit() ;Your script here $iLoopCount += 1 Clearer now? Only sleep for as long as necessary .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
CodyBarrett Posted July 14, 2011 Author Share Posted July 14, 2011 i believe so, its MUCH faster on my machine now... is it too fast for you guys? (updated the DL link) thanks admiral [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size] Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted July 14, 2011 Share Posted July 14, 2011 The game is fast now, but that may not be a bad thing But now the menu is too fast again, maybe use accelerators instead? .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
CodyBarrett Posted July 14, 2011 Author Share Posted July 14, 2011 While True If $State = 'main' Then Sleep (75) main () ElseIf $State = 'pick_bike' Then Sleep (75) pick_bike () ElseIf $State = 'match' Then Start_Cycle_Sleep () match () Finish_Cycle_Sleep () EndIf WEnd this fixes it for MY machine, what about yours? [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size] Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now