iDevGames Forums
Random wandering toward goal destination - Printable Version

+- iDevGames Forums (
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Game Programming Fundamentals (/forum-7.html)
+--- Thread: Random wandering toward goal destination (/thread-8608.html)

Random wandering toward goal destination - tron_thomas - Feb 6, 2011 09:38 PM

I have a situation where there are numerous objects that need to wander about on a 2D plane. The objects should avoid certain areas in the plane and should also eventually make their way toward a desired goal destination.

Where can I find resources that would help with implementing this type of behavior?

RE: Random wandering toward goal destination - monteboyd - Feb 6, 2011 10:38 PM

You might find some help here:

RE: Random wandering toward goal destination - Skorche - Feb 7, 2011 09:13 AM

Maybe something like this maybe? WASD to move, mouse to fire, you can climb the walls to get up top. The movement of the enemy circles is supposed to look sort of like ghostly jellyfish or something like that. They swarm into the bunker, go down a vent, and kamikaze themselves on an invisible spot in the lower part of the bunker.

The source code is is Ruby inside the app bundle if you want to look. It's not really commented as it was just hacked together in a couple hours for a contest I never actually entered. :-\

Basically I generated a pathfinding map using breadthfirst search. The map was a 2D array of vectors pointing in the direction to get to the target. I bilinearly interpolate the direction from the pathfinding map, add a little extra random direction using a perlin noise like function, and modulate that by a sine wave to give them the pulsing looking motion.