All posts by Aymeric

About Aymeric

Freelance Interactive & Game Developer.

Why DRM sucks ? My thought on piracy

As you may know, there is a war against piracy on digital contents. Piracy is of course prohibited, but moreover softwares’ companies try to block this practical thanks to new technologies. DRM for Digital Rights Management is used to describe any technology that inhibits uses of digital content not desired or intended by the content provider. So in fact, companies just wish to protect more their works this is natural. However there is a real unease, what is wrong with DRM ?

To explain my point of view, I start with the new controversial Ubisoft’s DRM. Ubisoft is a great company which made marvellous games such as Assassin’s Creed, Far Cry, Prince of Persia, ect… and of course as many others it uses DRM. Before using is own DRM, Ubisoft used SecuROM’s software. SecuROM aims to resist home media duplication devices, professional duplicators, and attempts at reverse engineering software. In fact SecuROM limits the number of activation on your product. For instance, if I just bought Far Cry 2, I must activate my game on the Internet through SecuROM to be able to play. But, there are 2 problems : the number of activations is controlled, no more than 5 in general and I should revoke SecuROM before uninstall my games for taking back my activation. This is a strong problem if your disk crash ! The second is if SecuROM’s server is down in a few years, I will not be able to play my game ! And this is completely unacceptable.

Now get back on the own Ubisoft’s DRM. Now, if I buy Assassin’s Creed 2, I download and install it, I will suffer if I am not connected on the Internet I can’t play, because the game requests a permanent connection. What the fuck guys ??? This is only a solo game !! This is preposterous… and of course the first weekend there were many connections’ problems with the server. People which just bought the game were not able to play. And nowadays there are always problems. Skid Row’s pirates have just complete their crack to revoke Ubisoft’s DRM, and tell in a letter that Ubisoft should improve quality of their games before thinking the DRM. And they add that they simplify life of honest customers ! Pirate 1 – Ubisoft 0.

I buy games, many games, I really enjoyed the first Assassin’s Creed but I hate DRM. I will buy the new Assassin’s Creed ? I don’t think so, because I don’t want to support this kind of practice. Oh for sure, I will buy it if they revoke their crap, or if it is really really cheap. And there is other problem with DVD, I just want to see my film and I can’t skip ads, piracy’s warning… I have bought it, what is the problem ?? So to conclude this first part on DRM, everything which compel the honest customer should be banned.

I have a dream, it is a world of freedom with a total access on Art for everyone, but it is impossible in our world ruled by money. I am the first to say that all work deserves payment furthermore if you earn money thanks to the work of someone else, but I can not abide that piracy is the first problem of the industry. The first problem of movies is the price of movie theater. In Belfort, for a student !, it is 7.10 €. This is really too expensive, for sure if it costs 3€ I go more often to the cinema and certainly I will consume food or drink. But no, actually I wait to buy the dvd, or rent it. And you know, if the movie is good people will see it. That’s a fact, for example the last Cameron’s movie : Avatar.

Piracy is also a means to judge quality before buy it. There are so many movies, so many bad movies… that you don’t want to pay 7.10 €. Our consumer society product always more and more, but quality is not here. It seems to be that artists are more attracted by money than their work. I am a metal music fan, and when you speak with some underground bands after concerts, you feel their passion. Of course they would like to live thanks to their music, but in fact this is not the most important. No, the most important for them is the audience, the people which waits since several years to see them in his town ! The man chich pay a beer to the band and like to share his passion. This is what a real artist should love !! Not the number of discs sold, and if he can earn more money if he puts a fucking DRM on them. You know when I buy a CD, I am proud to give money to the band, to contibute, to show that I like their work. And thanks to that they can organize concert and make an other good CD later.

To conclude, I would like to remember that pirates are people who consume the most. And there is one thing that I am sure : if they have all the money they want they will pay for all the entertainments they do.

Handle the Right Click in AS3

It can not be denied that handling the Right Click in Flash is a problem.
At first, it was made to display a Contextual Menu with Flash Player’s options, this is great for a website. However Flash is also used to make browser’s games and it is reductive if we can’t use this. For example in a Point & Click game, like the mythical Diablo, the Right Click is very important and simply to use. If you want to develop that kind of game with Flash (one of my dream ;-)) it will be difficult to manage this. In this direction, old Apple’s mouses with their only click were preposterous !! I think that was a commercial argument like “our Operating Systems is so ergonomic that you don’t need an alternative button”. But if you used software like Photoshop, you will always push the ctrl button on the keyboard, but also shift for other action or alt, cmd…

So today I try to look over that. And what I notice is :
– the right click and the middle click are functional in AS3 (those MouseEvent exist) but work only for Air !!
– you can easily change the context menu options (good example) and add functions but About and Settings can not be removed from the menu !!
– use JavaScript to handle the Right Click thanks to this class. Here we go :

I created a .swf in which with a right click you create a circle, and with a left click on a circle delete it (the application). Note it seems it is no more updated. But what happens ? It doesn’t work with Safari and Opera… failed. And you should have notice that I created a circle by pressing the right button, logically it should be the left… ?? Because of the JavaScript, you can’t give an occurence through it to Flash, so how can I obtain the target ?
This is the code :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
var circle:Circle;
 
stage.addEventListener(MouseEvent.MOUSE_DOWN, deleteCircle);
 
var i:int = 0;
 
var methodName:String = "rightClick";
var method:Function = rightClick;
ExternalInterface.addCallback(methodName, method);
 
function rightClick():void {
 
	circle = new Circle();
	i++;
	circle.name = String(i);
	addChild(circle);
	circle.x = mouseX;
	circle.y = mouseY;
}
 
function deleteCircle(m:MouseEvent):void {
 
	if (m.target.name != null) {
		removeChild(getChildByName(m.target.name));
	}
}

So to conclude, at the moment you can’t use cleanly the right click in Flash like the left. You will always have the contextual menu with About and Settings’ buttons. But in fact who use them ? Aside on a website using Webcam or Microphone. So I think that developers should have the choice if they want a contextual menu (by default if we don’t need the right click) or not to have a more ergonomical application.

Starfield for games

On monday’s afternoon waiting a C++ lesson, I surf on the web. But there aren’t a lot of news, so in a fully bother I go on a flash game’s website and I play a game with Starship, asteroid… I’m sure you know that kind of game 😉 And I ask myself about it mechanism.

After some research I discover the term “Starfield” but no explanation nowhere about how it works, therefore I decide to programme one !
So in fact a Starfield is a perpetual movement of Stars in a restrected field. I know this a little short 😀
The idea is to have a movement in your field and only there, so if a Star go away it should be deleted or puted back. And in fact that the field itself which is moving on the stage.

There is all the code below, but look at the application before !
Click on the animation and use arrow’s keyboard for moving the Starship. In this example the Starship never moves, it’s the Starfield !!

Continue reading Starfield for games

Recursion with factorial

A recursive function is a procedure or subroutine, implemented in a programming language, whose implementation references itself.
It is really useful, try to make a program like Tower of Hanoi with an iterative algorithm… good luck !

So I will give you an easy method to create a recursive algorithm, I choose the example of factorial because of it simplicity.
Mathematical’s reminder : 4! = 4 * 3 * 2 * 1 = 24.

There are 3 steps :
– parameter(s) : identify all the parameters that you need to resolve the problem. They will decrease at each call of the function. In the factorial’s case, it is the factorial’s number.

function factorialCalculation(factorial:uint):uint

– exception’s case : this is when the procedure stops to call itself.

if (factorial == 1) { return 1; }

– recursive’s case : where recursive call is implemented, don’t forget to decrease (generally) parameter(s).

return factorial * factorialCalculation(factorial - 1);

Now all the code :

var factorial:uint = 4;
var resul:uint = 0;
 
resul = factorialCalculation(factorial);
 
function factorialCalculation(factorial:uint):uint {
 
	if (factorial == 1) {
		return 1;
	} else {
		return factorial*factorialCalculation(factorial-1);
	}
}

Be careful : recursive function are really heavy. Factorial’s case is just an easy example, it should be implemented as an interative function !

And for the fun with a ternary operation :

function factorialCalculation(factorial:uint):uint {
 
	return (factorial == 1) ? 1 : factorial * factorialCalculation(factorial - 1);
}

😀

Setting-up MAMP for Php & Ruby on Rails with MySQL

If you want to develop php on localhost with you Mac, you sould use MAMP. But it doesn’t display error. To change that, just go in bin/php/php5.6.2/conf/php.ini and change display_errors = “Off” by “On”. Easy, but if we don’t know it could take time.

Now if you want to use Ruby on Rails on MAMP with MySQL instead of SQLite you need to download and install MAMP’s libraries.
After that, you should install Mysql for Ruby using Gem, do the command line in your terminal :

sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/Applications/MAMP/Library/bin/mysql_config

And finally, you will have “gem installed”. To create a new Rails’s project with MySQL :  rails -d mysql myProject. Next open the file config/database.yml and add the line : socket: /Applications/MAMP/tmp/mysql/mysql.sock below host.
Don’t forget to put your password !

Now you can start working 😉

Simple BevelFilter

Some months ago, I was at Turbulent Média Inc. in Montréal, Canada as a flash trainee. During this internship I discovered the BevelFilter class.
At this time, I’m creating my Portfolio (it will be online soon), and I reuse an effect discovered there for buttons.
Here is my button.

And now the simple code without any Tween !

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package {
 
   import flash.display.Sprite;
   import flash.events.Event;
   import flash.filters.BevelFilter;
   import flash.filters.BitmapFilter;
 
   public class Bevel extends Sprite {
 
       private var _effect:BevelFilter;
       private var _filter:BitmapFilter;
       private var _myFilters:Array;
       private var _angle:uint;
 
       public function Bevel():void {
 
	    btn.addEventListener(Event.ENTER_FRAME, _animation);
	}
 
	private function _animation(evt:Event):void {
 
	   _effect = new BevelFilter(5, _angle, 0xFFFFFF, 1, 0x000000, 10, 10, 1);
	   _filter = _effect;
	   _myFilters = [];
	   _myFilters.push(_filter);
	   btn.filters = _myFilters;
 
	    _angle +=2;
 
	    if (_angle > 360) {
		_angle = 0;
	    }
         }
    }
}

Mathematicals and AS3 = Biomorphs

A biomorph is a shape resembling that of a living organism (such as bacteria), though not necessarily of biotic origin. It is created with Mathematicals functions, such as fractal.
Based on the work of C. Pickover, I have made a computer program with AS3 that you can try below. I used the as3mathlib because of Complex Numbers.

Biomorphs – the computing time could be long, wait a moment.

Here is a part of the code. All comments are welcome 🙂

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
private function calculate():void {
 
  var r:Number = 0;
  var n:uint;
 
  for (var abs:Number = -3; abs < 3; abs += 0.01) {
 
    for (var ord:Number = -2.5; ord < 2.5; ord += 0.01) {
 
    n = 0;
    r = 0;
 
    z  = new Complex(abs, ord);
 
      while ((n < 11) && (r < 10)) {
 
      z = f(z, A, B, C, D, E, F, G);
      r = Complex.modulo(z);
 
      if ((n == 10) || (r > 10)) {
 
        putPixels(Complex.abs(z), abs, ord);
      }
      n++;
      }
    }
  }
  showBitmap();
}
 
private function f(z:Complex, A:Complex, B:Complex, C:Complex, D:Complex, E:Complex, F:Complex, G:Complex):Complex {
 
  var i:Complex = new Complex(0, 1);
 
  var inter1:Complex = Complex.adds(Complex.power(z, A), B);
  var inter2:Complex = Complex.adds(Complex.mult(C, i), Complex.mult(D, Complex.cos(z)));
  var inter3:Complex = Complex.adds(Complex.mult(E, Complex.sin(z)), Complex.mult(F, Complex.exp(z)));
  var inter4:Complex = Complex.mult(G, Complex.exp(z));
 
  return Complex.adds(Complex.adds(inter1, inter2), Complex.adds(inter3, inter4));
}
 
private function putPixels(h:Complex, abs:Number, ord:Number):void {
 
  abs = Math.round((abs + 3) * 100);
  ord = Math.round((ord + 2.5) * 100);
 
  var biomorphe:Number = Complex.norm(h) / 2;
 
  if (biomorphe > 1500000) {
    monBitmap.setPixel(abs, ord, 0xFFFFFF);
  } else if (biomorphe > 15000) {
  monBitmap.setPixel(abs, ord, 0x0099CC);
  } else if (biomorphe > 150) {
  monBitmap.setPixel(abs, ord, 0x993333);
  } else {
  monBitmap.setPixel(abs, ord, 0xFFFF00);
  }
}