int simulatepacketloss(ENetHost *host, ENetEvent *event)
{
return rand() / (double)RAND_MAX > 0.42 ? 1 : 0;
}
host->intercept = simulatepacketloss;
On 04/30/2013 06:21 PM, Nuno Silva wrote:
That may be true at some point, however in game development you don't want to
hack other people's devices just to simulate lag and packet loss. Valve for
instance already implements their own packet loss and lag simulation on their
Source engine, so it might not be a bad idea to give this some thought.
Otherwise, for the people who would be more interested in having that sort of
support than in hacking their OS like me, if Lee decides not to implement it
some tips on how we could do it ourselves would be useful for sure!
On Tue, Apr 30, 2013 at 4:16 PM, Shaun Reich <[email protected]
<mailto:[email protected]>> wrote:
packet loss simulation and latency are all something your OS (if it
isn't completely shitty), should be able to do. in the case of windows
you need to go through a lot of extra work to do it. in the case of
linux it's 2 short commands. there's no point in duplicating and
wasting effort on that, which is the job of the OS itself...
as for ENET_PACKET_FLAG_SEMI_RELIABLE, i'm wondering in which cases
one would actually want to use that?
NAT hole punching is definitely not something not-so-difficult. And
there are other libs out there that are meant for it that can be
integrated into your network handling.
"As a follow up I meant that it would allow us to simulate packet
drops and packet sending speed. Also allowing to simulate a % for
packet drop and packet sending through some parameter to the Host
would be just as good if it's too complicated!"
again, that's your operating system's job, not a job for a networking
library.
--
Shaun Reich,
KDE Software Developer (kde.org <http://kde.org>)
_______________________________________________
ENet-discuss mailing list
[email protected] <mailto:[email protected]>
http://lists.cubik.org/mailman/listinfo/enet-discuss
_______________________________________________
ENet-discuss mailing list
[email protected]
http://lists.cubik.org/mailman/listinfo/enet-discuss
_______________________________________________
ENet-discuss mailing list
[email protected]
http://lists.cubik.org/mailman/listinfo/enet-discuss