# How to use AI on Client Side in Network game ? (without replication)

**URL:** <https://forums.unrealengine.com/t/how-to-use-ai-on-client-side-in-network-game-without-replication/2479810>\
**Category:** Multiplayer & Networking\
**Tags:** Networking, Perception, unreal-engine, CPP, question\
**Created:** [April 28, 2025, 1:40pm UTC](https://forums.unrealengine.com/t/how-to-use-ai-on-client-side-in-network-game-without-replication/2479810 "2025-04-28T13:40:24Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![PaulRBear](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@PaulRBear](https://forums.unrealengine.com/u/PaulRBear)\
**Post date:** [April 28, 2025, 1:40pm UTC](https://forums.unrealengine.com/t/how-to-use-ai-on-client-side-in-network-game-without-replication/2479810/1 "2025-04-28T13:40:24Z")

</div>

Hello 🙂

**Description:**  
I am trying to control a AI on the **Client side only** using the inbuild capabilities of the Engine.

More specifically, I have an actor that need to use the **PerceptionSystem**. My actor does not have controller and has the following components attached; `UAIPerceptionStimuliSourceComponent`and `UAIPerceptionComponent`

It works fine on the Server Side (Listen Server) where Actors can perceived other Actors (sight) but on Client Side, no one can perceived no one …

What I found:

1. The PerceptionComponent needs a `UAIPerceptionSystem` and a `UAISystemBase` to works
2. Neither of `UAIPerceptionSystem` nor `UAISystemBase` seem to exist on Client Side
3. `UAISystemBase` seem to be instanced here: `UWorld::CreateAISystem()`
4. The condition to be instanced looks like:

```auto
if (AISystem == NULL && UAISystemBase::ShouldInstantiateInNetMode(GetNetMode()) && PersistentLevel)

```

1. The declaration and implementation of the fonction are:

```auto
static ENGINE_API bool ShouldInstantiateInNetMode(ENetMode NetMode);

bool UAISystemBase::ShouldInstantiateInNetMode(ENetMode NetMode)
{
	UAISystemBase* AISystemDefaultObject = Cast<UAISystemBase>(StaticClass()->GetDefaultObject());
	return AISystemDefaultObject && (AISystemDefaultObject->bInstantiateAISystemOnClient == true || NetMode != NM_Client);
}

```

1. And finaly I found inside `UAISystemBase`

```auto
	/** Whether the AI system class should be spawned when connecting as a client */
	UPROPERTY(globalconfig, noclear)
	bool bInstantiateAISystemOnClient;

```

So this looks like what I want but how to set the value at `TRUE` ? (without modifying the Engine..)

_ **Note:** _ `ShouldInstantiateInNetMode` is not virtual, so I cannot override it and `bInstantiateAISystemOnClient` is private.  
_ **Note2:** _ I think it is on the config file `DefaultEngine.ini` to add:

```auto
[/Script/AIModule.AISystem]
bInstantiateAISystemOnClient=True

```

But it does not seem to work so I need a confirmation that it is the solution or not before continuing to dig …

Thanks a lot! 😃

---

<div class="post-metadata">

**Author:** ![Auran131](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Auran131](https://forums.unrealengine.com/u/Auran131)\
**Post date:** [April 28, 2025, 2:03pm UTC](https://forums.unrealengine.com/t/how-to-use-ai-on-client-side-in-network-game-without-replication/2479810/2 "2025-04-28T14:03:49Z")

</div>

can i ask why you’d want the client to control an AI? keeping in mind that even if it worked it would desync from server?

---

<div class="post-metadata">

**Author:** ![PaulRBear](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@PaulRBear](https://forums.unrealengine.com/u/PaulRBear)\
**Post date:** [April 28, 2025, 2:21pm UTC](https://forums.unrealengine.com/t/how-to-use-ai-on-client-side-in-network-game-without-replication/2479810/3 "2025-04-28T14:21:04Z")

</div>

Hello @Auran131 ,

Yes of course !

I am making a RTS game and to save bandwidth (among other things), I an trying to use a deterministic lockstep architecture 🙂 (without rewrite all the engine code …)

I only send input to others players and the simulation should be exactly the same on Client and Server side (So I need the perception system working on both side).

Thanks!

---

<div class="post-metadata">

**Author:** ![Chatouille](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/chatouille/32/1194622_2.png) [@Chatouille](https://forums.unrealengine.com/u/Chatouille)\
**Post date:** [April 29, 2025, 10:00am UTC](https://forums.unrealengine.com/t/how-to-use-ai-on-client-side-in-network-game-without-replication/2479810/4 "2025-04-29T10:00:21Z")

</div>

Variable is “globalconfig” so you need to use the class it’s declared in

```ini
[/Script/Engine.AISystemBase]
bInstantiateAISystemOnClient=True

```

---

<div class="post-metadata">

**Author:** ![PaulRBear](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@PaulRBear](https://forums.unrealengine.com/u/PaulRBear)\
**Post date:** [April 29, 2025, 1:37pm UTC](https://forums.unrealengine.com/t/how-to-use-ai-on-client-side-in-network-game-without-replication/2479810/5 "2025-04-29T13:37:34Z")

</div>

Hello,

Thanks! It works like a charm 🙂

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [May 29, 2025, 1:38pm UTC](https://forums.unrealengine.com/t/how-to-use-ai-on-client-side-in-network-game-without-replication/2479810/6 "2025-05-29T13:38:30Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
