I'm converting a noise tutorial I wrote in ASP.NET to PHP or some scripting language that runs on a typical linux system. I used C# in the ASP version, and though I don't like ASP, C# is quite nice so I was happy with it. I'm moving my site over to a linux server, though, so the tutorial needs to be rewritten (that and I hated some things about ASP). Needless to say, I thought it would be easy.
I could rephrase: I hate languages that aren't strongly typed. Maybe I'm just not used to them? I hate having a function and having no idea what types are really being passed in. I guess that's the point- you shouldn't have to worry. But 2/3 of the time my operations on the parameters assume it is a certain type, like a string!
The implementation was easy, but I could not get it to work for the life of me. When it did work, it was extremely slow. I know I probably shouldn't be doing noise, a rather computational operation, in PHP but I liked the interactivity of my tutorial.
The problem was the PHP would internally convert between types, especially integer and long (I think). There were random places in the math where wrong numbers would result from an expression. I had to lay out each step of the expression per-line and cast it to the type I wanted it to be. Maybe I just don't know how to use PHP but that was the only way it worked! So. freaking. annoying.
This was so much freaking hassle on top of being so freaking slow that I gave up on it. Suddenly I had the bright idea of creating a c++ executable that would output the image data and I could use php for all the image creation and spitting out as an actual image. Got it running in an hour (whereas I spent 4-5 hours last night debugging php).
It's a pretty cool trick in my opinion. PHP calls the executable and fills in an array with the output, and in the exe I just printf() each float. Then in PHP I loop through the whole area and setpixel() in an image and output the image.
This made it sooo easy as well as met my speed requirement. (Seriously, it's about 500% faster).
Anyway, a sample php page can be seen here: Noise
This is the tutorial I wrote years ago. I need to fix a lot of stuff on it.. it's too wordy, isn't even really Perlin Noise, etc..