Ryan Scorpion
Member
This is mainly something that has peaked my interest in the last couple months and I have been trying to think of a way to do it but hitting a brick wall. So any suggestions would be greatly appreciated if anyone has done this before or has any ideas...
So currently I have Enemies in my game that are able to predict player movement and (if the bullet will reach them without hitting a wall) shoot in that direction effectively letting them lead shots. This system is great but it has one flaw which is that my projectiles can ricochet off a wall once. Currently I simply use move_bounce_solid(0) to do this although switching to something more reliable may be needed whilst doing this. The issue with this is that the Enemies effectively can't use the ricochet since they can only predict the player's with the projectile movements before the bounce. What I would like to do is combine these, so have the AI be able to predict where the Player will go and if it can, bounce a projectile to that position effectively to intercept them. If this doesn't make sense please let me know and I'll try clarify further since it is kind of hard to explain.
I currently see two ways of doing it currently, the first is a kind of brute force which is to simulate lines coming out of the enemy in all directions (kind of like rays) and if these rays bounce and are close to the player's future position in the time it would take the bullet to travel there, feedback that direction to the AI and tell it to shoot. This method would work but due to all the collision checking, I feel like this will really drain performance and since I'm already using lots of pathfinding functions, I need all the optimisation I can get.
The other option would be to just draw one line which would be the future position of the player and try to connect that to the Enemy's current position. The main issue is to get the Player's predicted path, I need to know how long the travel time would be and to know that, I need to know where the end-point is and to know that I need to know the travel time etc. As far as I can tell there is no solution but I could be thinking about it wrong.
All I need to do is supply my Enemies with a direction, once they have that, they can take care of the rest, it's just getting that direction that's hard. Any suggestions would be appreciated. Thanks for reading
So currently I have Enemies in my game that are able to predict player movement and (if the bullet will reach them without hitting a wall) shoot in that direction effectively letting them lead shots. This system is great but it has one flaw which is that my projectiles can ricochet off a wall once. Currently I simply use move_bounce_solid(0) to do this although switching to something more reliable may be needed whilst doing this. The issue with this is that the Enemies effectively can't use the ricochet since they can only predict the player's with the projectile movements before the bounce. What I would like to do is combine these, so have the AI be able to predict where the Player will go and if it can, bounce a projectile to that position effectively to intercept them. If this doesn't make sense please let me know and I'll try clarify further since it is kind of hard to explain.
I currently see two ways of doing it currently, the first is a kind of brute force which is to simulate lines coming out of the enemy in all directions (kind of like rays) and if these rays bounce and are close to the player's future position in the time it would take the bullet to travel there, feedback that direction to the AI and tell it to shoot. This method would work but due to all the collision checking, I feel like this will really drain performance and since I'm already using lots of pathfinding functions, I need all the optimisation I can get.
The other option would be to just draw one line which would be the future position of the player and try to connect that to the Enemy's current position. The main issue is to get the Player's predicted path, I need to know how long the travel time would be and to know that, I need to know where the end-point is and to know that I need to know the travel time etc. As far as I can tell there is no solution but I could be thinking about it wrong.
All I need to do is supply my Enemies with a direction, once they have that, they can take care of the rest, it's just getting that direction that's hard. Any suggestions would be appreciated. Thanks for reading