For a course on programming languages, we have decided to learn the Pony language. Learning Pony has been something really pleasant and easy until I came across capabilities. Looking for an easy and simple way to understand them, I found this. I call this “The deny properties matrix from hell”. Not because it’s evil, but because I find it really hard to learn from that diagram and also because it’s evil.

Ok, so I know this denying capabilities stuff is very formally correct, but it’s too hard to understand. So I re-wrote it thinking about what you allow instead of what you deny, and everything started to make sense. Of course, you can scroll down and see it right now but the idea of this article is to -sort of- deduce it so you can see how obvious and logical everything is.

About iso and the point of all this

Two threads can’t just share data: writes can happen simultaneously with reads and things get corrupted pretty easily. For two threads to share data, you either:

Only allow both threads to read

You allow full access to shared data in turns: only Thread A or Thread B can write and read from at a time.

Which means: you either share immutable data or pass mutable data. Traditionally, passing data is done with locks and mutexes. In pony, this is done with iso.

The whole point of pony is that actors send and receive messages, but the content of those messages must be either:

mutable but isolated: If you send the thing you can’t EVER read from or write to it again. (iso)

What’s cool about this is that you don’t need to copy stuff when you send messages. In other languages, to send data to another thread you either:

a)copy everything you are passing in the message to be sure that the other thread doesn’t touch your data.

b)put some locks here and there

In pony, that need vanishes because of reference capabilities.

So you can share mutable data with iso without copying it and with no mutexes. That’s the point of all this.

The security scale

This is sort of obvious, but let’s say it:

The colours

We’re going to talk about reference capabilities, so just forget about the “No access” part.

Here comes the matrix

In most papers and talks about Pony, “local” means this thread/actor and “global” means other thread/actor. This is the same matrix as before, just in terms of what you are allowed to do through the reference instead of what you can’t do.

Iso and trn are problematic, because as said before it’s unsafe for two threads to write to the same data, and for a thread to read data which can be written to by other thread (you can get a data structure that is half-updated!). So iso and trn only make sense if they are unique references. This means that only one actor has access and data never gets corrupted.

Sendables

iso, val and tag are the only sendable reference types because what this actor can do to the references is the same as what the other actor can.

Here comes the Hasse diagram

Capability subtyping, from the tutorial, establishes which reference types can be assigned to which. You should read that. Here is the Hasse diagram:

Note that the Hasse diagram also shows transitivity: box is safer than val and tag is safer that box so tag is safer than val. This means you can:

var number_val:U32 val = 5

var number_tag:U32 tag = number_val

However, you can’t just:

var iso_thing:Thing iso = ….

var ref_thing:Thing ref = iso_thing

because of the uniqueness of iso.

See how it makes sense

Here I tried to put the hasse diagram on top of the matrix. See how you deny one thing at a time?

iso only makes sense thanks to consume

I mentioned how you can’t

var ref_thing:Thing ref = iso_thing

this is because of the uniqueness of iso: by performing that assignment, you create a new reference to iso_thing so it’s not isolated anymore. Instead, what you must do is:

var ref_thing:Thing ref = consume iso_thing

Consuming iso_thing sort of destroys the reference: you can’t use it anymore, it’s a compile-time error!

recover lets you change the reference type (in the other direction)

With assignments and consume you can only go downwards (I mean down the matrix: from iso to ref, from val to box and such). However, recover blocks let you go upwards (e.g. from ref to iso).

In fact, you can also go downwards and right (just like with assignments)(Thing.create() returns a ref)

var iso_thing:Thing iso = recover Thing.create() end

var val_thing:Thing val = recover Thing.create() end

recover will by default return the topmost reference type (iso, val, tag), which is all you need anyways. You can also specify a target reference type, for example:

var trn_thing:Thing trn = recover trn Thing.create() end

recover isn’t cheating

Inside the recover block you can only access iso, val and tag references from the scope, which ensures thread-safety, as discussed in “about iso and the point of all this”.

So no, it’s not cheating.

Final words

I hope this was useful. Please point out any mistakes in the comments or e-mail me.

The Return to Cucken: AWAKENING is a retro platformer game where you have to help the main character go back to his homeland: Cucken. It has 18 carefully crafted levels, in wich you go throught a beach and inside a volcano that is about to explode.

In terms of gameplay, what differentiates The Return to Cucken from any other platformer is the way you obtain special powers: every killed enemy adds to the number of times you can use that ability.

The game is short because I prioritise quality over quantity of levels. The 18 levels the game has where modified lots of times, and the game, tested by more than 25 people. I wanted the player to learn the mechanics without realising.

It has a subtitle because the game is divided in chapters, and this is the first one. I have a general idea of how the whole, finished game will be, but, because of how long it took me to finish this first chapter, I’ll see what people thinks about the idea before starting to develop the next one.

Missile Walker is a game I made for CODEAR:Hardcore. It’s a frenetic platformer game where the player must avoid and mount missiles shot at her to win the game. You also have the ability to stop time, wich lets you do very precise movements.

The graphics are minimalist, but the many effects I apply makes the player enjoy them.

https://soyyomakesgames.wordpress.com/2013/01/09/missile-walker/feed/0soyyo5159Class to modify the speed of a sound: AS3https://soyyomakesgames.wordpress.com/2013/01/01/class-to-modify-the-speed-of-a-sound-as3/
https://soyyomakesgames.wordpress.com/2013/01/01/class-to-modify-the-speed-of-a-sound-as3/#respondTue, 01 Jan 2013 14:40:52 +0000http://soyyomakesgames.wordpress.com/?p=128]]>For the game I am making, I needed a class to change the duration and frequency of a sound, as there is the possibility to slow down time.

My first solution was to use this code: http://www.mcfunkypants.com/2011/as3-pitch-shift-mp3/. But it came out being extremely hard to read and modify. I expended all my day (I think almost 9 hours) trying to simply add the capability of playing not-looping sounds, wich this class didn’t include. That was because of how unclear the code was to me: it has almost no comments at all, and the loop inside the onSampleData event is just unreadable.

I must add that, althought the code was supposed to play sound effects in a game, it’s very poor in performance, so when you play more than one FrequencyChangeSound at the same time, your game could get some low FPSs. I’ll program a sound player class to do one single onSampleData event (instead of one for each sound), and get better performance.

So here’s the code:

Filed under: Uncategorized]]>https://soyyomakesgames.wordpress.com/2013/01/01/class-to-modify-the-speed-of-a-sound-as3/feed/0soyyo515959:99https://soyyomakesgames.wordpress.com/2012/11/19/5999/
https://soyyomakesgames.wordpress.com/2012/11/19/5999/#respondTue, 20 Nov 2012 00:21:11 +0000http://soyyomakesgames.wordpress.com/?p=123]]>It’s a prototype I made for fuck this jam. I made it in 4 days, wich means a total of around 20 hours of dedication put on it. Ihad the Idea for this game some years ago, and fuck this jam was a great way for pushing me to put this idea in a playable form.

In the game, you have 60 seconds to do as much as you can/want until everything starts again. This led to some interesting mechanics, like having to convince people to give you a password for a door, remembering it and then using it the next time the game starts.

I started the jam wanting to make some kind of fast RPG, but the result was this thing, that is some kind of text-sandbox, in wich you experiment with the world around you to understand it better and discover the story it hides.

I am most likely iterating over this prototype to get an actual game out of this: I’ll smooth the experience asmuch as I can so that it’s pleasant and enjoyable.

I found it while trying to organize my files, as I started coding some flashpunk

Oh, and I have a new game finished… hopefully I’ll post it here soon.

And yeah, I could start posting the source of some of my not-finished projects… and maybe even the finished ones, just not now

Filed under: Uncategorized]]>https://soyyomakesgames.wordpress.com/2012/04/22/sonic-sprites-collection/feed/0soyyo5159what a yearhttps://soyyomakesgames.wordpress.com/2012/01/19/what-a-year/
https://soyyomakesgames.wordpress.com/2012/01/19/what-a-year/#respondThu, 19 Jan 2012 18:24:08 +0000http://soyyomakesgames.wordpress.com/?p=98]]>Well, it`s been a long time I don`t post anything… But it didn`t happen much in the last months of my virtual life, mostly because I`ve been really busy in my new school, wich is much harder than the one I used to go. And, in my efforts of keeping the same grades, I have had to spend much less time in front of the computer, making games.
But summer time is coming to an end, and I used the time I had to learn new things…
First of all, I finished this C book and made some complicated program with it. And I`m really proud of what I got ^_^ . Then, I started reading Java. I ate the book in a week (miracles happen in summer), and made a tetris with the bare graphics basics the book teached me. Now, I readed half of an Action Script 3 book. The reason why I didn`t eat it like the java one is that it`s poorly written. But AS3 is almost the same as java, so I I`m learning more than the book teachs.

I`ve also gained 15 Kg of weight, wich I plan to lose in 2012. Be ready for some kind of gamification experiment.

And my second goal for 2012 is to make one cent with a flash game. For this, I`ll have to make some really good game so that some portal accepts it. I`m really whilling to see if I can get some money (no matter how much) from game making.

And about new games…
2011 has been my most productive year so far, with The Return to Cucken finished and some interesting game prototypes in my computer. If I make any GM game in 2012, I know it will have some quality, 1 or 2 may get finished before July, but I`ll try to focus more in flash and maybe make something interesting with java, so that I gain some experience, but overall I`ll focus on AS3.

PS: cutting-down and releasing The Theory of The Everything is another possibility.

This is my second game for this month’s Experimental Gameplay Project. It was made in 6 hours O_O

You use 1-2-3-4-5 as the pads that should be in the instalation where the game is supposed to be played.

You move the bar that’s below in the screen with 1-2-3-4-5 to grab as much snow as possible before time finishes. It’d be cool to have the player running around to press the pads. He/she could even get tired of running while playing.

I used some code of my first entry, wich I started threed days ago and finished yesterday. Yeah, I’m in the creative rush.

This game was made for this months EGP. Althought it’s supposed to be played with pads, you can play it with the 1-2-3-4-5 buttons.

When I first read this moth’s theme, I really loved the idea of people jumping on their pads like they were dancing/jumping at a club. Also, I thught that the people jumping on their pads harmonically could be fun to watch, as they are coordinated. This game would obligate them to coordinate those jumps.

The team that hits more notes makes more points.

Also, this game can be played by a minimum of three people, because you could have two of them “dancing” over two pads.