How Do I make my AI Wonder? 2D

I want the AI to randomly wonder around the stage until they find something to do. I’ve been looking forever and cant find any tutorials on this.

perhaps you should try differnt keywords, i guess that you want it to “wander” instead of “wonder”.

So try: “wander”, “roam”, “roaming”, “idle movement”
Especially “roam” gives me quite some good looking results in google.

If you want any more specific help you should perhaps share more information on your setup. Especially what that “stage” is. In addition what is “find something to do”? Do you already have the latter covered? Is the question really only about the movement part? Do you use a Navmesh?

What I did was pretty basic, but it was all that I needed. See if this doesn’t help you come up with a better way:

public void Exploring()
    {
        patienceCounter++;

        if (knownEntities > 0) { state = State.Working; }

        int randomA = Random.Range(1, 150);
        int randomB = Random.Range(1, 6);

        if (patienceCounter < randomA)
        {
            if (randomB == 1) transform.Rotate(0, -turnSpeed, 0);
            if (randomB == 2) transform.Rotate(0, -turnSpeed * 2, 0);
            if (randomB == 3) transform.Rotate(0, turnSpeed, 0);
            if (randomB == 4) transform.Rotate(0, turnSpeed * 2, 0);
            if (randomB == 5) transform.Rotate(0, -turnSpeed * 5, 0);
        }

        transform.Translate(0, 0, moveSpeed);
}