# Top Down Local Multiplayer with 4 Players and only 2 Camera Splitscreen

**URL:** <https://forums.unrealengine.com/t/top-down-local-multiplayer-with-4-players-and-only-2-camera-splitscreen/684725>\
**Category:** International\
**Tags:** unreal-engine, UE5-0, splitscreen, question\
**Created:** [November 5, 2022, 6:53pm UTC](https://forums.unrealengine.com/t/top-down-local-multiplayer-with-4-players-and-only-2-camera-splitscreen/684725 "2022-11-05T18:53:52Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![GuteNudel25](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@GuteNudel25](https://forums.unrealengine.com/u/GuteNudel25)\
**Post date:** [November 5, 2022, 6:53pm UTC](https://forums.unrealengine.com/t/top-down-local-multiplayer-with-4-players-and-only-2-camera-splitscreen/684725/1 "2022-11-05T18:53:52Z")

</div>

Hey Guys, i am struggeling with following Situation. I want to create a top-down-bee-adventure game with a local multiplayer up to 4 players. I wish to have a Splitscreen with two views. One shows the inside of de bee hive and the other shows the outside like in the Picture below.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/e/c/7ecbdf8f4589853cc796c0cec2ed40fa058a2e62.jpeg)  
The players can allready move between thes two places with portals.  
The Problem: If i enable Use Splitscreen in die Project Settings there are 4 views, each for every Player.  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/1/3/b13558e15b7e5ba3ac3bca62eea283a5ade4ea3d.jpeg)  
I use Player Start Components witch creates automaticly a Camera for all of my Players, and i have no controll about that. And i dont found a option to select the cameraviews i want in my splitscreen. Hope somebody can help.

---

<div class="post-metadata">

**Author:** ![SupportiveEntity](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SupportiveEntity](https://forums.unrealengine.com/u/SupportiveEntity)\
**Post date:** [November 5, 2022, 8:06pm UTC](https://forums.unrealengine.com/t/top-down-local-multiplayer-with-4-players-and-only-2-camera-splitscreen/684725/2 "2022-11-05T20:06:21Z")

</div>

Hey there @GuteNudel25! Welcome back to the community! A bee pollination overcooked style game sounds really cool!

So this is a bit of a common issue because the split screen system isn’t really exposed to external scripts too much. The logic was that tying it to the camera system would cause complexity issues. The side effect is that there’s little control over how the splitscreen cameras without exposing the system itself in the source, which is a bit more complicated than it sounds!

Most methods of workarounds are decently impractical, like routing all player inputs through 2 handlers or using render targets and just having 1 camera with a plane for the second location cover precisely half of the screen, which I understand isn’t ideal.

**Disclaimer: One or more of these links are unaffiliated with Epic Games. Epic Games is not liable for anything that may occur outside of this Unreal Engine domain. Please exercise your best judgment when following links outside of the forums.**

Render target/ scene capture 2D tutorial:

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/5/2/752e94c3db60e76032478b24146fafd09cb9940e.jpeg "Unreal Render Target & Scene Capture 2D") ](https://www.youtube.com/watch?v=a9iho861SlY)

---

<div class="post-metadata">

**Author:** ![GuteNudel25](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@GuteNudel25](https://forums.unrealengine.com/u/GuteNudel25)\
**Post date:** [November 5, 2022, 9:42pm UTC](https://forums.unrealengine.com/t/top-down-local-multiplayer-with-4-players-and-only-2-camera-splitscreen/684725/3 "2022-11-05T21:42:59Z")

</div>

Hey @SupportiveEntity, thank you for the fast reply.

I allready implementet a HUD with one view as Render Target. But this costs me 15fps and my Camera movement System dont work verry nice, because the main cameraview is still across the hole screen.

What do you mean with [quote=“SupportiveEntity, post:2, topic:684725”]  
outing all player inputs through 2 handlers  
[/quote] ?  
You know a toturial for this method, too?

---

<div class="post-metadata">

**Author:** ![SupportiveEntity](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SupportiveEntity](https://forums.unrealengine.com/u/SupportiveEntity)\
**Post date:** [November 5, 2022, 10:22pm UTC](https://forums.unrealengine.com/t/top-down-local-multiplayer-with-4-players-and-only-2-camera-splitscreen/684725/4 "2022-11-05T22:22:02Z")

</div>

Yeah it’s definitely not ideal to run the RT, the best method would be to dig directly into the source and expose some of the split screen logic, but I’m not well versed enough at working with the source to be able to work that out on the fly.

For the other method, I was trying to find the thread that I had read on it before but couldn’t come up with it. So I’ll do a bit of digging to see if we can get those inputs without a player controller present.

---

<div class="post-metadata">

**Author:** ![GuteNudel25](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@GuteNudel25](https://forums.unrealengine.com/u/GuteNudel25)\
**Post date:** [November 7, 2022, 10:56am UTC](https://forums.unrealengine.com/t/top-down-local-multiplayer-with-4-players-and-only-2-camera-splitscreen/684725/5 "2022-11-07T10:56:18Z")

</div>

I also thinking about unsing the ndisplay plugin, but dont know if this plugin works for my purpose. The Game is for a beekeeper museum, so instead of 1 monitor, i can use two monitor as well, if the plugin only works will multiple monitors and no splitscreens.

---

<div class="post-metadata">

**Author:** ![SupportiveEntity](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SupportiveEntity](https://forums.unrealengine.com/u/SupportiveEntity)\
**Post date:** [November 8, 2022, 8:10am UTC](https://forums.unrealengine.com/t/top-down-local-multiplayer-with-4-players-and-only-2-camera-splitscreen/684725/6 "2022-11-08T08:10:55Z")

</div>

I’m not too knowledgeable about nDisplay to be able to recommend it for this purpose. Glancing over some it’s documentation it seems like you’d be able to utilize multiple cameras without split screen. However it does seem like the solution will be significantly more complex. I couldn’t figure out a way to pull it off without player controllers being attached. The alternative is editing the source a bit, which also could be a deeper challenge than just not generating more viewports past 2.

---

<div class="post-metadata">

**Author:** ![GuteNudel25](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@GuteNudel25](https://forums.unrealengine.com/u/GuteNudel25)\
**Post date:** [November 10, 2022, 8:25pm UTC](https://forums.unrealengine.com/t/top-down-local-multiplayer-with-4-players-and-only-2-camera-splitscreen/684725/7 "2022-11-10T20:25:32Z")

</div>

Hi, i made a change in GameViewportClient.h.  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/9/2/29274d43959f9c8de300be6486d829a60d50e05a.png)  
But changing this value from 4 to 2 has no effect. Do you know why? I created a backupfile and tried restart the engine after change in visual studio and save. Do i have to note something else when editing engine code?

---

<div class="post-metadata">

**Author:** ![SupportiveEntity](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SupportiveEntity](https://forums.unrealengine.com/u/SupportiveEntity)\
**Post date:** [November 11, 2022, 12:23am UTC](https://forums.unrealengine.com/t/top-down-local-multiplayer-with-4-players-and-only-2-camera-splitscreen/684725/8 "2022-11-11T00:23:36Z")

</div>

Engine code needs to be recompiled in the source version of unreal, if you’re editing it directly in the launcher version it won’t do anything outright. If you are working in source and recompiled then I’d look over the header and CPP file for it and make sure how that variable is used. I assume you already have but I always have to mention it.

---

<div class="post-metadata">

**Author:** ![GuteNudel25](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@GuteNudel25](https://forums.unrealengine.com/u/GuteNudel25)\
**Post date:** [December 3, 2022, 10:30pm UTC](https://forums.unrealengine.com/t/top-down-local-multiplayer-with-4-players-and-only-2-camera-splitscreen/684725/9 "2022-12-03T22:30:27Z")

</div>

So finally i have made it. I followed the instuctions of how to change unreal source code with this video → [How To EDIT Unreal's Source (Engine) Code! | How To Make YOUR OWN Game | UE4/UE5 & C++ Tips & Tricks - YouTube](https://www.youtube.com/watch?v=DcEBKnJMxng&t=874s). To mension is, that you need a lot of free memory (194GB). But changing the int32 MaxSplitscreenPlayers to 2 is not the clue. It have to be 4, otherwise there are only 2 playercontroller. Instead of this value i changed in the UGameViewportClient::UpdateActiveSplitscreenType() method case 4. I just pasted anything from case 2 in.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/f/f/4ffdfa78a85c9f9767404fd6584cb3f13c99f5b6.png)  
Build the Engine (may take 1-3h) and this is the end result:  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/1/e/01e14c546986ccb8479ca3415626ff7afebec52c.jpeg)  
performant and without any z buffer issues. Thanks for your help!

---

<div class="post-metadata">

**Author:** ![SupportiveEntity](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SupportiveEntity](https://forums.unrealengine.com/u/SupportiveEntity)\
**Post date:** [December 3, 2022, 10:47pm UTC](https://forums.unrealengine.com/t/top-down-local-multiplayer-with-4-players-and-only-2-camera-splitscreen/684725/10 "2022-12-03T22:47:04Z")

</div>

Amazing work! There’s a kind of “Creator Spotlight”/“Cool things on the forums” thing we do, would you mind if I submit your post here for that? It might just bring some (possibly unwanted) attention or nothing at all depending on who sees it.

---

<div class="post-metadata">

**Author:** ![GuteNudel25](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@GuteNudel25](https://forums.unrealengine.com/u/GuteNudel25)\
**Post date:** [December 3, 2022, 10:56pm UTC](https://forums.unrealengine.com/t/top-down-local-multiplayer-with-4-players-and-only-2-camera-splitscreen/684725/11 "2022-12-03T22:56:15Z")

</div>

Thank you! Sure, no problem.

---

<div class="post-metadata">

**Author:** ![3dRaven](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/3draven/32/906552_2.png) [@3dRaven](https://forums.unrealengine.com/u/3dRaven)\
**Post date:** [December 3, 2022, 11:12pm UTC](https://forums.unrealengine.com/t/top-down-local-multiplayer-with-4-players-and-only-2-camera-splitscreen/684725/12 "2022-12-03T23:12:10Z")

</div>

It would be better to inherit from UGameViewportClient instead of editing the original engine code. You don’t need to compile the engine from source and hinder future split screen projects.

Example:  
.h

```auto
#pragma once

#include "CoreMinimal.h"
#include "Engine/GameViewportClient.h"
#include "GameViewportClientSplit.generated.h"

/**
 * 
 */
UCLASS()
class YOUR_API UGameViewportClientSplit : public UGameViewportClient
{
	GENERATED_BODY()

public:
		virtual void UpdateActiveSplitscreenType() override;
	
		/** Allows game code to disable splitscreen (useful when in menus) */
		void SetForceDisableSplitscreen(const bool bDisabled);

private:
	bool bDisableSplitScreenOverride;

};

```

cpp

```auto
// Fill out your copyright notice in the Description page of Project Settings.

#include "GameViewportClientSplit.h"
#include "UObject/Class.h" 
#include "GameMapsSettings.h"

void UGameViewportClientSplit::UpdateActiveSplitscreenType()
{
	
	ESplitScreenType::Type SplitType = ESplitScreenType::None;
	const int32 NumPlayers = GEngine->GetNumGamePlayers(GetWorld());
	
	const UGameMapsSettings* Settings = GetDefault<UGameMapsSettings>();
	
	if (Settings->bUseSplitscreen && !bDisableSplitScreenOverride)
	{
		switch (NumPlayers)
		{
		case 0:
		case 1:
			SplitType = ESplitScreenType::None;
			break;

		case 2:
			switch (Settings->TwoPlayerSplitscreenLayout)
			{
			case ETwoPlayerSplitScreenType::Horizontal:
				SplitType = ESplitScreenType::TwoPlayer_Horizontal;
				break;

			case ETwoPlayerSplitScreenType::Vertical:
				SplitType = ESplitScreenType::TwoPlayer_Vertical;
				break;

			default:
				check(0);
			}
			break;

		case 3:
			switch (Settings->ThreePlayerSplitscreenLayout)
			{
			case EThreePlayerSplitScreenType::FavorTop:
				SplitType = ESplitScreenType::ThreePlayer_FavorTop;
				break;

			case EThreePlayerSplitScreenType::FavorBottom:
				SplitType = ESplitScreenType::ThreePlayer_FavorBottom;
				break;

			case EThreePlayerSplitScreenType::Vertical:
				SplitType = ESplitScreenType::ThreePlayer_Vertical;
				break;

			case EThreePlayerSplitScreenType::Horizontal:
				SplitType = ESplitScreenType::ThreePlayer_Horizontal;
				break;

			default:
				check(0);
			}
			break;

		case 4:
			switch (Settings->TwoPlayerSplitscreenLayout)
			{
			case ETwoPlayerSplitScreenType::Horizontal:
				SplitType = ESplitScreenType::TwoPlayer_Horizontal;
				break;

			case ETwoPlayerSplitScreenType::Vertical:
				SplitType = ESplitScreenType::TwoPlayer_Vertical;
				break;

			default:
				check(0);
			}
			break;

		default:
			
			ensure(NumPlayers == 4);
			switch (Settings->FourPlayerSplitscreenLayout)
			{
			case EFourPlayerSplitScreenType::Grid:
				SplitType = ESplitScreenType::FourPlayer_Grid;
				break;

			case EFourPlayerSplitScreenType::Vertical:
				SplitType = ESplitScreenType::FourPlayer_Vertical;
				break;

			case EFourPlayerSplitScreenType::Horizontal:
				SplitType = ESplitScreenType::FourPlayer_Horizontal;
				break;
			
			default:
				check(0);
			}
			break;
		}
	}
	else
	{
		SplitType = ESplitScreenType::None;
	}
	ActiveSplitscreenType = SplitType;	
}

void UGameViewportClientSplit::SetForceDisableSplitscreen(const bool bDisabled)
{
	bDisableSplitScreenOverride = bDisabled;
	LayoutPlayers();
}

```

And then just set it in your project

 ![Split](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/7/1/f71a85b1a601293fc2736244265a0a939bec7801.png)

Edit: forgot to mention you need to add the “EngineSettings” module in your .build file otherwise you will get compile errors!

```auto
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "EngineSettings" });
``
```

---

<div class="post-metadata">

**Author:** ![GuteNudel25](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@GuteNudel25](https://forums.unrealengine.com/u/GuteNudel25)\
**Post date:** [December 3, 2022, 11:40pm UTC](https://forums.unrealengine.com/t/top-down-local-multiplayer-with-4-players-and-only-2-camera-splitscreen/684725/13 "2022-12-03T23:40:18Z")

</div>

oh nice. That would have saved me a lot of time and memory. I will definitely try it. Thanks!
