Mostrando las entradas con la etiqueta Challenge. Mostrar todas las entradas
Mostrando las entradas con la etiqueta Challenge. Mostrar todas las entradas

domingo, 13 de agosto de 2017

Volviendo de las vacaciones | Coming back from vacations

Español | English



En estas vacaciones de invierno que pasaron pude hacer varias cosas, desde cosas Web en Ruby on Rails y Javascript hasta empezar con C++. Esta vez les traigo un poco de los avances que pude hacer en general. Algunas de las cosas que hice son públicas así que pueden ver el código y hasta corregir/criticar si encuentran algún error.

Aplicaciones Web

Decidí aprender Ruby on Rails ya que estaba por participar de una Hackathon (Hackathon Unearthed 2017) y con mi grupo queríamos una plataforma fácil para realizar aplicaciones webs. Si bien no fue lo que terminamos haciendo en el evento, aprendí bastante.

Mi principal objetivo era saber hacer una aplicación básica y poder también complementarla con gráficos utilizando Chart.js, una librería Open Source que se maneja con JavaScript. Sobre Chart.js, pueden ver como fui creando gráficos simples y viendo como modificar la información de estos: https://jsfiddle.net/lpinilla/n2hj9nbn/


C++

Comencé también a aprender C++ por mi cuenta. Primero viendo tutoriales de como crear un Snake aunque lo abandoné porque no sentía que estaba aprendiendo. Así que decidí hacer un Snake de cero luchando con C++. Por ahora estoy trabajando en el Backend y todavía no tengo algo funcional y tampoco se si lo que estoy haciendo es correcto, para resolver esto voy a utilizar Tests Unitarios. 

Rock Climber


Como pueden ver, terminé de re-hacer las mecánicas del jugador. Falta ver si le agrego un gancho o no pero prefiero continuar con lo demás. Por ahora esta va a ser la mecánica base, todavía queda por ver si la cámara va a seguir al jugador o va a ser fija y va subiendo con él.

Es todo por ahora, voy a ir avanzando de a poco tanto en Rock Climber como en el Snake y como dije arriba, si ven algún error o optimización que se pueda hacer al código, pueden avisar tranquilamente y lo voy a tener en cuenta.

Saludos.

-L


-------------------------------------------------------------------------------------------------------
English


In this winter holidays that went by I could do several things, from web Stuff in Ruby on Rails and Javascript to start with C++. This time I bring some of the progress I could make in general. Some of the things I've done are public so you can see the code and even correct/criticize if you find any errors.

Web Apps

I decided to learn to use Ruby on Rails as I was goint to participate in a Hackathon (Hackathon Unearthed 2017) and with my group we wanted a platform that was easy to use to create WebApps. Although it was not what we ended up doing at the event, I learned a lot.

My main goal was to know how to make a basic WebApp and to be able to put some charts in it using Chart.js, which is an Open Source library that is handled with Javascript. About Chart.js, you can see how I was creating simple charts and seeing how to modify their information: https://jsfiddle.net/lpinilla/n2hj9nbn/

C++

I also started learning C++ on my own. First watching tutorials on how to create a Snake although I abandoned it because I felt I wasn't learning. So I decided to make a Snake from scratch fighting with C++. For now I'm working on the Backend and I still don't have something functional and I also don't know if I'm doing things right, to solve this I'll use Unit Testing.
Link: https://github.com/lpinilla/Snake

Rock Climber


As you can see, I've re-done the player mechanics. I still have to see if I'll add a hook or not but I rather continue on everything else. For now this will be the base mechanic, I still have to see if the camera will follow the player or it will be fixed and go up with the player.

That's all for now, I'll continue working both Rock Climber as the Snake and as I said above, if you can spot any error in the code or find a way to optimize things, don't be shy to let me know and I'll definitely take it into account.

Cheers.

-L

domingo, 21 de agosto de 2016

Generación procedural de circuitos de carreras - Parte 2 | Race Track Procedural Generation - Part 2

Español | English


Esta va a ser la 2da parte de una serie de Posts en donde explico como crear pistas de carreras generadas aleatoriamente. La primer parte la pueden encontrar en mi blog.

En la parte anterior, había definido la siguiente estructura lógica que iba a utilizar el algoritmo de geneación:
  1. Generar un elemento de forma aleatoria
  2. Si ese elemento es una recta, seguir de largo, si es una curva, girar
  3. Repetir 1-2 hasta tener una cierta cantidad de elementos
  4. Buscar la forma de el último elemento con la posición inicial
Esta manera fue descartada, ya que había muchas cuestiones a tener en cuenta, como las rotaciones de las distintas partes y como estas influyen a las siguientes.

Así también como el hecho de que no era capaz de indicar el tamaño del mapa, ya que cada vez que se generaba, se creaba un camino hacia un sentido aleatorio, de esta forma no se podía limitar a que el mapa ocupe "10 unidades del eje Y".

Por eso que decidí cambiar la idea, teniendo primero una "grilla" que si puedo dimensionar y luego eligiendo las partes que van a ser usadas para la pista. Entonces el algoritmo se modificó a que recorra la siguiente secuencia:

  1. Crear una grilla de dimensiones X  e Y indicadas.
  2. Seleccionar los nodos eligiendo lugares aleatorios de la grilla
  3. Unir los nodos.

Esta idea de nodos esta pensada a base de Grafos:



En donde para generar el circuito, elijo cuantos nodos quiero que existan y luego busco la manera en la cual pueda unirlos (generar las aristas) de formas aleatorias, para que de una misma posición de nodos, pueda tener distintas variantes.

Por ahora estoy en la etapa 2. Estoy creando la forma en la cual se puedan elegir los nodos de forma aleatoria sin repeticiones y en lo posible que no estén juntos.



En la imagen se pueden ver: Los parámetros para la creación de la grilla, la grilla con sus elementos en gris y los nodos seleccionados aleatoriamente en rojo.

Lo siguiente es indicarle a las posiciones que se eligieron que van a representar nodos. Luego de eso, empieza la etapa 3 de pathfinding, en la cual a partir de esos puntos, hay que crear las formas de unirlos para generar los circuitos.

-L 


-------------------------------------------------------------------------------------------------------------------------
English


This is going to be the second part of a series of Posts where I explain who to create procedural generated racing tracks. You can find the first part on my blog.

On the previous part, I've defined the next series of steps that were going to be part of the generator algorithm:
  1. Generate a random element
  2. If that element is a straight line, move forward, if it is a curve, turn
  3. Repeat 1-2 until there are a certain amount of elements
  4. Find the way to join the final position with the starting position
This way was thrown away, as there were too many things to take into consideration, like the rotations of the different parts and how they influence on the next parts.

As well as the fact that I wasn't able to set the size of he map, because every time the map was generated, a different path as created, so I couldn't limit the size map by saying that the map should be "10 units on the Y axis".

That's why I decided to change the idea, using a grid which in fact I can set the size and then selecting the parts that are going to be used for the track. So the algorithm changed to follow the next steps.
  1. Create a grid of X and Y dimensions.
  2. Select the nodes by selecting a random positions of the grid.
  3. Join the nodes
This node-idea was thought thinking of Graphs:



Where to generate the track, I choose how many nodes I want and then I find the way to join them together (generate the edges) in random ways, so the same set of positions of nodes can generate different variatons.

Right now I'm on stage 2. I'm creating the way in which I can select the nodes from the random positions of the grid without repeating and if possible, not side by side.




On the image it can be seen: The parameters for the creating of the grid, the grid with its grey elements and the nodes, randomly selected in red.

The next step is to indicate to those positions that were chosen that they will represent nodes. After that, the 3 stage begins, pathfinding. In which I'll have to create different ways to join the nodes to generate the racing tracks.

-L 

lunes, 15 de agosto de 2016

Generación procedural de circuitos de carreras - Parte 1 | Race Track Procedural Generation - Part 1

Español | English 


Hoy vengo a presentar un nuevo proyecto/desafío. Me propuse crear un algoritmo para crear circuitos de carreras de forma aleatoria en Unity. Esta va a ser la parte 1 de no se cuantas en las que voy a explicar como hago para lograr mi objetivo.

La idea básica sobre la cual va a funcionar el algoritmo es:

  1. Generar un elemento de forma aleatoria
  2. Si ese elemento es una recta, seguir de largo, si es una curva, girar
  3. Repetir 1-2 hasta tener una cierta cantidad de elementos
  4. Buscar la forma de el último elemento con la posición inicial
Hasta ahora estoy en el paso 3. En la cual puedo generar varios elementos y colocarlos como hijos de un elemento llamado "Track". Lo que puedo generar por ahora es esto:


Los elementos rojos son Curvas rectas, los marrones son curvas hacia la izquierda y los violeta curvas hacia la derecha. Por ahora solo quería probar como resultaba el paso 1 y el paso 2.

La lógica (mal hecha) fue: si se crea una recta, mover hacia adelante y generar otro elemento, si es una curva, mover hacia el costado y generar otro elemento y así sucesivamente. 

¿Por qué esta mal? Porque no tomé en cuenta las rotaciones que generan las curvas, para poder apreciarlas voy a necesitar más que una imagen de un cuadrado.

Pero como primera etapa, lo considero adecuado. Lo que tengo que hacer para tener esta etapa bien definida es no solo desplazar la posición antes de generar un nuevo elemento, sino que también rotarlo si el anterior era un curva, para crear un nuevo sentido.

Lo más difícil va a ser la etapa 4, en la cual tengo que hacer que desde la posición final, se creen los elementos necesarios para volver al inicio, algo que se me viene a la mente para hacer esto es utilizar un simple algoritmo de A* path-finding. 

Eso es todo por ahora, espero que les guste el nuevo desafío, cualquier duda o sugerencia pueden dejarla en los comentarios.


-L


-----------------------------------------------------------------------------------------------------------

English


Today I'm here to present a new project/challenge. I made up my mind to create an algorithm that creates race tracks randomly in Unity. This is going to be part 1 of I don't know how many, in which I'll be explaining what I'm thinking in order to achieve my goal.

The basic idea on which the algorithm works is:
  1. Generate a random element
  2. If that element is a straight line, move forward, if it is a curve, turn
  3. Repeat 1-2 until there are a certain amount of elements
  4. Find the way to join the final position with the starting position
For now I'm on step 3. In which I can create several elements and put them as child of a GameObject named "Track". What I can generate by now is this:


The logic (poorly made) was: If a straight line is created, move forward and generate another element, if it is a curve, move to the side and generate another element and so on...

Why it is poorly made? Because I didn't take into consideration the rotations that the curves generate, to be able to see them more clearly I'll have to use something else than a red square.

But for the first stage, I found it right. What I have to do in order to make this stage properly is to not only move the position of the next element that is going to be generated, but also rotate it if the previous element was a curve, in order to create a new direction.

The most difficult stage is going to be stage 4, where I have to figure out a way in which, from the final position, create the necessary elements that are needed to come back to the starting point. Something that comes to my mind for this task might be a simple A* path-finding algorithm.

That's all for now, I hope you like this new challenge, for any doubt or suggestion you can write me a comment.


-L