Desarrollo de Videojuegos Ma.Elena Melón Jareda ITESM-CEM Departamento de Sistemas de Información y Computación Persecución de enemigos Ruta más corta.

Slides:



Advertisements
Presentaciones similares
This is an interactive presentation
Advertisements

Mr. Redaelli OnlineTaco.com. To Have - Tener Yo tengo – I have Tú tienes – You have (Informal) Usted tiene – You have (Formal) El tiene – He has Ella.
Direct object pronouns. What is a Direct Object? The object that directly receives the action of the verb is called the direct object. The direct object.
Direct Object Pronouns (DOPs)
Hagan Ahora ¿Qué te gusta hacer?.
1 Usages of the Verb IR Spanish One ch.4A 2 IR is an irregular verb: voyvamos vas----- vavan.
Time Expression with Hacer
Los dias de la semana.
Hoy es el veinte de septiembre ¿Qué te gusta Hacer?
Direct and Indirect Object Pronouns
In Lección 2, you learned how to express preferences with gustar
Direct Object Pronouns. What is a direct object? A direct object is a noun that directly receives the action of the verb. A direct object is a noun that.
¿De dónde eres tú?.
Direct object pronouns (DOPs)
Avancemos 2 – Unidad 1 Lección 1
Los pronombres de objeto directo ¿Comes el bistec a veces? Sí, como el bistec a veces. Sí, lo como a veces. ¿Compras las fresas hoy? No, no compro las.
(por favor) By emory gibson Para describir how long ago en español, presta attencion.
Español 1: capítulo 5 gramática 2
Demonstrative Adjectives and Pronouns
HAZ AHORA / DO NOW Responde en frases completas: Por ejemplo: ¿Qué te gusta más, nadar o esquiar? Pues, me gusta más nadar. Pues, no me gusta ni nadar.
Transformaciones que conservan ángulos
DOUBLE OBJECT PRONOUNS Double Object Pronouns b Double Object Pronouns occur when an indirect object pronoun and a direct object pronoun are used in.
 Making complete sentences How to make complete sentences in Spanish. The following presentation is designed to help you learn how to do the following:
Tener - to have. ‘Tener’ is also a stem-changing verb. It has regular -er endings but the stem changes from -e to -ie. ‘Tener’ is also a ‘go’ verb. This.
GUSTAR (and similar verbs). EXLPANATION GUSTAR is not conjugated like other regular verbs. It is NEVER used in the “yo”, “tú”, or “nosotros” forms. When.
Direct Object Pronouns Bill hit the ball. "Ball" receives the action of the verb "hit." Sherry reads the book. "Book" receives the action of the verb.
Pronouns with Commands UNIT 5 LESSON 1. Pronouns with Formal Commands  English Grammar Connection: You often use pronouns with commands to direct the.
Time Expression with Hacer Grammar Essential #106.
Objetivo: Which form of the verb should we use? Are we pronouncing the vocabulary correctly? Hagan Ahora: El papel de APT P. 69, Actividad 2.
LOS PAISES HISPANOS Y SUS CAPITALES.
Completmentos le, les Telling what you do for others.
Direct Object Pronouns This material is the property of the AR Dept. of Education. It may be used and reproduced for non-profit, educational purposes only.
Direct Object Pronouns
La campana (Write Everything!!!!) Write the english translations for these words on page hacer gimnasia 2.Estar en línea 3.Saber 4.Conocer.
Telling Time La hora. Telling Time To ask what time it is in Spanish, ask: ¿Qué hora es? To answer: Es la una… (12:31 – 1:30) or Son las (hour). (1:31.
¿Qué haces en la escuela? Question words, objects, yo-go’s.
Señorita Rojo Señor Amarillo Padre Verde Señora Azul La pistola La soga El cuchillo El dormitorio El cuarto de baño La cocinaEl salón Señorita Rojo Señor.
Indirect Object Pronouns
Las Preguntas (the questions) Tengo una pregunta… Sí, Juan habla mucho con el profesor en clase. No, Juan no habla mucho en clase. s vo s vo Forming.
En la Ventana. This screen is now a window!!! (a Ventana) How do you feel when you look out the “window”?
Canciones y Poesía. 0 Ustedes van a hacer una actividad fantástica para ayudar a sus compañeros de la clase con el vocabulario!!!! 0 Van a utilizar el.
Time Telling time is rather easy. You only need to know the numbers up to 59 to be able to tell the time.
Both verbs, “saber” and “conocer” mean: How do I know when to use “saber” and when to use “conocer”?
Octubre 7, Español 2: Cap. 2B pag. 110 Q: ¿Cuántos estudiantes hay en el salón de clases? ¿Dónde están? “Hay” means there is/ there are.
Spanish Sentence Structure How can we make better sentences?
Gustar + infinitive to like / to be pleasing to. How to form gustar To talk about what we like, we use the verb gustar. With gustar, we use indirect object.
Direct Object Pronouns This material is the property of the AR Dept. of Education. It may be used and reproduced for non-profit, educational purposes only.
V ERBOS IRREGULARES : T ENER Y V ENIR Irregular verbs: To have and to come.
Interactive Notebook. A composition notebook is required for this class. Notebooks will be graded periodically every quarter based on content, organization,
Direct Object Pronouns This material is the property of the AR Dept. of Education. It may be used and reproduced for non-profit, educational purposes only.
Repaso: Object pronouns
Essential ?: How do I use these irregular verbs? How are they different than the verbs I already know?
Overclipping It’s very important as a trader that you understand your clip size and what positions this allows you to have. In addition it will help you.
Los verbos reflexivos Reflexive Verbs.
Los números Apuntes de vocabulario. treinta treinta y uno.
El Verbo “GUSTAR” En español gustar means “to be pleasing” In English, the equivalent is “to like”
Global Warming Project and Presentation. Save this PowerPoint to your S- User Then, answer the following questions about Global Warming. (Luego contesta.
El Objeto Directo Direct Object Pronoun Sra. Altamirano.
  Jugó=he/she played  Use the preterite tense for past actions that are viewed as over and are not being connected to the present. ¿Te acuerdas?
Clase de español I Tarea: QUIA (online practice) Turn in A Escribir: 3-3 Examen Escrito A Practicar: 3-3 A Conversar.
Spanish III Honors Week 31. Para Empezar 20 de abril In English, what is happening in this comic?
El show de la moda Spanish 1 Fashion Show.
Verbs that are similar to gustar
Apuntes: Gustar Lección 2: En la clase.
The Preterite Tense of the Irregular Verbs: Ir, Ser, Ver, Dar
Capítulo 6 El Caribe Así se dice IV
How to use “Gustar”.
Fecha: Hoy es martes el ocho(8) de enero de
Astronomy has really big numbers. Distance between Earth and Sun meters kilometers This is the closest star.
Las Preguntas (the questions) Tengo una pregunta… Sí, Juan habla mucho con el profesor en clase. No, Juan no habla mucho en clase. s vo s vo Forming.
Transcripción de la presentación:

Desarrollo de Videojuegos Ma.Elena Melón Jareda ITESM-CEM Departamento de Sistemas de Información y Computación Persecución de enemigos Ruta más corta

Persecución sencilla Implementación en Unity PJ Moskal

Persecución El enemigo siempre voltea a ver al FPS controller y se mueve en su dirección. El script de distancia hace que sólo se mueva el enemigo si el FPS controller se encuentra a una distancia mínima. Ver video.

Script de distancia //attach this script to the object that will follow FPC //this script working conjunction with SmoothLookAt script that you should also apply to the object //and Constant Force component that should be applied to the object //The object needs a sphere collider and it has to be a rigidbody with Freeze Rotation turned on //object to be followed var detectObject: Transform; //distance that will trigger following action var distanceDetection: float; function Update () { if (detectObject) { var dist = Vector3.Distance(detectObject.position, transform.position); //if distance is less than what is specified then do something if(dist<distanceDetection){ //print("attack"); GetComponent(SmoothLookAt).enabled = true; GetComponent(ConstantForce).enabled = true; }else{ //print("stop attack"); GetComponent(SmoothLookAt).enabled = false; GetComponent(ConstantForce).enabled = false; }

Otra persecución sencilla Implementación en Unity GesterX /how-to-create-a-basic-follow-ai

Instrucciones En este caso el script hace todo lo que a mano se realizó en el video anterior. No se toman en cuenta distancias. Seguir las instrucciones de la liga.

Modificaciones El código de Internet no toma en cuenta las distancias. Combinando los 2 scripts anteriores, el de persecución y el de distancia, se puede detectar si el enemigo está demasiado lejos o demasiado cerca y detener la animación.

Script modificado var target : Transform; //the enemy's target var moveSpeed = 3; //move speed var rotationSpeed = 3; //speed of turning var maxDistance=100; var minDistance=10; var myTransform : Transform; //current transform data of this enemy function Awake() { myTransform = transform; //cache transform data for easy access/preformance } function Start() { target = GameObject.FindWithTag("Player").transform; //target the player }

Script modificado function Update () { if (target) { var dist = Vector3.Distance(target.position, transform.position); //if distance is less than what is specified then do something if(dist<minDistance){ Debug.Log("Te atrape!"); }else if(dist>maxDistance){ Debug.Log("Estas demasiado lejos!"); }else{ Debug.Log("Alla voy!"); //rotate to look at the player myTransform.rotation = Quaternion.Slerp(myTransform.rotation, Quaternion.LookRotation(target.position - myTransform.position), rotationSpeed*Time.deltaTime); //move towards the player myTransform.position += myTransform.forward * moveSpeed * Time.deltaTime; }

Ruta más corta A*

El algoritmo de búsqueda A* (A estrella) se clasifica dentro de los algoritmos de búsqueda en grafos. Presentado en 1968 por Hart, Nilsson y Raphael. El algoritmo encuentra el camino de menor costo entre un nodo origen y uno objetivo (siempre y cuando se cumplan determinadas condiciones). A* es un algoritmo completo: en caso de existir una solución, siempre dará con ella.

A* A* utiliza la función de evaluación: f(n) = g(n) + h'(n) o g(n) es el costo real del camino recorrido para llegar al nodo n. o h'(n) representa el valor heurístico (estimado) del nodo a evaluar desde el n hasta el final

A* A* mantiene dos estructuras de datos auxiliares: una fila de prioridad (ordenada por el valor f(n) de cada nodo) nodosPorVisitar o abiertos una fila donde se guarda la información de los nodos que ya han sido visitados nodosVisitados o cerrados En cada paso del algoritmo, se expande el nodo que esté primero en nodosPorVisitar y en caso de que no sea un nodo objetivo, calcula la f(n) de todos sus hijos, los inserta en nodosPorVisitar y pasa el nodo evaluado a nodosVisitados.

Ejemplo Simple origen destino obstáculo

Ejemplo Simple origen destino obstáculo ¿Qué camino seguir?

Ejemplo Simple Para este ejemplo vamos a suponer lo siguiente: Moverse horizontalmente o verticalmente cuesta 10 Moverse en diagonal cuesta 14 g(n) se calculará sumando el costo del último movimiento más el costo que lleva el padre

Ejemplo Simple h'(n) puede estimarse de diferentes maneras. El método que usaremos para este ejemplo se conoce con el nombre de Método Manhattan. En este método calculas el total de cuadros que se requieren recorrer horizontalmente o verticalmente para llegar al destino, ignorando movimientos diagonales y obstáculos. Después se multiplica por 10 que es el costo de cada movimiento horizontal o vertical. H = 10*(abs(currentX-targetX) + abs(currentY-targetY))

Ejemplo Simple f(n)f(n) ¿Cuál es la mejor opción? h'(n) g(n)g(n)

Ejemplo Simple

A* h'(x) es un estimador de h(x) que informa la distancia al nodo objetivo, entonces: Si h'(x) hace un estimación perfecta de h(x), A* converge inmediatamente al objetivo. Si h'(x) = 0, la función g(x) controla la búsqueda. Si h'(x) = 0 y g(x) =0 la búsqueda será aleatoria. Si h'(x) = 0 y g(x) =1 o constante, la búsqueda será Primero en Anchura. Si h'(x) nunca sobrestima a h(x) (o subestima), se garantiza encontrar el camino optimo, pero se desperdicia esfuerzo explorando otras rutas que parecieron buenas. Si h'(x) sobrestima a h(x), no puede garantizarse la consecución del camino del menor costo.

Implementación de A* en Unity Aron Granberg y/a-pathfinding/download/

Versiones actuales etstarted.php etstarted.php