Her first Marvel movie – watching The Avengers with Pam (part 1)

Now that Pam is 6 – and has proclaimed that she knows what is real and what’s not, and if it isn’t real, it’s not scary – we thought she might like to watch The Avengers with us. She loves the video game, so she was excited to watch it. We thought it might be a bit much for her, but she told us that if we’re with her, there’s nothing to be afraid of.

“You’ve got nothing to fear. I’m here.” – Steven Universe

I’d forgotten how slow the movie is for the first 30 minutes or so, but Pam was asking questions and talking to us about it throughout. We don’t mind that, it’s her first proper live action superhero movie, so there’s going to be a lot she wants to ask and comment on.

Our first “oh my goodness, our hearts are going to burst from the sweetness of this” was Black Widow’s first scene. Pam saw her and asked who she was. “That’s Black Widow.” “Oh yes. She is strong. Girls can be pretty AND strong.”

Oh my goodness YES, thank you for learning this lesson at 6 years old. You can be a princess AND kick butt.

Then Captain America appeared. He was in the gym, hitting a punching bag and generally having a good workout to forget the horrors of war. As soon as Pam saw him she exclaimed, “Oooooh! He’s a strong boy!” and she had a huge grin on her face. I asked her if she knew who he was. No, she didn’t. “That’s Captain America,” I told her. She didn’t say anything, but if the word “squee” had a physical expression, she did it.

I think our little girl has a crush on Cap.

We’re about halfway through the movie now. Thor has shown up and Loki is captured. Pam is eager for the Hulk to show up and smash things.

Pizza is in the oven, and the movie will resume when it’s ready.

I’m so proud of Pam. She’s still a little kid, but she’s got such a good foundation and outlook on things. She knows the things in the movie are only fun because they’re just a story. She knows girls can be pretty and strong. She knows Loki would be a bad king because he doesn’t care about the people. She knows that Iron Man and Thor were only fighting because they didn’t get to know each other and they were afraid. These were all her own conclusions.

I’ll update later with her reactions to the Hulk.

My daughter is a grunge/punk/metalhead and I couldn’t be more proud

 

Steven Universe is wonderful. Full of love acceptance, and magic lesbians from outer space (yes, really).

The music in it is exceptional. Such a variety of styles, from shouty punk rock to duets that could have come from a West End musical.

My daughter is currently obsessed with this song…

She jumps around, headbanging, yelling, being a joyous ball of pure energy. So I decided to find out if she’d like similar music.

Here are her opinions.

“It’s good, but it’s not as loud as the Steven Universe song.”

Hmm… loud… well I turned the volume up, but that’s not what she meant by loud.

“This is good! It’s loud!”

Ah, loud is Pam-speak means heavy and shouty! Ok, let’s see what more we can find…

“Yeah, this is good, I’d like to dance to this one! Yeah, I like this one a lot!”

I think we’ve found what she likes! Heavy speed grunge punk!

So proud!

Things my daughter learned from video games

My parents never liked the vidja gayms. They rot your brain, apparently. Mindless, useless, wastes of time staring at a flickering screen.

They didn’t like birthdays, or various bits of essential medical treatment either, so I’m glad I didn’t listen to them.

Over the past few months, Pam (6) has got into video games in a big way. She’d played Pokémon Go obsessively, and she still likes Magikarp Jump, but those were really fuelled by her love of Pokémon rather than a love of games.

She wasn’t really interested in anything if it wasn’t Pokémon.

Things changed when we got Sega Classics.

To start off, she played Toejam and Earl (because we could play it together and I could help her out), and the Sonic games, favouring Sonic 2 because of Tails. Cuteness rules her world, of course. That led her to Flicky, and that’s when things got interesting.

“Mama, it’s gone wrong. It keeps restarting.”

“Oh, ok, show me?”

“Look…”

If you’ve played Flicky, you’ll know it’s unforgiving. Games can last less than a minute when you start learning it.

Pam was learning. Specifically, she was learning that older games are tough. None of the constant progression if you wait long enough, that modern mobile games have. No, this was the original git gud.

The cat bumped into Flicky? GAME OVER.

You hit the spikes in Sonic? GAME OVER.

Fell off the edge in Golden Axe? GAME OVER.

Start again.

Learn.

Improve.

Die.

Do it all over again.

We’ve noticed a difference in her over the past month. Usually, she would be hesitant to try new things. She’d do them, but given the choice between playing something new, or watching a familiar episode of Pokémon, she’d choose Pokémon every time. But now, things are different. Given the large library of games in Sega Classics, she’s exploring them and picking ones at random. She’s found that she likes Ecco the Dolphin, too.

Her cries of “I can’t do it. It’s too tricky,” have almost gone. Now it’s a silent, resilient determination to win. Things aren’t “too tricky” any more, either. They’re “tricky like Flicky” now.

Her hand-eye coordination has improved. Her cooperation has improved. Her willingness to do work in order to get rewards has improved. Her concentration has improved.

She’s also learned about how skills transfer. To my surprise, she keeps returning to Golden Axe 2, which is the best in the series, but I didn’t think she’d like that style of game. She loves it though. So when she fired up Streets of Rage 2 (again, impeccable taste!) she said, “Mama, I thought older games were hard, but this one is easy!”

“Yes, that’s because you learned how to play this type of game when you played Golden Axe.”

“Oh, I didn’t know you could do that!”

“Yes babe, it’s called being able to transfer a skill, and it’s probably one of the most important things you can learn – that what you learn in one place can help you in other places too.”

So now she’s trying new things with glee, which has led her to Steven Universe.

I’m not complaining!

Nicola is doing a draw (with you!)

Over at Automattic, we have a fair few projects that use WebSockets. I knew what they were, but I’d never really used them for anything serious.

If you haven’t heard of WebSockets, they’re an easy way for a webpage and server to send messages to each other, without having to mess about with forms, or individual requests, or reloading pages.

My usual learning style is that I have to do something useful with a tech before I really get it. Sure, I can hold abstract concepts in my head, but it doesn’t really settle in until I do a project using them.

So I did this: http://draw.notnownikki.com/ – a 16×16 grid of pixels that anyone can draw on. You see everyone’s drawing happen in (pretty much) real time, and it works on most modern mobile devices too.

I learned a lot from doing this, both from a technical and personal perspective.

The technical stuff.

WebSockets are easy! Start a server, have the client open a connection, and send messages back and forth!

Managing events and making sure all your clients have the correct, up-to-date data, is hard.

When the user clicks on a pixel, a message gets sent to the server, saying, “Hi! We’re coloring in pixel X with color Y!”

Then, the server has to notify all the connected clients that the pixel has a new color, so a message gets sent out saying, “Someone just colored pixel X with color Y!” and everyone’s screen updates.

Simple, eh?

It would be if we only had one user. And if networks were all the same speed and everyone always got every message in the same order. But, we don’t, they’re not, and they don’t.

Let’s say that Emma and Nikki both go to color the same pixel at the same time. Emma used pink and Nikki used purple. The server gets these two messages, and sends the notification out to all the connected users. The server is going to do send out the “color it pink!” and “color it purple!” at pretty much the same time, and there’s no guarantee that connected users would get them in the order they happened. That means, some of the people might see pink as the last color applied to that pixel, and others might see purple.

That would be wrong and bad.

There were a few solutions I considered.

One was to put all incoming events (such as coloring a pixel) into a queue, and have them processed one by one and the results sent out to each connected user. That would work, but the nature of JavaScript made this the more difficult solution. If this was Java, I’d start a thread that dealt with the queue, and it would sit there happily processing. But with JavaScript, I can’t really do that. I can use signals to start the queue processing when a new event is added, but there’s the issue of what happens when two users add an event at the same time, and we’d have to have locking around that, and it just turned into a bit of a mess.

The next one I considered was to lock the entire image, update it, and send out the new data. This works, but means that every change is blocked when any change is getting processed.

What I finally settled for was locking individual pixels during a change. That meant that other bits of coloring could go on unblocked, but we’d be sure that the data we were changing wasn’t going to change underneath us when we were half-way done updating it.

Still, there was the issue of two changes going through, and not arriving in sequence to all the connected users.

See, while the state of the pixels was guaranteed to be consistent on the server side, the messages going out to connected users might not arrive in the order they were processed.

Let’s say we have 3 users. We get two changes to the same pixel, Emma sets it pink, and then Nikki sets it purple. Now those changes have to go out to the users. While both changes are getting sent out, the pink change might stall a little sending to the first user, because of some system conditions beyond our control. That means we could have finished sending out the purple change to all three users, when the pink change had not yet been sent. What happens then? The pink change carries on sending after the purple change had finished sending, and we have users seeing a pink pixel when they should be seeing purple!

We can’t have that, can we!

The solution here was a serial number for pixel changes.

When we set a pixel, we increment a serial number for it, so we can say “Change 5 to pixel X was to set it pink”, and, “Change 6 to pixel X was to set it purple.”

Now when clients get a message to set a pixel’s color, it can check if it has a more up to date change by comparing the serial number of the change. If change 6 (setting it purple) had been applied, and then we get a message saying to set it pink with a serial number of 5, we know that change is out of date and can be discarded.

And, it works!

Although there are scaling issues (it’s limited to a single nodejs process at the moment) these issues are solvable with a solution like Redis. But I doubt I’m going to need that with this application 🙂

The personal side.

I learned that, even though the canvas is a shared environment, I feel really strange going over stuff other people have drawn. It’s like I don’t want them to be offended if I add shading, or change it somehow!

I found I wasn’t alone in this either.

I also learned that the people on my twitter feed are lovely, and in a few hours of me tweeting out the address, we had collectively drawn this!

Screenshot from 2017-05-25 11-43-44.png

I plan to increase the resolution of the canvas and make the color palette nicer next, and hopefully get some of my pixel-arting friends to show what can really be done when people with talent collaborate!

What do you look like when you’re working?

I wonder if there’s a mental image people have of programmers that we’re always tapping away at keyboards, clicking, testing, and generally looking busy.

It’s been a long time since I worked in an office full of other programmers, so I’m not sure if that’s just the image I presume people have, or if it’s reality.

It’s certainly not my reality.

My daughter asks me many times a day if I’m working. I might be playing guitar, or staring into space, or spinning a pen, or making circles with my foot… and it’s generally in those moments that I’m working the hardest. Those distracting activities are allowing my mind to relax and visualise more complex scenarios and the bigger picture of how the thing I’m working on will fit together.

It’s in those moments that the solutions come to me.

I’ve worked like that for many years. Back when I was in a room full of programmers, one of them, Stephen, would see when I’d spaced out and he’d wait a few minutes and ask me what I was thinking about. Usually I’d reply, “I’m not sure yet. Something’s coming though.” And it usually did.

Writing this post is another distraction. Right now, my mind is full of dancing database tables, admin interfaces, workflow diagrams… stuff that would be overwhelming if I put it all on a whiteboard in front of me, but in my mind with a distracting conscious task going on, everything starts to fit together.

Perhaps I’m just weird though.

Do you want to watch a movie?

Hey, wanna watch a movie based on a William Gibson story?

Yeah!

Wanna watch a movie where Henry Rollins plays a doctor fighting for an underground resistance?

Yeah!

Wanna watch a movie where Ice T plays the leader of a group of freedom fighters in cyberspace?

Heck yeah!

Wanna watch a movie where Dolph Lundgren plays a manic street preacher?

YEAH!

Wanna watch Johnny Mnemonic?

Um, no thanks…

🙂