Gorilla3D

Blogs of my work and thoughts

Php on Windows is ...

From my last post I found that depending on Memcached for fast memory access across multiple processes was a bad idea. So then I began to moved my work towards the php module shmop. Using in-processor memory I was able to up to process 300,000 events, while Memcached let me process 1,000-3,000 events. So now what did shmop yield? Well Considering I had to move to a binary format, and then depending on deseralization using pack / unpack php calls I get about 35,000+ events per second. Its not the 300,000 I was hoping for but the bottle neck is now CPU bound. So what do you do when the cpu becomes an issue? Well use a CPU with multiple cores! Multiple processes means you can now use multiple cores. Also since its using shared memory, its not bound by a single process. So If I spawn more then one world simulator on a 4 core system and then I could process up to 140,000 events per second.

Issues with Php on Windows

This was a huge disappointment, all the speed you get from linux doesn't transfer over with Windows. This is also true for Php GTK and Shmop. Php GTK Fullscreen redraws where about 10 frames a second versus the 30 FPS I got on Linux. As for shmop, I tried on a Window laptop so this might be the reason for this, but I hit about 1,000 (versus 35,000) events before the CPU would max out. Considering most people will only be running the game clients on Windows this isn't too bad. However Php Gtk will have to have some hard core dirty rect calcutions. Dirty Rect is a term used in 2D games where you find what areas of the screen to redraw, rather then redrawing the entire screen. Anyways onto the last issue with PHP on Windows, pcntl DOESN'T WORK ON WINDOWS!!! Gosh this is a big blow I think... I can revert to using a windows shell script to run the processes by themselves. If I completely ignore windows as an OS to run the server on, then I can get away with using Php GTK to run the threads via Gtk::timeout_add

Php on Wine 1.3

Wine is a program used to run Windows applications on Linux. Its awesome stuff, even better when you can test PHP on there as to running back and forth between machines for Windows testing. However I will note shmop does not work on Wine, I get "fixme:msvcrt:MSVCRT__sopen_s : pmode 0x01b6 ignored" Which results in me unable to write to memory.

Php GTK Running on Php 5.3 and Windows

The last issue I ran into was finding a version of Php-GTK that worked on Php 5.3 for windows. There is just some random link http://php-gtk.eu/en/apps/php-gtk-installer-for-windows that has Php 5.3 and GTK working together, wasn't the easiest thing to come across.

Php, Memcache, BInary Packing and Shared MemoryMultidimensional Arrays in C++ for a tilemap in SFML