简体   繁体   English

Pygame事件队列最大值

[英]Pygame Event Queue Max

I'm taking some data over the network and inputing it into Pygame as Events. 我正在通过网络获取一些数据,并将其作为事件输入到Pygame中。

If the network is congested or the connection drops briefly, a lot of data comes at once when it becomes decongested. 如果网络出现拥塞或连接短暂中断,则当网络变得拥塞时,会立即发送大量数据。 When that happens, the event queue fills up fast to the point it gives me this error: 发生这种情况时,事件队列会很快填满,直到它给我这个错误:

error: Event queue full

Searching different sites has not yielded me any answers. 搜索不同的站点并没有给我任何答案。 What is the maximum number of events in queue in Pygame? Pygame中队列中事件的最大数量是多少?

Pygame is built upon SDL, and everything I've been able to find says the SDL event queue has a 127 element limit. Pygame是基于SDL构建的,我发现的所有内容都表明SDL事件队列的上限为127个元素。 What library are you using to push networking on to the queue? 您正在使用哪个库将网络推入队列? It seems like it would take an awful lot of network traffic to flood the event queue if you are flushing it every game loop, even if it gets backed up. 如果您在每个游戏循环中刷新事件队列,即使备份了它,似乎将需要大量的网络流量来淹没事件队列。 Also, what events specifically are you queuing here? 另外,您打算在这里排队哪些活动? Maybe you should be buffering your network traffic each game loop and throwing out irrelevant information so you don't generate as many events. 也许您应该在每个游戏循环中缓冲网络流量,并抛出不相关的信息,以免产生太多事件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM