Swoole

Swoole

Application and Data / Application Hosting / Web Servers
Software Developer at AvaiBook·
Needs advice
on
ReactPHPReactPHPSwooleSwoole
and
UnityUnity

Hi! Anyone had any experience programming a game-oriented UDP server in PHP using Swoole or ReactPHP? I'm considering trying PHP 8 to really test performance (updating players based on received inputs during a time, simple radius based collision detection).

Also, I would love to know if there is any article/documentation about architecture (code organization, better ways to structure the game logic than a giant switch/elseif, etc.).

READ MORE
4 upvotes·22.9K views
Replies (1)
Recommends
on
ReactPHP

Swoole is a fast c extension that’s great for speed but you’re stuck fast. Amphp or reactphp with libev are more flexible and stay really fast

READ MORE
2 upvotes·4 comments·5.9K views
Pablo Largo
Pablo Largo
·
December 21st 2020 at 8:48AM

Thanks for your opinion! What do you mean by "stuck fast"?

·
Reply
Vincent Vermersch
Vincent Vermersch
·
December 21st 2020 at 4:39PM

Debug breakpoint, middleware,...

·
Reply
Pablo Largo
Pablo Largo
·
December 22nd 2020 at 7:21AM

Huh yeah, saw something about not recommending xdebug at all.

I have one more question if you don't mind: ReactPHP's loop has several drivers to rely on extensions, and falls back from one to another until the StreamSelectLoop. Is there a specific driver more reliable/more efficient? If not considering PHP8, at least PHP7.4.

·
Reply
Vincent Vermersch
Vincent Vermersch
·
December 22nd 2020 at 12:28PM

Libev is the more stable and fast

You should also compile php to override the default max socket which is really low

·
Reply