You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is no secret that the code for the enemies is not well-designed. After all, it was made back in 2018, I didn't even know a design pattern back then.
I didn't read on AI either, it was quite literally handmade without any guidance, I still remember the "breakthroughs" and how making the AI felt like exploring, happy times.
There are some good things, like the split of enemy onto pathfinder and behaviour, and the attacks being split in classes, hence monsters are "modular" (e.g. hollow with some clicks, could get the jump attack of satyr, or the rush attack of centaur and minotaur)
However! There are 5 horrible things, which linger to this very day, as I didn't know anything about AI, and I was coding whatever came into my head:
Attack Detection Hitbox and Attack Damage Hitbox are MERGED
Yes, this is as horrible as it sounds. The same hitbox which says "if in X range, use your first attack" is also the hitbox which checks for applying damage within X range.
It isn't really noticeable in-game, because with the above, enemies attack when they get in range of their attack. But it is noticeable for Harpy's spin attack.
Harpy's spinattack is clunky/janky, because of this flawed design.
Sidewalled Bug
A serious bug, where enemies at wall sides have bugged AI (e.g. they run towards you but cannot move towards you...)
Flying Type
Instead of splitting EnemyBehaviour into Grounded and Flying, I slapped Flying code onto default EnemyBehaviour. And if (flying) then bloated code overrides default.
Not a bug, not wrong, but it makes the code ugly and bloated.
Delete IDamageable
My first experience with Interfaces, and I did it with monsters. Unity is not meant for interfaces, it goes against its component system. And if you override them, you create insane spagghetti.
Decouple State Machine from Physics.velocity
Its such a mess. Physics.velocity is set on Update() and pathfinder, and FixedUpdate()
This is the only part which is worse than WarriorMovement
For this reason, netcoding enemies was impossible, and I just disabled EnemyBehaviour altogether for the client.
The text was updated successfully, but these errors were encountered:
It is no secret that the code for the enemies is not well-designed. After all, it was made back in 2018, I didn't even know a design pattern back then.
I didn't read on AI either, it was quite literally handmade without any guidance, I still remember the "breakthroughs" and how making the AI felt like exploring, happy times.
There are some good things, like the split of enemy onto pathfinder and behaviour, and the attacks being split in classes, hence monsters are "modular" (e.g. hollow with some clicks, could get the jump attack of satyr, or the rush attack of centaur and minotaur)
However! There are 5 horrible things, which linger to this very day, as I didn't know anything about AI, and I was coding whatever came into my head:
Attack Detection Hitbox and Attack Damage Hitbox are MERGED
Yes, this is as horrible as it sounds. The same hitbox which says "if in X range, use your first attack" is also the hitbox which checks for applying damage within X range.
It isn't really noticeable in-game, because with the above, enemies attack when they get in range of their attack. But it is noticeable for Harpy's spin attack.
Harpy's spinattack is clunky/janky, because of this flawed design.
Sidewalled Bug
A serious bug, where enemies at wall sides have bugged AI (e.g. they run towards you but cannot move towards you...)
Flying Type
Instead of splitting EnemyBehaviour into Grounded and Flying, I slapped Flying code onto default EnemyBehaviour. And if (flying) then bloated code overrides default.
Not a bug, not wrong, but it makes the code ugly and bloated.
Delete IDamageable
My first experience with Interfaces, and I did it with monsters. Unity is not meant for interfaces, it goes against its component system. And if you override them, you create insane spagghetti.
Decouple State Machine from Physics.velocity
Its such a mess. Physics.velocity is set on Update() and pathfinder, and FixedUpdate()
This is the only part which is worse than WarriorMovement
For this reason, netcoding enemies was impossible, and I just disabled EnemyBehaviour altogether for the client.
The text was updated successfully, but these errors were encountered: