## Convert images to MovingAI maps

The MovingAI Benchmark Database is one of the most famous collections of maps for benchmark on pathfinding algorithms. I use it a lot during my work, it is useful to test an algorithm over a lot of real-world game maps. The consequence is that I developed a lot of tools to work with the map format of the MovingAI database.

The last of these tools is a straightforward Python script to convert images into maps in the MovingAI format. It is useful when you want to quickly develop some test maps.

## Research Code vs. Commercial Code

Since the beginning of my working life, I was torn between my researcher and software developer self. As a software development enthusiast, during my experience as a Ph.D. student, I suffered a lot looking at software implemented by researchers (many times my code is in the set too). Working with research code is usually an horrible experience. Researchers do so many trivial software development mistakes that I’d like to cry. The result is a lot of duplicated work reimplementing already existent modules and a lot of time spent in integration, debugging and understanding each other code.

On the other hand, it is almost impossible that a researcher will learn the basics of software development in some book because 1) nobody cares (and they really should!) and 2) books on this topic are mostly focused on commercial software development. This is a problem because, even if best practices overlap for the 80%, research code and commercial code are driven by completely different priorities.

So, because I am just a lonely man in the middle of this valley, nor a good research code writer nor a good commercial code writer, I can share my neutral opinion. Maybe, I will convince you, fellow researcher, that may be worth to spend some time improving your coding practices.

## Postmortem: Writer’s Block – 1GAM January

The first month of the year is gone and I’ve made a game! The January 2016 entry of 1GAM, namely “Writer’s Block”, is now completed (kind of)!

January 2016 has been a great start for this year! During the last months of last year I started a personal journey to fight my inner demons. I don’t want to bore you with some self-improvement/productivity bullshit -it is not the place for that- so I will not. You just have to know that after 6 months of trying and failing this January is the month in which all the good habits really start to stick.

The “One Game A Month” challenge was the perfect way to test myself and doing one of the activity I love most. As usual, we will start from the beginning.

## Fast (Approximated) Moving Average Computation

Computing the Moving Average of a sequence is a common task in games (and other applications). The motivation is simple: if something happened too far in the past, probably it does not matter anymore.

One of the main problem with the standard average is that it “slows” over time. This can be a serious problem. Suppose that you are designing a game in which your player have to quickly press a button to keep a value (e.g., player speed) above a certain average. If you use the global average, after a certain amount of time, your player can stop pressing the button and still keep the average above the threshold.

The demonstration of this is quite intuitive. If you have an average a(t) at frame t and the player will not press anything in the current frame, the average at frame t+1 will be

$a(t+1) = a(t) \frac{t}{t+1}$

This factor depends on the elapsed time and becomes “almost 1” very quickly. You don’t want that. You want to keep your player on the narrow land between “boredom” and “frustration”. You cannot give to your player the possibility to win without doing nothing for 30 seconds.

The solution to this problem is simple. Use a Moving Average. The player will have to push the button faster than the threshold but the average is computed only using the data from the last 5 second (or any other time window you want).

## YoshiX – Experiments made easy

Some months ago, I was frustrated by the monotony of the task of writing, running and collecting data from experiments. I was bored of facing always the same challenges,writing always the same code and facing always the same problems. In addition, every experiment ran on different platforms, and they quickly becomes difficult to replicate (and this should be the very point of every experiment).

Thus, I decided to write my personal framework for running experiments in Python: YoshiX. The idea behind YoshiX, inspired by classical Unit Testing libraries, is quite simple. You write your test in a separate file, then you run yoshix and it automatically finds every experiment in a specific folder, runs them, and collects the output in the format of choice.

It is a simple tool; I still have not spent a lot of time in it. But I think it has some interesting developments. Let’s look into some details.

## The most promising languages of 2016

It is time to update one the most popular article in this blog. It is time to talk about the most promising languages of 2016! But first, let me repeat the small notice I did the last year. The languages I am listing below are not the most used languages, or the languages that you have to learn in order to find a great job as a developer. There are many more established languages that fill this role. Languages such as C++, Java, C#, Python and JavaScript are way more solid and safe if you are looking for a job or to start a developer career.

Instead, I am trying to list emerging languages that may becomes more important at the end of 2016. This list is for you if: 1) you are passionate about programming languages 2) you want to learn something new because you are bored with your current language 3) you want to bet on a language hoping that it will become mainstream (and thus, you will be one of the early expert in that language, and this imply nice job opportunity). Or you can read this list because you are simply interested on where the language research and development is going in the real world (academic research is a totally different story).

## Turn-based Battle Systems – Chapter 2 – Analytical Analysis

Hello everybody! It is time to continue with our series on Pokemon-like battle systems. In this chapter I will be more general: now we have our beautiful damage formula and a draft of our characters sheet, it is time to quickly check if the game the formula is balanced. There are a lot of questions that we want to answer as quick as possible. How much HP the enemy must have? What is a good value for the attack power? Is the damage formula fair enough? The critical strike is too much? The randomness is too much? Is it fun?

Except for the last question, we can try to answer them just looking at the damage formula. Obviously we can not answer all the questions now, but if there is some evident mistake, we will be able to catch it as soon as possible. There are several ways to analyse the tuning and balancing problem for a damage formula (and thus for a large part of the combat system): analytically, with Google Sheet/Excel, and with a quick software prototype.

In this article we will start from the first step: the analytical analysis.

## The Challenge of Infinite Space

Is it possible for a finite amount of gameplay to fill an infinite space? This is the “infinite space” problem in modern massive space simulators. We need to solve this gameplay problem or Elite: Dangerous, Star Citizen and No Man’s Sky could be doomed to fail.

## A.K.A. why Elite: Dangerous, Star Citizen and No Man’s Sky could be doomed to fail

Since the beginning of the videogame era, developers aim to reach a perfect simulation of the world. “So realistic!” is probably one of the most abused comment to a videogame ever. Videogame industry tried to reach realistic graphic, realistic sounds, realistic landscapes and realistic Non-Player Characters. However, reaching the perfect realism is a never-ending quest. As soon as we reach something, desire drive us to seek more.

Now that we have extraordinaire graphic capabilities and stunning landscapes, some developers are going to raise the bar to a much bigger task: simulating the universe (or at least, the galaxy). We are not in the first (game) generation who is trying to achieve that (the original Elite is a very old game indeed), but we are for sure in the first generation who can reach this goal; at least to some extent.

We have the technical capabilities for doing amazing things: we can generate and simulate hundreds of billions of star systems, we can allow the player to travel to every one of them, explore and land on every square unit of the planet surface, every asteroid, every satellite. Software/games such Space Engine can clearly show us what a lonely developer can do in its spare time. Imagine what a game developers team can do on their full time job! It is not a surprise that several studios spotted the niche in the market and tried to use this power for a real game. After all, it is not “simulation of experience” one of the meaning of “game”?

## How to design a Pokémon-like Combat System – Chapter 1

The Combat System is one of the main gameplay element in a game. Of course there are a lot of games without “combat”: puzzles, simulation games, driving games and so on. However (and you know this in the depths of your soul) that your game must have an amazing combat system because we LOVE beating the crap out of our enemies! Other games mechanics are good, but a good fight can be AMAZING.

There are several ways to implement a combat system but, at the end of the day, we can divide the heterogeneous world of combat systems into two big clusters: real time combat systems and turn-based combat systems. The first are exciting but they rapidly becomes hard to implement. We will need to do a lot of animations, tuning collision boxes and tons of graphical stuff. If you are a poor programmer like me, you cannot do that (sad face :<).

With turn-based combat system, instead, you can do the most complex things you can image! You can take into account hundreds of variables and statistics, create complex strategic combinations, evocations, magic, everything. You can use dice, cards, tokens, everything in order to emulate an epic combat between a dragon and drunk dwarf with a wooden leg. Because turn based combat systems are an explicit abstraction of a real combat, the player can absorb without complaining a bigger level abstraction. The same cannot be said for a real-time combat system in which just an ugly animation can be labeled as “ugly designed and sluggish combat” and provide frustration to the player.

So we are going to implement a turn-based combat system! But how? Well, this obviously depends on which type of turn-based combat system you want to do. For now, we will try to do a replica of the first turn-based game I’ve ever played: the Pokemon Combat System!

This is a nice combat system to replicate as a tutorial because is not too complex (especially in Gen. 1 or 2), but contains several tricky points that we need to handle! We will explore the design and the implementation of this combat system in details. We will see how to design the combat system, how to do a first balancing and test on paper, and every implementation step! So let’s start!