I got mugged today

I got mugged today, in Kista, Stockholm, Sweden. They took my phone, credit cards, asked for credit card passwords (sic!), and started looking how to look inside my backpack. They held a knife to my throat when I said I won’t give them the PINs, and when I screamed for police they beat me up a little and run away. Few interesting observations:

1) I would’ve had a knife in my pocket like I always do if it wasn’t for airport security that doesn’t let you take one. I would still be in a 3v1 at a severe disadvantage, but all of the chances of defending myself were taken away in the name of security. Thanks, law.

2) They run away as soon as I started making noise, but possibly because they already had some loot; it’s possible that they’d silence me and search properly if I started screaming right away. I’ll miss the phone numbers and pictures from the phone, but I take some comfort in the fact that nobody’s going to buy a used, worn-out Jolla phone, and that they didn’t manage to take anything from the credit cards in the 15 minutes I needed to block them.

3) Right after that my first priority was blocking the credit cards, changing my email password and revoking my ssh keys. The latter two are hardly recoverable from the phone that you don’t know the passcode to, not in a matter of minutes anyway, but with the police, ambulance etc it took at least an hour for me to get to a safe place with the internet and take call of all the things that I actually still had. Also, Google is not smart enough to terminate your existing IMAP sessions after you change the password to your account (I received the “your password has been changed” email while logged in with the old one). Pathetic.

4) Swedish police was quite interested in possible fingerprints at first, but then lost all interest after a dog couldn’t sniff out the attackers. Either they gave up on the case as soon as the dog did, or realised that it won’t be much use anyway. Clearly, taking fingerprints off your citizens isn’t worth fuck all. Swedish ambulance figured that a hit on the head didn’t kill me and declared that even if my toes are broken (they hurt quite a lot) you don’t put toes in casts anyway, so I can go get myself an xray at the hospital if I feel like it. Sure, I’m gonna call a taxi with my stole phone and pay for it with my stolen money. Good riddance.

5) One of the first things police asked for is “Do you have «find my iphone?»” If you have an iphone, get yourself a “find my iphone” I guess.

Bottom line, I’m okay, but don’t expect me to answer my phone for a while (not that I was very good at answering it anyway :))


New game: Space Invaders

It’s been a while since I published RetroRacer, but a lot of new things happened in Steroids too! So many things that I backported the old games to the new engine; I’ll be testing them each time to see if I’m introducing any breaking changes. But! back to Space Invaders.

Image

(brave ship fighting off alien hordes)

 

The game is now available at https://github.com/tadzik/steroids. Below I’ll outline some of the new features in the engine itself.

Animations

It is now possible to load animations from spritesheets (example here), and tell Steroids to animate them over time.

self.load_spritesheet(‘invader’, ‘assets/invader.png’, 72, 32, 7);

my $invader = self.add_sprite(‘invader’, $x, $y);

self.add_animation($invader, Any, 200, True);

In order: load a spritesheet of seven 72×32 images, put it on screen an animate all its frames (Any), changing a frame every 200 miliseconds, and play it in a loop (True). The ships will rotate and look nice :)

Gamepad support

method update($dt) {
    my $pad = self.gamepads[0];
    my $analog = $pad.analog_percentage($pad.analog_left_x);

    if self.is_pressed(“Left”) or $pad.dpad_position(“Left”) {
        $!player.x -= 15;
    } elsif self.is_pressed(“Right”) or $pad.dpad_position(“Right”) {
        $!player.x += 15;
    } elsif $analog.abs > 0.1 {
        $!player.x += Int(15 * $analog);
    }

    …

}

    

New steroids features gamepad support! At this point the only supported one is the Xbox controller (I accidentally used the old SDL joystick API instead of a new, shiny gamecontroller API), so it’s all a little bit experimental. But, as you can see, it works pretty well and is quite useful indeed!

Game states

class Main is Steroids::State {

    …

}

 

class Menu is Steroids::State {

    …

}

 

given Steroids::Game.new {
    .add_state(‘menu’, { Menu.new });
    .add_state(‘main’, { Main.new });
    .change_state(‘menu’);
    .start;
}

What’s going on here? We have to separate game states (one for the menu and one for the actual game), and we can switch between them at any point using the change_state() method. For example, somewhere in Menu’s code:

method keypressed($k) {
    if $k eq ‘S’ {
        self.reset_state(‘main’);
        self.change_state(‘main’);
    }

    …

}

The states themselves are passed in as code references for the sake of the reset_state() method shown above. You can think of them as factories. The reset above is necessary, so each time you start a new game, it actually starts anew instead of continuing the old one (which is probably either lost or won by that time).

I probably forgot about something, so if anything is unclear just write it in the comment section. Go try out Space Invaders, and don’t forget about the soundtrack!

I’ll be talking about Steroids next weekend at this year’s Polish Perl Workshop; make sure to stop to find out about the latest developments and future plans.


Zebras in the Perl 6 herd

Well, the #perl6 herd mostly. Where did they come from? Well, it all started with this tadzik guy one day on the #perl irc channel.

tadzik  | good evening zebras!
colomon | zebras?
tadzik  | oh, I just felt a need for a funny greeting
tadzik  | how are things?

Zebras had to wait to become noticed until the morning next day:

masak   | <tadzik> good evening zebras!
masak   | I for one hope this will become an instant classic :)
jnthn   | It may, but it's not black and white.

And it did became, actually. Since that day, zebras have been mentioned 230 on #perl6, my irc logs say. In a various forms, in a various contexts. But the main idea remained. -Ofun, all the way.

(Gee, that sounds so official)

Zebra is also a codename of a Secret Project of mine, a bit GSoC related. But that’s another story, and it’s not coming very soon anyway.


OS couples

Being sent the following comic strip by a friend of mine

Original comic

how could I possibly resist adjusting it just a tiny bit to suit my actual situation? :)

Modified version of the above comic

Big thanks for the author of the original comic!  See http://www.stickycomics.com/where-did-you-meet/ for more funny stuff.


About META.info and friends

As promised, later than sooner it turns out, I sort of specified the META.info file, how to write it and how is it interpreted. The problem is that for me, everything is obvious, so it surely needs clarifications, examples etc. Any ideas, changes, patches are welcome as always. Here is the document: read it, let me know what’s stupid or what’s not clear enough.