Mr Speaker

mrspeaker's head in a monitor You find yourself at the entrance to the Hompage of Mr Speaker. In a darkened corner sits a trunk containing HTML5 games and some JavaScript tidbits. Next to it you spy a mastodon account. Exits are North, East, and .

Springs with Canvas

Fluffy linesEven more Canvas vs Maths fun! This JavaScript demo vaguely emulates some spring physics. There are 10 linked points - each of whose acceleration is determined by the distance to the spring in front of them. A nice curve drawn between each point using the quadraticCurveTo command. And it sure makes some perdy patterns.

The controls let you adjust the friction and the spring strength, as well as turn on or off the "trails". Clicking on the canvas element will toggle drawing (so you can "lift your pen"). Anyhoo, that's it. Make some lines!

3D with HTML5 Canvas: Part 2

Part 2! Unbelievable, my attention span is expanding in my old age... Today we are going to look at building on the 3d starfield of Part 1 by moving from dots to lines! By the end of this tutorial, we'll have a floating cube demo that we can scale and translate in 3D space. Use the arrow keys to move the "camera" in the X and Y directions and the ctrl and space keys to update the Z direction. When you lose the cube (and you will) just click on the page to reset everything.

Read on for more »

Convert WordPress fetch_rss to fetch_feed

I realised that I wasn't properly handling the return value on a feed I was grabbing to display the "Spiffy things from the Internet" section of the blog. I went to WordPress to look up the fetch_rss API details, only to find that it had been deprecated in WordPress 2.8.something. Being the ever-vigilant beacon of vigilance, I decided to covert my feed-fetching to feed_fetch. Here's what I had to do.

There's not much to it, for the simple stuff. But SimplePie (the rss class that feed_fetch uses) has a LOT of advanced options that you should check out. For a basic feed we just need to update a couple of calls.

Read on for more »

JavaScript games for iPhone

javascript games for iphoneThe good Mr Craig Sharkie (URL pending...) pointed me to a JavaScript game that was designed to run on the iPhone. Being a copycat, I decided to port my recently un-earthed platform game to be iPhone-friendly. Due to a serendipitous accident, the game was already 320x480 pixels - so all that was required was to handle the touch events. Left & Right to move left and right and Down to jump. Which kind of works, but is damn fiddly. Any suggestions for better controls? Anyhoo... here's the iPhone friendly version of Some Adventure-y Guy.

3D with HTML5 Canvas: Part 1

starfieldsAh ha! First time on this blog where I've started a "series" and got past post 1. (Check out post one: called "Part 0"). Well anyway, it turns out that my theory that simple 3D is easier that it seems was correct. Based on my vague inclination of how the maths should work, I constructed a lil' 3D starfield and, more importantly, I pretty much completely understand how it works. Pretty much completely. Accordingly, this post will cover setting up our "field of view" and projecting our 3D stars on to our 2D screen with parallel projection.
Read on for more »

3D with HTML5 Canvas: Part 0

A hypercubeMy breakthrough with high-school level vector mathematics got me thinking: maybe maths isn't as hard as my math teachers made it appear? And maybe it could be used for more cool stuff... like, making a 3D game? My programming skills are such that I could make games that come from 1980 - and Battlezone was made in 1980! It's time to enter the third dimension!

It's not going to be an easy ride, I'm sure. But if I take it slowly, I think I can conquer it. The plan is to start at the beginning, figure out the minimum amount of maths and theory as possible (but, like, really figure it out - not "get a D in trigonometry" figure it out) and make something. And by something, I mean the ultimate in 1980 tech: the spinning cube. And no cheating using canvas's built-in rotations and translations: I'm talkin' about doing it the hard way. I estimate it's going to take me 6 posts to get there:
Read on for more »

Faking email delivery in .NET

Well here's a tip that would have prevented me from barraging the owners of test.com and asdf.com with mountains of garbage test emails, had I discovered it many years ago (sorry about that, guys!). In .NET you can easily specify a location to dump emails ready to be picked up by the SMTP server. If you make it a location that the SMTP server doesn't know about, then they'll sit there forever, and asdf.com can rest easy at night...

Read on for more »