Mostrando entradas con la etiqueta Desarrollo de Juegos. Mostrar todas las entradas
Mostrando entradas con la etiqueta Desarrollo de Juegos. Mostrar todas las entradas

World Enduro Rally

I'm happy to share the result of the work I've been doing in the last months: yesterday, World Enduro Rally came to light.



The game is available for XBoxOne, Steam, Android and Windows. You can get all the details at its Facebook page, or download directly here:





Hope you like it!

Manually copying Unity's APK and OBB files to an Android device for testing

When developing an Android game that is meant to be published through the PlayStore, there's a limitation regarding the maximum file size of the APK. It currently can't exceed 100 MB.

The thing is that games usually go beyond that limit. To deal with that, Google offers the so called APK Expansion Files. Every application can include up to 2 of them, with a maximum size of 2 GB each.

If your game goes beyond 100 MB, you can easily instruct Unity to split the game in two by checking the "Split Application Binary" in Edit->Project Settings->Player->Android->Publishing Settings.

Image result for unity split application binary

That will generate two files instead of one:
  • APK: the usual APK file with all the binaries, scripts etc, and the first scene included in the build settings (the scene with build index 0). You need to take care that the first scene is small enough so this APK doesn't go beyond 100 MB. In general, this scene is usually just a loading icon, or a game logo that is displayed while loading. 
  • OBB: A second Expansion File with the OBB, holding everything else. 
Some time ago, it was necessary to use a Unity plugin to deal with OBB loading, but this is no longer necessary. So, first of all, DO NOT USE that plugin. In fact, it hasn't been updated for years, and won't work in current versions of Unity. 

Current versions of Google PlayStore natively support the distribution of OBB files, so you won't need to do anything special besides providing the OBBs along with the APK when you upload your game.

Note: usually, the first time you upload your game to Google Play, it won't ask you for OBB expansion files (I guess that's a bug in the system). If that's your case, simply generate a second version of your game, and re-upload your APK. Then it will ask for Expansion Files properly. 

How to install the game locally, in a test device? 

In normal circumstances, you  just create one big APK, copy it manually to the SD-Card of your phone, and install the game by tapping on the APK file. If you do that now, the game will install fine but it won't be able to find the Expansion OBB files, so the first scene will load fine, but it will probably get stuck there. 

In order to let the game find the OBB files, you need to:

1.- Rename the OBB so it follows the convention:

Unity creates valid OBB files, but their names don't follow the convention Android expects. Your OBB file should have a name like the following: 

main.[VERSION_NUMBER].[PACKAGE_NAME].obb

Where [VERSION_NUMBER] is the highest digit of the version number you can find in the Player Settings:


And [PACKAGE_NAME] is the package name specified in the same screen, right above the version number:


So, in the example depicted in the images, the name of the OBB file would be:

main.1.com.iayucar.TestGame1.obb

2.- Copy the renamed OBB file to an specific location

The game will expect to find that OBB file in a location like:

[INSTALL_LOCATION]\Android\obb\[PACKAGE_NAME]

Where [PACKAGE_NAME] is the same value described above, and INSTALL_LOCATION refers to whether the game is installed in the internal memory or the external SD-Card (this depends on your own settings). 

As our game is configured to be installed in an external SD-Card preferably, the folder where we need to paste the OBB file is:

\\SDCard\Android\obb\com.iayucar.TestGame1\

And that's it. Now you can launch the game, and it will properly find the additional contents included in the OBB Expansion File. 

Using RacingWheels and other kind of devices in Windows.Gaming.Input

Now that UWP (Universal Windows Platform) is out (and apparently the way to go for video games), a decent Input API was more than needed, to be able to use controllers like racing wheels. And that API is Windows.Gaming.Input.

I already talked about this topic last month, but no matter how hard I tried to make my Logitech G27 be recognized by the API, it simply didn't work. And it was hard to do something wrong in the code, as reading the controller is as simple and straightforward as checking the contents of a collection.

I simply assumed that the API, or the Logitech Driver, or Windows, had problems with certain controllers somehow. And provided that the G27 is a bit old, and that Logitech hasn't updated the drivers since last March, that sounded realistic.

But yesterday, Forza 6 Apex was updated (and taken out of BETA), and finally announced steering wheel support, so I quickly updated it, just to check (to my surprise) that my G27 worked perfectly.

And it's a UWP too, so it was clearly not due to a bug in the API or the driver, but a problem in my application. Provided that the code is so simple, it had to be some configuration issue, and yes, it was...

I checked a thousand times the Capabilities section of the AppxManifest, but I never saw anything that seemed related. But thanks to Mark Thompson (and to the XBox Developer Forums), now I found out what should be added to the AppxManifest in order to make it work.

Simply add the following to the Capabilities section:

 <DeviceCapability Name="humaninterfacedevice">  
     <Device Id="any">  
      <Function Type="usage:0001 0004"/>  
      <Function Type="usage:0001 0005"/>  
     </Device>  
  </DeviceCapability>  

Et voilá. Now the G27 is properly recognized by the app. I still don't understand why this is needed for racing wheel, but not for gamepads.

However, you can find more info here:

Microsoft guys told us that this will be added to the docs soon, but for now, it's not there.

Hope it helps!

Quiero trabajar haciendo videojuegos ¿Qué tengo que hacer?

Hace algún tiempo, un buen amigo me pidió si podía asesorar a una alumna suya, que quería orientar su carrera profesional hacia el sector de la creación de Videojuegos. 

Más concretamente, le gustaría trabajar desarrollando software (ingeniería) en alguno de los estudios realmente grandes de la industria (casi siempre situados en el extranjero). 

Dado que es una industria bastante particular y algunos ya hemos pasado por ello unas cuantas veces, me pareció útil publicar aquí la carta que le escribí. Espero que ayude a otros estudiantes que quieran seguir los mismos pasos. 

Ahí va! 

---

Hola XXXXX. Encantado de saludarte.

He escrito el siguiente texto, describiendo todos los aspectos que me parecen relevantes a la hora de acceder a esta industria. Espero que te sirva...

Estudios y formación previa

Sobre departamentos de arte no puedo opinar mucho, pero si lo que te interesa es la parte de ingeniería, lo mejor es estudiar Ingeniería Informática o alguna otra carrera especializada. 

En cuanto a los másters que suelen ofrecer las universidades, cuidado... porque hay de todo. Muy a menudo (y más en este país) la gente que imparte los masters tiene poca (o ninguna) experiencia en estudios de desarrollo reales (y menos aún en estudios de primera fila). Casi toda la experiencia que hay en este país es en estudios muy pequeños, generalmente de desarrollo para móviles. Y aunque puede ser muy buena, hay algunas diferencias entre trabajar ahí, y trabajar en DICE. 

Así que lo que yo te recomendaría, si te decantas por esta opción, es que te fijes no solo en los contenidos que se imparten, sino también en quienes son los profesores del master y si tienen experiencia real en la industria. Eso es lo más importante, porque así no solo aprenderás la parte teórica/práctica, sino también las particularidades que tiene el día a día del trabajo en un estudio (que no son pocas).  

El proceso de selección

Una vez hayas completado tu formación, y quieras aplicar a un trabajo, el proceso de selección en los estudios grandes o TripleA (Visceral, Rockstar, DICE, Ubisoft, Valve, Rare, etc), suele ser como sigue (evidentemente varía en función del puesto, pero suele ser asi):

1.      Filtro inicial: se aplica un filtro de corte y a los que no lo pasan ni siquiera le devuelven el email (si, son así de crueles). Se trata de comprobar algunos requisitos mínimos, que son absolutamente indispensables y normalmente lo hace un empleado de RRHH. Es decir, si no pasas ese filtro, el verdadero reclutador (responsable del departamento que ha abierto la plaza), ni siquiera ve tu candidatura (luego te hablaré más de RRHH):

a.      Nivel de inglés muy alto (indispensable). No importa cómo de bien creas que hablas inglés, cuando llegues a un estudio así, los primeros meses los pasarás fatal en las reuniones (te lo digo por experiencia…). El resto de idiomas que hables, importa más bien poco. Da igual a qué país vayas… Da igual que no hables el idioma local. Vas a trabajar en inglés, y cualquier estudio serio es el único idioma que te va a exigir.

c.      Permiso de trabajo en el país donde está el estudio. Hay muchas ofertas en USA en las que no quieren ni oír hablar de candidatos que no tienen permiso de trabajo allí. Para ellos es un lío gestionar eso, así que es muy frecuente que te rechacen por esto. Empresas grandes como EA o Microsoft sí suelen gestionar el visado, pero aún así es complicado.

2.      Filtro secundario: este ya tiene que ver con necesidades adicionales para el puesto, y dependiendo de casos pueden ser irrenunciables también. En ocasiones, y si el personal de RRHH está especializado, este segundo filtro lo aplican ellos también, por lo que seguirás sin llegar a la persona que sería tu jefe en caso de ser aceptado:


a.      Experiencia en la industria: Esto suele ser muy habitual. A no ser que busquen gente muy muy junior (recién salida de la uni), la experiencia en otros títulos suele ser algo exigido con mucha frecuencia. Y aunque no sea un requisito indispensable, suele ser de las cosas que más valoran. Sobre todo si has estado ya en un estudio considerado “de los grandes”, suele ser de las cosas que más pesan en el CV. Por encima de másters, formación, etc.

b.     Muestras de trabajo: Hoy en día, el CV se utiliza más como un filtro de corte para rechazar candidatos, pero como te decía no es lo más importante a la hora de valorar un candidato. Si pasas el primer corte y, aunque no tengas experiencia, aportas muestras de trabajo (o de proyectos en los que hayas trabajado) que impresionen a los reclutadores, ganarás muchos puntos. Eso si, asegúrate de presentar solo lo verdaderamente bueno. El nivel en los estudios es altísimo, y si presentas algo que les parezca mediocre, puede ser contraproducente.

3.      Entrevistas: Si has pasado los 2 primeros filtros, eso quiere decir que el de RRHH no te ha descartado, y ha hecho que tu candidatura llegue a la persona que realmente ha abierto el puesto. Probablemente la persona que será tu jefe en caso de ser aceptado. Dicha persona puede aplicar su propio filtro y descartar más candidatos, pero si contactan contigo, lo siguiente que querrán será tener una entrevista contigo por Skype. 

Yo he hecho muchas, y me he encontrado de todo. Lo normal es que todo el mundo sea muy amable, pero como te digo, te puedes encontrar de todo. Recuerdo una vez, en una entrevista para Blizzard  (en Los Angeles), el tío fue tan borde que fui yo el que a mitad de la entrevista le corté y le dije que no me interesaba el puesto. 

Deberías haber visto su cara, pero sinceramente, si ya en la entrevista son tan estresantes y bruscos es probable que luego el día a día allí sea un infierno. Nunca se sabe, probablemente el tipo tenía un mal día, pero es un mal modo de empezar, y estudios hay muchos.

Las entrevistas suelen ser varias:


a.      Primera entrevista: en la primera entrevista, probablemente solo querrán conocerte. Ver qué tipo de persona eres. Esta entrevista a veces la hace RRHH también, y va más orientada a asegurarse de que vas a encajar en la filosofía del estudio (que como verás más adelante, suele ser especial de narices).

b.      Segunda entrevista: esta entrevista seguramente será mucho más técnica o enfocada al puesto para el que aplicas, y seguramente la hagas con la persona que sería tu manager si fueras admitida.

c.      Prueba técnica: Es muy frecuente que, después de esta entrevista, te hagan una especie de examen técnico. Suele ser una prueba de programación, que a veces va acompañada de un examen teórico. Y suele ser muy, muy exigente. Lo normal es que la prueba esté a un nivel exigente incluso para ellos, porque una de las cosas que quieren ver es cómo reaccionas ante algo que no sabes resolver. Ahora que soy yo el que prepara los procesos de selección, te aseguro que a veces preguntamos cosas que nosotros mismos tendríamos que consultar.

d.      Entrevista en persona: esto es algo inevitable. Si pasas todos los filtros anteriores, tarde o temprano te querrán ver en persona. Da igual si el estudio está en Inglaterra, Estados Unidos o Australia. Lo normal es que hagan una entrevista personal, y lo normal es que ellos corran con todos los gastos también (viaje, hotel, etc). 

Si todo el mundo pide experiencia en el sector, ¿cómo demonios voy a lograr entrar en el?

Como te decía, lo que más va a pesar una vez pasas el filtro básico, es la experiencia. 

Aquí es donde uno se pregunta lo de siempre… ¿cómo demonios voy a ganar experiencia, si todo el mundo exige experiencia para contratarme? Es un círculo vicioso, si, pero hay formas de poder salir de el.

  • Opción 1: tener experiencia en otros sectores que, aunque no sean de videojuegos, pueden ser muy similares. Por ejemplo, el sector de la simulación.
  • Opción 2: tener experiencia en estudios mucho más modestos que no suelen ser tan exigentes. El típico ejemplo son los estudios de juegos para móviles pequeños, y de eso hay unos cuantos en España.
  • Opción 3: no tener experiencia en estudios, pero haber publicado tus propios juegos a título personal. Hoy en día, en el mercado móvil es muy asequible hacer esto y es una muy buena forma de demostrar lo que sabes
  • Opción 4: no tener experiencia alguna, pero deslumbrar con muestras de trabajo de otro tipo. Como te decía, pueden ser un buen sustituto y en temas de programación es fácil demostrar lo que sabes. Proyectos en los que hayas colaborado, tener tu propio blog técnico, proyectos en GitHub o CodePlex, etc. Todo ayuda.
  • Opción 5: Internships: Es el equivalente extranjero a los becarios o a las prácticas de empresa, y ahí si que es mucho más fácil que acepten a recién graduados. Y es una experiencia que sirve. Quiero decir, que otros estudios sí lo valorarán a la hora de evaluarte, así que es una forma muy buena de conseguir experiencia.

¿Cuando aplicar?

Si tu objetivo es trabajar en un estudio, empieza a aplicar en cuanto acabes la carrera. Se ambicioso, que nunca se sabe. Tiempo tienes para que te digan que no. Y no te preocupes, que no pasa nada porque no te cojan. 

No vas a entrar en una lista negra en la que ya no volverán a considerarte. Al contrario. Los estudios tienen cierto puntito de “religión” y les suele gustar la perseverancia. Hay mucha pasión en este mundillo, y que les digas que uno de tus sueños era trabajar con ellos, les pone. 

Si ven que has aplicado 4 veces, y que has ido mejorando tu candidatura por el camino, va a ser algo positivo, no negativo.

Y lo que te decía, si consigues entrar, aunque sea como internship, eso va a pesar mucho más en tu CV para futuras aplicaciones que cualquier Máster que hayas podido hacer. Eso si, mientras no consigas entrar en ningún sitio, estudia mucho, haz todos los máster que puedas y prepara un buen portfolio de muestras de trabajo.

Referencias

En esta industria es bastante frecuente que consulten tus referencias. Sobre todo si aportas algo de experiencia en otros estudios, les van a llamar para preguntar por ti. Es algo importante a tener en cuenta. Incluye referencias en tu CV.  

Recursos Humanos

El tema de RRHH merece mención aparte, ya que su comportamiento es muy curioso: el personal de RRHH está centrado en lo suyo. EXCLUSIVAMENTE. A veces, incluso son “contractors”, y van por objetivos. Su trabajo es conseguir candidatos que terminen encajando en el puesto y son evaluados por ello. Punto. 

No es el caso de Electronic Arts (ya que aquí el personal de RRHH es parte de la plantilla fija), pero a veces si pasa en otras empresas grandes como Microsoft, Google, Apple, etc. 

Y cuando eso pasa, la cosa funciona así: algún manager necesita cubrir una vacante, así que informa a RRHH y les pasa una descripción del puesto y de requisitos. A partir de ahí, RRHH toma las riendas de todo, y el reclutador se limita a valorar los candidatos que pasan los primeros filtros.

¿Qué quiere decir todo esto? Pues que aunque parezca sorprendente, a veces RRHH y ese mánager están increíblemente des-alineados. Y lamentablemente, muchas veces la gente de RRHH funciona como comerciales. Si tienes pinta de ser un buen candidato para el puesto, intentan “vendértelo” por todos los medios. 

No es algo que pase en EA, pero en otras empresas si puede suceder. Así que mi consejo: TODO lo que te digan los de RRHH debes contrastarlo con el que vaya a ser tu mánager.

Y otra cosa, los de RRHH son perros viejos. Y como saben de qué va el juego, nunca te van a confirmar nada por escrito. Verás que, aunque tu les mandes un email, ellos te contestan por teléfono la mayoría de las veces. Tienen alergia a dejar las cosas por escrito, así que NUNCA consideres nada como cerrado hasta que no te manden “la carta”. 

Cuando las cosas ya están confirmadas, te mandan una oferta formal por escrito que oficializa todo. En estudios grandes, esto se hace siempre y es una carta en la que se especifican todas las condiciones. Hasta que no te han mandado esa carta, y tu la aceptas oficialmente, no hay nada comprometido. 

Puede que para internships la cosa sea menos formal, pero para puestos fijos (regular, o full-time) es así. 

Regular/Full-time employees

Esto probablemente aplique para cuando tengas más años, pero conviene tenerlo en cuenta: todas estas empresas tienen siempre dos tipos de empleados: permanentes y temporales. Y solo los full-time suelen gozar de todos los beneficios asociados al puesto. A veces, no queda otra que entrar como temporal. Pero ojo, pasar a ser un empleado permanente a veces no es sencillo. Si tienes que escoger entre dos estudios, y en uno eres fijo y en el otro no, tenlo en cuenta. 

Los estudios de desarrollo

Los estudios de desarrollo suelen componerse de artistas (modeladores 3D, sonido, texturas, etc), que suelen ser mayoría en todos los estudios, e ingenieros (que suelen ser un 20-40% del total de empleados). 

Estos últimos, suelen dividirse en los siguientes equipos:
  • Tools&Pipelines: creación y mantenimiento de herramientas para la gestión de assets y procedimientos, editores 3D, etc.
  • UI: creación y mantenimiento de la tecnología de user interface
  • Gameplay: ingenieros que trabajan en la tecnología para gestionar el juego y hacer que sea fluido, divertido, etc.
  • Core Tech: Rendering, animation, audio, A.I., Physics
A mucha gente le suele llamar la parte de Core Tech, pero ya te aviso: es donde más bichos raros hay. Gente que duerme en el estudio, y a veces incluso gente que huele mal (literalmente). 

Te vas a encontrar freaks de un nivel que nunca nunca nunca hubieras imaginado. Pero claro, ese nivel de frikismo es por un motivo: CoreTech es lo más complicada de todo y la que requiere más talento. Vas a conocer gente con un talento que te va a dejar alucinado. Literalmente. Y vas a aprender muchísimo. Así que tiene su lado malo y su lado bueno… :)

Las dinámicas de trabajo


En los estudios actuales, normalmente se trabaja siguiendo dinámicas SCRUM. Con equipos no muy grandes en los que un mánager gestiona a su equipo, tanto a nivel personal como profesional. Luego suelen estar los Project o Product Managers, que se encargan de comunicar a unos equipos con otros: transmitir necesidades, priorizar temas, etc. Todo lo que te puedas familiarizar con éstas formas de trabajo, mejor.

El nivel en los estudios

Si eres un buen ingeniero, conviene no asustarse demasiado. En casi todos los estudios están los 3-4 típicos cracks que son DIOS. Las personas a las que todo el mundo pregunta cuando tiene dudas. Y luego hay una masa de ingenieros, que simplemente son muy buenos. Pero no DIOS. :)

Y otra cosa, todo el mundo asume que una persona nueva tiene que aprender. Nadie te va a pedir que llegues y seas productivo el primer día. No agobiarse con eso. 

Solo aprender la terminología y los acrónimos propios del estudio ya te llevará semanas… :)

Tecnología

Hay algunas tecnologías que se han adoptado como estándar en la industria. Por ejemplo Perforce. No es más que un sistema de repositorio y de control de versiones y código fuente, que se usa para almacenar y gestionar el acceso a todo el código de los juegos (y de los assets). Si tienes experiencia con Perforce, mini-punto para ti. :)

En cuanto a herramientas típicas para otras gestiones, tienes Jira, Confluence, DevTrack, etc... Si te suenan, mini-punto para ti... :)

Lenguages de Programación

Normalmente, el lenguaje de programación estándar es C++. 

A no ser que apliques a un estudio exclusivamente móvil, en el que últimamente se ha estandarizado mucho Unity (con C#). Pero si es un estudio que publica para consolas y PC, casi seguro tu lenguaje será C++.

Hay otra excepción: si aplicas a un equipo de Tools&Pipelines, éstos suelen trabajar en C#, por una cuestión de eficiencia y rapidez. Puesto que sus herramientas suelen ser internas y no necesitan ser cross-platform (solo se usan en PC, de forma interna al estudio), casi todos los estudios escogen este lenguaje para esa parte.


Espero que os sirva! 

Steering Wheel Support in Forza Motorsport 6: Apex (and any other UWP application)

Since Turn10 released the Forza Motorsport 6: Apex demo, there has been quite a lot of noise, rumors, and opinions about the lack of support for steering wheels like Logitech G27, G29, Fanatec, and so on.

Sites like this or even the official Forza forums have tough debates about the issue. Some users complain about Microsoft not caring about PC gamers, or even talking about a conspiracy to force us to renew our controllers (or to buy XBox Certified devices). Leaving conspiracies aside, most people wonder why a PC game has no support for steering wheels, when the controller is perfectly detected and configured in Windows.

Truth is there is no conspiracy... The answer is simple: UWP

What is UWP and why should I care? 

UWP stands for Universal Windows Platform.

Apps developed as UWP can run in any device (PCs, XBox, Phones, ...) and can be published in the consolidated Windows Store. You know, the famous convergence:one OS, one Store... So, it has its advantages (big advantages, to be honest).

Why does that affect to Forza? Guess... Forza 6: Apex has been developed as an UWP. Probably as part of a marketing campaign to push the platform forward, or maybe because Turn10 really saw the benefits of UWP. Who knows.

The thing is that UWP-compatible APIs currently offer no single way to do proper controller input, besides Gamepads. And that's probably the main reason why Forza 6 has been released as BETA until now. Because they knew they didn't have a chance to offer support for steering wheels.

See? No conspiracy. It's just a technical limitation.

So, will it be fixed?

Short answer: yes.

Long answer: a bit of history first...

To make your apps compliant with UWP, you cannot use certain old technologies that don't follow some of the current standards. One example of those technologies that are no longer valid is DirectInput.

DirectInput is a quite old piece of technology that hasn't received updates for many many years. And yet it has been the only way to get decent access to certain types of controllers, until now.

Even the Logitech Developer Labs has been using DirectInput to build their SteeringWheel SDK up to date (this screenshot has been taken today):


As a developer that has been working with DirectInput for more than a decade, I have to say that it had its charms: it was extremely open to literally ANY kind of device. But it had its drawbacks too (like a quite difficult learning curve). So I agree it needed a replacement that complies with current development standards.

That's what Microsoft has been trying in the last few years: to find a decent replacement for DirectInput. With no luck, I have to say. They created XInput, which was meant to be that replacement. Or at least that's what they promised, but the truth is that it never received enough attention to become that. It never got any kind of support for game controllers besides Gamepads. So, it never was an option for Joysticks or RacingWheels.

Some time ago, we heard about a new API called Windows.Gaming.Input. And again, it was described as the way to go now.

We (developers) were a bit skeptical about that, because it sounded too familiar after the XInput promises. And things got only worse when we could start testing it out, and again it only offered support for Gamepads.

That has changed now with the release of the Windows 10 Anniversary Update. and the corresponding Windows 10 SDK - build 14393. Both publicly released today.

So, is it fixed yet?

No, but at least the tech bits needed are there.

The Windows.Gaming.Input namespace now includes all the classes necessary to read from a wider selection of devices, including ArcadeSticks, Gamepads, HeadSets and RacingWheels (surprisingly no Joysticks by now).

I´m sure that now that the update has been released, and UWP apps can read from Steering Wheels, Turn10 will release an update to Forza 6 soon. Maybe it even exits the BETA stage, who knows.

What Steering Wheels will Forza Support?

As far as I know, Forza should support the same range of devices supported by the API. And according to the API documentation, the currently supported list of steering wheels is:


Supported Devices

RacingWheel supports any Xbox One certified or Xbox 360 compatible racing wheel without force feedback support.
Force feedback is supported on the following device models:
ManufacturerModel
LogitechG25
G27
G29
G920
MOMO Force Feedback Racing Wheel
ThrustmasterT300RS
T500RS
RGT Force Feedback
T150
TX
TMX
FanatecCSR
HID-mode for the Xbox One
So, the wait should be over soon! 

Be patient, and wait for the Forza update... 

Cheers, 

DirectInput, XInput, Windows.Gaming.Input, y ahora qué? Forza Motor Sport 6

Desde que supe que Forza Motorsport 6 iba a ser una UWP (app universal), y por tanto iba a tener una versión Windows 10, estaba muy expectante para ver qué pasaba con un tema muy concreto: DirectInput. 

Microsoft lleva años dando bandazos con determinadas tecnologías de juegos (todos recordamos el bizarro caso de XNA). Y DirectInput es un caso parecido, aún más extremo si cabe. Para los que no lo sepáis, DirectInput es un módulo dentro de DirectX que se encarga(ba) de acceder a dispositivos como Joysticks, volantes, gamepads, etc.

Cuando salió Windows 8, lanzaron el que (se suponía) iba a ser su sucesor: XInput. Pero inexplicablemetne hicieron una chapuza que solo soportaba gamepads, nada de dispositivos de entrada genéricos ni Force Feedback.

En applicaciones Windows Desktop, uno puede seguir usando la librería, por muy deprecada que esté. De hecho, si vais a la web de Developers de Logitech y os bajáis su SDK, veréis que aún está basado en DirectInput: http://gaming.logitech.com/en-us/developers

El problema, es que las Apps Universales no son aplicaciones desktop, sino aplicaciones del AppStore, y por tanto no pueden referenciar DLLs antiguas. Y ahí está la movida: no existe actualmente un sustituto válido para DirectInput.

Si uno va a la MSDN, para consultar qué tecnologías de juegos pueden usarse en UWP (https://msdn.microsoft.com/en-us/library/windows/apps/mt282476.aspx), verá una sección específica para Input, en la que pone esto:


Hay un API nuevo rondando desde hace tiempo: Windows.Gaming.Input, pero nuevamente no es, ni de lejos, un sustituto a DirectInput. De nuevo, ni Force Feedback ni soporte para dispositivos de entrada genéricos HID. Solo gamepads.

Así que cuando vi que Forza iba a ser una UWP, enseguida me pregunté cómo se lo iban a montar para dar soporte a los volantes y pedales de alta gama que los aficionados a este tipo de juegos suelen tener en casa. Sistemas que, en algunos casos, se acercan a los 1000 euros.

Y hoy que se ha publicado la BETA, se ha desvelado el misterio: no lo hace. No soporta volantes. At all...

Y claro, la gente está que trina... Los comentarios en la appstore son de risa... 

Supongo que en Microsoft estarán trabajando a destajo para convertir Windows.Gaming.Input en lo que siempre debió ser, pero con Microsoft nunca se sabe... :D

Inyectando TypeEditors dinámicamente

Muchas aplicaciones de edición todavía utilizan Windows Forms. Y muchas de ellas (sobre todo si son prototipos rápidos o herramientas internas) utilizan el PropertyGrid como método rápido y eficiente para editar propiedades de objetos.

Una de las funcionalidades más utiles de los PropertyGrids, es la posibilidad de definir TypeEditors para las propiedades de un objeto, de forma que el sistema escogerá automáticamente un interfaz de usuario específico para editar su valor. .Net incluye por defecto algunos de ellos, como el ColorPicker o el DateTimePicker:

Cuando los TypeEditors por defecto no son suficiente, es una gran idea desarrollar tus propios editores, para hacer tus editores lo más eficientes posible. Por ejemplo, el selector de colores por defecto de .Net no permite escoger valores para el canal Alpha (transparencia). La solución es sencilla y fácil: podemos implementar nuestro propio editor que sí lo permita.

Ahora bien, ¿qué ocurre si queremos aplicar ese TypeEditor a todas las propiedades de un tipo definido en otra DLL?

Es un caso bastante frecuente. En mi entorno, por ejemplo, tengo mi propia clase para almacenar colores, llamada Color4, pero está definida en una DLL específica para operaciones matemáticas. Es una DLL muy básica que quiero mantener con el menor número de referencias posible, para evitar dependencias todo lo que pueda. Por este motivo, es imposible definir el TypeEditor en dicha DLL, ya que eso implicaría referenciar System.Windows.Forms, System.Drawing, y unas cuantas cosas más que no tienen que estar ahí. A fin de cuentas, es mi editor visual el que debe depender de Windows Forms, y no mi DLL de operaciones matemáticas. ¿La solución?

Inyección dinámica de editores de tipo

La solución es asignar el TypeEditor dinámicamente, programaticamente, o como queráis decirlo. En lugar de incluirlo en tiempo de compilación, con clásico código…

 [EditorAttribute("Color4Editor", typeof(System.Drawing.Design.UITypeEditor))]

…lo añadiremos en tiempo de ejecución, algo posible gracias a la clase TypeDescriptor y su método AddAttributes.

Basta con invocar algo como lo siguiente el el inicio del programa:

TypeDescriptor.AddAttributes(typeof(Color4), new EditorAttribute(typeof(Color4Editor), typeof(UITypeEditor)));

De esta forma, mantenemos las DLLs limpias de referencias innecesarias, y solo dependeremos de Windows Forms y similares donde realmente se necesita: en el editor.

Listo ! Smile

Mesa redonda–Intrograph II (Jornadas Nacionales de Informática Gráfica)

Se acaba de publicar un vídeo grabado por uno de los asistentes a Intrograph II, las Jornadas Nacionales de Informática Gráfica celebradas en Mayo en la Universidad Rey Juan Carlos.

Participé como ponente y también en la mesa redonda que clausuraba el evento. El vídeo se corresponde con ésta última sesión:

Un pequeño índice dentro del vídeo, con los temas sobre los que los ponentes respondíamos preguntas o debatíamos:

2:16 ¿Indie o triple A?
20:31 ¿PC o Consola?
49:00 Videojuegos ¿Son mas fáciles ahora?
59:55 Fecha optima del lanzamiento de videojuegos
1:13:39 Desarrollo de videjuegos ¿Por donde ir?

Massive hard drive activity when opening the Visual Studio 2013 XAML designer

This has been happening to me since last Wednesday. Honestly, I have no idea why wasn't happening before and why it started to happen now...

I have a pretty big C# Visual Studio solution, with references to native DLLs. Part of the UI is WPF, so it involves using XAML user controls. Now, when I open one of those XAML files and the designer kicks in (you can see a new process in the task manager called XDesProc.exe), my PC almost freezes.

After checking for a while, I realized that the VStudio's designer is filling the Shadow Cache folder like crazy (in my PC it's C:\Users\XXX\AppData\Local\Microsoft\VisualStudio\12.0\Designer\ShadowCache). And when I say "crazy", believe me... I mean it... It filled like 8 GB of data in a few moments...

There are many people out there with similar problems (some say to have cleaned from that folder more than 50 GB of data). You can find more examples here, here and here

If any of you have any clue about why this is happening, please let me know. By now, I managed to workaround it by completely disabling the XAML visual editor by:

1.- In Visual Studio solution explorer, right-click in a xaml file and select "Open With"...
2.- Choose XML (Text) Editor
3.- Click on "Set as default".
4.- Click Ok.


Please note: I found several websites suggesting a similar change, but saying the the Source Code (Text) Editor would work as well. It didn't work in my case. The designer didn't open, but the disk activity was surprisingly the same. The only choice that worked for me was XML (Text) Editor.

Next time you open an xaml file, the visual editor won't kick in, and you won't have the problem. However, it'd good to find the cause for this... Maybe I´ll try to re-install VStudio 2013 when I have a minute...

Hope it helps !! :)

Evolution of visuals in racing games 1992-2014

22 years. That's the time it takes to move from barely recognizable locations to blazing reality.

I still remember when I first saw Geoff Crammond - MicroProse's Formula One Grand Prix. It was mindblowing!! 3D graphics, amazing gameplay... Best racing experience I had so far...

One of my best friends had a 386 PC that met the ultra-high-end requirements the game needed (DOS, 1 MB of Ram and VGA Graphics Card). Every time I had the chance to drop by his house, first thing we did was to play this game.


But things have changed quite a lot in this time. Comparing the Monaco environment from that game with the one from CodeMasters F1 2013 makes a hell of a difference...

[Best viewed in FullHD 1080p]

And things still keep moving forward. This year, we will have a new F1 2014 game, and some others that keep pushing the limits of visual realism in videogames: [All videos best viewed in FullHD 1080p]

Diveclub:


Project Cars Trailer:


Project Cars vs Real Life:


Awesome !!!

Cómo tomar una muestra de color en cualquier cosa mostrada en tu pantalla, con Photoshop

Esta es una funcionalidad de Photoshop que no conocía. Si alguna vez te has preguntado qué color exactamente utiliza un icono, un botón de una aplicación, o cualquier otra cosa que se muestre en tu PC, puedes averiguarlo con Photoshop siguiendo estos sencillos pasos:

1.- Abre una imagen cualquiera, en Photoshop

2.- Selecciona el “EyeDropper” tool, para tomar muestras de color (normalmente dentro de la imagen en la que estás trabajando).

3.- Haz click en cualquier punto de tu imagen y, SIN SOLTAR EL BOTÓN, arrastra el puntero del mouse a cualquier otro punto de tu escritorio, a cualquier otra aplicación, icono o ventana.

Photoshop irá mostrando constantemente el color debajo del cursor del ratón, sin importar si todavía estás en tu imagen o siquiera dentro de Photoshop. Cuando sueltes el botón, ese color es seleccionado como color de trabajo en Photoshop, por lo que ya puedes utilizarlo en tus imágenes o acceder a sus componentes RGB.

Muy útil!!!


J

How to install Windows Phone 8.1, even with no developer account

If you can't wait to have Windows Phone 8.1 and Cortana, you can have it right now.


As you might have read, all you need to do is search in the Store for the application: Preview for Developers, install and open it. It opens the door to the set of updates that will trigger the installation of Windows Phone 8.1.

The thing is that one of the steps when opening it require you to enter your Live Account credentials, and in theory you must be registered as a Developer in the Windows Phone Dev Center.

Sincerely, you should consider register as so if you plan to do any development... It's only $14 yearly... But if you don't want to pay, there is a way:

1.- Go to http://appstudio.windowsphone.com
2.- Log in with your non-developer Live Account ID, and accept all the terms and conditions
3.- Click in "Start New Project"
4.- Select whichever project template you prefer (empty app will do the trick), and complete the process.

Now, you should be able to run the Preview for Developers thing, and it should accept your credentials as a registered developer.

Ta dá !!!

Disclaimer: Do this at your own risk. Windows Phone 8.1 is currently a developer preview and might contain bugs. I take no responsibility for any damage done to your phone or to your data, so better know what you are doing... :)





Fast casting of C# Structs with no unsafe code (but still kind of "unsafe")

C++ allows us to perform any casting between memory pointers. It's basically up to you to ensure the correct types are casted to prevent memory problems.

C# however doesn't allow to do this out of the box, unless you go into using unsafe code and perform the pointer conversion yourself, pretty much like in C++.

Problem is that unsafe code is not supported in all platforms, and generally it's a good idea to avoid using it as long as you can.

So, imagine we have two structs like this:


    public struct STA
    {
        public int CustomerID;
        public float CustomerRate;
    }
    public struct STB
    {
        public int CustomerID;
        public float CustomerRate;
    }

One of them is yours, and the other one comes from an APIs or legacy software you don't have access to. Now, imagine you need to convert one into another. How would you face that?

Obviously, if you try to simply assign them, it just won't work:



Of course, the most evident (ans safest) solution is to create a new struct of the type STB and copy the contents from STA to STB:

struct_a = new STA(struct_b.CustomerID, struct_b.CustomerRate);

The drawback is that this approach is slow and implies a memory overhead, what might not be an option sometimes.

If performance is a critical issue, you are sure that both structs are 100% compatible and share the exact same memory layout, and that both come from compatible platforms... Why not fooling the compiler and make it just assume that they are compatible types? 

As we mentioned, in unsafe C# code this can be simply achieved by casting pointers, just like in C++. But if you mark your C# code as unsafe, it can be rejected in some platforms. Is there a way to do that without using unsafe code? Yes, there is.

C# StructLayout to the rescue

Perfectly safe C# code allows you to explicitly define the offset of struct members, using attributes from System.Runtime.InteropServices, just like this:


    [StructLayout(LayoutKind.Explicit)]
    public struct STA
    {
        [FieldOffset(0)]
        public int CustomerID;
        [FieldOffset(4)]
        public float CustomerRate;
    }

This allows you to do tricky things like settings two different members of the struct at the same offset, creating something similar to C++ Unions:


    [StructLayout(LayoutKind.Explicit)]
    public struct Union
    {
        [FieldOffset(0)]
        public STA StructA;
        [FieldOffset(0)]
        public STB StructB;
    }

Note that both StructA and StructB are at the same field offset, and therefore will occupy the exact same location in memory. As both share the same memory layout, the result is that you have ONE single object in memory, and two different references (kind of pointers) to them, each one using a different type. 

Now, we can do the following:


            STA struct_a;
            STB struct_b;
            ...
            Union stu = new Union();
            stu.StructB = struct_b;
            struct_a = stu.StructA;

As you can see, no new STA has been created in memory, and we have saved all the process of copying data from one struct to another.

However, please be aware that this is kind of cheating... You are fooling the compiler to accept that, but in practice you are performing a classical pointer conversion, even if you are using purely safe code.

PLEASE BE AWARE that this approach doesn't take into account endianness. Different platforms, with different byte endianness, may store bytes in the opposite way. For example, if STA comes from a big-endian platform, and STB works in a little-endian platform (or just the opposite), bytes will be reversed when doing this operation. It doesn't take into account differences in data types either, so you must be very careful to ensure that all types have the same size in one struct and the other.

So, remember:
if(same endiannes & same data types) 
                              you are good to go !

Functional improvements

The Union struct we have created can be made much more comfortable to use if you add operators to it.

For example, comparison operators like this:

 public static bool operator ==(STA left, Union right)
        {
            return left == right.StructA;
        }
        public static bool operator ==(STB left, Union right)
        {
            return left == right.StructB;
        }

Will allow you to simply compare Unions with the original types:

if(union == struct_a)

And even more comfortable, adding implicit operators like this:

        public static implicit operator Union(STA value)
        {
            Union ret = new Union();
            ret.StructA = value;
            return ret;
        }

Will allow you to simply assign one type to the other like this:

            STA struct_a;
            ...
            Union union = struct_a;

Memory footprint improvements

One small drawback of this approach is the need to create structs of the type Union, each time you want to perform a conversion of this kind. A simple solution is to perform the operation in a static Union object. It's a bit messy, but it works. For instance, if you declare the class like this:

    [StructLayout(LayoutKind.Explicit)]
    public struct Union
    {
        [FieldOffset(0)]
        public STA StructA;
        [FieldOffset(0)]
        public STB StructB;

        public static Union StaticRef = new Union();

        public static STA ToSTA(STB pStructB)
        {
            StaticRef.StructB = pStructB;
            return StaticRef.StructA;
        }
        public static STB ToSTB(STA pStructA)
        {
            StaticRef.StructA = pStructA;
            return StaticRef.StructB;
        }
    }

You can now re-use the same static object over and over again, doing things like:

            STA struct_a;
            STB struct_b;
            ...
            struct_a = Union.ToSTA(struct_b);

Hope it helps!! Cheers...