-1
\$\begingroup\$

I'm trying to develop a 2D platformer AI that is aware of its buddies and tries to not overlap with them. However, I always end up with an "snake":

AI example

I dont want them to be so robotic, but instead influenced by player's movement.

I also tried to give all "waiting" enemies a chance of walking back, but that ended up in some strange pinball-type movement.

\$\endgroup\$
4
  • 3
    \$\begingroup\$ What behavior exactly do you want to achieve? \$\endgroup\$
    – Kromster
    Commented Feb 21, 2014 at 4:59
  • 1
    \$\begingroup\$ The question title is misleading. You seem to have managed the awareness-part, but you still have problems with how to react on the awareness-information. \$\endgroup\$
    – Philipp
    Commented Feb 21, 2014 at 12:28
  • 1
    \$\begingroup\$ This interesting tutorial may be what you're looking for: gamedevelopment.tutsplus.com/tutorials/… \$\endgroup\$
    – Shaun Wild
    Commented Feb 21, 2014 at 15:01
  • \$\begingroup\$ The answer from Willem goes in that direction. Although the title of my Question got altered. I never wrote how i make them aware much more how i can make them work more organic with each other. \$\endgroup\$
    – Mottenmann
    Commented Feb 24, 2014 at 23:28

2 Answers 2

0
\$\begingroup\$

Your question immediately made me think of Pacman -- here you have the ghosts, each kinda doing its own thing. Words from the PacMan guy himself confirmed it:

“I wanted each ghostly enemy to have a specific character and its own particular movements, so they weren’t all just chasing after Pac Man in single file, which would have been tiresome and flat.” - Toru Iwatani, Pac-Man creator

Check out this great article for information on how he did it.

\$\endgroup\$
1
  • \$\begingroup\$ Thanks, that article says it pretty much. But i still wonder how i could reflect the 2d behavior of those ghosts onto the more 1d movement of my enemies. I see that iam much more restricted with an platformer. \$\endgroup\$
    – Mottenmann
    Commented Feb 24, 2014 at 23:34
0
\$\begingroup\$

How about you try changing the speed of individual enemies? For example, the one closest starts running towards the player and attempting to hit him, while the 2nd enemy continues walking at the same speed it did before.

Also, you say that you don't want the enemies to overlap, but in that image above, they kind of do, have you tried giving them a little more visible distance between each other? After that you could try implementing handlers for overlapping, i.e., whenever an instance of an enemy is about to run into another instance, it should either have a small wait time before continuing moving or perform an altogether different behavior, such as walking backwards. I am not completely sure what your main goal is here, but I am trying to give you some suggestions that you could work on. Furthermore, the enemy on left is exhibiting a strange behavior, why does it stop and do nothing when the player has stopped? Shouldn't it attempt to damage the player before he continues moving forward?

\$\endgroup\$
1
  • \$\begingroup\$ With overlapping i mean that i dont want them to be exactly above each other. Atm i use an "personal" space for each enemy that has an random size. Also the attacking is random and has an 30% chance to occur. It seems that most Games dont use the movement of the player. They mostly patrol.. \$\endgroup\$
    – Mottenmann
    Commented Feb 21, 2014 at 12:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .