MiniDungeon – A Free Random Dungeon Jump Start for Unity

The other day I was discussing with a friend about automatic dungeon creation in Unity3D and I recommend him an excelent and also a free and easy Unity project I had found some time ago. The project is called "MiniDungeon – A Free Random Dungeon Jump Start for Unity" and it used to be hosted here http://www.stevegargolinski.com/minidungeon-a-free-random-dungeon-jump-start-for-unity/
For my and his suprise, the website was (actually is) down but I told him to not to worry because I have the source home at home.
As I think this code is great, I decided to re post the original blog spot (I have it in my pocket ;) and to upload the original source code to my public bitbucket.

First of all, you can download the minidungeon source code here https://bitbucket.org/hzaldivar/minidungeon.git

Here you have the original blog post written by Steve Gargolinski (@sgargolinski):

Over my holiday break I spent some time messing around with Unity on a basic random dungeon generator with lightweight RPG elements, and I’ve decided to post a version up here as a jump start in case anyone is interested in working on something similar. Hopefully this will help someone out.

I’ll start this post with a web player version and then the full Unity project download, and then go into a bit more detail below. I also want to throw out the caveat up front that this code is not polished and hasn’t been iterated on much or tested extensively.

With that out of the way, click the image below to check out MiniDungeon in the web player. There is a ‘walkthrough’ below.
The Basics / “Walkthrough
MiniDungeon starts off at a main menu, but the only real current option is to play the game. Clicking on Play takes you to the Home Base, which is what I envision as the hub in between adventures – a place to upgrade weapons/armor, train skills, shop for healing potions, maybe get some info from townsfolk, etc.
I also envisioned the Home Base as a quest hub, where you choose which adventure you want to go on and the future dungeon/storyline is configured to make this happen. So you might choose “Go Rescue the Princess” or “Go Slay the Dragon”, and the dungeon generator/storyline will be customized appropriately. In this demo, all you can do from here is click “Go on an Adventure”.

At this point you are launched into a randomly generated dungeon. There are some instructions on hotkeys in the upper-left, and then some info on your character in the upper-right. This randomly generated dungeon floor includes stairs up (green) and stairs down (red). If you move around (with WASD) to the stairs down, you can press spacebar to go to the next level. Note that the dungeon floor counter in the upper left will increment. As you go down each level, there’s a random placeholder story segment to advance the future story.

If you want to see a larger view of the dungeon, hit ‘Z’ to zoom out and then back in. You can also hit ‘Tab’ to skip ahead to the next dungeon level. Zooming out and then repeatedly hitting ‘Tab’ will show you the range of dungeon floors that can be generated.

Every once in a while you will hit a random battle vs a giant toad. Press ‘X’ to defeat him, you’ll notice that sometimes you’ll lose HP from this battle. If you run low on HP you can hit ‘I’ to open up your inventory and use a Healing Potion. Defeating a bunch of toads will level you up and increase your max HP/MP.

That’s about it – nothing staggering, but probably a pretty good jump start if you’re interested in making a random dungeon game. The only real complicated aspect of this project is the random dungeon generation, so I’ll go into a bit more detail on that.

Random Dungeon Generation
The random dungeon generation algorithm included (in the DungeonGenerator class) is something that I worked out off the top of my head. I did some quick research and couldn’t find an algorithm to do what I was looking for, but it’s possible I just didn’t look in the right place. My goal was something similar to the iPhone game Deep Deep Dungeon (link here), and I’m definitely happy with the results. The algorithm is definitely not optimal or optimized, but it works well enough and should get you started.

We start off with sixteen dungeon building blocks. Here’s a page from my notebook that shows what we’re working with along with my naming convention.

The prefabs that represent these can be found in Prefabs/Dungeon Building Blocks. These are what we’re going to piece together in order to create our dungeon.

In the DungeonGenerator object, you are able to specify the size of the dungeon – NumBuildingBlocksAcross and NumBuildingBlocksDown. The default values create an 8×8 dungeon, but it should work for most size specifications. I just tested a 1×8 dungeon floor (not very interesting), and a 100×100 dungeon floor (took a while to generate) – which both work.

Here is the basic algorithm that we use to generate a dungeon floor:
  • We start off by creating a grid of empty building blocks. The grid matches the size specified (discussed above), and the cells are defined in the (x, z) plane. (0,0) is in the bottom-left, (max, 0) in the bottom-right, and (max, max) in the top-right. 
  • At this point we iterate through the entire grid, bottom-left to top-right, and choose a ‘valid’ building block for each cell position. What’s a ‘valid’ building block? I’m glad you asked! 
    • If the surrounding cells are all empty, then we choose a building block type randomly. We leave out the ‘capper’ building blocks from this choice, which are the four blocks used to cap off dead ends (Nx, Sx, Wx, and Ex). 
    • If some of the surrounding cells are not empty, then we choose a building block that matches the existing paths. 
      • Let’s say we have a cell to our west that’s a passage from west to east. We’ll make sure that the block we choose has an exit to the west to match the existing path. 
      • Let’s say we have a cell to our east that’s a passage from north to south. We’ll make sure to NOT choose a block that goes west, since it would create a disconnect with the existing path. 
      • So basically we narrow down the possibilities based on surrounding cells, and then choose randomly from the valid building blocks. 
  • After filling out the grid in this way, there’s the potential that the algorithm has generated ‘islands’. Sections of the maze that are separated from each other with no connecting paths. There might be a way to update the ‘filling out’ section of the algorithm to eliminate these islands, but right now I deal with it through some post processing. 
    • I do a little bit of low-class pathfinding in the CellConnectedToCell() function to identify these islands and turn them into empty cells. There might be a better way to recover and connect the islands instead of deleting them, solid exercise for the reader. 
    • Right now I consider an Island to be any section of the maze that has no way to connect to the center of the grid. 
  • The final step in the pathway generation is to cap off dead ends. As mentioned above, there are four ‘capper’ dungeon building blocks that are dead ends. We go through the grid and identify any hanging passages that don’t connect to anywhere and cap them off with dead ends. 
  • After completing the maze, we choose a random location on the path for the stairs up (start position) and stairs down (exit position). 
And that’s it, we’re done! As mentioned above, there are some shortcomings and lots of potential optimization and improvements – but it works well enough.

Future Work
It’s not hard to come up with a list of future work for this project, since the possibilities are endless. Here are some ideas off the top of my head that should result in a pretty solid dungeon crawler: 
  • Add in some real graphics, animation, sound, models, etc. 
  • Create a real combat system, maybe stat-based and simulated or some sort of combat mini-games? Special abilities, magic spells, bonusus? 
  • Add an inventory and loot system. 
  • Add a shop/economy. 
  • Extend the random dungeon algorithm to be more interesting. The one included works well, but is bare bones. Some potential extensions/improvements are discussed above, and there are plenty more… 
  • Right now the dungeon building blocks are just basic passages, but there’s no reason they can’t be much more interesting. 
  • Create different dungeon floor exit conditions. Maybe some levels need to be completed by defeating a specific monster instead of finding stairs down. 
  • Make some real quests, and parameterize the dungeon to be different based on the type of quest you’re doing. Add some real storyline segments (talking heads, text, lots of possibilities here) that advance the story. Maybe add a branching quest structure? 
  • Develop a hero. 
  • Try using this approach for a different game genre. You could try making a FPS with random maps, for example. 
  • Add support for additional building block ’tilesets’. 
  • … and many, many more. 
What Can I Use This For?
Feel free to use this project for whatever you want, I only ask that you take the time to drop me a message and let me know what you’re using it for.

Good luck!

Oh yeah, one last thing – here’s a link to a thread on the Unity3D forums for MiniDungeon: http://forum.unity3d.com/threads/minidungeon-a-free-randomly-generated-dungeon-jump-start.72525/

¿Por qué aparece semalt.com en Google Analytics?

Recien estaba revisando las Analytics del sitio de mi juego "A comic of zombies" (www.acomicofzombies.com) y me encontré con la sorpresa que muchas de las visitas provenían de semalt.com. Inmediatamente me dirigí a Google a buscar su había algún tip o pista para darme cuenta que esto mismo le había pasado a mucha gente.
Aquí les deje un muy buen post que explica que es semalt y como removerlo o filtrarlo desde Analytics

¿Por que aparece semalt.com en Google Analytics?

Que lo disfruten!!

Desbloquear blackberry

Probé este procedimiento en un Blackberry 9300 pero debería funcionar para todos los dispositivos. Esto es un rejunte de información de varios sitios y como hacerlo GRATIS! Para hacerlo debemos tener los códigos IMEI y MEP. Acá te contaremos como hacer para obtenerlos y que hacer con ellos para finalmente obtener el código de desbloqueo o MEP2
  • Retiramos el chip SIM de nuestro BlackBerry 
  • Tenemos que conocer el codigo IMEI de nuestro BlackBerry, para esto escribes: *#06# y al poco tiempo te sale tu codigo IMEI. Anotalo.
  • Para encontrar el MEP de tu Blackberry:
    • Hay que ingresar la combinación alt+aA+h en el menu de inicio de manera a que un menú de ayuda aparezca:
    • Luego nos dirigimos a la pagina web http://www.unlockbase.com/widget/blackberry-escreen-keygen.php que nos permite obtener nuestro MEP. En esta página hay que ingresar los datos que nos pide. Copia el “PIN”, la “Versión de la aplicación” (App Version) y el “Tiempo de actividad (sin lo de secs o s)” (Uptime). Estos datos nos servirán para obtener la clave de acceso a la pantalla para ingenieros de tu BlackBerry (eScreen). 

    • Cuando hayas introducido todos los datos y los mismos sean correctos, presiona el botón “Get my key” (Obtener mi clave) y la calculadora va a generar una “clave” como la que se muestra a continuación. 
    • Ahora con esa clave podrás acceder al menú de ingenieros de tu BlackBerry. Simplemente escribe la clave directamente en tu Blackberry sobre la pantalla de ayuda que dejaste abierta anteriormente. No aparecerá nada al escribir. Como siempre, para los números deberás presionar la tecla ALT mientras escribes, y para las letras no pulses aA (mayus), solo escríbelas en minúsculas. 
    • Ahora deberías estar en el menú de ingenieros, si no estás ahí, por favor inténtalo de nuevo y asegúrate de que has escrito los datos exactamente como se muestran. Paso siguiente iremos a "OS Engineering Screens" y una vez ahí a "Device Info". Anotar el código MEP del BlackBerry
  • Luego con tu IMEI y tu MEP, ve a http://a-zgsm.com/blackberry/, submitea y te dara los códigos MEP necesarios. El que yo usé es el MEP2. Si esta pagina no te funciona, prueba con http://www.bbs.x-mobila.ru/
  • Ahora para insertar el código MEP2 y desbloquear tu celular (Otros métodos para ingresar el código MEP en http://www.buzzolo.com/unlocking-instructions-for-blackberry-bold-9930.html):
    1. Inserta el chip SIM  no aceptedo en tu celular y enciendelo
    2. Te va a aparecer una ventanita diciendo que ingreses el un código de desbloqueo (conocido como código MEP, MEP2 o MEP4)
    3. Presiona SI
    4. Ingresa el código MEP2 y presiona ENTER
    5. Listo! el teléfono está ahora desbloqueado
    6. Reinicia el teléfono sacandole la batería
    7. Ir a "Conecciones" “Manage Connections” y prender las conexiones móviles.

Instagram SMS confirmation code

Below there is a note for english speakers

El otro dia, vi que algo raro paso en mi cuenta de Instagram asi que decidi cambiar mi password. Al cambiarla, comenzo a pedirme que ingrese mi numero de telefono asi me enviaba un SMS con un codigo de verificacion. Ingrese mi numero de telefono pero lo unico que hacia era enviarme un mensaje en chino. 

Luego de varios intentos pero usar Google Translator pero sin suerte, era un mensaje sin sentido.

Buscando la solucion en Google, decia que habia que usar algun sistema de recepcion gratuita de SMS que hay online pero ninguno funciono. Hasta que encontre este servicio que si funcion http://sms-verification.com/rec/%2B4796667263.php  

El servicio dice "To get your message here send sms text message to: +4796667263" asi que copie y pegue este numero +4796667263 (con el signo + y todo) y al cabo de unos segundos llego el SMS y pude reactivar mi cuenta de Instagram 

NOTE for english speakers: Use this service http://sms-verification.com/rec/%2B4796667263.php if you are expecting issues receiving Instagram SMS confirmation code. Just enter the number with the + sign

Google Authenticator crashes on Sony Xperia Zx

I had this issue from a long time but I had never dedicated the time to solve it. 

Today I was doing some stuff with PC, Picassa and my phone (Sony Xperia ZL with Android 4.3, 10.4.B.0.569) that involved using Google 2 steps Authentication. One way to use it is to wait for a SMS with the code and here in Argentina, I dont know why, some days the SMS service doesnt work. The other solution is to use Google Authenticator but the app was not working on my phone and crashed every time I tried to use it.

So I googled for a solution and found some thing related to my problem and also realized that a lot of people were facing the same problem as I. The solution was here https://code.google.com/p/google-authenticator/issues/detail?id=353, in the project home page obviously :)

The solution came from this 2 guys:

  • #7 brokenha...@gmail.comwas having the same problem, but found a workaround for this. Instead of clicking "begin setup" go to options at the top right and click setup account. I then used the barcode scanner to add my device using the "change device" option on my google account settings (on pc). Seems that the issue only exists in the "begin setup" option, however i have not verified other setup options device: xperia z1s OS: 4.3 app: authenticator 2.49 Feb 10, 2014
  • #8 glennerooI saw a warning message that Authenticator can only be installed on one device at a time. It could be possible that because Authenticator is already activated on an old device, it crashes trying to setup on a new device instead of (sensibly) displaying an error message e.g. "Sorry you already activated... scan a barcode...". If you are moving to a new device, go here: https://accounts.google.com/b/0/SmsAuthSettings And select the option to "Move to a different phone". On your phone, do as comment #7 suggested (scan the barcode provided) and it should work. device: xperia z1 compact os: 4.3
It seems there is some issue when you dont have Google Authenticator enabled as your "PRIMARY WAY YOU RECEIVE CODES" or when you have it activated on other device. Also I think there is an issue when you try to active it using other method than scanning the QR code with your app.

So to solve it, these are the steps I followed:

  1. Go to https://accounts.google.com/b/0/SmsAuthSettings
  2. Set to use Google Authenticator my "PRIMARY WAY YOU RECEIVE CODES"
  3. Scan the QR code using the app
And voila! Google Authenticator is now working!

Solution to error updating to Windows 8.1 Update KB2919355

The other day I was trying to update my Windows 8.1 Pro to Windows 8.1 Update 1 but I had no luck.

Searching the web I found no solution until I arrived to this article http://netscantools.blogspot.com.ar/2014/04/windows-81-update-kb2919355-woes-and-my.html

Basically my problem was the order which Windows Update applies the updates. As the blogpost says  "the order of the KB's being installed on April 8 was SUPER IMPORTANT and the automatic Windows Update didn't know that so it installed the others first, then tried to install KB2919355 out of order."

What I did, was (a system backup is highly recomendable):

  • Then, went to Control Panel/Recovery/Open System Restore and chose a Restore Point that was BEFORE the April 8 mess.
  • Did the System Restore.
  • Manually installed msu in the order above. I had each in Downloads and I simply double clicked to run them. These KB's must be installed in the following order: KB2919442, KB2919355, KB2932046, KB2937592, KB2938439, and KB2934018
Each one required a reboot. Fortunately SSD reboot time is super fast.

Enjoy it!

PS: The main update is KB2919355, so if you install it without problem but you have other problems installing the other MSU, just run Windows Update as normally

Actualizacion Sony Xperia ZL de Personal Argentina a Android 4.3

Como ya es de público conocimiento Sony ya libero la actualizacion oficial a Android 4.3 (y proximamente a Android 4.4) pero Personal todavia no la libero por eso no lo podemos actualizar.
Lo que hay que hacer es instalarle la ROM generica de Sony de Android 4.2.2 para Latinoamerica (que sería la misma versión que tenemos instalada pero sin toda el extra de Personal) y luego te aparece solita la actualizacion oficial de Android 4.3 tal y como dice en este foro http://www.grupoandroid.com/topic/92644-sony-actualiza-oficialmente-a-android-43-jelly-bean-los-xperia-z-zl-zr-y-la-xperia-tablet-z/?p=1334684 y se puede ver en la captura que recién obtuve de mi teléfono

  1. Para eso hay que bajar el flashtool de http://www.flashtool.net/download.php
  2. Luego  bajar la ROM 10.3.1.A.2.67 Branding Generic LAM Versión: 10.3.1.A.2.67 Android Version 4.2.2 (aca hay otras ROMs http://www.grupoandroid.com/topic/86874-xperia-zl-firmwares-thread/). 
  3. Despues los pasos son simples:
    • Ya teniendo el archivo FTF de la ROM e instalado Flashtool pasaremos aconfigurar el teléfono para poder flashear el teléfono. Tenemos que activar el modo de desarrollo que se hace en ajustes/acerca del teléfono y en número de compilación pulsar varias veces hasta que activemos el modo.
    • Cuando esté activado nos vamos a Ajustes/Opciones del desarrollador/Depuración USB y activamos el Modo Depuración.

    • Vamos ahora a Ajustes/Seguridad/Orígenes Desconocidos y activamos “Permitir orígenes desconocidos“.
    • Y para terminar de configurar el teléfono para el flasheo, vamos a Ajustes/Conectividad Xperia/Conectividad USB y pulsamos sobre Modo de conexión USB y elegimos el modo MSC.
    • Ahora ya tenemos configurado el teléfono y debemos pasar a configurar una cosilla de Flashtool, tenéis que ir a la carpeta c/Flashtool/Drivers, y allí ejecutar el archivo “Flashtool_drivers”. Os aparecerá una ventana donde tendréis que seleccionar la casilla de “Flashmode Drivers” y luego el modelo del teléfono para el Xperia Z o el ZL. Seguís los pasos de instalación de los drivers dándole a instalar en todas las ventanas que os aparezcan.
    • Ahora el siguiente paso es llevar el archivo FTF de la ROM a C/Flashtool/firmwares y ejecutar Flashtool
    • En la ventana de Flashtool darle al rayo y luego elegir el modo Flashmode.
    • En el panel izquierdo seleccionar la ROM, y aquí se puede desactivar las tres casillas a la derecha de Data, Cache y Appslog si queremos tan sóloactualizar el terminal sin la pérdida de ningún dato o si queréis instalar Android de una manera totalmente limpia dejar las tres casillas seleccionadas. Darle a “Flash” y empezará a prepararse para la instalación.

    • Ahora aparecerá una ventana que indica que debéis conectar el teléfono con el cable USB al ordenador, pero hay que hacerlo en modo Flashmode. Con el teléfono apagado, mantener pulsado la tecla de volumen abajo y conectáis el teléfono al ordenador a la vez.

    • Empezará el proceso de flasheo del terminal y veréis como va instalando los drivers si es la primera vez que hacéis esta instalación vía Flashtool. Cuando se haya instalado el driver, tendréis que repetir el proceso anterior de seleccionar ROM, activar/desactivar las tres casillas para instalar de una manera limpia Android o actualizarlo sin pérdida de datos, y darle de nuevo al botón flash para volver a desconectar el teléfono y pulsando la tecla de volumen abajo volver a conectarlo para que inicie el proceso de flasheo.
    • Tardará un rato en instalar la ROM y cuando termine, desconectáis el teléfono y lo encendéis. Actualizará las aplicaciones y ya tendréis Android 4.2 en vuestro terminal.

Consuming OData Service with Xamarin Android

I'll show you a simple way of consuming OData Service with Xamarin Android

For those who don't know, OData is a standardized protocol for creating and consuming data APIs. OData builds on core protocols like HTTP and commonly accepted methodologies like REST. The result is a uniform way to expose full-featured data APIs.

We will use Simple.OData.Client. Simple.OData.Client is a multiplatform OData client library supporting .NET 4.x, Silverlight 5, Windows Phone 8, Android and iOS. The adapter provides a great alternative to WCF Data Services client. It does not require generation of context or entity classes and fits RESTful nature of OData services. The adapter has a NuGet package that can be installed from NuGet site.

Open Visual Studio and go to FILE --> NEW --> PROJECT and choose "Android Application"

This will open a new Android Application template.

As the "Getting started with Simple.OData.Client" article says, the easiest way to start using Simple.OData.Client is to install it’s Nuget package.

Now open the default activity file (Activity1.cs) and copy this code (NOTE that we have changed the inheritance activity from Activity to ListActivity).

What we are doing here is:
  1. On the OnCreate mehod, we just have initialized the ODataClient (client = new ODataClient("http://packages.nuget.org/v1/FeedService.svc/");)
  2. Then we have started an async task, so we dont block the UI, with method StartRestRequestAsync
  3. Last, we query the service client.FindEntries("Packages?$filter=Title eq 'Simple.OData.Client'"); iterate their result and add it to the ListAdapter
You can download a sample from https://bitbucket.org/hzaldivar/odataandroid

Global Game Jam: Resources for Jammers and game developers

Next weekend will be the Global Game Jam (GGJ) 2014. The Global Game Jam (GGJ) is the world's largest game jam event taking place around the world at physical locations. Think of it as a hackathon focused on game development. It is the growth of an idea that in today’s heavily connected world, we could come together, be creative, share experiences and express ourselves in a multitude of ways using video games – it is very universal. The weekend stirs a global creative buzz in games, while at the same time exploring the process of development, be it programming, iterative design, narrative exploration or artistic expression. It is all condensed into a 48 hour development cycle. The GGJ encourages people with all kinds of backgrounds to participate and contribute to this global spread of game development and creativity. (extracted from GGJ's website)

Here you have a list of resources for Jammers and also game developers / designers. This list was created by our friend of Rosario Game Dev. It's not a complete list but a good starting point. Feel free to added more resources in the comments. Enjoy it!

Table of contents

  1. Tools
  2. Vector/Scalar Image & 2D Graphics
  3. Source Control
  4. IDEs
  5. Engines
  6. Sound
  7. HTML5 / Javascript
  8. Frameworks
  9. Assets
  10. SDKs
  11. Miscellaneous
  12. Board games


Vector/Scalar Image & 2D Graphics

Source Control




HTML5 / Javascript





Board games

Task Management Tools

Starting ErnestoRPG clon made with Unity

The other day, Daniel Benmergui,  an independent videogame maker and creator of Storyteller, a puzzle game about building stories, Today I Die and I wish I were the moon, published on a game developer group on facebook a new game with new mechanics called "Ernesto - A quick RPG". The game was published on Kongregate and can be played here http://www.kongregate.com/games/danielben/ernesto-a-quick-rpg

I really like the game and I played it for several hours untill I finished it (it's a very short game)

Also, I really like the mechanics and as I'm learning Unity 2D, I started to port it. The port is being developed in Unity 4.3 using the new 2D tools.

Here you have the playable result http://bit.ly/1cyZgb5 (note that is work in progress) and a screenshot

What does it do?
  1. Draws sprites / game objects in a grid randomly
  2. Validates if starting point is selected. You must start from a cave door 
  3. Validates movements, you can move up, down, left, right
  4. If you click one of them, It will give you the click object mane / type and position in grid.
  5. Draws  the hero's quest. :)
There is a lot of more work to do, so stay tuned