Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Debugging C++ in Visual Studio

How do I use Visual Studio's debugging capabilities on a client server game? I'm running both the client and the server on the same machine during development. When I run "Local Windows Debugger" in Visual Studio and set a breakpoint in my code, how do I know if execution hits the breakpoint in the server executable or the client executable?

Product Version: UE 4.7
more ▼

asked May 26 '15 at 07:23 AM in C++ Programming

avatar image

Ian Proulx
44 7 10 20

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

3 answers: sort voted first

I don't know if it will help, but you have several configurations. "Debug Game Editor", "Development Editor", ...

If you use "Development Editor", what I've seen, is that some variables are optimized. The editor is launched separately and you have to attach the debugger to an exe. Every time you made code modifications, the hot reload takes care of the changes.

If you use "Debug Game Editor", it will launch the editor when you start debugging. It is slower, but easier to debug. You don't launch the editor, VS2013 will do it for you.

I hope it will help. Have a nice day. D.

more ▼

answered May 26 '15 at 04:31 PM

avatar image

714 49 56 126

avatar image Ian Proulx May 26 '15 at 06:44 PM

Thanks, but that still doesn't help. I have a bug where I change the material of an actor. When running on a listen server the material change happens but not on a client. So I want to step through my code when it's running as a server and again when it's running as a client to see where the differences lie. Should be pretty straightforward but (as with everything that should be easy on ue4) I can't figure it out.

avatar image domzorg May 27 '15 at 05:11 AM

Ok. Then you have two instance of VS2013. One for launching the listen server and one for the client ? And you start the listen server instance and the client without launching the editor with the -game parameter on the debug command line ?


avatar image Ian Proulx May 27 '15 at 05:51 AM

I'm doing things differently. When I click on "Local Windows Debugger" in VS2013 it launches a debugging version of Unreal Editor. I click Play (with 2 players) and two windows launch, one for the client and one for the server. Then I switch between the two windows to test being on the client or on the server. Is there a better way for me to set up for debugging?

avatar image domzorg May 27 '15 at 07:49 AM

When I did debug on the client, I don't launch the game through the EU4 Editor. I debug the code launching the game without the editor. You have to change the debug command line and add the parameters you need to :
- connect to your game server
- to launch the exe as a game and not through the editor -game

May be the way you did it is right. I'm not 100% sure, but I prefer to debug the game without launching the editor.


(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Hello, Ian

Please note that for client-server game debugging, you can use Network Profiler tool that comes with the Engine. It can show you a lot of network-related information, such as the amount of replicated properties and Actors, how much bandwidth is being used and more.

You can find the tool at /Engine/Binaries/DotNET/ directory.

To view the data, please capture a profile while your game is running. To do this you can enter 'netprofile' command in the console to start/stop recording. Then, after the recording stops, the appropriate *.nprof file will appear in Saved/Profiling directory of your project. To get the information, please open the file with the Network Profiler.

Hope this helped!

Have a great day!

more ▼

answered May 26 '15 at 11:26 AM

avatar image

Andrii Melnyk
1.8k 60 19 112

avatar image Ian Proulx May 26 '15 at 04:21 PM

But if I want to just single step through my code on just the server side or just the client side how do I do that?

avatar image Ian Proulx May 26 '15 at 07:11 PM

This doesn't work. I'm in game editor and click play. I type netprofile from console (which doesn't autocomplete by the way so I don't know if it even worked--but didn't get an error msg so who knows). After I quit the game I can't find the *.nprof file. There is no Saved/Profiling directory of my project. There Saved directory but it doesn't contain a Profiling directory.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

My way: 1. build a windows dedicated server(DS); 2. debug the DS, find what happened when launch the DS; 3. package a DS, and start with the command: ShooterGameServer.exe /Game/Maps/Sanctuary?game=TDM -server -log -port=7777 -NOSTEAM 4. build and package a game client; 5. start the game client with the command: ShooterGame.exe then attach the client process to visual studio, and debug the client, find what happend when launch the client; 6. debug the DS, make a break point at Net Driver or somewhere you like, then launch client to connect DS, find what happend when a client connect to DS; 7. now, open your imagination to do something else like find what happened when a player fired to other player

better way to debug a game, please tell me, thanks!

alt text

more ▼

answered Feb 03 '17 at 04:36 AM

avatar image

11 2 5 8

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question