Breeding/Pack Creating

I am creating a survival game with animals and what i am looking for is how to allow my ai to breed with other ai but also allow my player(lion) to find a mate, breed and create a pack of lions. Does anyone know how i can go about this?

And what you tried?

I have just started this just looking for some pointers on where to look to go about this

It’s actually more simple than you might think, you’ll be able to look up wonder scripts pretty easily, I’ve found them myself and they already offer good explanations of how it all works then after that it’s just a matter of using tags and OnCollisionEnter to breed your animals.

I’ve already don’t something similar with villagers the thing that I ran into which annoyed me a lot which isn’t necessarily obvious right at the beginning is if you are having Unity collide with a tag and you have children that have their own separate tags it will go through your whole hierarchy looking for RigidBodies and spawn them for every rigidbody it has. So this means if you have a gameobject tagged as “Wolf” and you search for it with a collision the wolf will spawn multiple times if the gameobject tagged as wolf doesn’t have it’s own rigidbody.

Just something to bear in mind, hope this information helps what gets tricky is when you start trying to simulate personalities for the animals and have them flee or attack but that’s just a matter of breaking things down rather than trying to do it all at once.

I think you are better ask this question in game design.

Problem is trivial.
Make array of animals.
Select animal.
Find next animal in array.
You may consider distance and gender check.
Execute breed algorithm.

1 Like

Nothing wrong with what you suggested @Antypodish but if he’s new to this I would start off way simpler than that.

Normally I would agree with your statement. But OP definitely is not new Unity user. Is with us since 2017, with decent activity.

But being honest, I don’t know what OP knows, or don’t know.
RigidBodies collisions check can work very well too.

We simply don’t know however, how far OP wants to go. If using RigidBodies at all?

ah right so would i need to close this to re-ask in game design? yeah i had a look at oncollison and manage to get an instantiate new game object when within distance but i want it to spawn near the mother lion

No, don’t close it. But you can request using report button to move to correct forum section.

But if you start posting scripts here, of what you want achieve, then it could fit to this forum sections.
Sometimes is blur line, to which forum thread fits in. No stressing about. :slight_smile:

i’ll explain it in better detail quick just to clarify everything.

My AI and character are using rigidbodies (my ai are using emerald ai asset).
i am looking at creating a game like wolfquest (just the mating and pack creating).
I am not new no , but i am new to my topic

Unfortunately I don’t use Emerald AI.
But I think there is feature, to find targets.

So I would look intp approach, where you need define target filter, to find mates, in range.
As @Lethn suggested, you could use RigidBodies, like sphere collider for example, to search near targets.
Then proceed from there, based on found targets.

Then execute AI logic, which closes up two entities. Then when right conditions are met, execute next logic of mating.