Programmer, game designer, geek.
Catching Elephant is a theme by Andy Taylor
So I got the AJAX chat fired up and working pretty well, then swapped out the text-file backend to a more robust (and cheaper on bandwidth) mysql backend that sends quanta of information in sensible groups, in JSON format, which is then parsed by the client and displayed correctly (because it’s easier to parse, I had the client insert the HTML instead of the server, *pats self on back* saving valuable bytes of bandwidth on a very rapid polling algorithm that I might later need to rework if I can find some way to ‘push’ updates to clients rather than relying on ajax polling).
Anyway, I need to think about the game engine backend now, the part which stores your “fields” and displays them to you in a sensible format. The frontend is kinda important too, but I’m figuring I can do that mostly in javascript since I’m getting along OK with it at the moment. The chat was relatively painless anyway (miranda might disagree, having heard my grunts and swears of exasperation and frustration…). Should I keep going with PHP for the backend, or add a C++ native module (still using php to authenticate a client connection, but calling the native module to receive information about the field). The advantage of C++ isn’t in the run-time speed (per ce), as you might expect, but the persistence - I want to be able to keep umpteen hundred “active” fields in RAM, swapping to disk only when a field gets old or too many connections are active at once. It’s more scalable, but it’s also more complex. I’ll need to open a socket on the C++ side (which will be a permanently running daemon) that’ll send data to the PHP script from the daemon, about one socket per connection but there’s no way to reliably determine how many connections there are from the C++ side. So I’ll need to open one socket that just accepts “knock knock!” type packets, and another that accepts persistent connections. The PHP script will need to deal with persisting the socket for its connection, but I can probably do that in the $_SESSION variable.
Wow, this was a long post. I’m incredibly excited about this project. Woo! Go me! I also might turn part of the client into a Java applet, depending on how well I can get JS to render isographic projected 2.5D without using WebGL (which isn’t supported on my platform).
And if you want an example of a decent websocket based server w/ chat, here be a link to the Cemetery Mania server:...
Ta very much, I’ll take a gander now and see what’s what.
Here’s one simple example from my repos. Basically, it’s a real simple ROM delivery mechanism using a single event...