#multiplayer

1 messages Β· Page 371 of 1

cobalt whale
#

Nothing special

#

It's triggers after rapidly pressing button for 3-5 times

ripe raptor
#

Is there any way to verify that a person from your friend list is actually part of your current session (to filter them out from invites)

verbal wave
#

@cobalt whale you can let aim mechanics happen on client side, for better player experience

cobalt whale
#

@verbal wave but I thought input is already client side

verbal wave
#

@cobalt whale client can change replicated variable but server will override it whenever a change happens server side. the whole logic will tangle terribly when latency is bad

cobalt whale
#

so how can I let other clients to know this player is aiming when get rid of this stuck bug?

verbal wave
#

use a seperated ReplicatedIsAiming variable, which the client changes via server RPC

#

but it's just a way to tell the server what is going on. The actual aimming logic doesn't depend on that

#

actual aimming happens locally

slim holly
#

set aim rotation on client, rpc it with tick and set var replication to skip owner

#

and to save bandwidth, you can do a check has the value changed since last tick, no point sending same value twice

cobalt whale
#

well, skip owner flag seems like what I need

slim holly
#

oh and, for aim rpc events I suggest using single event that sends the IsAiming boolean

#

so, in case of packet loss it doesn't get de-synced

#

(if you send aim True, then after 100ms send aim False, but first send got lost in the way so reliable sends it again, you would end up with false-true, when the last input was false)

#

using skip owner does introduce the possibility of desync

#

well, it doesn't affect direct set values

wary wyvern
#

Hey guys. Is there a way to move character from client? I need to move it a bit on client at some location.. Add Movement Input and Add Input Vector don't work.

#

I can't use Set location, by the way, as AnimBP works with velocity

#

Replicate Movement is off, by the way

#

Oh, and It is another character, not mine

#

Like other player enters the trigger, and I want him to walk forward on my side

zenith yarrow
#

@opaque seal had the same issue, I updated to 4.18.3 from 4.17.2, and am using steamOSS for hosting of sessions, it seems to work for now.

1.] Remember to do a Absolute travel when the host travels to the lobby/firstmap after successful creation of a session and make sure that the clientTravel is absolute when the client first connects to the host. Tried seamless at that point but it did not work.

2.] When doing LAN sessions with steam OSS , make sure you add "?bIsLanMatch=1?listen" to the travel URL, instead of just "?listen". Do this even if you specified the session as lan session in session settings during creation. For some reason that is still necessary...

3.] You can then use seamless travel for other maps and it would work...

#

@wary wyvern Hey flakky, were you able to solve the GC issue you were having earlier this week ?

wary wyvern
#

@zenith yarrow What issue?

zenith yarrow
#

the one where your game would crash because it was unable to find a "item" object ?

wary wyvern
#

Oh, nope( Even 4.19 doesn't help

opaque seal
zenith yarrow
#

and addtoroot for the uobject didn't help ?

opaque seal
#

for the server side. I dont know where you get Absolute travel for clientside

wary wyvern
#

Add to root?

#

What do you mean>

zenith yarrow
#

@opaque seal client travel should be in on join complete. I was doing stuff in cpp and I set the client travel to absolute instead of relative

#

@wary wyvern AddToRoot() adds Uobject to rootlist so that it is not GC'd

opaque seal
#

Yeah I dont get what that means.

#

I get a length of 0 out of my found sessions array.

zenith yarrow
#

After joining a session a client should go to the map the host is on, and for that after join succeeds you need to do a client travel. Also, you may need to use ServerTravel when a session is created, at least that is what I am using...

wary wyvern
#

@zenith yarrow I'l try

opaque seal
#

It does not find a session.

wary wyvern
#

Another question, by the way.. How to destroy actor on server, but keep it on client?)

thin stratus
#

I don't think that's how it's supposed to work

#

If the Actor replicates, it'll be destroyed

#

You might only be able to tear it off

#

But I think someone tried that already

#

What reason is there to keep the Client version around anyway?

wary wyvern
#

Yes, I tried

#

When character moves to another server, I want to keep his character and sync it with my own server, so player see, what he's doing on other server.

#

I have seamless travel to another server. Map is splitted my world compose

#

Each part is own server..

thin stratus
#

That works?

wary wyvern
#

What works?

thin stratus
#

The whole "Travel to other Server and keep Character"

wary wyvern
#

Travel works, but character removes from server one.

thin stratus
#

Cause that sounds more like working against the system

#

Seamless Travel ,for one, is a ServerTravel thing

#

Not Client, as the fresh connection to a new server is a hard travel

#

Never a seamless one

#

If you want to keep Actors between servers, you'd need to save the data somewhere and request it back when on the new server

#

At least I wouldn't think that it works properly any other way

wary wyvern
#

That is not the question. It works but I want to see other player from other server

thin stratus
#

Well, then you need to bypass UE4s servers and save the stuff on your own backend

#

Like position etc.

wary wyvern
#

That is what I'm trying to make. I sync players with my own server. But I need to keep character on client, when he travels to other server

#

Because if character travels to other, it gets destroyed from this server, and I cannot see him

thin stratus
#

You mean if Player A leaves, you want to keep the Character on the Server, visible for Player B?

wary wyvern
#

Yes, but I need to keep it on Client B. No need to keep it on server

#

That's what I'm trying to make

thin stratus
#

Okay, how about you don't stop the Character from being destroyed

#

But rather catch the event (Event Destroyed or Unpossessed)

#

And then spawn a local version that you handle yourself

wary wyvern
#

Well, I could spawn, yes.

thin stratus
#

So just a dummy character you spawn that gets information from the backend

wary wyvern
#

On Destroy

thin stratus
#

Then you don't have to fight with unreal

wary wyvern
#

Good point. The proplem I have is to send all the info, like Equipment, weapons an stuff..

#

But that is easier.

thin stratus
#

Well but that's in both cases

#

I mean, on Destroy, you can spawn "DummyCharacter"

#

Lightweight version

#

That is not replicated

#

Spawn it only on the client and pass it all info from the character that gets destroy

#

For the initial setup

#

After that you'd need to handle the character sync via your backend

#

But that's something you need to do anyway

#

Even if you keep the client version

wary wyvern
#

Yeah, I got it) Thanks)

thin stratus
#

Hope that helps

#

Interesting concept!

wary wyvern
#

Yeah, our lead said "Its imposible" -_-

#

And I say, "I will try" πŸ˜ƒ

zenith yarrow
#

@thin stratus if he spawns on the client only the client he spawned the actor on will be able to see it right?, so if there are other clients on the same map they would need to spawn the actor too, right ?

wary wyvern
#

Yes, everyone needs to spawn it, who gets his destroy

thin stratus
#

Well, OnDestroyed calls on everyone

#

Filter the Server and let everyone else spawn a local copy

worn nymph
#

bigger question is why would you want to do this though?

raven holly
#

What's the best way to pool a large amount of replicated actors?

#

(3000-4000)

worn nymph
#

why would u need that many lol

#

bullets for fast firing weapon?

raven holly
#

open world items

#

items

#

for players to pickup

worn nymph
#

what so thy pick it up you then resspawn them

raven holly
#

umm not really, so items despawn and respawn after a while to rotate loot around the map

#

if its picked up it is destroyed

#

but if it despawns it just relocates using a pool system rather than destroying

#

bascially repurposes an already spawned actor

worn nymph
#

youre already pooling then . so whats the question how to optimise it ?

i guess i do mine differernt from most people . i dont have the items there on the server the whole time . i have a trigger volume for each area of where items are going to spawn. and when a player enters the trigger area only then do i spawn the items . i also start a timer when players leave the trigger. if no players enter the trigger before the countdown the items are destroyed

raven holly
#

im just asking if putting the pool actors up in the air outside of a replication distance is a good idea

#

or should i turn replication off when its waiting

#

not sure you can turn toggle replication in runtime though

#

trigger volumes work, but then loot isnt random and spread over the map, it's only in that area

zenith yarrow
#

@opaque seal I think I read in a article somewhere, that your steam session need to be presenceSession if you need the NAT stuff. Make sure that while hosting and finding the session it is marked as a presenceSession.

opaque seal
#

Dunno I'm up to about my 50th forum thread. THis once worked. It worked for a good week, then it stopped working. Not I make it Null and clean out the SteamOSS stuff from Engine, and I cant join over LAN either.

#

The only way it works is to open 127.0.0.1 on the second window once the first has hosted.

#

Using the SteamOnline test project, I get connectivity between 2 systems on 2 steam accounts, just like my game used to. I've even copied my entire project 'into' that working Stema example, and it doesn't woprk again.

#

Sick of compiling over and over to find out it wont work. The basics are all there, using advanced sessions, I even did a Steam Online Subsystem check, and I get true, once I'm sitting in the lobby.

#

(If I do that in PIE, I get an expected false for Steam, which is normal. But 2 standalones give me true on host, but cannot find sessions on other client)

#

Have tried 20,000 num sessions to search for as well, using 480 ID.

#

From getting a good look at so many threads, this would have to be the most randomly unsolved problem with ue4 that goes around since 2014.

#

My actual project hasn't gone anywhere since about Jan 10th because of this, really irritating and essentially makes me wanna give up. Give us better sessions!

#

So this this stage I've removed all Steam from defaultEngine so it's just:

#

[OnlineSubsystem]
DefaultPlatformService=Null

#

Cannot find LAN sessions either.

#

I even get this in the log

#

LogOnline: Verbose: Sending 16 bytes to 255.255.255.255:14001
LogOnline: Verbose: Sent query packet...
LogOnline: Verbose: Received 16 bytes from 192.168.1.200:14001

#

(One PIE picking up the broadcast for sessions from the other PIE)

zenith yarrow
#

are you comfortable using cpp ?

opaque seal
#

Not particularly. I didn't touch cpp and it went from working to not working.

zenith yarrow
#

could you show me the BP where you find sessions ?

raven holly
#

try get the advanced sessions plugin it might help

#

it extends the existing sessions system

opaque seal
#

Also tried advanced sessions, did not fix it, and does not explain why it went from working to not working in the first place, or why LAN won't work, or why all of this worked in PIE then didn't.

#

It's messy because of mthe print strings I use for debug

#

But in saying that, I'll paste what they return

#

LogBlueprintUserMessages: [ServerMenu_C_0] Server: 2 Find Session Success
LogBlueprintUserMessages: [ServerMenu_C_0] Server: 0
LogBlueprintUserMessages: [ServerMenu_C_0] Server: 4 Loop Complete
LogBlueprintUserMessages: [ServerMenu_C_0] Server: 5 No Session Found After Loop

#

If you cut out the print strings, it's a dead copy of the Multiplayer Shooter, 28 video set on youtube do make the menu, etc.

#

I always get array length of 0 on sessions

#

(So, FindSessionSucess is kinda misleading, ignore that, poor usye of words)

#

Num Of Sessions Found is set at 20 (where it once worked) but I've made that all the way up to 20,000 (from reading various addpi 480 threads)

#

appid*

zenith yarrow
#

if your are using ossNULL the app ID wont matter

opaque seal
#

Well right now all my Steam related stuff is removed from DefEng.ini and I just have

#

[OnlineSubsystem]
DefaultPlatformService=Null

#

Cannot find sessions with either LAN checked or not. I've also removed links to Enable LAN andd set it manually as another test, did not help.

#

(On both the find and create nodes)

zenith yarrow
#

did you try disconnecting the pins on enable lan and checking them to be true ?

opaque seal
#

Thats what I meant above, yes. Both ddisabled and Enabled on 2 tests, and both on the Find and Create Session nodes.

#

Every possible combination. And again, this once worked, so I just dont get it

#

I also tried advanced sessions and used their node, added a GAMENAME filter on both create and find session nodes, as per their BLueprint example, also did not help.

valid python
#

Can you force replication even if nothing has changed? Trying to combat some crazy desyncwitha boncuing projectile

zenith yarrow
#

The host is succesfully created right? and you are on the same lan ?

opaque seal
#

Well the host joins the lobby using the on suiccess with create session node

#

I just found a jan 5th backup of my project which works, but is far behind. Considering I've wasted weeks fixing something I've felt is 'just around the corner' maybe I should just go back and r ebuild from there

torn gust
#

Hey, suddenly out of nowhere, i canΒ΄t see the other player on joined session. I checked all the common problems like owner no see and so one. Does anyone have an idea why that is happening ?

opaque seal
#

Not constant weeks, you know, just no reprieve from the problem for that time period. Cheers.

ripe raptor
#

Can someone please double check that I am not going crazy

#

This signature:
virtual void OnSessionInviteReceived(const FUniqueNetId& UserId, const FUniqueNetId& FromId, const FString& AppId, const FOnlineSessionSearchResult& InviteResult);

Matches FOnSessionInviteReceivedDelegate?

#

Nevermind, I am in fact an idiot

ripe raptor
#

@thin stratus - Sorry to ping you, just run into a small snag and I google isn't being very helpful... is it possible to accept Steam invites from in-game? So when I get an invite, and I'm in the game, I show a pop-up, the player presses accept and I tell Steam that the invite is accepted.

#

The IOnlineFriendsPtr::AcceptInvite() is not supported by Steam

torn gust
#

Found the problem. Was something inside the .ini . Happend when copying from a post on the internet. The first Time i did it had it all right, second time ( another post) had it wrong. Took me 8 hours to fix this.

thin stratus
#

@ripe raptor yeah, however can't remember what exact method that was

ripe raptor
#

damn

#

If you have the code in some project, would you mind looking it up if and when you get the chance? I've been trying to trace back where the OnSessionUserInviteAcceptedDelegate is called to try and find what I might call, but to no avail.

thin stratus
#

Sure

ripe raptor
#

thanks

ripe raptor
#

hm, the FOnSessionInviteReceivedDelegate isn't getting fired either on the client getting the invite (steam does give an invite notification)

wary wyvern
#

How to check, if actor has serverside copy, or it was created on client?

#

Oh.. if(HasAuthority() && !IsServer()){}

twin juniper
#

How can I keep a sound playing across ClientTravel

#

like if i travel from main menu to in game

#

i want to keep a song loop playing

ripe raptor
#

So apparently

#

Steam never fires the FOnSessionInviteReceivedDelegate in my game

#

Even though it seems to be properly set up no matter how I look at it

raven holly
#

Alrighty.. so moving items to a pool based system keeps ping a lot more stable and i dont have the garbage collection hitches

thin stratus
#

@ripe raptor I know you would search the session via "Sessions->FindFriendSession"

#

Lemme see

#

Yeah

#

And when found

#

you simply call JoinSession on it

#

Now about the "React to an Invite"

#

Let's see if I find that too

#

OnLobbyInviteReceived

#

Should be the correct thing

#

Need to manually bind it via STEAM_CALLBACK_MANUAL(Class, Function, LobbyInvite_t, Callback)

#

THen register it OnLobbyInviteReceivedCallback.Register(this, &Class::OnLobbyInviteReceived);

#

OnLobbyInviteReceived(LobbyInvite_t* CallbackData)

#

THat's the signature of that function

#

And IDs are like this

#
FUniqueNetIdSteam InFriendId(CallbackData->m_ulSteamIDUser);```
#

You can then use that to get info about the Friend via the FriendsInterface

#

And since that is a steam callback, when reacting to it you will want to move that back to the gamethread

#
//Send Blueprints Notification
AsyncTask(ENamedThreads::GameThread, [this, FriendName]() {
    UE_LOG(LogSteamBeacon, Log, TEXT("Running inside AsyncTask() TRUE"));
    BPEvent_PartyInviteReceived(FriendName);
    UE_LOG(LogSteamBeacon, Log, TEXT("Exiting AsyncTask()"));
});
ripe raptor
#

Oh, lobby!

#

Man, thanks a ton

#

I already posted about it on UDN but eh, good to know

heavy marlin
#

haha

#

how much is udn access as an indie?

worn nymph
#

hello has anyone had any experience with this error

LogWindows: File 'aqProf.dll' does not exist
LogWindows: Failed to load 'VtuneApi.dll' (GetLastError=126)
LogWindows: File 'VtuneApi.dll' does not exist
LogWindows: Failed to load 'VtuneApi32e.dll' (GetLastError=126)
LogWindows: File 'VtuneApi32e.dll' does not exist
LogPlatformFile: Not using cached read wrapper```

my dedicated server crashes when calling events as the server

all google answers say to just clear intermediate and saved folders which i tried and didnt work
ive rebuilt the project and repackaged several times. never have any errors at all when packaging etc
winged badger
#

you using the vanilla engine version?

opaque tinsel
#

Im having issues where my HUD is not being shown to the server and only to client

#

i create the HUD widget in gameinfoinstance and calling it in GameState

thin stratus
#

That sounds wrong

#

Can you show your code?

light grove
#

That does sound particularly awkward.

#

Isn't HUD considered to be a client-only thing?

thin stratus
#

Yes, but a ListenServer would also have a HUD

light grove
#

Ah, yeah. @opaque tinsel c++ or bp?

opaque tinsel
#

sry its bp

#

thats in the GameInfoInstance

#

and Im calling Main HUD in the GameState

light grove
#

Is there a reason you're doing that in GameState?

opaque tinsel
#

No reason, is there a better place to do it in?

light grove
#

UI stuff is not replicated so should generally be client-side. Character and PlayerController are good places to do it.

opaque tinsel
#

i tried calling the HUD in PlayerController but its still doing the same thing

opaque tinsel
#

is it weird that it works in new editor but when i package, it doesnt work

thin stratus
#

Actually

#

That is fine how you do it

#

BeginPlay calls on everyone

#

so that will create one UI per player

#

You will only want to filter the DEDICATED server, if you plan on using one

#

For listenServer setups this is fine

#

Did you try placing a few PrintString to see what code is calling and what not? @opaque tinsel

raven holly
#

Is there a way to turn off replication and then turn it back on?

winged badger
#

you can set bReplicates to true or false at any point (per actor)

raven holly
#

seems to still replicate

heady epoch
#

Character has a variable called BEARD and it is a replicated variable. When they overlap another object ON THE SERVER I set the variable in the character. The client version of the character thinks BEARD variable is still null unless I run a RunOnOwningClient and pass through the BEARD value. Is this correct?

I thought if you set the variable to replicated you only had to set it on the server and not the client.

worn nymph
#

thaat says target.cs not server target when are youi getting this error ?

#

when trying to build the server in visual studio>?

#

take it to pm so we dont flood the channel

twin juniper
#

Is there a reason ShooterGame replicates down a struct with an impact origin (FVector), ReticleSpread (float) and RandomSeed(int32) with every client shot, even if the hit doesn't cause damage? Seems like it would be more accurate but a bit wasteful if firing a big machine gun that doesn't need to look 100% accurate on remote clients

verbal wave
#

Hi buds, one question I hope you love:

if the server randomly set a replicated variable very fast , say, bool CoinFlip 10 times in one second. And the network condition is terrible so the package may arrive at different time.

Does the replication system go out of the way to make sure the final result is the same for client and server?

#

like using a timestamp for every package or something.

opaque tinsel
#

@thin stratus yes i did, and the HUD is being called in the server but its not showing it

cyan bane
#

Anyone know about multiplayer physics issues or have attempted to mitigate those issues?

slim holly
#

in short, mp doesn't compute with physics

#

it can be done to some degree

valid python
#

when you spawn a player does that consume the spawn point? and if so how can I spawn multiple players at the same point (in case for spectators)

slim holly
#

no, unless you tag the spawn point as used manually

#

and playerstart is really a simple placeholder, you should really do a custom system yourself

valid python
#

ah ok cool, atm i was just overriding chooseplayerstart and looping until i found the spectator spawn. however for some reason the 2nd actor to spawn gets spawned at world origin. it's probably something I did in code that it's behaving that way.

slim holly
#

possible overlap issue

#

not that spectator should even have collision but

valid python
#

actually specator does have some default collision from APawn i believe

#

that must be my problem

slim holly
#

I haven't looked into it that much

#

so you could be right

valid python
#

cool well thanks for the info! I'll see if disabling collision makes it work

#

hmm yeah still not working

#

looks to be a problem in my function it's not finding the spectator spawn

#

yup found my problem lol nothing to do with spawns at all more like a possible replication error from one of my checks

cyan bane
#

@slim holly That's what I thought. I worked with multiplayer physics for months to my dismay, so i had to drop my project. However I found a developer working on a similar game (actually almost exactly the same) and asked him about it and his words: "UE networks physics but they didn't seem to add interpolation so we added it. It looks decent."

#

So I'm now confused. Half doubting myself half doubting the developer.

#

Because UE has interpolation

slim holly
#

it's doable in small scale, but just interpolation is not gonna be accurate

#

so it's really use context

cyan bane
#

garrysmod 2

#

aka s&box

valid python
#

i was just fighting with network phsyics myself recently pain in the ass

cyan bane
#

it doesn't work with loads of rigid bodies, i've tried

#

unless im missing something

slim holly
#

bandwidth is probably the first hurdle to overcome

cyan bane
#

that's easy to change

#

even if you give UE access to excessive bandwidth, latency is the issue

slim holly
#

you can't just throttle it and assume it will work

#

and latency

#

physics are allergic to time-dilation changes

cyan bane
#

they didn't change it to make it fixed timestep, so it's not that

slim holly
#

oh my god that thread just hurts my brain in general

tidal venture
#

same xd

cyan bane
#

Layla is one of like 3 developers on the project, garry used to commit changes but hasn't in a while.

tidal venture
#

ahahahhah why I came here xd

slim holly
#

update rate however, may or may not be fixed timestep, latency on the other hand is not fixed

#

so if you can sync all those together then yea you can do accurate replication

cyan bane
#

yeah but if you make the engine fixed timestep you can make physics about as good as source engines, which is what I imagine they're shooting for

mild hull
#

you can make it fixed, but do you want to run a video or play a game?

cyan bane
#

I woudn't make it fixed, I'm just trying to figure out how this dev did it

#

or is claiming to have done it

tidal venture
#

do you guys talk about movement prediction ?

slim holly
#

no, physics

tidal venture
#

oh how they'r replicate physic state ?

cyan bane
#

No, how're they are claiming to keep it in sync by adding interpolation

mild hull
#

never tried it, but i would get pos, speed, rot and fix that by adding force and if gap to large reset to new data

cyan bane
#

But the engine already has physics interpolation

slim holly
#

an interesting talk about the subject

#

but as you can see, even after super hyper optimization the bandwidth will limit the experience to <20players

#

or, 20 objects

opaque tinsel
#

Anyone know why my client is seeing this?

cyan bane
#

That's actually about where i got with my project

#

Having about 50 rigid body cubes in a pile is when it stopped working.

slim holly
#

yea, and you're suppose to build a game on top of that

#

reducing the value significantly

cyan bane
#

the value?

slim holly
#

50 cubes minus gameplay replication

mild hull
#

was that test in LAN?

cyan bane
#

Oh, yeah I know. But they're making gmod 2, so a limit of 20 props won't cut

slim holly
#

gmod parents objects

#

soo 100 objects can use the interpolation of a single object

opaque tinsel
#

that was test through multiplayer

cyan bane
#

only if they're welded though

#

UE does the same thing

slim holly
#

I mean, "welded" and welded

#

considering the object data is available for all clients, it only needs to replicate one simulation result

#

it doesn't need to send location data for each part

cyan bane
#

Yeah, I'm still confused at that developers comment though. I just felt like I was missing something.

slim holly
#

a bs comment

mild hull
#

fake it basic rule for everything

cyan bane
#

but I mean that's the core of that game, there's no point in adding anything else if that doesn't work

slim holly
#

it's not fake as such, just well optimized

cyan bane
#

I mean you can turn off client sim, but waiting 50-100ms for objects to move feels like an eternity imo

slim holly
#

you kinda have to

#

that's why the gmod gravity gun beam bends

#

it's latency

#

just hidden in plain sight because it also bends when you try to lift heavy items

cyan bane
#

Yeah, but in gmod when you as a player walk into/drive into a rigid body, it'll move. Even if you've got a poor ping.

hard flint
#

Can anyone with steam help me test to see if you can find and join my server

#

260mb packaged file with hos t and join buttons

#

would be quick test

fossil spoke
#

Whats the link?

opaque tinsel
#

Is this the right way to play anim montage?

fluid terrace
#

thats a loaded question. badoom chhhh

#

it looks right to me. Just an idea, you might think about switching out that AND for a NAND then you could drop all of those NOT's

opaque tinsel
#

yeah i tried NAND, but it doesnt really work properly

thin stratus
#

@opaque tinsel why do you replicate the montage variable

#

It's an asset, available on everyone. You set it in the BP before you start the game

#

Also your multicast etc doesn't need to pass it. It's only needed directly at the play Montage node

#

Would only make sense to pass it if your function was a generic one that plays different montages. For holster or equip you could easily just have an onRep boolean

cerulean hamlet
#

Are actors such as Character and PlayerController automatically spawned on the server if they are spawned from player start?

thin stratus
#

PlayerStart is just an actor. It doesn't spawn

#

It's used as a spawnpoint

#

GameMode spawns Character and Controller

cerulean hamlet
#

Does GameMode only run on the server or it's also running on the clients?

#

or what I mean is when GameMode spawns the Character and Controller, is the server spawning them and having authority over them?

#

just found your compendium, gonna read through it πŸ˜ƒ

thin stratus
#

It answers the questions :P

cerulean hamlet
#

@thin stratus oh also one separate question. For trying to make a networked top down game, people recommend having a proxy actor on the client which has a playercontroller that passes input to an AI player controller on the server which is replicated back to the client

#

Is this the way you would go about this?

#

I've also seen people that say that AddMovementInput should be used and a new CharacterMovementComponent should be created

thin stratus
#

I wouldn't do either

#

You can simply ask the NavMesh for a Path

#

And use a normal directly controlled pawn

#

Or character

cerulean hamlet
#

Well I'm doing just that

thin stratus
#

And well actually you can use add movementinput then

cerulean hamlet
#

but for moving I am using SimpleMoveToLocation

#

which isn't replicated

thin stratus
#

Well you can just do a server rpc

#

In the character

#

/shrug

cerulean hamlet
#

oh wait don't shrug just yet, I'm pretty new so I might take a bit to get this

#

so the easy way would be to have a server RPC which calls SimpleMoveToLocation on the character on the server?

#

and this would be replicated to clients?

thin stratus
#

It should at least

#

However might look a bit laggy

#

I would try to get a path from the navmesh and use addmovementinput or so to move the character towards tje next path point

cerulean hamlet
#

and I would be using addmovementinput in the Tick() function for the character?

#

and this will be automatically replicated?

thin stratus
#

Addmovementinput is networked yes

cerulean hamlet
#

don't have to touch the CharacterMovementComponent at all?

thin stratus
#

Not if you can avoid it

cerulean hamlet
#

and this would go in Tick()? Just going down the path and using AddMovementInput?

thin stratus
#

Yeah, you don't have any Axis input here so tick is fine

#

Direction for the Input is simply "NextPathPoint - ActorLocation".Normalized and Z value set to 0 (after normalizing)

#

Although, you might be able to leave Z

cerulean hamlet
#

ah so if I was going up a ramp then the Z should not be 0

thin stratus
#

Na, you usually use the ControlRotation

#

Which is the camera view direction

#

So there it's also not 0

#

So just leave Z

#

Shouldn't matter

cerulean hamlet
#

Great, thanks. All of that made sense so hopefully I can implement it

twin juniper
#

when i use IP for connecting ("open <IP>"), do i have to use Destroy Session when i quit game or disconnect or i just use Open Level?

thin stratus
#

Open Level should be enough

twin juniper
#

ok

dull jasper
#

are grenades in fortnite physics or somekind of formula/spline?

slim holly
#

Grenade physics are really simple tho

#

throw velocity + 0,0,-980 *delta^2

#

you could use projectile movement at low velocity for it

#

if you don't feel like doing it manually

undone girder
#

In UE I can do multiplayer game with only 100 players?

slim holly
#

if you have to ask, then no

#

start small, like 4 players

undone girder
#

okey, but UE has the limit?

slim holly
#

not limited, just recommended to 30 players

undone girder
#

So I can build own network module or uptade ue network module for more players? For example 200 - 400 players @slim holly

ancient root
#

Hello, so im trying to create a multiplayer game however im having some issues. I have a custom Pawn class that has 2 hand child actor components. WHich are of type BP_Hand. This BP_Hand has a skeleton mesh, collision sphere and widget interaction

#

all components and the BP_hand is set to replicate. As well as all the replication bools are ticked in the BP_Wizzard class. Yet the interaction debuglines disapear on the client aswell as the server cant see the clients had move

next falcon
#

Can i tell a multicast to execute on the server at Last?
so like if i use Server Variable with multicast i remove them first on the clients and the last on Server
because if a multicast removes the variable first on the server the clients can't use it anymore
And if i can how can i do that ?

#

Nvm i fixed it already

ember needle
#

Hello everyone! I’ve been modding games for years and I’m taking this to the next level. My aim is to do a simple FPS game, with the only main complexity being the fact that it’s multiplayer. I already have googled for a list of resources and started following the UE multiplayer screencasts.

#

Does anyone have good pointers for me, as to which resources you’d recommend starting with? Thank you in advance for anyone willing to input πŸ˜ƒ

#

It looks like I’m in for many months of sweating, which is fine πŸ˜ƒ

thin stratus
#

Pinned messages

#

My compendium

#

@ember needle

sleek pumice
#

Has anyone had problems running multiple server on the same dedicated box when using steam as the oss?

#

I can't seem to get more that one server to init the Steam API.

thin stratus
#

@sleek pumice Nope, but you need to run them on different ports

#

UE4 and query ports afaik

tidal venture
#

If I run what I showed in Β«Event tickΒ», (basicly move forward and backward by input change state) what would you suggest to me if I want to reproduce the same result by using Β«addInputVectorΒ», inside an identical map, with the same start location?

tidal venture
#

Over a network using TCP

wary wyvern
#

Hey guys, who knows how to make client travel from one server to another and keep it's controller? I need to make this from server, not client.

#

I also need seamless travel

next falcon
#

Is Someone Useing Advanced Sessions? i can't get Session Settings it always fails.. someone else with that problem ?

thin stratus
#

@wary wyvern Seamless Travel is a Server Travel

#

Not a Client Travel

#

From Server to Server is designed to be a hardtravel

wary wyvern
#

But I need seamless travel from server to server

thin stratus
#

Afaik that's not how UE4 is designed

#

Then you need to create your own server backend and probably also adjust the engine

wary wyvern
#

You don't need backend. We've made seamless in our project. I just want to make it on my own

thin stratus
#

I can only tell your that seamless is for server and not client travel

#

If you made it work then do it again?
99% of the poeple here simply join a server and leave it again. As that's how UE4s Servers are used

wary wyvern
#

@thin stratus I didn't, our programmers made this. I just want to make it again..

#

What about ClientTravel?

thin stratus
#

ClientTravel is afaik a hard travel. Seamless traveling is when a server changes maps and doesn't disconnect the clients

wary wyvern
#

If so, there should be a way to send actor to other server..

ripe raptor
#

Does anyone know if there any sort of pre-processor macro that is defined with Steam is enabled?

uncut pivot
#

theres a call for if its loaded or not

wary wyvern
#

Another question.. Is there any way to send data from one server to another? Without other server backend

thin stratus
#

I assume you could do some TCP/UDP connection stuff in C++

twin juniper
#

for a multiplayer game with a very simple inventory per player (primary weap, secondary weap, healthpack, ability), would you bother creating inventory logic or instead simply have a pointer for each "slot", as in if the user presses F on a health pack, it'll increment the "CurrentEquippedHealthPacks" var directly

#

Then if he presses the "Use healthpack" button, it'll check if the CurrentEqiuppedHealthPacks var is > 0 and use

wary wyvern
#

I found UIpNetDriver, so I could connect and send data, but trying to make it work now. Lack of documentation(

#

@thin stratus

lost tinsel
#

is there a tutorial to implementing sql without using a plugin?

light grove
#

You'd need to integrate a system that handles communication with the SQL server.

lost tinsel
#

ye lol

#

you have execute databse query with strings. these strings work with c++

hasty adder
#

Interface with a php doc to interface with mysql ;0

glad sedge
#

Anyone particularly knowledgable about PostInit() ? I'm getting what looks to be a recursion error (or something of that nature)

#

i.e. I have this bit of code

#

    if (ItemInstanceClass)
    {
        //ItemInstance = NewObject<UBSItemInstance>(this, *ItemInstanceClass, TEXT("Instance"));
    }

#

I get a Stack overflow - code c00000fd (first/second chance not available) and it points to that ItemInstance line of code when I uncomment it

brittle sinew
#

What is ItemInstanceClass' type?

#

If it's a UClass* or a TSubclassOf, you shouldn't have to manually dereference it

glad sedge
#

TSubclassOf

#

So that's the issue, it shouldn't be dereferenced?

brittle sinew
#

Yeah, you don't need to dereference it, but I'm not sure that's part of the issue

#

Well, if it's just a TSubclassOf, I'm not exactly sure what's even allowing it to resolve to a boolean in the if statement

glad sedge
#

hmm I thought it'd resolve to null and therefore fail if it wasn't set?

brittle sinew
#

Well, a normal, non-pointer struct can't just 'resolve to null'

#

It might be using the dereference operator implicitly, dunno

#

And I guess you don't need to worry about dereferencing it; there is an implicit operator UClass*(), but I'm guessing it's not harmful to do it manually

#

It just stuck out at first glance

glad sedge
#

well, might explain why it tries to create a new object and crashes

brittle sinew
#

I'm just talking about compiling, even

#

Try sticking a dereference within the if statement? That'll check if the internal UClass* is valid

glad sedge
#

Compiles fine, atm. But yeah okay lemme try that.

#

bugger. Still cooked.

brittle sinew
#

Oh, I really need to read errors better

#

That's my bad, rofl

#

I just saw the c0... and assumed nullptr access

#

🀦

#

But huh...that does make things interesting

glad sedge
#

Actually, just to add more insult to injury

#

So I have two classes - ItemDef and ItemInstance. ItemDef is what I've CnP'd

#

But ItemInstance has the same function.

#

i.e. if (*ItemDefinitionClass) { //ItemDefinition = NewObject<UBSItemDefinition>(this, ItemDefinitionClass, TEXT("ItemDef")); }

#

An Item Def creates an instance from a TSubClassOf and Item Instance creates an instance of ItemDef from TSubClassOf.

#

If I comment out one of them, it works fine.

#

Doesn't matter which one; I'm guessing I've got a recursion problem ItemDef Creates an Item Instance, Item Instance creates Item Def, Item Def Creates etc etc

brittle sinew
#

Yeah, that sounds like an issue πŸ˜„

glad sedge
#

heh

#

Truth be told, an item def doesn't need an item instance.

#

though Sion may disagree. And I don't want to disagree with Sion.

tidal venture
glad sedge
#

oh, shit I just realised I;'m in multiplayer.

#

Apologies.

tidal venture
#

Np

worn nymph
#

This sounds very interesting

grand kestrel
#

It is, unfortunately they don't use unreal's replication

#

Can be very convoluted to work with

worn nymph
#

maybe i understood wrong but isnt that the whole point? unreal replication and networking isnt designed or suited to mmo . so they use their own system and extract the networking away so esentially unreal just becomes a client so to speak

#

@grand kestrel

bitter oriole
#

Well, sure, but that's still way harder than using Unreal's replication

#

Though if you're making a MMO, your 100-heads team can surely afford it

grand kestrel
#

Not really to do with whether it's the whole point or not, I say it's unfortunate because then you're tied to SpatialOS (and at their mercy)

#

The system is really a pain in the ass to work with

#

A lot of it is outside of the engine and frankly just odd

#

Like the schemas

#

Could be on actors or w/e

worn nymph
#

ah i see what you mean now . true but its only in beta with enough people trying it and giving feedback and time this could change .

#

and i dont see whats difference between being reliant on unreal or another 3rd party platform . i mean currently im using unreal , gamesparks for database backend and aws for server hosting so im reliant on 3 already . would be nice if there was an all in one solution

bitter oriole
#

You become reliant on two too-big-to-maintain-yourself systems instead of one, AND the support between eachother

#

If SpatialOS drops UE4 because Unity buys them, or if they are slow to update, or don't support the console you want to ship for, then you're fucked

worn nymph
#

yeah but its the same for any of them

bitter oriole
#

You can have a very high confidence that UE4 alone is going to exist and support consoles for the coming years, if only because a few major studios use it.

#

Nintendo uses it, Microsoft uses it, Sony uses it

#

Epic does PC games

#

The support for UE4 at this moment is pretty much 100% sure for the 2,3 years to come

worn nymph
#

yes but ue4 alone doesnt provide everything needed

bitter oriole
#

For a MMO ? Probably not

worn nymph
#

for most games

bitter oriole
#

What kind of stuff does UE4 lack that "most games" need, and require third-party software rather than a few hundreds lines of code ?

worn nymph
#

databases. server hosting ??

grand kestrel
#

UE4 is absolutely strangled by the dependance on a single game thread and low core frequency + high core count

bitter oriole
#

Most games definitely do not need databases, and server hosting has nothing to do with the engine

worn nymph
#

the point was reliant on thirdparty solutions

#

unreal doesnt provide that so you still need other solutions

eternal anchor
#

like every game engine ever build

#

so what is the point ?

bitter oriole
#

If you need a database and server hosting, you can use anyone

#

Any database works, remotely or locally

#

And any kind of server hosting can work too

#

It's very easy to move from one to another

eternal anchor
#

if you don't want to dependd on third party, the only way to roll your own solution

#

@bitter oriole on that I disagree

#

if you build backend using cloud

#

you are pretty much locked down to the single cloud provider

#

unless you really try hard to use cloud indepedent stack

bitter oriole
#

Sure, but then again, everyone on the planet has that constraint

eternal anchor
#

yeah, no saying not, it's just not easy to move from one hosting to another, unless you just host single servers

bitter oriole
#

Using a specific third-party networking stack is a much more obvious point of failure for your project, than using a cloud provider all your competition uses already

eternal anchor
#

true, although SpatialOS is just glorified orchestrator running on top of FCP

#

GCP*

bitter oriole
#

@worn nymph As to databases, since this was given as an example - you can trivially build an UE4 game that has zero dependency on the database vendor.

#

If the database is accessed from the server, as it should.

#

You're going to want some interface layer that ensures connections are from valid servers, etc - and that software will then tap into a database

#

The server is just going to see a socket and send requests, or even raw SQL if you're into that

#

Databases are exactly the kind of stuff that people do swap around during their project's lifetime

#

Not to mention database technology is mature, stable and diverse

#

What I'm saying is, don't build large projects upon stuff that could die overnight

tidal venture
#

Out of your subject, do you guys have try to make client movement prediction (without unreal replication) ?

bitter oriole
#

I've done it with Unreal replication myself

tidal venture
#

what do you means ?

#

like you have your own movement prediction but over replication network ?

bitter oriole
#

Unreal replication just offers a way to replicate data, it doesn't do any high-level stuff. Some UE4 classes have movement prediction, like ACharacter - others don't, so you might need to implement prediction yourself

thin stratus
#

Isn't it the MovementComponent

#

That has the prediction

tidal venture
#

Yes

thin stratus
#

Not the Character itself

tidal venture
#

Exactly

thin stratus
#

I know it comes with the class

bitter oriole
#

The CharacterMovementComponent, really

#

Which is pretty much 100% for ACharacter

thin stratus
#

Sure, just code location-wise

bitter oriole
#

If you want anything else, you need to do prediction yourself

thin stratus
#

You'd not extend the character, but the component

#

To add your own prediction

#

Still on my list to completely look through that thing and implement proper interp for a physics based pawn >.<

fossil spoke
#

The CMC needs an serious refactor lol

bitter oriole
#

I mean if you need anything else than a walking animated humanoid character, then you need to build prediction yourself from the ground up

thin stratus
#

Yeah

#

We currently apply force and that works nicely for low-ping stuff

#

But yeah, anything a bit higher than 10-20 ping starts to jitter.
Just no time to face the MC

tidal venture
#

@bitter oriole I'm using my own tcp server and everything was fun until I need prediction for movement

thin stratus
#

Only heard bad, time consuming things

#

Well movement prediction is actually a pretty straight forward thing

tidal venture
#

yeah

thin stratus
#

Grab the last known data and simulate what the pawn would have down

#
  • some timestamps to make sure the data is uptodate etc
tidal venture
#

I would love to keep it deterministic lockstep

#

So I try to only send pressed and release input

#

For the moment i'm not intersted in float interp.

#

Maybe it will became the easy solution, but even there I don't find anyway to make sure movement happen correctly with 10ms

#

@thin stratus If you could only send Β«pressed & releasedΒ» how would be sure position is good ?

eternal anchor
#

do I really have to mark actor as replicated, if I want to replicate it as attachment ?

#

ie, I have weapon, and it's logic in in seprate object (which is seplicated)

#

replicateD*

#

Actor in this case serves only as visual representation in world, so I doesn't really need replication

#

I tried to spawn it on server and then multicast to all clients (and then spawn it)

#

but it is really unhandy solution

#

I thought that attachments are automatically replicated, but it doesn't look like a case

regal narwhal
#

Hello, Can I set two different player one VR and other one non VR ?

#

on Same Computer

thin stratus
#

Hm, what logs could I enable to see session and online stuff?

#

Tried already:

#
[Core.Log]
LogOnline=VeryVerbose
#

But still missing session info

#

Guess manually calling DumpNamedSession might help

ripe raptor
#

Hey cedric, just a quick question - you've sent me the LobbyInvite callback code a few days ago and it has the snipped "OnLobbyInviteReceivedCallback.Register(blabla)... where does that callback come from?

#

or sorry, bad question, it shoul be "is creating the callback via STEAM_CALLBACK_MANUAL enough to hook it up into the actual Steam system, i.e. will it fire with just that?

#

or do I have to do something else?

thin stratus
#

That should deal with setting it up for steam

#

I mean, the macro's name kinda says that

ripe raptor
#

Yeah, got confused since I was chasing the wrong thing with the normal STEAM_CALLBACK and the way it's setup in FOnlineAsyncTaskManagerSteam

#

Now the only question remains is how to actually include the necesary headers for FUniqueNetIdSteam, since it keeps tripping a #if STEAMSDK_FOUND == 0 error in OnlineSubsystemSteamPrivate

thin stratus
#

FUniqueNetIdSteam might be in a private folder?

#

Had the same sh*t with oculus today

#

Had to force my way into the private folder

manic pine
#

anyone know exactly how replicated vars behave in terms of packet loss? lets say i set X = 5, replicate that, then X = 3, replicate that, but X=5 is lost due to connection problems

#

whats gonna happen on the client, in detail, assuming no more packet loss

bitter oriole
#

You'll just get X=3

ripe raptor
#

Well, no dice with the lobby invite

#

the callback just isn't called at all

#

STEAM_CALLBACK_MANUAL(UArkhamGameInstance, OnLobbyInviteReceived, LobbyInvite_t, OnLobbyInviteReceivedCallback);

...

OnLobbyInviteReceivedCallback.Register(this, &UArkhamGameInstance::OnLobbyInviteReceived);

....

AsyncTask(ENamedThreads::GameThread, this {
UE_LOG(LogTemp, Log, TEXT("GOT STEAM INVITE!!!"));
});

#

That's in the header, the GameInstance's Init() and the OnLobbyInviteReceived function respectively

manic pine
#

hmm i thought it woudl be reliable... e.g. it would wait for client confirmation for X=5, otherwise resend

bitter oriole
#

@manic pine I wouldn't even trust that in correct network conditions

#

See replication frequency for that - if you change a value every frame and the freq is set at 10, how could you have all values ?

manic pine
#

hmm yeah, it would cause excessive traffic too

worthy wasp
#

Does anyone know if i can have an array of FName for this value in ShooterGame?

/** Keywords to match in session search */ #define SEARCH_KEYWORDS FName(TEXT("SEARCHKEYWORDS"))

#

i was hoping to search on more than 1 criteria for FindSessions

#

there are 8 CUSTOMSEARCHINT's in OnlineSessionSettings - i suppose those are it?

ripe raptor
#

Yes

worthy wasp
#

there's no example of how to use these - and it straight up says ....

#

#if !PLATFORM_SWITCH // On Switch, we don't have room for this in the session data (and it's not used anyway when searching), so there's no need to add it. // Can be readded if the buffer size increases. HostSettings->Set(SEARCH_KEYWORDS, CustomMatchKeyword, EOnlineDataAdvertisementType::ViaOnlineService); #endif

#

"Its not used anyway when searching"

#

bah - tahts some false advertismeent.....

#
            SearchSettings->QuerySettings.Set(SEARCH_KEYWORDS, CustomMatchKeyword, EOnlineComparisonOp::Equals);

            TSharedRef<FOnlineSessionSearch> SearchSettingsRef = SearchSettings.ToSharedRef();

            OnFindSessionsCompleteDelegateHandle = Sessions->AddOnFindSessionsCompleteDelegate_Handle(OnFindSessionsCompleteDelegate);
            Sessions->FindSessions(*CurrentSessionParams.UserId, SearchSettingsRef);
#

it IS TOO used.....

rancid current
#

Ey guys I got a question, are events (Like Begin OverLap, or OnHit event) already replicated? πŸ˜„

manic pine
#

no, they run on both server and client(unless youve done something to prevent it)

#

separately*

rancid current
#

no? so then whatever code i run through it needs to be replicated via Custom events? (Server RPC, mutlicast etc) ?

manic pine
#

depends on what your objective is really

#

seems unlikely youd need/want to run the exact same code in them on both server and client

rancid current
#

okeh I get it πŸ˜„ thanks lots @manic pine ^_^

manic pine
#

just keep in mind the fringe cases... actor position may not be identical, so its possible client could trigger beginoverlap but not server, or vice versa

ripe raptor
#

@worthy wasp - You literally answered your own question. It's not used and there's no room for it ON THE SWITCH

worthy wasp
#

i was told from a co-worker that the code can be ignored by the OnlineSubsystem safely...

#

specifically: SearchSettings->QuerySettings.Set(SEARCH_KEYWORDS, CustomMatchKeyword, EOnlineComparisonOp::Equals);

#

if a platform doesnt support something - doesnt it crash the game?

untold cipher
#

When I attempt to launch a dedicated server on Linux I receive this error: Preparing to exit.Shutting down and abandoning module NetworkFile (10)Shutting down and abandoning module CookedIterativeFile (8)Shutting down and abandoning module StreamingFile (6)Shutting down and abandoning module SandboxFile (4)Shutting down and abandoning module PakFile (2)Exiting.Exiting abnormally (error code: 1)

ripe raptor
#

Well, one step forward two steps back, the othr PC receives my lobby invite callback, but crashes somewhere related to threading

#

joy.

#

Finaaally

twin juniper
#

anything past this would NOT get run on a dedicated server, correct?

if (MyPawn->IsLocallyControlled())

bitter oriole
#

Yeah

twin juniper
#

Some shootergame code I'm trying to understand

else if (CanReload())
    {
        StartReload();
    }

------------------ Later on in the same function -----------

    if (MyPawn && MyPawn->IsLocallyControlled())
    {
        // local client will notify server
        if (Role < ROLE_Authority)
        {
            ServerHandleFiring();
        }

        // reload after firing last round
        if (CurrentAmmoInClip <= 0 && CanReload())
        {
            StartReload();
        }
    }

#

Thanks stranger

#

So in the code above, there is no IsLocallyControlled check, so the server and client will both check if can reload

#

But then later on in the function, it looks like the client will call the same StartReload function again?

#

Unless I'm missing something fundamental about C++, does the first StartReload() call exit out of the funciton and stop executing further?

bitter oriole
#

Does shootergame support dedicated servers ?

twin juniper
#

I'm not sure but I'm writing my code to work for listen and dedicated

#

well there are dedicated server checks in Shootergame

#

So I think it aims to support all

bitter oriole
#

Asking because IsLocallyControlled() on listen server doesn't do the same thing obviously

twin juniper
#

Yeah, exactly so this function is basically if local client or listen server, do firing logic, then check if not authority and fire again on server if not

#

But the StartReload() function seems to get called twice

#

If you can reload and are out of ammo

#

It's really headwrecking to consider where and when everything is being called

#

Just trying to understand if StartReload() needs to be there twice, or if the server and client will pick it up in the first check. I need to delay the startreload by a small amount in order for the end fire FX to properly play on remote clients and I'm debating if both calls of StartReload() need a timer call as it seems only the second one needs to have a timer on it to work

#

Ok I commented out the first StartReload() that both server and client would hit, and just kept the second one (since the client only needs to call it as there is a ServerReload RPC triggered from within there) and it seems to work fine

ripe raptor
#

Just query unlocked achievements on the start of your game and unlock the gun when the achievement is found?

#

There's nothing stopping you from doing your own isolated achievement system.

#

As for cheating

#

I am not 100% sure if Steam achievements can be broken that easily

#

but I haven't much looked into it really

bitter oriole
#

I'm fairly sure you can programmatically cheat achievements tbh

ripe raptor
#

Well yeah but that's now a question of what you want to do - save the user's progress as a cloud save or unlock the awards via achievements.

#

or you can do both as an extra layer of security

twin juniper
#

@ripe raptor would saving this information in the same place you might save stats be better? Say a data server you have setup that the game reads from?

twin juniper
#

Does GetNetMode() != NM_DedicatedServer

basically return the same thing as

OwningClient->IsLocallyControlled

If you are locally controlling a pawn, that means you are either a local client or a listen server host, not on the dedicated server right?

bitter oriole
#

It would return the same on the pawn for the local player

#

GetNetMode() is global IIRC, while IsLocallyControlled() is for a specific pawn

#

Also IsLocallyControlled() works offline

#

So they're subtle differences

twin juniper
#

Thanks for the reply @bitter oriole I'm not sure I fully understand the difference in this case of Shootergame code

    
      if (GetNetMode() != NM_DedicatedServer)
        {
            SimulateWeaponFire();
        }

        if (MyPawn && MyPawn->IsLocallyControlled())
        {
            FireWeapon();
        }
#

Do those need to be 2 checks? or can they both be condensed into 1?

bitter oriole
#

GetNetMode() != NM_DedicatedServer will return true on all pawns if you're playing coop with a listen server

#

IsLocallyControlled() will return true only on each player's machine

#

and false for the other player's pawn on each machine

#

So yes they are different

#

SimulateWeaponFire() is called on all non-dedicated-server pawns, FireWeapon is fire only on locally owned pawns

twin juniper
#

That almost makes sense, thanks for the explanation. The only problem I'm having now is that the only pawn that needs to worry about calling that function is the local one, because the server sets a repnotify variable which then will call that same function on remote clients

#

So I'm not sure if there's any significance for it to be behind that check

bitter oriole
#

SimulateWeaponFire() might just not make any sense on a dedicated server

#

I guess it's all display

twin juniper
#

That's why I'd just move that function into the locally controlled check, then the server would never need to call itt

#

This stuff is so brain melting I swear haha

bitter oriole
#

YOu definitely do not want that

#

Or SimulateWeaponFire() would be called only for your pawn

#

And you wouldn't see the effects from another player

twin juniper
#

No because the server increments a BurstCounter int which is a repnotify variable

#

That repnotify then calls the FX for remote clients

#

Ohhh if you were a listen server host tho?

#

Maybe?

bitter oriole
#

Well, I don't know the other code, i'm just talking about the code here

twin juniper
#

Man I'm so confused

bitter oriole
#

The only thing I can say is, if you put SimulateWeaponFire() in the IsLocallyControlled() if

#

Then SimulateWeaponFire() won't be called for "other pawns" anymore

twin juniper
#

It'll only run on the local client, but it would never run for other pawns anyway because they aren't calling the firing function

bitter oriole
#

"Other pawns" meaning pawns that you aren't controlling - oanwed by other players

twin juniper
#

They are only calling the play cosmetic fx functions which gets called from an onrep variable set by the server later in the function

#

So basically I think it only needs to run on the owning client at this point in the code

#

But there must be a reason it's there as shootergame was made by Epic

#

Shootergame code is a lot harder than it seemed on first reading

#

Just because you have to consider not only local, server and remote clients, but if the host is dedicated or a listen host

#

And do the right things in all of those cases

#

And they have split screen on top of that...

manic pine
#

its not so bad

#

you have your clients fire function, which creates local effects and notifies server of hit/miss

#

then server hit/miss function which confirms, then does a multicast for visual fx, then the visual fx function which checks if shot was made locally and skips out if true

#

so it doesnt duplicate visual effects

twin juniper
#

@manic pine but things like end fire fx have lots of specific cases to handle especially with remote clients

#

If you go with the default logic to instantly reload as soon as the last bullet in the clip is used, the remote clients won't play the end fire FX as the onrep var gets set and unset in one frame so you have to offset it with a delay

#

at a high level the system is fine but when you have to try and ensure that everything happens correctly from many different perspectives, it's a bit difficult

#

I haven't worked through to the confirmed hits yet but so far there have been no multicast RPCs at all

#

it is all using repnotify vars to then tell the remote clients to do something

manic pine
#

ah yeah, that demo uses full auto fire i guess

#

ive only dealt with semi automatic in my projects

twin juniper
#

I'm doing both that can be toggled so it's even more annnoying because some stuff works great with semi and not with full

#

So just figuring out how to get all cases satisfied with the simplest code possible

manic pine
#

hmm... what about a ForceNetUpdate after setting the var?

#

may not be a great idea, im not actually entirely sure how that function works

twin juniper
#

I fixed it with a short timer before calling the reload logic which works great

#

Still some edge cases not quite working like a listen server client being able to fire off an extra cosmetic shot when he shouldn't

#

But that doesn't happen on dedicated or when hosting lol

#

I mean it can all work fine as is now but I feel it's better to make the core architecture as solid as possible before trying to build on it

#

I know it's fixable just will melt my brain before all cases are covered!

#

Maybe it's better to just not try and code the listen and dedicated cases and just have dedicated only

manic pine
#

shouldnt be much difference

twin juniper
#

It's just so much easier to read- this runs on server, this doesn't

#

Instead of- this runs on server, this doesn't...unless you are a listen server host in which case it does, so don't actually call that logic again

manic pine
#

yeah but you shouldn't usually have to differentiate between them

#

player input should always lead only to stuff that runs on client

twin juniper
#

Yeah in general it's fine but when dealing with anything like shooting that needs lots of stuff to happen in multiple places, it becomes difficult

#

I'll just have to keep rereading and understanding it

worn nymph
#

have they fixed the bug i submitted yet ?

manic pine
#

im trying to find if ive actually made any concessions for listenserver anywhere, but i dont think i have

#

i think it just works flawlessly in both dedi and listen

worn nymph
#

if you hold down fire untill all bullets are fired but dont let go it keeps firing on other clients version but stops on local

twin juniper
#

Yeah stuff like that

#

Loads of error cases to handle

#

And stuff like if you hold down a semi automatic shot button and release late, the end fire fx plays

#

So you have to manually end the semi auto shot but not manually end the full auto

manic pine
#

well i wouldnt really trust the tutorial projects to be bug free

twin juniper
#

No it's a fantastic resource

manic pine
#

definitely, for ideas and such

twin juniper
#

And good to question it too

manic pine
#

but the UT source is even better

twin juniper
#

Just some parts can be hard to understand like that double check for net server or locally controlled

#

from what I've seen on the UT source, there's loads of fluff around every function

#

So wanted to keep it simple at first ot learn

#

fluff as in stats, loads of extra checks (isfeigningdeath etc)

#

Lots more movement checks

#

It's a bigger beast

#

Would you say the code there is pretty rock solid there?

manic pine
#

theyve considered a lot more stuff than in e.g. the shooter demo

#

so it handles a lot more scenarios and fringe cases

#

as you say though, it also has a lot more features and things to consider, which does make it a lot more complex

twin juniper
#

Yeah like each weapon basically being its own class

#

and not a simple BP child class

#

Will take a lot of time to read and understand

#

I do think they have some lag compensation though

#

For shooting

manic pine
#

yeah, i believe they have for both hitscan and projectiles

twin juniper
#

That is great, basically the only public lag compensation example for UE4 shooting?

#

haven't seen one anywhere else

manic pine
#

i think you can find a hitscan tutorial out there, but not necessarily projectile yeah

#

oh, for your specific case of that visual effects thing

#

keep in mind there's a prereplication function

#

not sure how UT handles it though, you could have a look in one of its automatic weapon classes

twin juniper
#

What would that mean in general, something that is automatically called before replicating down properties?

manic pine
#

yeah its called right before an actor starts this tick's replication... on second thought though, it may not be very useful in this case

twin juniper
#

Cool, well I will look into it for sure

#

Thanks for the help!

manic pine
#

it might also be an idea to send time instead of just a boolean

#

i.e. startfiretime endfiretime

#

seems very messy this way of keeping track of it though

#

ban automatic weapons

#

^___^

twin juniper
#

Not sending a bool, sending an int

#

So if the currentfiredshot is > 0 when ending the shot, then you know it has fired at least once so play the end fx

#

otherwise do nothing

manic pine
#

right

dull saddle
#

Hi guys, so I just wanted to know how I can display a HUD Widget just to one player (I got local / steam multiplayer up and running). With these settings it'll display it on all clients.

twin juniper
#

Anyone know how to replicate instances

warm anvil
#

I was just wondering what the level of effor twould be to move the character multiplyer perdictability code over to the flying pawn movement?

winter zenith
#

@dull saddle You can check to see if that character IsLocallyControlled

twin grail
#

I've been plugging away at the blueprint multiplayer tutorial on youtube, and it keeps failing to load levels here. Is there a real basic error in these servertravel commands?

winged badger
#

iirc you only need the level name, without the path to it

ripe raptor
#

No, you need the path

#

Mind you, the editor can't server travel.

twin grail
#

it... actually seems to be working without the path, but not with

#

so, thanks for that

ripe raptor
#

Where are your maps placed?

#

Folder-wise

twin grail
#

just Content/Maps

ripe raptor
#

Yeah see

#

you can't have your maps in the maps folder, and try to load them with Content/MAP

#

The path needs to be correct

twin grail
#

so /Content/Maps/whateverfile or Content/Maps/whateverfile?

thin stratus
#

If the you have "Content/Maps/MapFile" then just write "ServerTravel MapFile"

#

UE4 actively searches for the files

twin grail
#

aha

thin stratus
#

The Content/Maps stuff is more for packaging

#

Maps in different folders might not be auto included/cooked

ripe raptor
#

hm, I always did /Game/Content/Maps/MapFile

#

In any case, @thin stratus could I bother you with a minute help, been tearing my hair out for a full day on this

thin stratus
#

Just post your question here again

#

Currently bg in WoW

ripe raptor
#

Good luck πŸ˜›

#

It crashes on the "CheckFriendId" log due to a pure-virtual function call, presumably because the FUniqueNetId is invalid at that point

#

I am 99% certain that passing shared pointers doesn't work the way I did it

thin stratus
#

Why do you need to read the friendlist at that point?

ripe raptor
#

To show the name of the friend who threw the invite

thin stratus
#

You don't have to load the list for that

ripe raptor
#

Oh?

thin stratus
#
void UYourGameInstance::OnLobbyInviteReceived(LobbyInvite_t* CallbackData)
{    
    AYourPlayerController* const PlayerController = Cast<AYourPlayerController>(GetFirstLocalPlayerController());
    if (PlayerController)
    {
        FUniqueNetIdSteam InLobbyId(CallbackData->m_ulSteamIDLobby);
        FUniqueNetIdSteam InFriendsId(CallbackData->m_ulSteamIDUser);

        LobbyIdInvite = InLobbyId;
        FriendIdInvite = InFriendsId;

        IOnlineFriendsPtr FriendsInterface = Online::GetFriendsInterface();
        if (FriendsInterface.IsValid())
        {
            TSharedPtr<FOnlineFriend> FriendInfo = FriendsInterface->GetFriend(0, InFriendsId, EFriendsLists::ToString(EFriendsLists::Default));
            if (FriendInfo.IsValid())
            {
                PlayerController->OnPartyInviteReceived(FriendInfo->GetDisplayName());
            }
        }
    }
}
#

Something like that

#

I mean, could be that you ahve to load it

#

But you can do that way earlier if needed

ripe raptor
#

Won't that work only if the friend list has already been loaded?

thin stratus
#

CAn't remember right now

#

if so, just load it way before the player invite

ripe raptor
#

That seems reasonable... last thing, can you tell me what type LobbyIdInvite is?

#

and FriendIdInvite

vernal thistle
#

Hey , I'm following the Blueprint Multiplayer tutorial by Epic in an attempt to add multiplayer to a project I'm working on and I was just wondering if there's a way to use just one character blueprint rather than many? Just I'm hoping to have skill trees and such rather than set characters

ripe raptor
#

Well yeah there's nothing from stopping you doing that

vernal thistle
#

Sweet , Just thought I'd check , thank you for the quick reply πŸ˜ƒ

thin stratus
#

That tutorial - _- can't they finally take it offline

#

And redo it properly

ripe raptor
#

who are "they"?

#

The skeleton crew who are only there to make sure that the "forum server" light is blinking green? πŸ˜„

worn nymph
#

the 2hour stream video on replication by a senior network engineer was the best one yet . in that time he made one run on server event and ticked a check box πŸ˜‚

thin stratus
#

They = Epic

#

The Lobby Tutorial on Youtube is bad

#

Tons of wrong information and mistakes

#

Every time I get a client who used that as a base I could flip 6 tables

ripe raptor
#

I know, I was attempting a snide joke about Epic abandoning those things πŸ˜›

bitter oriole
#

Epic doesn't really support stuff on the long term

#

Documentation has always been weak, to say nothing of engine support for some features

ripe raptor
#

If I have the uint64 ID of a session, do I have to convert it to a FOnlineSessionSearchResult to be able to join it with JoinSession()?

ripe raptor
#

So apparently, the easiest way to actually join the session would be to store the uint64 session ID and then perform a session search by id

#

Problem is - what if it's a private, unbroadcast session?

#

Will it still be found?

thin stratus
#

If it's not advertised, then probably not

#

You would better always advertise and make sure you use an additional setting on the session that you can use to hide them

#

like bIsPrivate

#

and list only public matches in the ServerList

#

And yes, if you have the ID, you would search by ID

#

Afaik, you can also save the whole session result if it ever gets into your hands

#

You can save whole sessions

#

Even if they destroy and recreate, teh session data to join should still be valid afterwards

#

(as long as the IP etc didn'T change i would say)

ripe raptor
#

I thought bIsPrivate makes the session not advertise?

thin stratus
#

This is not supposed to be a ue4 boolean

#

You can add your own settings to the session after all

ripe raptor
#

ah

#

yea

thin stratus
#

When you query the sessions, you can add the boolean true/false to it to limit the results

#

You can also use an enum/integer

#

if you have multiple states

ripe raptor
#

Yeah I use one of the custom ints already

thin stratus
#

Could technically just use one int and use it as a bitflag

ripe raptor
#

But just to confirm - there is no "direct" way to join a session using the 64-bit int ID that Steam spits out when I receive an invite?

thin stratus
#

hm

#

open STEAMID is a thing afaik

#

But I can't recall what the exact format is

ripe raptor
#

or to be more precise, UE4's online session interface wants a FOnlineSessionSearchResult, so I'd have to convert the Steam ID into that... I've seen how Steam does it internally in OnlineSessionAsyncLobbySteam::FillSessionFromLobbyData and it's not pretty

thin stratus
#

If you have an ID

#

it's better to search by id

ripe raptor
#

yea guess there's no two ways around it

thin stratus
#

I mean ,why fighting it

#

It's not like this gives you any bad things

ripe raptor
#

aye, let's give it a shot and see what happens...

twin juniper
#

Hey

#

I'm not qute sure how to do weapon switching online

#

right now I'm only calling an RPC to the server

#

but it will be unresponsive so I need to do it on the client

#

the problem is that each gun has different movement speed and max jump count, so I can only change these values on the server when the player switch guns

#

should I switch guns locally and on the server, but the movement part will only be done on the server? wouldn't it be weird?

thin stratus
#

Your weapons should be replicated

twin juniper
#

they are

thin stratus
#

As well as the Variables you save them in

twin juniper
#

it's all working fine

thin stratus
#

So if you want to switch them, call a Server RPC and let the server switch them

twin juniper
#

but I don't want to only do it on the server

#

yeah that's exactly what I am doing

thin stratus
#

Then replicate teh changes

#

CurrentWeapon can be an OnRep variable

twin juniper
#

it will be unresponsive tho

thin stratus
#

And you can do stuff on the client in the OnRep

twin juniper
#

oh

thin stratus
#

Like movement changes

twin juniper
#

Wouldn't it be unresponsive? even under 50-100 ms of lag

thin stratus
#

Well 50-100ms is not really what you want to deal with anyway

#

I mean you can do it like this

#

Do 2 paths and limit the OnRep to "SkipOwner"

#

Handle all the client changes for other clients in the OnRep

#
  • also the Server as OnRep calls in BP for the server too
#

For the local client, perform the changes along side with the ServerRPC

thin stratus
#

So basicall do "ServerRPC" and then continue doing the things directly locally

twin juniper
#

It's working fine

#

it's replicating and all

#

that's not my problem]

thin stratus
#

You want it to be responsive on teh client

twin juniper
#

the problem is that the game is baesed around switching gun quickly

#

so it has to be responsive

#

so I thought that I would change guns on the local client and the server as well, but change the movement stuff only on the server?

#

Like that

#

the question is won't it be weird for the player if on their client they have already switched guns

#

but they are still slow / cant double jump?

inner iris
#

@thin stratus "Well 50-100ms is not really what you want to deal with anyway"

I'd say would be really important to target this ping range and even higher when testing as in reality most players will have 50+ ms ping based on averages I see in many games

#

Like in Fortnite, I'm not sure if the ping counter is broken or not but it starts out at 150-180ms ping and then eventually goes down to about 80- 100 ms ping during any match

#

On the right servers (EU)

ripe raptor
#

So

#

I was wondering why FindSessionById() was returning failure

#

So I look into OnlineSessionInterfaceSteam

#

and find this gem:

#

bool FOnlineSessionSteam::FindSessionById(const FUniqueNetId& SearchingUserId, const FUniqueNetId& SessionId, const FUniqueNetId& FriendId, const FOnSingleSessionResultCompleteDelegate& CompletionDelegates)
{
FOnlineSessionSearchResult EmptyResult;
CompletionDelegates.ExecuteIfBound(0, false, EmptyResult);
return true;
}

steady tendon
#

Guys i have a little question

#

Why when im in the client and add a struct to an array then if i try to access that array in the server the lenght is 0?

#

I send some photos

ripe raptor
#

er

#

If data is replicated, only the authority (in most cases the server) can change values

#

if it's not replicated... then any changes will be local only

steady tendon
#

Ok let me try to set the array to replicated

#

No, same result dude

#

I tried to add to the array on server with the array set to replicated and then the lenght is 0 on the client...

ripe raptor
#

Is your component set to replicate?

steady tendon
#

No

#

Its added in the player controller

ripe raptor
#

The component needs to be set to replicate too

steady tendon
#

Ok let me try

#

@ripe raptor Thank you dude! It works now, so the component has to be set to replicated, that makes sense, but it will consume a lot of bandwidth right?

stiff lily
#

Hello guys, i need some help with detecting player leaving on dedicated server. I tried different methods that suppose to do that, but doesnt get called(or I'm doing smth wrong), the only thing that gets called is OnNetCleanup, but thats not helpfull cause it doesnt point me to player leaving.

twin vault
#

@stiff lily have you tried AGameMode::Logout

stiff lily
#

Yes

#

it doesn't get called

#

I tried also GameMode:: HandleDisconnect and PlayerController::PawnLeavingGame

worthy wasp
#

I'm trying to set up a voting system in AGameState.... i thought to do a TMap - but obviously this isnt replicated. Do i have any resort to TMap & a getter funcitonality that is accessible by remote clients?

manic pine
#

a system to vote on what? what do you need the map container for exactly

#

and why do you have to replicate it?

worthy wasp
#

FName/Int

#

because i i need the scores of the vote public accessible to everyone

#

for UI purpose

manic pine
#

ah

worthy wasp
#

there will obviously be a few FNames

#

and each FName will be scored

manic pine
#

well cant you just do a normal tarray of a pair type?

worthy wasp
#

forgive me but isnt that a TMap?

manic pine
#

tmap is just a hashmap isnt it

worthy wasp
#

unfamiliar with the term - i'm unsure

manic pine
#

well like with a pair, it has a key and a value

worthy wasp
#

that is correct

manic pine
#

but the key is meant to be hashed so it has quick access

worthy wasp
#

yes that seems to be the DEFINITION of a TMap

manic pine
#

so its very quick to look through

#

right, but though the tmap isnt replicated, tarray is

#

so a tarray with a pair should work just fine ye

worthy wasp
#

you cant do key/value tarray?

#

teach me the ways Obi-1

manic pine
#

giving you the same effect but without the hash part(which you dont need)

#

hmmm actually can that be replicated.........

#

well if it cant, it shouldnt be a big problem making one yourself, like any struct you replicate

#

its essentially just two members after all, and getters/setters for them

worn nymph
#

@stiff lily it does get called im using it in mine

worthy wasp
#

but the # of keys is undeterminned

#

never static

#

it could be 2/3/5/1

manic pine
#

yeah but tarrays will replicate

worthy wasp
#

again - TArray is a signular variable type

#

no?

manic pine
#

yeah but you put an object of type tuple/pair inside it

#

essentially just an encapsulating thing

#

MyVotesContainer[0].GetKey() or MyVotesContainer[0].GetValue()

worthy wasp
#

so wrapping a TMap in a TArray

#

very nice

#

i'll try this - thanks!

manic pine
#

yeah, just find out if it a TTuple will actually replicate

#

if it doesnt you'll have to make your own struct that will

#

e.g.

USTRUCT()
struct FVoteStruct
{
    GENERATED_BODY()
 
    UPROPERTY()
    FName Name;
 
    UPROPERTY()
    int32 NumVotes;
};

UPROPERTY(Transient, Replicated)
 TArray<FVoteStruct> VoteContainer;
worthy wasp
#

yah raap that'll work too

#

thanks

#

2 heads > 1

manic pine
#

yeah, because ttuple wont replicate ;|

#

nothing in the map.h file will, very sad

rancid current
#

Is there any way to spawn something on the server only to other clients and not to the owner who spawned it without using multicast? πŸ˜„ thanks

winged badger
#

you could try ReplicatedVariable, Replication Condition that excludes the owner and RepNotify

#

somewhat at a loss at what you're trying to do

hidden belfry
#

Hi! I have a problem with loading screen doesn't disappear in multiplayer VR client. It's just a LAN mode. I'm just running it from UE4 Editor in VR preview. If I start the game as a server - that works just as expected. When I start dedicated server and run the VR preview as network client: I can see the window with game working fine on my PC's monitor but inside of my HMD loading screen ("Please wait" with UE4 icon) never disappears. Looks like something is not running on VR client... But what?
I found the topic: https://answers.unrealengine.com/questions/491177/i-cannot-play-vr-multiplayer-client-side-within-ed.html - exactly the same problem. I can't believe it wasn't fixed since 4.12 (2016) 😦 And I still can't find an answer...

ripe raptor
#

@hidden belfry - If I understand you correctly you have multiple instances of the game using the HMD? Did you try running the client as standalone?

#

Also, does anyone know if I can run RPCs on a CDO?

hidden belfry
#

@ripe raptor I'm running dedicated server with another instance as a client...

steady tendon
#

So i can see that actor component variables doesnt get replicated from server to client in blueprints, i thought the cause was that i was replicating a struct array and maybe it doesnt accept that, but i have tried with an integer and a string and the result is the same

#

My actor component is added to the player controller and the checkbox to replicate the component is set to true

winter plover
#

So I have the following situation. I got some basic stuff done in my game and I wanna test it on a real internet connection instead of the UE4 editor. Is there an out of the box way to do that without having to create an ingame connection menu or that sorta stuff?