Hello world again! I have suddenly faced a weird and horrible bug. I have tested the game multiple times, and everything worked fine, I have packaged game and published it in the Internet (unfortunately, only for specific world region that is not popular on this forum). I have been asked to record a video about the game, and I have chosen to capture my fighting with aggressive enemies, but a weird and horrible bug suddenly appeared. Enemies push player and he can’t even strike them. In the debugger, everything continued to work fine (it is known as “heisenbug”). I did record the video, but now to show the bug. Please watch:
(Video deleted by author)
Here is the logic of the enemy, if that helps:
Bump. The topic is actual.
Double bump.
My best advice is to simply stop the enemy once they reach the player (or a little before)
Hello @DPS! Sorry for the late answer. I have detected that this bug affects not only aggressive enemies but all enemies that are larger than player. What to do with them if they move in random locations, not only onto player? If such enemy stops, it stops in all directions and cannot also pass by the player. Is it possible to stop the enemy onto player but don’t stop in other directions?
you’d want to create something like an ‘attackrange’ variable and when the enemy is in that range it stops moving.
you could test this in your SetDirection function since you have access to the targetplayer. have it return a bool if its not in range and only AddMovement if its true
Hello @Auran131! I seem to have written:
if i understand you, you’re basically talking about pathfinding which is a quite complex matter.
you can create a basic avoidance by having them push back equally which is what RTS games use
I have done temporarily in the following way (fragment responsible only for direction):
But this solution has the disadvantage that if several allies (player is a subclass of ally) are on the different sides from the enemy, it will reflect from the first overlapping ally and start to push the second one. @Auran131, do you know how to fix it?
EDIT: it seems that after a reflection from the first ally, the enemy will push the second one for at most several meters and reflect again. Even if allies encircle the enemy, it will push them at random directions but not far. So I think this works in most cases.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.