MochiAds - Flash Game Ad Network
MochiAds is finally out the door! There's a pretty good summary of what we're doing on TechCrunch.
For the technically inclined, the UI for MochiAds is built with Pylons, Genshi and SQLAlchemy. The secret sauce is a combination of Python and Erlang code, and we've got Nginx as the gatekeeper. I've got nothing but good things to say about this whole stack. Erlang's module reloading, concurrency oriented programming model, and pattern matching has really been a dream.
For Flash game developers, we support ActionScript 1, ActionScript 2, and MTASC. Flash movies must be published in Flash 6 or later. Currently we support two ad formats: preloaders and interstitial ads. Either way it's just one line of code to toss in the movie.
The really Big Deal is that Flash game developers can make money off of their work throughout the entire lifespan of the project, especially if it spreads virally. It's no longer a bad thing if a portal "steals" the game without paying a licensing fee, the developer still gets paid!
Will you be sharing with us any of the nice tidbits you learned when integrating python and erlang?
Comment by Duncan McGreggor — 2006-11-21 @ 2:42 pm
There isn’t anything particularly interesting. Python and Erlang talk to each other by way of HTTP and flat text files. Some of the communication is JSON, but most of it is either Python speaking to Erlang in a subset of Erlang syntax, or Erlang speaking to Python in a subset of Python syntax. The reason I chose to just use the native syntax rather than JSON everywhere is for convenience (parsed JSON is cumbersome from Erlang) and efficiency (eval is a lot faster than a pure Python JSON parser).
Obviously they don’t talk a lot, otherwise I’d probably have chosen something more tightly coupled or compact… but this strategy was very easy to put together and it works perfectly.
Comment by bob — 2006-11-21 @ 3:17 pm
When you say the “Erlang syntax” do you mean the Erlang message wire protocol, or are you actually using something like eval in Erlang? I also wonder if a subset of the Python marshal format would be even faster than eval? Harder to debug, I guess.
I’ve never heard of Nginx before; what caused you to use that?
Comment by Ian Bicking — 2006-11-26 @ 12:10 pm
I mean Erlang syntax. Not a wire protocol. Marshal might work, but this data is for long term storage and I like to be able to grep it. It’s also harder to write a marshal implementation than it is to write a serializer that deals with tuples, floats, and strings.
I chose Nginx because Apache can’t scale and neither can Pound because of fundamental design flaws, LigHTTPD’s proxy implementation is broken, Squid was too hard to figure out (because all of the documentation is for forward proxies), and everything else seemed to be Just A TCP Proxy, which is not sufficient for the architecture I want. You’d know this if you’d have paid attention to the past few blog entries ;)
Comment by bob — 2006-11-26 @ 6:00 pm
Bob,
So have you moved from TurboGears to Pylons? If so (or not) any reasons why? I’m planning on giving it a try Real Soon Now.
Comment by Cliff Wells — 2006-11-29 @ 9:04 am
I moved from TurboGears to Pylons because I wasn’t using *any* of TurboGears features. Pylons has less code, it’s more modular, and it’s far easier to debug. Porting to Pylons actually ended up being less application code, too.
Comment by bob — 2006-11-29 @ 9:55 am
If your current interface between Python and Erlang wears out, you could use the Erlang C api from Python. This makes a Python process look to Erlang as if it is another remote Erlang node/process.
Comment by Patrick Logan — 2006-11-30 @ 9:20 pm