<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=KOI8-R" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
With any game-- and most real-time applications, for that matter--
you will always want some kind of <i>rest(1)</i> (to rest ~one
millisecond). This saves CPU cycles, batteries, and makes fans less
noisey. My latest ENet game does it this way:<br>
<blockquote><i>while ( !_main_loop_exit ) {<br>
ššš while ( enet_host_service(client, &event, 0) > 0 ) {<br>
...<br>
ššš }<br>
<br>
ššš logic();<br>
ššš display();<br>
</i><i><br>
ššš rest(1);<br>
}<br>
</i></blockquote>
<br>
The biggest up side of ENet not wasting time waiting for something
to happen is other time-critic sections of code have a chance to do
something without having to wait (as is implied by this statement my
application is single-threaded). As long as the other code does not
take too long this allows ENet to check for a new events a hell of a
lot of times each second (as is bound by the CPU).<br>
<div class="moz-signature"><br>
<hr style="height: 1px;">
<p><span style="font-weight: bold;">Nicholas J Ingrassellino<br>
<a style="text-decoration: none;"
href="http://www.lifebloodnetworks.com/" target="_blank">LifebloodNetworks.com</a></span>
|| <a style="text-decoration: none;"
href="mailto:nick@lifebloodnetworks.com">nick@lifebloodnetworks.com</a></p>
<p style="font-size: 75%;">"<span style="font-style: italic;">The
idea that I can be presented with a problem, set out to
logically solve it with the tools at hand, and wind up with a
program that could not be legally used because someone else
followed the same logical steps some years ago and filed for a
patent on it is horrifying.</span>"<br>
- <span style="font-weight: bold;">John Carmack</span> on
software patents</p>
</div>
<br>
On 11/05/2010 12:28 PM, ÷ÑÞÅÓÌÁ× âÌÉÎÎÉËÏ× wrote:
<blockquote
cite="mid:AANLkTikf3VBW2r4ECwQHH3-gBUddAk5Mi3PvY-+TQoR5@mail.gmail.com"
type="cite">
<pre wrap="">I tried to set "0" but in such case cycle with "enet_host_service()"
consumes 100% of processor's power.
I did not understood the phrase "I haven't noticed any performance
issues with ENet" - you meant that there is nothing faster then ENet?
5 ÎÏÑÂÒÑ 2010šÇ. 19:21 ÐÏÌØÚÏ×ÁÔÅÌØ Ruud van Gaal <a class="moz-txt-link-rfc2396E" href="mailto:ruud@racer.nl"><ruud@racer.nl></a> ÎÁÐÉÓÁÌ:
</pre>
<blockquote type="cite">
<pre wrap="">I always use 0 for the enet_host_service() delay. And as for delays, I
haven't noticed any performance issues with ENet, although I'm doing a game
where framerate is very important.
Ruud
</pre>
</blockquote>
<pre wrap="">_______________________________________________
ENet-discuss mailing list
<a class="moz-txt-link-abbreviated" href="mailto:ENet-discuss@cubik.org">ENet-discuss@cubik.org</a>
<a class="moz-txt-link-freetext" href="http://lists.cubik.org/mailman/listinfo/enet-discuss">http://lists.cubik.org/mailman/listinfo/enet-discuss</a>
</pre>
</blockquote>
</body>
</html>