tanis
|
|
« on: February 23, 2015, 09:40:52 AM » |
|
I've rewritten my 2D platformer path finder code and it looks like a big step forward for my poor AI code. It would be nice if anyone could have a look at the results and try to get the AI stuck so that I can figure out the weak spots. If you can manage to get a Vine or any other kind of video capture of when it gets stuck, that would be awesome! :-P The demo is in Flash and you can play it here: http://www.onemancrew.org/demo/HaxeMultiPlat/Thanks!! :D
|
|
|
Logged
|
|
|
|
andrew.r.lukasik
|
|
« Reply #1 on: February 23, 2015, 11:41:35 AM » |
|
Hi, One issue I see is that you can find good spots to kill Ai and after respawn there is very high probability it will behave literally the same way. It feels little like game-breaking exploit but probably some randomness (?) or alternative behaviors could fix it.
|
|
|
Logged
|
|
|
|
tanis
|
|
« Reply #2 on: February 23, 2015, 11:44:26 AM » |
|
Thanks for the reply Andrew! Indeed you're right about the lack of randomness. Did you find any spot where the AI would get stuck and unable to move?
|
|
|
Logged
|
|
|
|
andrew.r.lukasik
|
|
« Reply #3 on: February 23, 2015, 11:56:32 AM » |
|
None so far. Ai seems to move pretty smoothly. I like player movements/controls too. There is little to play yet but it feels like solid foundation for something cool
|
|
|
Logged
|
|
|
|
Quicksand-S
|
|
« Reply #4 on: February 23, 2015, 12:26:23 PM » |
|
I didn't see it get stuck at all, so it's a great start.
It seemed to fall off platforms quite often. I got the feeling that whenever it spotted me, that threw off its movement for a moment because it usually failed to jump right after that.
It might be a good idea to make the AI prioritize ammo when it doesn't have any, since otherwise it's just going to get killed. That would probably have the added benefit of making its movement a little more interesting and slightly less predictable.
|
|
|
Logged
|
|
|
|
tanis
|
|
« Reply #5 on: February 23, 2015, 12:56:07 PM » |
|
That's very good to hear. I think that the AI sometimes gets lost when you are jumping as it loses a reference point on the A* grid. When that happens, it just chases in the direction of the player without actually following a path and eventually falls off the platform it's standing on. I'll see if I can make it stick to the node where it's last "seen" the player.
Right now the AI is looking for ammo only when it runs completely off. It should choose the closest bullet and run to pick it up. I should also change it a bit so that it also picks up bullets it happens to stumble upon while getting to the one it wants to pick up.
I noticed I forgot to let the AI lose the target when the player dies. It should just get out of the way and grab some ammo for a few seconds while the player respawns. That should make it for more variance in gameplay.
|
|
|
Logged
|
|
|
|
Quicksand-S
|
|
« Reply #6 on: February 23, 2015, 01:07:14 PM » |
|
Since the player and AI respawn without any ammo, it's often easy to just guard the bullets and not let the AI anywhere near them. I guess that's the problem with reusable ammo. Seems like another ability or ammo-less weapon might be required (Maybe a slow-firing weapon that temporarily disables the target so you can run over and grab ammo quickly?).
|
|
|
Logged
|
|
|
|
tanis
|
|
« Reply #7 on: February 23, 2015, 01:23:33 PM » |
|
Since the player and AI respawn without any ammo, it's often easy to just guard the bullets and not let the AI anywhere near them. I guess that's the problem with reusable ammo. Seems like another ability or ammo-less weapon might be required (Maybe a slow-firing weapon that temporarily disables the target so you can run over and grab ammo quickly?).
That sounds like a super idea! :D
|
|
|
Logged
|
|
|
|
tanis
|
|
« Reply #8 on: February 24, 2015, 03:03:32 AM » |
|
This video
gave me another idea. I should probably stop checking for collisions while the AI is jumping. If my paths are correct, the jump should always let the AI land somewhere where there's space. That way I'd avoid the AI hitting the head against a ceiling when jumping in small areas.
|
|
|
Logged
|
|
|
|
Quicksand-S
|
|
« Reply #9 on: February 24, 2015, 03:12:03 AM » |
|
This video
gave me another idea. I should probably stop checking for collisions while the AI is jumping. If my paths are correct, the jump should always let the AI land somewhere where there's space. That way I'd avoid the AI hitting the head against a ceiling when jumping in small areas.
Temporarily ignoring collisions seems like a good way to cause unforeseen issues. Why not just adjust the jump strength based on how far/high they have to jump? I feel like variable-height jumping is generally a good idea in platformers anyway, so it'd be nice if the player had that option as well (based on how long they hold the Jump key).
|
|
|
Logged
|
|
|
|
tanis
|
|
« Reply #10 on: February 24, 2015, 03:37:28 AM » |
|
Why not just adjust the jump strength based on how far/high they have to jump?
That would imply that I'd have to determine how long the jump key should be pressed for the AI to successfully jump on a platform, but at the same time avoid hitting the ceiling. I'm pretty sure there's a formula to come up with the correct jump arc, but I need to investigate
|
|
|
Logged
|
|
|
|
Quicksand-S
|
|
« Reply #11 on: February 24, 2015, 04:31:43 AM » |
|
That would imply that I'd have to determine how long the jump key should be pressed for the AI to successfully jump on a platform, but at the same time avoid hitting the ceiling. I'm pretty sure there's a formula to come up with the correct jump arc, but I need to investigate I'm sure you'll find a lot of info about it (possibly under the topic of "projectile motion"). Since your game is grid-based, I imagine you could pre-calculate all the necessary values in order to speed things up during runtime. You don't even necessarily need to work the formula into your code, although I guess calculating the values with code could save time if you ever change the gravity or anything.
|
|
|
Logged
|
|
|
|
|