Publicado el Deja un comentario

Cómo usar node http server con Phaser

En la búsqueda de actualizarnos a tiempos modernos y dejar el clásico XAMPP de lado por la versatilidad que ofrece NODE, he llegado a encontrar una fácil solución que puede servir para los desarrolladores de Phaser al momento de levantar un servidor http para poder visualizar los videojuegos en un browser.

Paso 1: Instalar NODE

El primer paso es instalar el entorno NODE en el computador. Este paso en caso de que sea una instalación limpia no requiere mayor esfuerzo y se puede hacer mediante línea de comnados en Linux o Mac, o simplemente descargando el archivo de instalación para PC.

Recomiendo acceder a la página oficial de NODE.js para consultar directamente el procedimiento detallado.

Paso 2: Instalar Globalmente el módulo HttpServer de NODE

Una vez que la instalación de NODE fue exitosa procedemos a instalar el módulo de HttpServer de node que servirá de reemplazo de XAMPP con APACHE para poder ejecutar los videojuegos de PHASER.

Para realizar este paso, simplemente ejecutamos en una ventana de línea de comando (Terminal en MAC ó CMD en Windows) el siguiente código:

npm install -g http-server

Recuerda, es diferente instalar el servidor de manera local, directamente en la carpeta del proyecto, a instalarlo de manera global, para poder ejecutarlo con cualquier proyecto en el momento que se requiera.

Para las personas que desarrollan videojuegos en Phaser y dependiendo el caso, encontramos muy útil la función de ejecutar el NODE Http-Server de manera global, ya que de esta forma, mediante Terminal o Línea de comando de Windows se accede a la carpeta de desarrollo del juego y se ejecuta el servidor.

Paso 3: Ejecutar el Http-Server

Para ejecutar el servidor se debe acceder mediante línea de comando a la carpeta donde se encuentra la instalación de Phaser o los archivos del videojuego en desarrollo y ejecutar el siguiente comando:

http-server

También se puede utilizar la versión corta y sólo ingresar «hs» sin las comillas.

Listo, con esos tres simples paso se debe acceder a un explorador de Internet y si todas las opciones se encuentran en «predeterminado» se puede acceder a la dirección localhost:8080

Esta dirección mostrará lo que se tenga albergado en la carpeta donde se lanzó el servidor que en nuestro caso debe ser el juego de Phaser

Y si quiero ejecutar un servidor HTTPS?

Para ejecutar el servidor HTTPS o SSL se deben seguir un par de pasos adicionales

Cómo ejecutar mi juego con servidor HTTPS

Una vez instalado el servidor http, para ejecutarlo en modo Https se debe tomar en cuenta que este tipo de servidor requiere dos tipos de archivos de claves que se deben generar para poder acceder al servicio.

Para generar estos archivos de clave lo más sencillo es hacerlo en una MAC o en un LINUX que tienen instalado de antemano el llamado openssl, un comando que te permite generar estas claves de manera fácil, sin embargo si te encuentras en windows lo más fácil y recomendable será instalar PUTTY Keygen

En caso de utilizar línea de comando con MAC o Linux, se deben ingresar los siguientes códigos y seguir las instrucciones que aparecen en pantalla:

 openssl req -newkey rsa:2048 -new -nodes -keyout key.pem -out csr.pem

Este comando creará dos archivos, key.pem y csr.pem, como la idea es tener un servidor para desarrollo con https habilitado procedemos a AUTO firmar nuestro archivo csr.pem, sin embargo en caso de que se necesite habilitar un servidor HTTPS validado se debe enviar este archivo a un proveedor de certificados autorizado como goddady ó ssls.

Procedemos a firmar nuestro archivo de claves con el siguiente código de comando:

 openssl req -newkey rsa:2048 -new -nodes -x509 -days 36500 -keyout key.pem -out cert.pem

Finalmente, debemos tener en cuenta dónde se encuentran guardados estos archivos respecto a la carpeta de nuestro juego de Phaser ya que mediante línea de comando se debe levantar el servidor HTTPS apuntándolos de la siguiente manera:

http-server ./ -S -C cert.pem -K key.pem

El ./ indica que el server https ejecutará los archivos de la carpeta raíz donde me encuentre, si le indico por ejemplo /webcontent en lugar de ./ u otra carpeta dentro, pues el server ejecuta los archivos de dicha carpeta a partir de la raíz.

Por último se debe tomar en cuenta que los archivos de claves también pueden ser relativos y pueden estar dentro o fuera de la carpeta del proyecto, sin embargo para los juegos de Phaser es recomendable que estos archivos estén fuera y que inclusive el server se lo lance en un directorio superior para no tener que mezclar archivos de server con los archivos de del proyecto.

Publicado el Deja un comentario

Our new game, code name The Wisher

We are proud to present an advance of our last game in development, the code name by now is The Wisher, later maybe this game will change because we are pointing to a casual Facebook Audience, and seems that, on that social media platform the games must have simple names.

Regardless of that, with each game we are making in weveana the bar of quality and fun in our games is rising, so as first we begun with some sketches of how the game should look and feel, how we imagine the original gameplay.

For sure many things have change since the original concept, and we are very exited to get the release date of this game.

Publicado el Deja un comentario

Flash is dead… but Phaser users can still create animations with it

As an old user of Flash technology i still miss the power and potencial that AS3 had and how it expanded the casual gaming industry with those Flash action games of the 2000s.

Now the chance is for HTML5 and lot of web frameworks able to accomplish great results as for example the one im using now, Phaser.

Phaser is a great framework to generate HTML5 games, you can check my games at www.weveana.com, and same as AS3 a great programing language required a great IDE. PhaserEditor is the choice in this case and it makes a great job into helping the developer with the most common tasks in developing great HTML5 games.

The PhaserEditor IDE is a great tool to assemble the many media that a game can include and sync it together, but games also are in need of tons of graphics and animations that many designers or developers where used to do it in Flash.

So how can a developer use Flash or in nowadays Adobe Animate to create the graphics for use it with PhaserEditor?

The secret lies in the sprite exporter that adobe animate has included and it will help a lot of designers export their animations to the Phaser.io world.


p.p1 {margin: 0.0px 0.0px 20.2px 0.0px; text-align: center; font: 14.5px ‘Times New Roman’; color: #424242}
After creating your animations go to “Generate Sprite Sheet”

When using any sprite generator the important thing is to set the specs correctly, for the PhaserEditor 2.x i use the following:

The width and height can be set on Auto or manual, but the important thing here is to select Starling as Data format and 1px for border and 1px for padding, also remember to click Trim.

Very important is to have in mind that the animations must be created on layer and not using the nested MovieClips that Flash is capable to use, instead the animations must be created for a frame by frame sprite sheet export. Instead of using nested Movie Clips it is preferably to use the simple layers and maybe some classic tweens.

With that small explanation, people who still remember or still uses Flash or Animate as their primary animation tool can export the animations created on it to Phaser.

In my case image will export on png format with transparent activated, and with a xml able to be imported in Phaser Editor, but also flash can handle json files.

Publicado el Deja un comentario

Facebook Instant Games can’t be monetized via Audience Network if you live in Ecuador and some other countries.

“This platform is not supported in the region of this payment account”

At the time of this writing there is a huge problem when trying to monetize games for Latin American countries like Ecuador using Audience Network.

From a developer perspective living in this country is a disappointing situation when using the Instant Game model to rise up a game design studio focused on casual gaming for social media because Facebook does not accept payment accounts for every country in the world.

This issue is huge for people searching to create some kind of income designing and developing instant games. For a better understanding of the issue i explain why Facebook should fix ASAP this situation for people giving a chance to this model of instant game revenue.

So, to develop an Instant Game for Facebook it is possible following some rules they have implemented in order to publish any kind of casual game in their site.

Beside of the normal development process of creating any game, one of the first complicated parts of the process for develop Facebook Instant Games, is to present some kind of document certifying a company or enterprise that is going to represent those games.

As a person living in Ecuador this implies to do the paperwork to create a company valid in Ecuador and with all the right and obligations that held up maintain it, that is to pay foundation fees and paying taxes.

After being approved by Facebook and able to upload and publish games on their Instant Game section, the next step will be trying to monetize the published games. The problem lies when applying for a payment account on the Audience Network section.

It a long step by step configuration and at the end the answer i get is “This platform is not supported in the region of this payment account”, the image below show this problem.

Why why…

I believe Facebook should extend the countries or methods to accept payment accounts for Instant Games, Im sure there is a bunch o people in many countries that will hit this wall when trying to develop and grow the library of Facebook Instant Games.

When asking customer service of Facebook this is the message i got, ‘Thank you for contacting us and for applying to the Audience Network. At this time we are unable to accept your request’

Sad Facebook, sad

Publicado el Deja un comentario

Phaser and Tone.js music box prototype

Playing with Phaser and a sound library called Tone.js, i was able to assemble a prototype of something like a music box. Using Tone.js is very interesting how it can handle the sound for an experiment like the one presented in this post.

Tone.js is able to create the notes from scratch and with a bit of luck execute from Phaser.io

The experiment uses Phaser as the trigger of the notes in Tone.js, and the notes can be added as expected with the Tone.js notation system. In this case the music was written by a friend who is a musician and was very effective recreating the notes from A-HA TAKE ON ME.

Click on the link bellow to listen and see the Tone.js and Phaser experiment:

https://weveana.com/proyectos/SoundTest/WebContent/TakeOnMe
Publicado el Deja un comentario

The road to HTML5 casual game development – “I still use Phaser 2”

Well, for some time now, i´ve triying to catch the Phaser 3 train. In my experience, as a single developer who already passed several years deciding how to get involved into the HTML5 game design and development world, first i started with a js framework called impact.js.

But going even more to the past, i remember to proof myself doing any game with whatever languaje i had. So as a multimedia designer i already was, the first technology i had contact with and able to really do some interesting interactive stuff was FLASH. At the time this technology was involved in many web games that used to inspire me to try to develop something like that.

So my first game prototypes where made using FLASH but the dead of this tech marked me with a new task, learn how to make HTML5 games. Thats why i ended at firts with impact.js, a library in JS that is fine for doing games but its no more upgraded or maintained for a while now.

So i decided to search for another solution, and found Phaser, that in the moment was in version 2. For many years i used my time to learn this framework, i got some ebooks and followed some tutorials, i spent many hours and did some prototypes and finally i knew how to move a bit quickly in that development eviroment.

In some point i was exited for the upcomming release of Phaser3, but untill then i continued learning how to develop things on Phaser 2. I even aquire some plugins or programs to accelerate the development process and make my first complete game.

So after i got the chance to fully concentrate in develping a complete game, i did it knowing that Phaser 3 was already realeased, in my mind this technology was an “upgrade” from Pasher 2. But sadly when i wanted to connect my already aquired knoledge and effort with the “New Phaser”, I was surprised and i felt a bit dissapointed to the complete rewrite of the framework.

So with the history backgorund given, on my case to continue learning the new workflow showed in Phaser 3 is a WANT but not a MUST, considering that also i am attracted to give the chance to Unity as the IDE for building the web games.

The funny thing here is that already is an upcomming Phaser 4 on the way! Well i left here the link to other of my articles where i did the same thing with the two versions of Phaser, with this examples i ended making my first multiplayer game but i decided to go with Phaser 2 mostly cause the workflow i already have optimized and aquired and by now no further plans on cotinuing on Phaser 3 because i want to try Unity.

Publicado el Deja un comentario

A new game has arrived: Spacewalk

In our quest for creating interactive experiences, we begun to explore the vast world of multiplayer gaming design and develop. As a first example of what can we do with the tools and languajes available to build HTML5 games with ease, Spacewalk is the result of that path of design and development.Play our first multiplayer game now!

As we advanced with the creation process, we have the theory of what a multiplayer game must do in terms of the coding and the networking behind the scenes to deliver a online multiplayer experience.

Publicado el Deja un comentario

Phaser 2 and 3 Multiplayer test

So we are trying to get into the multiplayer game area with Phaser, and the current technologies we know so far that could work are Socket.io and Croquet.io. The diferences between them are huge, and the performance also very noticeable.

By now i will juts post the examples we made, but we are planning to bring a tutorial or series of tutorials if the community has some interest.

The examples ill give you bellow, are not perfect, but in the first case (socket.io), it will demostrate how the socket.io is working in our weveana server and can handle a multiplayer game, at least the movement and shooting of some spaceships.

We haven’t tested the performance of how many ships can handle the server, but please! don’t you try here! in case of shutting down my own server :S

The second example is made with Phaser and the Croquet.io engine, a very interesting approach to the multiplayer programing, recomended to check out their website http://croquet.io/

If you want to test by yourself ill give you the links of the examples and the soruce code at github.

Example 1: Socket.io

https://weveana.com/proyectos/socketTest/
https://github.com/pattodiablo/socketTest

Example 2: Croquet.io

https://weveana.com/proyectos/MultiplayerTest3/WebContent/
https://github.com/pattodiablo/MultiplayerTest3