Why You Should Avoid Processes
Author |
Message |
[Gandalf]
![](http://compsci.ca/v3/uploads/user_avatars/189297994e4c716fec7f1.png)
|
Posted: Fri Mar 04, 2005 7:34 pm Post subject: (No subject) |
|
|
Quote: Delays are another bad thing...I'll get into that later though.
Why are delays bad? Why don't you get on that some time soon, they only pause the code - whats bad about that? |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
ssr
![](http://siruisite.port5.com/ssr.jpg)
|
Posted: Fri Mar 04, 2005 8:34 pm Post subject: (No subject) |
|
|
I donno but I think that I've heard
delays are not really accurate
use Time.Elapse
8) |
|
|
|
|
![](images/spacer.gif) |
person
|
Posted: Fri Mar 04, 2005 9:30 pm Post subject: (No subject) |
|
|
u can actually read about how bad delays are in F10 but frankly it doesnt matter much for me |
|
|
|
|
![](images/spacer.gif) |
Martin
![](http://www.compsci.ca/wiki/images/4/46/CanadianStickUp.jpg)
|
Posted: Fri Mar 04, 2005 9:52 pm Post subject: (No subject) |
|
|
I'll write up a bit about delays later. Basically, they're bad because you've got your program structured like so:
code: | loop
<some unfixed amount of time passes processing stuff>
<a fixed time is delayed>
end loop |
What this means is that the speed of the game is directly dependant upon the speed of the client computer. |
|
|
|
|
![](images/spacer.gif) |
person
|
Posted: Fri Mar 04, 2005 9:54 pm Post subject: (No subject) |
|
|
isnt it always dependant on the clients computer (processing speeds and etc.) ?? |
|
|
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
Posted: Fri Mar 04, 2005 11:18 pm Post subject: (No subject) |
|
|
The idea is to control frame-rate, and pause for less on slower machines and during calculation heavy moments.
In practice, you don't want a Counter-Strike player to shoot twice as fast as the next guy just because one has liquid cooling installed. |
|
|
|
|
![](images/spacer.gif) |
Martin
![](http://www.compsci.ca/wiki/images/4/46/CanadianStickUp.jpg)
|
Posted: Sat Mar 05, 2005 10:01 am Post subject: (No subject) |
|
|
person wrote: isnt it always dependant on the clients computer (processing speeds and etc.) ??
No. Yes, on a faster computer, the animation will be smoother, but a player shouldn't be put at a disadvantage because they have a slower processor. Similarly, people with faster computers shouldn't be able to shoot 5 times faster than everyone else.
Let's say that you want each frame of animation to take 20 milliseconds.
Suppose on your computer it takes 10 ms to do all of the crunching, so you delay(10) at the end. Works exactly how you wanted it to on your computer.
You bring it over to your buddy's computer, who has a slower processor, so it takes 15 seconds to do the number crunching, but you still are delaying 10 at the end of each frame. So the game runs slower on his computer.
Now, the quick solution to this is to:
1. Determine the total time, GoalTime, you want the frame to last (in the above example, the total time was 20).
2. In each iteration of the loop, determine how long the number crunching took with Time.Elapsed.
3. Delay for the GoalTime - Time.Elapsed.
Now, what happens if the number crunching is longer than GoalTime? This is where time based movement comes into play, which I'll explain later. |
|
|
|
|
![](images/spacer.gif) |
Bacchus
![](http://img104.exs.cx/img104/9206/ravenmoon12ns.jpg)
|
Posted: Sat Mar 05, 2005 7:19 pm Post subject: (No subject) |
|
|
1 simple thing that is fixed in 4.0.5 Time.DelaySinceLast() |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Martin
![](http://www.compsci.ca/wiki/images/4/46/CanadianStickUp.jpg)
|
Posted: Thu Mar 10, 2005 10:34 am Post subject: (No subject) |
|
|
Nobody has taken me up on this 1000 bit challenge. So I'm raising the stakes. 2000 bits.
I still don't think it can be done. |
|
|
|
|
![](images/spacer.gif) |
StarGateSG-1
![](http://img61.imageshack.us/img61/4417/jesushulk2sq.gif)
|
Posted: Thu Mar 10, 2005 12:26 pm Post subject: (No subject) |
|
|
This program comes form the top!
code: |
monitor controller
export observe, report
var counter : int := 0
procedure observe
counter := counter + 1
end observe
procedure report (var n : int )
n := counter
counter := 0
end report
end controller
process observer
loop
% "¦ observe one event "¦
controller . observe
end loop
end observer
process reporter
var n : int
loop
controller.report ( n )
% "¦ report n events "¦
end loop
end reporter
fork observer % Activate the observer
fork reporter % Activate the reporter
|
This is form deep in the Documentation of turing and I even contacted Tom West to make sure. |
|
|
|
|
![](images/spacer.gif) |
Martin
![](http://www.compsci.ca/wiki/images/4/46/CanadianStickUp.jpg)
|
Posted: Thu Mar 10, 2005 1:10 pm Post subject: (No subject) |
|
|
And umm...what is that supposed to be doing? |
|
|
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
Posted: Thu Mar 10, 2005 1:44 pm Post subject: (No subject) |
|
|
StarGateSG-1 wrote: This program comes form the top!
...
This is form deep in the Documentation of turing and I even contacted Tom West to make sure.
And we all know that the said top thinks at a highschool level.
Martin : Your turn |
|
|
|
|
![](images/spacer.gif) |
StarGateSG-1
![](http://img61.imageshack.us/img61/4417/jesushulk2sq.gif)
|
Posted: Fri Mar 11, 2005 7:14 am Post subject: (No subject) |
|
|
The program runs 2 processes at the same time.
Quote:
And we all know that the said top thinks at a highschool level.
What do you mean by this ![Question Question](http://compsci.ca/v3/images/smiles/icon_question.gif) |
|
|
|
|
![](images/spacer.gif) |
Martin
![](http://www.compsci.ca/wiki/images/4/46/CanadianStickUp.jpg)
|
Posted: Fri Mar 11, 2005 8:05 am Post subject: (No subject) |
|
|
StarGateSG-1 wrote: The program runs 2 processes at the same time.
Quote:
And we all know that the said top thinks at a highschool level.
What do you mean by this ![Question Question](http://compsci.ca/v3/images/smiles/icon_question.gif)
Umm, that's easy enough to do without processes, although the above code seems somewhat abstract for me to provide a solid counter arguement.
And Tony, it's on. I'll have the processless code posted by the end of the weekend hopefully. |
|
|
|
|
![](images/spacer.gif) |
StarGateSG-1
![](http://img61.imageshack.us/img61/4417/jesushulk2sq.gif)
|
Posted: Fri Mar 11, 2005 8:29 am Post subject: (No subject) |
|
|
Quote:
Umm, that's easy enough to do without processes, although the above code seems somewhat abstract for me to provide a solid counter arguement.
Well if it is so easy do it.
If works exaclty the same as anyone other way.
The coed is not abstract, it is right out of the help file. |
|
|
|
|
![](images/spacer.gif) |
|
|