<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Isabella Herman</title>
    <description>The latest articles on DEV Community by Isabella Herman (@isabellaherman).</description>
    <link>https://dev.to/isabellaherman</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F646816%2F028778d5-c8a7-4365-a689-00dc01e718c1.png</url>
      <title>DEV Community: Isabella Herman</title>
      <link>https://dev.to/isabellaherman</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/isabellaherman"/>
    <language>en</language>
    <item>
      <title>O poder de uma boa inteligência artificial</title>
      <dc:creator>Isabella Herman</dc:creator>
      <pubDate>Wed, 01 Dec 2021 13:35:55 +0000</pubDate>
      <link>https://dev.to/isabellaherman/o-poder-de-uma-boa-inteligencia-artificial-bpj</link>
      <guid>https://dev.to/isabellaherman/o-poder-de-uma-boa-inteligencia-artificial-bpj</guid>
      <description>&lt;p&gt;&lt;em&gt;English version&lt;/em&gt; &lt;a href="https://dev.to/isabellaherman/the-power-of-a-good-artificial-intelligence-228i"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Cada vez mais as &lt;em&gt;I.A.’s&lt;/em&gt; (Inteligência Artificial) estão presentes no nosso dia a dia. Desde assistentes virtuais que te contam uma piada, te contam curiosidade, ligam as lâmpadas e fecham as portas da sua casa até soluções em grandes empresas corporativas.&lt;/p&gt;

&lt;p&gt;Se fosse possível dar um pulo na década de 50, iríamos acompanhar o surgimento das IA’s e ver que IA em videogames é uma ramificação distinta e diferente da IA ​​acadêmica, e o principal motivo é que ela lida e reflete comportamentos humanos.&lt;/p&gt;

&lt;p&gt;Os seres humanos não são máquinas, fomos feitos para viver em sociedade, conversamos com quem nos identificamos. Nesse artigo eu descarto a ideia de “os opostos se atraem”. O jogador tem que se identificar com o mundo e uma boa IA vai te ajudar nisso.&lt;/p&gt;

&lt;p&gt;Do ponto de vista técnico uma IA para jogos nada mais é que um monte de condições: &lt;em&gt;“if”&lt;/em&gt; aqui, &lt;em&gt;“if”&lt;/em&gt; ali, &lt;em&gt;“if”&lt;/em&gt; lá. Mas se essas condições partirem de um olhar crítico do ponto de vista psicológico, o jogo muda.&lt;/p&gt;

&lt;h2&gt;
  
  
  IA vs MENTE DO JOGADOR
&lt;/h2&gt;

&lt;p&gt;Os jogadores não querem uma boa IA no seu jogo. Os jogadores querem experiências que façam eles se sentirem no poder, se sentirem bons em algo, querem ser recompensados com a vitória. Os seres humanos não são máquinas, temos reações que devem ser exploradas pelo game design.&lt;/p&gt;

&lt;p&gt;“Ah, mas se os jogadores não gostam de uma IA difícil, por que Dark Souls faz tanto sucesso?” A resposta é simples. A IA de Dark Souls não é difícil, o jogo também não. Ele só trabalha numa soft skill muito rara nas pessoas hoje em dia: a paciência. Paciência em esperar para ler e entender os passos de cada agente do jogo. &lt;br&gt;
É tão simples, mas como é uma dificuldade real nos dias de hoje, o jogador se sente o melhor do mundo ao vencer um combate. &lt;/p&gt;

&lt;p&gt;Ficou claro a diferença de complexidade e desafio? O design e aplicação de IA’s devem ser desenhados para estimular uma sensação de superioridade e controle, com o jogador enfrentando situações que equilibram a dificuldade.&lt;/p&gt;

&lt;p&gt;Por exemplo, você está produzindo um jogo que se passa na segunda guerra mundial. Em um cenário de guerra é normal encontrarmos inimigos armados, bombas de fumaça, minas terrestres, tanques de guerra, automóveis blindados, etc.&lt;br&gt;
Você pensou em uma missão onde o jogador terá que parar o avanço de um caminhão blindado carregado com suprimentos para o exército inimigo. O caminhão tem uma vida X e pode explodir com o jogador atirando explosivos por exemplo, mas quanto tempo isso levaria? A resistência de um automóvel blindado é muito mais forte do que o poder destrutivo do armamento do jogador, podendo causar uma experiência cansativa com o passar do tempo.&lt;/p&gt;

&lt;p&gt;Com uma IA podemos achar soluções mais interessantes. O caminhão é muito forte porém ele é dirigido provavelmente por um NPC (non-player character), então como o jogador pode tirar a atenção desse NPC pra que ele pare o caminhão, desça para ver o que está acontecendo, assim permitindo um combate mais justo e uma experiência de vitória positiva? O jogador pode usar bombas de fumaça, arremessar objetos, usar sinalizador entre outros eventos que façam sentido no contexto.&lt;br&gt;
Uma simples condição com o olhar voltado ao psicológico do jogador, gerou um sentimento de vitória e superioridade dele em relação ao jogo. Entender as reações emocionais do jogador que estão ligadas com as ações do jogo é fundamental.&lt;/p&gt;
&lt;h2&gt;
  
  
  O PAPEL DA IA NA IMERSÃO
&lt;/h2&gt;

&lt;p&gt;Um grande erro dos jogos quando o assunto é imersão, é colocar o jogador como o único ser vivo do jogo, o que não está errado em teoria, mas como criadores de jogos, precisamos ser mais céticos com a realidade.&lt;/p&gt;

&lt;p&gt;A franquia GTA tem sua importância e notoriedade na indústria, e vende a ideia de um universo com experiência realista de mundo aberto, que parece mais um simulador de dirigir carro. Você entra no carro, vai do ponto A ao B e todo universo do jogo praticamente para, esperando o jogador concluir o que estava fazendo.&lt;br&gt;
Experiência de um mundo aberto onde o centro das atenções é o personagem principal não funciona. O personagem principal deve ser o centro de atenção do jogador, não do mundo.&lt;/p&gt;

&lt;p&gt;Vamos fazer uma analogia da nossa vida como se estivesse representada em um jogo. Hoje você precisa acordar e ir para o trabalho, esse é o compromisso mais importante do dia então essa é sua &lt;strong&gt;missão principal&lt;/strong&gt;. Enquanto se arruma para o trabalho você começa sentir uma azia, às vezes é pela comida mexicana que você jantou na noite passada e então decide passar em uma farmácia a caminho do trabalho. Diferente do trabalho, você não necessariamente precisa ir na farmácia, mas vai te beneficiar em algo além de ter ligação com alguma ação do seu dia, então essa passa a ser sua &lt;strong&gt;missão secundária&lt;/strong&gt;. &lt;br&gt;
Até aí bem comum como nos jogos, mas a vida não para aí. Não para aí porque o mundo é muito maior e existem outras pessoas, variáveis, acontecimentos, etc, que devem ser levados em conta se você tem uma proposta de mundo aberto.&lt;/p&gt;

&lt;p&gt;No Far Cry 4 existe uma IA diretora que se assegura de manter o universo vivo. Novamente levando em conta a temática de guerra, é de se esperar que existam pessoas precisando de ajuda, não só em situações de sequestro ou invasões, mas também em ajuda de arrumar algo que quebrou, e a realidade delas não deve ter nenhuma relação com você, jogador, que está no papel de um recém chegado do exército.&lt;/p&gt;

&lt;p&gt;Qual seria o sentido de colocar um evento aleatório como esse no seu mini mapa? Nenhum. Mas ele ainda está lá, porque o universo de um jogo de mundo aberto é, e deve ser maior que o universo do personagem principal. E é aí que a magia da imersão do Far Cry 4 entra. Se você estiver usando fone é possível ouvir os NPCs te chamando, sem nenhum aviso na tela, perguntando se você pode ajudar, tal qual seria no mundo real.&lt;/p&gt;

&lt;p&gt;Esse mesmo exemplo se aplica ao GTA, é comum conforme o jogo desenrole apareça no minimapa do jogador um símbolo de pessoas aleatórias que você pode oferecer carona, mesmo essas não tendo relação alguma com a &lt;em&gt;lore&lt;/em&gt; do personagem. &lt;/p&gt;

&lt;p&gt;Mas sejamos honestos, um dos maiores desafios dos desenvolvedores de jogos é montar um sistema de jogo mundo aberto que funcione, construindo eventos interessantes e diversificados para os jogadores explorarem, e se ao longo desses anos de franquia a RockStar pecou nesse quesito, ela com certeza já se redimiu com o título Red Dead Redemption 2, na qual IA atua na imersão do universo com maestria.&lt;/p&gt;

&lt;p&gt;As comparações de Far Cry 4 e Grand Theft Auto V param por aqui, mas vamos explorar tecnicamente como a IA diretora comanda todo território do jogo e faz ele parecer mais vivo.&lt;/p&gt;
&lt;h2&gt;
  
  
  IA DIRETORA NA PRÁTICA
&lt;/h2&gt;

&lt;p&gt;Primeiro vamos entender o conceito de &lt;em&gt;Systemic AI&lt;/em&gt; (IA Sistêmica), uma estrutura sistêmica dependente de NPC's: inimigos, civis, aliados, animais, etc. &lt;br&gt;
Cada agente NPC citado tem sua própria estrutura de comportamento e gerenciar todos eles juntos não é uma tarefa simples e muito menos fácil, é agora que a IA diretora entra.&lt;/p&gt;

&lt;p&gt;Uma IA Diretora cujo o nome é bem sugestivo, assim como o diretor de uma organização, controla o ritmo, adequação e intensidade dos eventos de um jogo.&lt;/p&gt;

&lt;p&gt;A imersão do universo de Far Cry 4 é sem dúvidas uma das melhores que já joguei, levando em conta a época que o título foi lançado e as melhorias técnicas desde o seu antecessor Far Cry 3, que foram reconhecidas por críticos da indústria, conseguindo uma nota 85 no metacritic.&lt;/p&gt;

&lt;p&gt;A IA diretora de Far Cry 4 monitora os passos do jogador acompanhando o mesmo por um raio de 500 metros, e popula esse raio com os eventos do jogo. Mesmo com o raio limitado, popular esse raio com toda a cadeia sistêmica teria um custo computacional muito alto, então a IA diretora conta com a regra de: se o player não vê, logo, não acontece.&lt;/p&gt;

&lt;p&gt;Somado a essa supervisão geral, cada agente NPC é regido por uma máquina de estados finita (FSM), um modelo matemático usado para representar circuitos lógicos muito comum em jogos principalmente pela necessidade de pouco processamento. A FSM de cada agente é projetada para reagir aos estímulos próximos feitos pelo jogador.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.discordapp.com%2Fattachments%2F898036167361056818%2F913454000538533929%2Ffarcry-4-fsm-isabellaherman.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.discordapp.com%2Fattachments%2F898036167361056818%2F913454000538533929%2Ffarcry-4-fsm-isabellaherman.png" alt="diagrama de FSM"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Fiz o diagrama acima analisando o comportamento de um animal carnívoro dentro do jogo FC4. Esses tópicos representam os comportamentos designado a esse circuito.&lt;/p&gt;

&lt;p&gt;A seguir, os estímulos que desencadeiam as ações da FSM:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.discordapp.com%2Fattachments%2F898036167361056818%2F913454000257503242%2Ffarcry-4-fsm-isabellaherman2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.discordapp.com%2Fattachments%2F898036167361056818%2F913454000257503242%2Ffarcry-4-fsm-isabellaherman2.png" alt="diagrama de FSM 2"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Lógica dos componentes iniciais do diagrama:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;enum&lt;/span&gt; &lt;span class="n"&gt;type&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;Prey&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Predator&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;enum&lt;/span&gt; &lt;span class="n"&gt;agentBehaviour&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;Awake&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Hunting&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Eating&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Patrolling&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Recovering&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="n"&gt;agentBehaviour&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Awake&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;type&lt;/span&gt; &lt;span class="p"&gt;==&lt;/span&gt; &lt;span class="n"&gt;type&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Predator&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="c1"&gt;//if &amp;gt; se estiver faminto:&lt;/span&gt;
     &lt;span class="n"&gt;agentBehaviour&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Patrolling&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="n"&gt;agentBehaviour&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Patrolling&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="c1"&gt;//achou um type = prey no range:&lt;/span&gt;
  &lt;span class="n"&gt;agentBehaviour&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Hunting&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;É claro que para cada um dos casos exibidos existem N funções que devem ser analisadas para completar a lógica de cada um dos estados. Você pode considerar como um exercício analisar o diagrama e terminar a lógica restante ou até mesmo criar o seu próprio diagrama analisando a IA de algum jogo que te agrade.&lt;/p&gt;

&lt;p&gt;Esse é meu primeiro artigo e espero que ele tenha apresentado um outro ponto de vista em cima de um assunto que cada vez mais se populariza no mundo. &lt;/p&gt;

&lt;h3&gt;
  
  
  Referências:
&lt;/h3&gt;

&lt;p&gt;MAUW, Sjouke. Finite state machine diagram of Protocol 3. Research Gate. Março de 1996.&lt;/p&gt;

&lt;p&gt;CARRILLO, Richard. Interviewing For Game Design. GDC Session. 2017.&lt;/p&gt;

&lt;p&gt;THOMPSON, Tommy. The Definition of [Artificial] Insanity: The Systemic AI of Far Cry. Informa, 12 de Outubro de 2017.&lt;/p&gt;

&lt;p&gt;SHUMMON MAASS, Laura. Artificial Intelligence in Video Games. Towards Data Science, 01 de Julho de 2019.&lt;/p&gt;

&lt;p&gt;Davebot. Finite state-machine example. Undefined Games, 24 de Abril de 2019.&lt;/p&gt;

&lt;p&gt;Far Cry 4 Review Page. Metacritic, 18 Novembro de 2014.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>gamedev</category>
      <category>braziliandevs</category>
    </item>
    <item>
      <title>The power of a good Artificial Intelligence.</title>
      <dc:creator>Isabella Herman</dc:creator>
      <pubDate>Wed, 01 Dec 2021 13:35:14 +0000</pubDate>
      <link>https://dev.to/isabellaherman/the-power-of-a-good-artificial-intelligence-228i</link>
      <guid>https://dev.to/isabellaherman/the-power-of-a-good-artificial-intelligence-228i</guid>
      <description>&lt;p&gt;AIs are increasingly getting more presence in our daily lives. Virtual assistants who can tell you a joke, curiosities, can turn lamps on and lock the doors of your house or apartment to solutions in huge corporate companies.&lt;/p&gt;

&lt;p&gt;In the 50s decade, we could watch the growth of AIs at games and see how it is a distinct ramification from the academics AIs. The main reason behind it is because the academical AIs are reflective of human conduct/behavior.&lt;/p&gt;

&lt;p&gt;Human beings are not machines, we are made to live in society, chat with who we identify with. In this article I put away the idea of “opposites attract”. The player has to identify with the game world and a good AI will help you in this.&lt;/p&gt;

&lt;p&gt;From the technical view of an AI for games, nothing is more than a lot of conditions: &lt;em&gt;“if”&lt;/em&gt; here, &lt;em&gt;“if”&lt;/em&gt; there. But if the conditions can be seen from a critical and psychological point of view, the game changes.&lt;/p&gt;

&lt;h2&gt;
  
  
  AI vs PLAYER MIND
&lt;/h2&gt;

&lt;p&gt;Good players do not want a good AI in their games. Players want experiences that can make them feel at power, or that they are good at something, feel rewarded with the victory. Human beings are not machines, we have reactions which must be explored by game design.&lt;/p&gt;

&lt;p&gt;“Oh, but if the players do not like a difficult AI, why does Dark Souls have so much success?” The answer is easy. Dark Souls AI or the game are not difficult at all. They just work at a very rare soft skill nowadays: patience. Patience waiting to read and understand their steps from each agent of the game.&lt;br&gt;
It is so simple, but since it is a real difficulty nowadays, the player feels the best of the whole world after scoring a victory in the combat.&lt;/p&gt;

&lt;p&gt;Is it clear to understand the complexity and challenges? AI designs and applications must be sketched to stimulate a feeling of superiority and control, with the player confronting situations that balance the difficulty.&lt;/p&gt;

&lt;p&gt;For example, you are producing a game set in WW2. In a scenery of war, it is completely normal to encounter armed enemies with different challenges settled in.&lt;br&gt;
You idealized that in a mission where the player will have to stop the advance of an armored truck who is supplied to the enemy army. The truck has an X life and can explode with a player firing explosives at it, but how long will it take? The resistance of a bulletproof car is much more than the power of the armament of the player, this can cause an exhaustive experience over time.&lt;/p&gt;

&lt;p&gt;With good AI we can find more interesting solutions. The truck is really strong but it is driven probably by an NPC (non-player character), so how can the player take this NPC’s attention away to stop the truck, get down and check what is going on, allowing a fairer combat and with a positive victory experience? The player can use smoke bombs, throw objects, use a flare gun among other events  makes sense at the context.&lt;br&gt;
The plain condition with eyes turned to the psychological aspect of the player originated a feeling of victory and superiority from him relating to the game. Understanding one’s emotional reactions that are connected with the game actions is essential.&lt;/p&gt;
&lt;h2&gt;
  
  
  AI ROLES IN IMMERSION
&lt;/h2&gt;

&lt;p&gt;A huge mistake in games when we talk about immersion, is to put a player as the only one to be alive at the game, which is not wrong in theory, but as  game creators, we must be more skeptical with reality.&lt;/p&gt;

&lt;p&gt;The GTA franchise has their importance and notoriety in the industry, they sell the idea of a universe with realistic experiences of an open world, which looks more like a driver simulator. You get to the car from point A to B and all the universe of the game stops, waiting for the player to finish what he is doing.&lt;br&gt;
The experience of an open world where you are the center of attention and the main persona, does not work. The main character must be the center of attention of the player, not of the world.&lt;/p&gt;

&lt;p&gt;So let's do an analogy from our life about how it would be represented in a game. Today you need to wake up and go to work, this is the most important task, your &lt;strong&gt;main quest&lt;/strong&gt;. While you are getting ready to work, you start to experience heartburn, maybe it is because of the Mexican food you ate last night so you decide to go to a drugstore on your way to work. Different from going to work, you do not necessarily need to go to a drugstore, but it will be beneficial in something besides having a connection with some action of your day, so this is going to be your &lt;strong&gt;side quest&lt;/strong&gt;.&lt;br&gt;
Until then everything is very common in games, but life does not stop there. It does not stop because the world is so huge and there are a lot of people, variables, events, that must be considered if you have a proposal of an open world.&lt;/p&gt;

&lt;p&gt;In Far Cry 4, there is an AI director who makes sure to make the universe alive. Considering the war tematics, it is safe to say that there are people needing help, not only in situations of kidnapping or invasions, but also in need of help to fix something that has broken, and their reality does not have any correlation with you, the player, who is just a newcomer from the army.&lt;/p&gt;

&lt;p&gt;What is the sense of creating a random event like this in your mini map? Not a single one. But it is still there, because the universe of an open world game is and it must be bigger than the universe of the main character. Here is where the magic of the immersion from Far Cry 4 gives an entry. If you are wearing headphones it is possible to listen to NPCs calling you without a warning on the screen, asking if you can help, like it would happen in the real world.&lt;/p&gt;

&lt;p&gt;The same example applies to GTA, it is common that as the game unrolls random people symbols will appear on the player’s minimap, who you can offer a ride to , even if they do not have any relation with the lore of the character.&lt;/p&gt;

&lt;p&gt;But let's be honest, one of the biggest challenges for game developers it is to assemble a game system where the ‘open world’ can work, doing interesting and different events where the players can explore, and if along the years of franchise RockStar failed on this matter, they for sure have already redeemed themselves with the title Red Dead Redemption 2, where the AI act in the immersion of the world with mastery.&lt;/p&gt;

&lt;p&gt;The comparison of Far Cry 4 and Grand Theft Auto V stops here, but let’s explore technically how the director AI commands all the territory from the game and it makes it look more alive.&lt;/p&gt;
&lt;h2&gt;
  
  
  DIRECTOR AI IN PRACTICE
&lt;/h2&gt;

&lt;p&gt;First of all let’s understand the concept of &lt;em&gt;Systemic AI&lt;/em&gt;, a systemic structure dependant of NPC’s: enemies, civilians, allies, animals, among others.&lt;br&gt;
Each NPC quoted has their own comportamental structure and managing all of them together is not a simple or easy assignment, it is now that the director AI gives an entry.&lt;/p&gt;

&lt;p&gt;A director AI whose name is very suggestive, like an organization director, controls the rhythm, the adequacy and each intensity from the events of the game.&lt;/p&gt;

&lt;p&gt;The immersion of Far Cry 4 universe is without a doubt one of the best I have ever played, taking into account the time that the title was released and technical improvements since its ancestor Far Cry 3, which has been recognized by industry critics, scoring 85 on metacritic.&lt;br&gt;
The director AI from Far Cry 4 monitors the players' steps accompanying the same one for a radius of 500 meters, and populates this radius with game events. Even with a limited radius, to populate this area with the entire systemic chain would be a huge computational cost really, so the director AI has to count with the rule: if the player doesn’t see, it can’t happen. &lt;/p&gt;

&lt;p&gt;Adding to this general supervision, each NPC agent is commanded by a Finite State Machine (FSM), a mathematical model used to represent logical circuits that are very common in games, mainly for the necessity of low processment. Each agent’s FSM is projected to react to close stimuluses around the player.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--w0Fc11XB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.discordapp.com/attachments/898036167361056818/913454000538533929/farcry-4-fsm-isabellaherman.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--w0Fc11XB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.discordapp.com/attachments/898036167361056818/913454000538533929/farcry-4-fsm-isabellaherman.png" alt="diagrama de FSM" width="880" height="443"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The diagram above was made to analyse carnivorous animal behavior inside of the game Far Cry 4. This topic represents each designed behavior to this circuit. &lt;/p&gt;

&lt;p&gt;Next, we have the stimulus which triggers the FSM actions:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cpC8ZeJT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.discordapp.com/attachments/898036167361056818/913454000257503242/farcry-4-fsm-isabellaherman2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cpC8ZeJT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.discordapp.com/attachments/898036167361056818/913454000257503242/farcry-4-fsm-isabellaherman2.png" alt="diagrama de FSM 2" width="880" height="443"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The diagram’s initial components logic:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;enum&lt;/span&gt; &lt;span class="n"&gt;type&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;Prey&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Predator&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;enum&lt;/span&gt; &lt;span class="n"&gt;agentBehaviour&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;Awake&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Hunting&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Eating&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Patrolling&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Recovering&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="n"&gt;agentBehaviour&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Awake&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;type&lt;/span&gt; &lt;span class="p"&gt;==&lt;/span&gt; &lt;span class="n"&gt;type&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Predator&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
     &lt;span class="n"&gt;agentBehaviour&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Patrolling&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="n"&gt;agentBehaviour&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Patrolling&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="n"&gt;agentBehaviour&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Hunting&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Undoubtedly, for each of the explored cases there are N differente functions that must be analyzed to complete the logic in each one of the states. You can consider as an exercise to analyze the diagram and finish the remaining logic or even creating your own diagram analyzing the AI of a game that you like. &lt;/p&gt;

&lt;p&gt;This is my first article and I hope that it showed you a different point of view of a subject that is getting more and more popular in the world.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Translated by Harianne Goya and João Corrêa.&lt;/em&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  References:
&lt;/h4&gt;

&lt;p&gt;MAUW, Sjouke. Finite state machine diagram of Protocol 3. Research Gate. March 1996.&lt;/p&gt;

&lt;p&gt;CARRILLO, Richard. Interviewing For Game Design. GDC Session. 2017.&lt;/p&gt;

&lt;p&gt;THOMPSON, Tommy. The Definition of [Artificial] Insanity: The Systemic AI of Far Cry. Informa, October 12, 2017.&lt;/p&gt;

&lt;p&gt;SHUMMON MAASS, Laura. Artificial Intelligence in Video Games. Towards Data Science, July 01, 2019.&lt;/p&gt;

&lt;p&gt;Davebot. Finite state-machine example. Undefined Games, April 24, 2019.&lt;/p&gt;

&lt;p&gt;Far Cry 4 Review Page. Metacritic, November 18, 2014.&lt;/p&gt;

</description>
      <category>gamedev</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
