Scopi implementatie
Scopi is an npc in the game that realy likes to shoot you with his laserbeam
With this npc there was a problem, when it was made a few months before we joined the studio by a different group of developers it was made in a different way then the rest. To streamline the process of making new npcs there is a "baseFlyingEnemie" prefab this can be used as a template for npcs so every enemy has at least the most basic functionality.
This was the first userstory I did at the studio and me and a classmate decided to go at it together
Scopi needed to be totally rebuild from the "baseFlyingEnemie" prefab, when we started doing this it seemed not all that bad.
I started with transfering the visuals, and my teammate started on the statemachine
this was de easy part. All I had to do was take the model from the bad Scopi and put it on a copy of the base flying enemy, very nice, very easy, very quick.
Since I had completed the first part in just one day I was optimistic, my teammate had already done a fair bit of work concerning the logic and I also started work on some scripts, this took a few days but wasnt all that difficult.
This is were the struggle started. In this project there is a custom build State Machine.
A state machine is a script that points to sate scripts, those scripts then tell the npc how to act in certain situations, there are some conditions that trigger a state transistion and this is all packed into an easy to use package to edit said state transistions.
The states themself were just scripts we wrote to handle behavior on how to act in states and in transistions to and from states
Here you can see the final setup for scopi`s state transistions.
Getting this right was a realy long and boring process of tuning every transistion and finding the perfect setup of state`s, this was also a very bug atracting activity as we shuffled around the states and transistions.
So after 2 weeks of fixing edge casses and trying different combinations of states and transistions we had a fully working Scopi enemie that was conform with the rest of the enemies in game