# Gamemode multiplayer \[C++\]

**URL:** <https://forums.unrealengine.com/t/gamemode-multiplayer-c/280448>\
**Category:** Multiplayer & Networking\
**Tags:** gamemode, unreal-engine, Multiplayer, CPP, question\
**Created:** [April 12, 2014, 11:58pm UTC](https://forums.unrealengine.com/t/gamemode-multiplayer-c/280448 "2014-04-12T23:58:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![undercover](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@undercover](https://forums.unrealengine.com/u/undercover)\
**Post date:** [April 12, 2014, 11:58pm UTC](https://forums.unrealengine.com/t/gamemode-multiplayer-c/280448/1 "2014-04-12T23:58:28Z")

</div>

Hi!

I have some questions regarding the gamemode in unreal engine that I haven’t been able to find any answers to.

One, is it always possible to join a “gamemode” with e.g. "open " command? How to turn off/on the listen server, e.g. in a single player game it would probably be considered a hack to rejecting incoming connections instead of stop listening for connections, the same goes from menus? How is this controlled?

Two, I understand that you can use the online subsystem to allow searching for servers and so on but how do you implement a simple join IP system in pure C++ code without any console commands?

I think a better understanding for this really would help me understand the engine a lot better =) I have looked at the shooter game example and from what I have understood it relies on the NULL implementation of the online subsystem. Maybe it’s obvious but I haven’t found answers for those questions yet and find it kinda fundamental to understand how the gamemode works in order to build a game and is a bit surprised so few details are mentioned about it in the documentation.

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_53648559](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_53648559](https://forums.unrealengine.com/u/anonymous_user_53648559)\
**Post date:** [April 13, 2014, 2:23am UTC](https://forums.unrealengine.com/t/gamemode-multiplayer-c/280448/2 "2014-04-13T02:23:17Z")

</div>

Hi Undercover,

To answer your first question, you actually have to opt-in to be a listen server, so by default you actually aren’t listening for connections. To opt-in (and listen for connections), when you load a level, add the ?Listen option to the level name (open MyGame MyLevel?Listen -game).

To join a server directly (bypassing online subsystem) using c++, you can call ClientTravel on the player controller for that machine: PlayerController-\>ClientTravel( TEXT( “ip:port” ), TRAVEL\_Absolute );

Hope that helps!

---

<div class="post-metadata">

**Author:** ![undercover](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@undercover](https://forums.unrealengine.com/u/undercover)\
**Post date:** [April 13, 2014, 11:54am UTC](https://forums.unrealengine.com/t/gamemode-multiplayer-c/280448/3 "2014-04-13T11:54:25Z")

</div>

Thanks a lot! This really helps me to understand how the networking should be used. What method is used to host/start the server? Is is InitGame?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_53648559](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_53648559](https://forums.unrealengine.com/u/anonymous_user_53648559)\
**Post date:** [April 15, 2014, 2:46pm UTC](https://forums.unrealengine.com/t/gamemode-multiplayer-c/280448/4 "2014-04-15T14:46:21Z")

</div>

The high level call would be GetWorld()-\>ServerTravel( TEXT( “MapName?Listen” ) );

This will open the map call “MapName”, and start listening for connections.
