Tag Archives: PC

Localisation for libgdx projects

Edit: I just added UTF-8 support

Localization is a key aspect in games, specially if you want to reach a wider audience. I recently ported Freegemas to the libgdx platform and, as the original one, I wanted to ship it with multi-language support. There is no such a thing as gettext for Java and I didn’t see the Android internationalization system as a good fit in a multiplatform development. That’s why I developed my little own internationalization module.

Download LanguagesManager.java

Its usage is extremely simple, first we need a media/languages.xml file where all the strings in our project will be located. The syntax is pretty straight forward, we lay language sections identified with the code for each language. Inside every language, we provide a list of key value pairs with the localized strings.

< ?xml version="1.0" encoding="UTF-8"?>
<languages>
   <!-- English -->
   <language name="en_UK" >
      <!--  Menu  -->
      <string key="Timetrial mode" value="Timetrial mode" />
      <string key="How to play" value="How to play" />
      <string key="Exit" value="Exit" />
   </language>

<!-- Spanish -->
   <language name="es_ES" >
      <!--  Menu  -->
      <string key="Timetrial mode" value="Contrarreloj" />
      <string key="How to play" value="Ayuda" />
      <string key="Exit" value="Salir" />
   </language>
</languages>

We can retrieve localized strings in our project through the LanguagesManager class and its getString() method. It’s been implemented using the Singleton design pattern as we only need one instance accessible from, potentially, everywhere in the code. When we ask our manager for a certain string we will use its key, if it finds it within the current language, it’ll return it, otherwise it’ll return the key itself. That’s why using strings in a base language (English) as keys can be a good idea, those will be returned by default.

For now, it uses lazy initialization which means it’ll load the language the first time the getInstance() method is called but that might change in the future. It automatically detects the system language (no matter if we are on Android or a desktop environment) and it fallsback to English if the system language is not among the available ones in the data/languages.xml file. However, you can explicitly specify the language you want to load through the loadLanguage() method.

LanguagesManager lang;

lang = LanguagesManager.getInstance();

String option1 = lang.getString("Timetrial mode");
String option2 = lang.getString("How to play");
String option3 = lang.getString("Exit");

Freegemas libgdx is open source (GPL v3) as is this internationalization module which means you’re more than welcome to download it, use it and improve it. If you do the latest, make sure you distribute it the same way as me.

Getting started with XNA: Urban Race

As if I didn’t have enough work, I recently started another project which has an early deadline. For the Advanced Games Programming module here at Kingston University we have to develop a game for Windows and Xbox 360 using C# and the XNA framework. The final deadline was in a month counting from the start date and, halfway through the development, we had to show a demo. That’s how Urban Race began just a week ago, in this post I’ll talk about the game and my first impressions on XNA.

Continue reading

“Shiny PC graphics in Battlefield 3″

Just a quick update, you really should spend a few minutes watching this presentation. Johan Andersson, Rendering architech at DICE, gave a talk called “Shiny PC graphics in Battlefield 3” during the last nVidia GeForce LAN. It’s focused on the latest improvements the Frostbite 2 engine includes and I think it’s a pretty good example of where the graphics technology is going.

Click on more to see the videos.

Continue reading

Videojuegos de Warhammer 40.000

Buenas, me recordarán de otros artículos como “Videojuegos de Warhammer Fantasy”, un repaso sobre las incursiones del famoso wargame de fantasía medieval en el mundo del ocio electrónico. En esta ocasión me dispongo a hacer lo propio con la correspondiente versión futurista, en la que las lanzas se sustituyen por bolters pesados y los carros de combate por Deadnoughts. Mi experiencia con Warhammer 40.0000 se reduce a poseer un regimiento de Marines Espaciales, aunque he tenido la ocasión de probar buena parte de los títulos que se listan a continuación.

Continue reading

Videojuegos de Warhammer Fantasy

Apenas era un pipiolo cuando comencé a interesarme por el mundo de Warhammer, a partir de entonces pasé una buena temporada reclutando mi ejercito Alto Elfo, pintando o librando batallas. De eso hace ya casi ocho años pero antes de mutar en la entrañable figura del abuelo cebolleta voy a centrarme en el objetivo de este artículo, hacer un repaso sobre los videojuegos existentes basados en el mundo de Warhammer Fantasy.

Continue reading