Skip to content

Integrates NPC Generator in a separate scene. NPC generation path def…#98

Open
ga-hirakawa wants to merge 10 commits intoDevelopfrom
feature/npc-generation
Open

Integrates NPC Generator in a separate scene. NPC generation path def…#98
ga-hirakawa wants to merge 10 commits intoDevelopfrom
feature/npc-generation

Conversation

@ga-hirakawa
Copy link
Collaborator

Integrates NPC Generator in a separate scene. NPC generation path defined to Assets/Resources/NPCs. Input system is in conflict with the new input system and does not work properly. In order to work, the generator executes itself automatically when playing the scene. Fixes #52.

…ined to Assets/Resources/NPCs. Input system is in conflict with the new input system and does not work properly. In order to work, the generator executes itself automatically when playing the scene.
@ga-hirakawa ga-hirakawa added the enhancement New feature or request label Apr 29, 2022
@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 94 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

{
map = randomPopulation;

NPC_SO[] parents = new NPC_SO[2];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Não precisa pra agora. Mas se vcs colocassem o 2 como uma variável, o algoritmo poderia ser generalizado para funcionar com quantos parentes e filhos quisesse. Existem evolutivos que aceitam mais de 2 pais/filhos. Mas não acho que tenha necessidade. Só, de modo geral, seria bom fazer uma const com esse 2 pra ele não ficar jogado por aí.

for (int j = 0; j < 2; j++)
{
// duelo podia fazer o random dentro da funcao
parents[j] = GetBest(map[(int)Random.Range(0, numRaces), (int)Random.Range(0, numJobs)],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No sistema eu criei um random singleton que vcs podem usar pra isso. Não precisa alterar pra esse PR, mas acho bom a gnt deixar os randoms todos no mesmo lugar. Assim qualquer regra de alterar semente afeta todos duma vez. Às vezes queremos uma semente fixa pra testar e replicar os resultados. Mas geralmente queremos que ela varie toda execução. E com tudo no Random Singleton isso fica trivial de fazer.

//adicionar uma chance de ocorrer uma mutacao <aqui>
//s e m p r e fazer mutacao tem risco (pouca mutacao eh okay (mas mais tentativa e erro))

if (Random.value < 0.5f)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definir esse valor numa constante, assim fica fácil de mudar a taxa de mutação.

return map;
}

public static NPC_SO[,] EvolutionProcess(MapElites mapElite, int numIter)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Esse código é quase igual o anterior. Façam uma função que executa os passos parecidos. Polimorfismo provavelmente faria que não precisasse replicar nada daqui.

Copy link
Collaborator

@LeonardoTPereira LeonardoTPereira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

O Código está ótimo!
Deixei algumas sugestões de melhora. As do random são para depois do merge.
Porém, se vcs puderem verificar sobre as 2 constantes que pedi para criar e tentar sumir com um trecho de código repetido que comentei, seria ótimo!
Se vcs tiverem muito apertado, me avisem que aprovo sem isso.
Mas só devo conseguir começar a mexer com os NPCs dentro do projeto no final do mês, então vcs tem um tempinho aí.

Copy link
Collaborator

@LeonardoTPereira LeonardoTPereira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deletar assets das pastas de Execucao

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Integrar Gerador de NPCs com a Develop

3 participants