Computer Science Canada Real-time delaying |
Author: | Raknarg [ Thu Dec 22, 2011 8:48 pm ] |
Post subject: | Real-time delaying |
Is there a way to make it so that two computers can run an application on turing at roughly the same speed? I made a program on this computer and it was fine, and then I tried it on a different one and it was way faster. I know part of it is the speed at which it reads the code, but could it also be the length of time it uses the delay function? Like would two computers run delay (1000) at different speeds, or does it use the internal clock? |
Author: | Tony [ Thu Dec 22, 2011 8:51 pm ] |
Post subject: | RE:Real-time delaying |
you can easily test this out by delaying for a few seconds and timing it yourself, to see how accurate that is. For framerate control (the problem you are having), Time.DelaySinceLast is the easiest way to go about it. |
Author: | evildaddy911 [ Fri Dec 23, 2011 12:25 pm ] |
Post subject: | RE:Real-time delaying |
Time.DelaySinceLast only really works if both computers can run the program without more delay than your function causes |
Author: | Aange10 [ Fri Dec 23, 2011 2:42 pm ] |
Post subject: | RE:Real-time delaying |
Untrue. That's what Delay () is. Time.DelaySinceLast delays shorter if it takes the computer longer to execute the other functions. If my Time.DelaySinceLast is 300 ms, and it takes my computer 50 ms to complete the functions, it will delay me for 250ms. However, if my computer takes 200 ms to execute the functions, it will only delay me for 100 ms. But, at both senarios, it is taking each computer the same amount of time to finish the execution (300 ms). Now this obviously doesn't fix the problem if it takes the computer 500ms to execute. But it would help drastically. Instead of being 750ms difference in speed, it'd be a 200ms difference. That's nearly, what, 4x? |
Author: | mirhagk [ Fri Dec 23, 2011 3:27 pm ] |
Post subject: | RE:Real-time delaying |
@aange, I believe what evildaddy meant was that if the computer can't run the function in less than the delay specified. |
Author: | Aange10 [ Fri Dec 23, 2011 4:18 pm ] |
Post subject: | RE:Real-time delaying |
Ahh. I must have misunderstood. |
Author: | copthesaint [ Sun Dec 25, 2011 4:28 pm ] | ||
Post subject: | RE:Real-time delaying | ||
For real distance drawing try this
This will generally draw things at the same speeds. the only problem is that with all the math done by the program, frames may end up skipping every once and a while. |
Author: | Raknarg [ Sun Dec 25, 2011 9:16 pm ] |
Post subject: | RE:Real-time delaying |
Haha thatnks guys, i appreciate the suggestions. In the end, I tested it out on his computer and then changed the delay settings instead ![]() |