I can't figure out if the error is in the code or the engine

My problem is that when I wrote the code (and I run the engine through Visual studio, as I remember it solves most of the problems with compilation). And ran the project to check the display of messages “Server: OnRep_ReplicatedVar” and “Client %d: OnRep_ReplicatedVar”. code below:

But as you can see it doesn’t display information about the client. I didn’t get any errors from the engine.

When I connected the OnRep_ReplicatedVar function in Level Blueprint, it displays only information about the server. But there is no information about the client. I decided in the code to swap the message about the server and the client. It shows information about the client only ID shows 0, even with three clients. I changed MyBox.cpp file from GitHub, but everything is the same. Deleted temporary files. But GPT-chat suggested that in the function if (HasAuthority()) is always true and that’s why it always shows messages about the server. I decided to go through the code through debug, and I didn’t even go down to else debug. In the if() condition you could specify that HasAuthority() try/false, so that there would be an explicit overlap (I think so). But I don’t know how to do it yet! But alas while the problem I have such an inscription for different clients is not displayed, but everything else works fine.

That error is a sign that your gpu has not enough vram. 8gb is usually good enough but for complex levels, you need a lot more. This means higher end gpus.

I would say a 3060 or higher ideally.

Maybe you misunderstood, my question is not about the video card!

That’s the only error I saw in the screenshot you shared. Then I reread and realised, so I apologise for that. Also for some reason I didn’t see the code, just the screenshots. Just FYI, that GPU error is going to be an issue if you are seeing it on the basic level.

Now, the issue you are seeing about messages.
Have you deleted the binaries and intermediate folders at all?

This is the only thing that jumps out at me to start with.

Other things to try. A packaged build may demonstrate if the issue is with the code or something else. A glance over your code seems to indicate it is fine.

Next, you need to compare against the end of lecture code. This may point to an issue with your code over the lecture.

There are some UE5.3 specific issues as well. You need to exit steam when trying to test and also have noticed that sometimes the behaviour is incorrect in the editor so you have to use command line to run the game which is covered in a lecture.

Give these a try one at a time and let me know how you get on.

Edit: ChatGPT is actually wrong. The hasAuthority should return true on a server instance and false on the others.

Maybe I misdescribed my thoughts in a fit of passion, or maybe the translator didn’t do it right. Anyway, I’ve done everything you suggested. HasAuthority returns only ture and the compiler doesn’t even get to the false logic. I manually debugged the code several times.

As you can see in the screenshot, I stopped compilation as soon as the server message was displayed
And it only gives a message about the server. (I didn’t write this before, I apologise for that. But in the lecture I was watching, both client and server messages were displayed at the same time).
Here are the screenshots: I stopped the debug on the client message output. The compiler doesn’t even get to else at all. In the end I came to the conclusion that HasAuthority is always outputting the truth.

In Blueprint I showed you specifically because in the lecture without the C++ function “OnRep_ReplicatedVar” in Blueprint. The information about the client was displayed. Only when it is enabled the message about the client and the server is displayed. Of course, you can remove “else” in the code and leave :
GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Green, TEXT(“Server: OnRep_ReplicatedVar”));
GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Yellow,
FString::Printf(TEXT(“Client %d: OnRep_ReplicatedVar”), GPlayInEditorID));

And of course it will output information about both client and server.
But since in :
FString::Printf(TEXT(“Client %d: OnRep_ReplicatedVar”), GPlayInEditorID));
It also talks about the client ID number, and it should show (Client 1/2), but it outputs (Client 0).
I just want to understand what is the error in the code logic. Well, it can’t be because of temporary files in folders that need to be deleted. This is all possible if you run the engine and development environment temporarily and compile code changes through (Live Coding Unreale). Such errors happen because of it.

Ok, did you set the run to start using a listen server. This would affect how HasAuthority works. It shouldn’t always be returning true as that would indicate all are servers.


I didn’t change the server settings. I switched on the listen server from the first lesson and haven’t switched it off!

Ok, then I’m not sure without the project. Can you delete your binaries and intermediate folders, zip the folder (not rar please) and then upload to https://gdev.tv/projectupload

Let me know when done and I’ll get a look over the weekend if I can.

All right, I’ll get it all to you.

I’ve sent you the archive

1 Like

Ok. So, 2 things here. When you zip, you need everything in the folder. The sln and uproject are only for the projects themselves.

Second, UE does not like non-ascii characters and the zip I noticed had cyrillic characters. Your project, all folders containing the project, folders within the project and files all need to use ascii characters.

I don’t understand what you’re getting at! First of all, Cyrillic characters in the code are commented out and how can commented out sections affect the code itself if the compiler detects an error when it detects Cyrillic characters or any other characters that are not in the libraries??? Even if we take your conclusion it is more logical to say that the installation path for the engine and development environment I use Latin characters. And how does that solve my problem??? It just sounds a little crazy, doesn’t it? If you don’t know how to help me with this issue then just say so and I’ll leave you alone and look for a solution myself!

I think you misunderstood.

Unreal engine install path is fine. It should be fine regardless. The entire project path however must be ascii characters only ie a-z, A-Z, 0 to 9 and other symbols like that. We have no control over this and it is an Unreal Engine thing. That does cause issues if it does not comply. It is not specific to Cyrillic characters, irish letters, German umlaut letters and other accented characters are not allowed either. They have to be valid file path letters located from ascii code 32 to 126, with certain other characters not permitted within that range.

For example.
C:\abc\test.uproject is fine
C:\ab¢\test.uproject is not valid

As for what you uploaded, it did not have the entire project, just 2 files both of which are useless on their own. The uproject has nothing much more than the version of unreal, and the solution file from visual studio which is also no good without everything else.

So, inside the folder you’ll find a uproject file, contents folder, config
folder and so on. We as for the binaries and intermediate folder to be removed before zipping the entire folder. When you do that, I will have something I can test for you.

I apologise for the archive, but why didn’t you say that not all the files were in the archive!?

I did! I maybe could have been clearer.

When you zip, you need everything in the folder. The sln and uproject are only for the projects themselves.

I’ve reuploaded the archive

1 Like

I’m sorry it has taken so long to get back to you. I can’t see any sign of the archive.

Well, I reuploaded the previous link,
okay, I’ll reupload it again.

The upload process was updated to send emails to us when an upload occurs and also with details instructions of what to include and not include in your zip file. Perhaps the switchover caused issues. This is the first chance I’ve been able to get at my PC in a couple of days, so again, apologies. I should be able to look at this tomorrow when the file is uploaded.

Just post a message here when done and I’ll check again. Thanks.

Privacy & Terms