Archive for the ‘ActionScript 3’ Category
My AI reads your mind (part 1)
I regularly read about people complaining that AI in games should be improved. I definitely agree with them, but here’s a argument why pushing it to the limits might not be such a good idea: computers can easily discover and exploit our unconscious biases. Magic? ESP? More like a simple application of decision theory. In [...]
Advanced math functions for AS3
Did you ever need to sample from a Dirichlet distribution in Actionscript 3.0? What about computing a value of the Gamma function? Probably not In case you did, I wrote a class with a few math methods: a function to sample from multinomial distributions; this is useful if you need to choose randomly from a [...]
Guess 2/3 game: sending data from Flash to a remote database
I wrote a simple game to learn how to store on and retrieve data from a server-side database. The rules are simple: you have to guess 2/3 of the average of the guesses of all the players. So, for example, if you think that the other players guessed on average 100, your guess should be [...]
Simulated evolution
Here’s another classic from the 80′s: an artificial life simulation, where bugs move on a virtual Petri dish, hunting for bacteria. If they manage to survive until adulthood, and accumulate enough energy from bacteria, the bugs reproduce and generate two copies of themselves. In the reproduction process, the genetic code undergoes small mutations, so that [...]
Spatial database for collision detection
In games and other graphical applications one has to keep track multiple sprites and detect collisions between them. A naif approach would loop over all sprites and check for collision with *every other sprite*. This is, of course, terribly inefficient and can be very slow even for a small number of sprites. One way out [...]
2D Cellular Automata
I decided to get my feet wet with Flash + ActionScript programming with a classic of the 80′s: 2-dimensional Cellular Automata! A 2D CA is a grid of cells, each of which can be in either an “alive” or “dead” state. The state of each cell evolves in time, according to simple update rules based [...]
