#multiplayer
1 messages · Page 53 of 1
I tried destroying all my pawns before travelling because I read on a forum that somebody had the same issue and it went away after destroying any pawns with dynamic materials
Lol
yeah i'm a cowboy dev
you only live once right lol
anyways
you tried unlinking server travel?
yeah standalone games don't even open
if you standalone with 1 instance only, does it work just fine?
OK, that's a clue.
then it crashed
The problem is not related to multiple clients, actually 🙂
playing as client
ChildActor
is this a child actor component?
ok listen server crashes
yes probably
I use quite a lot
I don't know if this is at all relevant but my editor crashes when I close it as well
child actor components are broken by nature
But don't panic yet, it might not be your culprit.
yeah time to stop mystery hunting and debugging properly 😄
at this point you'll wasting time
what do you suggest I do?
This
- download debugging symbols
- install VS
- run with DebugGame Editor config
- run debugger
then reproduce crash
Oh boy
then post here where its crashing
or just download debugging symbols and post the same log again
but depending on the error you might need VS again
This sounds hardcore
I should mention i'm hardly a programmer
I've got another idea I'm going to quickly try
this is the default workflow 🥲
haha
Well -
#cowboydev'
Regardless of anything
Now you have an environment to at least reproduce what you got in your Steam version
try this first
maybe you dont need VS
they are the information that required to display function names in here
Ok where do I download them
Epic games launcher -> Unreal Engine
yeah you gotta click this
i guess it was "modify" or something - cant recall its name
I see
click to that and tick "debugging symbols"
Yes
yeah it contains debugging information for a few millions of lines of code 😄
incredible
Speaking bout that
You know if those symbols damage the editor's startup time?
probably they do
it might depend on the build config
or not
it'll load pdb files anyway
I'm so used to waiting for editor load that I dont even feel the time passing 
I keep repeating myself over and over but b/c I don't usually work w compiled languages, that's a real burden to me
And I avoid debugging symbols as much as I can mostly because back in 4.17 I think, they screwed me up when it comes to some load time
So I'm a brute-force debugger
Unless as last resorts (which may be Jackson's situation)
I never worked with a non-compiled language other than Blueprints - which probably doesnt count
so I'm assimilated to this cursed workflow
Does this mean anything to anybody?
Assertion failed: ((UObject*)ContainerPtr)->IsValidLowLevel() [File:D:\Build++UE4\Sync\Engine\Source\Runtime\CoreUObject\Public\UObject/UnrealType.h] [Line: 386]
yesn't
cursed workflow got me lol
This is really generic
probably a variable in BP causing error - thats what I can think other than 3 million different possibilities 
Also after working with BPs a lot when I saw other interpreted language's performance benchmarks I was amazed
since BP is 10x slower than some certain languages 😅
oh yeah
But I respect Blueprints. Lots can be achieved with it. And I guess that's what made Unreal Engine mainstream at its debut
I just started w UE b/c of it back in 2014
They're a gift from god
I'm not able to - I've read its source code and its a tech debt from earlier 2000s
Scripting gameplay visually with blueprints is something I am thankful for beyond belief
Makes it so easy for me to wrap my brain around
Yeah I bet :/ I mean, it comes from UnrealScript right?
yes
same VM
Running 150 nodes in tick (including expanded nodes and pure nodes etc) consume 1ms on PS4
150 is not enough to script anything 
the context of the nodes not even included to that overhead, its just calling empty nodes
Yep. Really pleasant. Although I dare to say this is quite illusive, really. I don't think visual programming is actually different from, you know, writing programs. But that's a subject for another conversation I guess lol
You talking about lightweight nodes? 🤔
This is lightweight lol
Holy sh*t
1ms 150 empty nodes
Cruel
If you are interested, as a terrible writer I found some courage a while ago and wrote some stuff about what I discovered in ScriptCore.cpp
https://intaxwashere.github.io/blueprint-performance/
You're not going to believe this
But the fatal error disappeared when I disabled seamless travel
Loooool
Just reuploaded to steam and tested on a second laptop
I knew it was from UnrealScript exactly because of that post that i read it today. omg
So you're the author of it lol i read it fully today
lol
OH WAIT
I only have 3 brain cells left and generally this stuff is not my expertise
You were Server Travel without level streaming? 🤔
I'm really confused now
I'm afraid Jackson was Server Travel with Seamless Travel to an outer level of the streaming tree
B/C Lobby -> Gameplay doesn't really sound something you'd want to persist state across (not sure about his use-case though)
Anyways @peak sentinel - thank you so much for that post!
Geez. So many myths I was exposed to all these years caught by you.
And I was casually speaking to the author of that post as if nothing happened lulz
Yeah I had a menu, a gameplay lobby where you can run around with other people, and then another main game map
3 brain cells is better than 2
Your Main Game Map wasn't a child of your Lobby right?
150% better in fact
Happy to help
I'm still anxious I explained some things terribly in that article but hearing positive feedback makes me sleep in peace 😅
No different map
I guess that's why you were getting fatal lol
Why?
Seamless Travel is for level streaming
I had a transition map setup in project settings
I thought it was supposed to use the transitiion map you set for it
Nothing related to your transition map
In fact, the black screen you saw in your client
Is because they got stuck in the transition map
Which had nothing
Level Streaming requires you to have a PersistentLevel
And your other levels nested in it
I understand how level streaming works
Right - but that's my point
But I thought that seamless travel was meant to move the game to a new persistent level using the transitiion level as an intermediate so clients don't disconnect
Maybe I'm completely wrong
Lol
I don't know
But it's working now so that's good
Thanks for your help
And Eren
No, you are not. I am. I got confused. Seamless Travel is for persistence, and has absolutely nothing related to Level Streaming. I don't know exactly from where I related level streaming to seamless travel (perhaps because the two share the level keyword).
Kill it!
Now this is solved I can finally get back to game design and fun stuff
😆
Go to bed!
I love that sensation haha
😆
Enjoy!
Any idea why my players play separately after a seamless travel?
This is a symptom they got disconnected for some reason during travelling.
Is this happening on Standalone Game?
yes and with seamless travel 🥶
OK so just to break it down - you got them together in a map X, then you called ServerTravel and after that, they all went separate ways
Is that right?
Exactly
Question - they got into the correct map, but in different realms, or they got back to the former map from where they originally travelled from?
I'd say check your project's log at Saved/Logs.
If the clients don't see each other in the destination map, it's very likely they got disconnected from the server and the reason might be described in your log file.
I'm struggling removing a client's HUD widget on Event PointDamage. Since it runs on the server, how would I remove only the actor-owning client's HUD from a server event when other people could be using their own version of the actor at the same time?
That's a devious topic which can lead to multiple ramifications, but to keep it short: a "simple" multicast might resolve it.
So when i did a multicast it removed it from all clients
In your multicast event, you gotta filter it.
thats what i tried to do but wasnt sure which node was good for it
You using BP or C++?
Ok, this has multiple takes. May I see your multicast function?
would something like this work maybe?
nope still removes it from all clients
and the host too
Yep, you got no filters. From whom you want to RemoveHUD from?
the owning player of the actor
so i assume it sends the message to all and tries to filter by owner of the dying actor
You got it!
I have a problem where when I use a big map my play montage dosent work replicated could the problem be style scape?
I have run this on my implanted neurochip, and it returned false. Halp?!?
If your married then “Has Authority” will also return false
I guess there's no winning
Hey @whole grove back in the time, you advised me too look into a tech for assuring client getting data from a SQL (webservice or something like that) for a game.
(the idea is to gather data like player level, data... do some interaction with SQL...)
I don't remember the name of the tech
and can't found back this message, do you have it in memory ?
Yeah, i understand that part.
But you suggested something it was maybe not a tech, but a way to do it, and it has a name. And unfortunaly i can't found it back.
To be more precise, i'm looking mostly for the way to achieve it, and read about it.
RESTful API maybe?
Hey, i need some help with pawn rotation replication. I have no idea where to begin or how to structure it. No luck trying to find any sources either, I'd appreciate it a lot if someone could point me in the right direction with a basic overview :-).
hi, i have created a variable in game mode for timer .. after a specific task is done, i want to change timer value to x amount of seconds.. How can i do this from character or controller ? from casting or any other ways in c++ ? thanks for answers
Net culling, maybe?
Before doing anything else, just mark “Always relevant” in your actor and see if it works; if so, remove the always relevant check and leave it that way because you don’t want montages relevant everywhere in your map. The real fix would be: “do I really need montages playing everywhere?”
Implement your timer in the game state
Game mode is only exist on the server
hi, if I use seamless travel, and I want a loading screen to be displayed during the travel (level load), do I just use the transition map's level bp to create the widget for all players in that level, or should I create and add the widget on the src map, and remove it once the travel finished?
Can not travel to accepted Steam session with this error : Initial Connect Diagnostics: Sent '10' packets in last '10.016082' seconds, no packets received yet. where should I check?
Interesting network bug of the day:
Network system cannot distinguish between a TWeakObjectPtr that is "Stale" vs one set to "Nullptr". When it is compared, it will incorrectly think a "Stale" pointer has been explicitly changed and send out a network update to all clients.
What's mad about this is that anything that causes the property to be compared at anytime can cause the replication update to be sent, even an unrelated player walking into relevancy range. What fun!
So we're actually better off using UPROP raw pointers? 🙂
oh, scratch that, that will keep it alive
Not necessarily. If you mark the object as garbage it'll still be destroyed even with a UPROP raw pointer
the UPROP pointer will be nulled by the system
(which would also give you a property update, but at least at an expected time - not randomly)
I don't have experience with using seamless travel, but I always create the loading widget in the current map and then start the travel.
thanks, will try
That begs the question, why are you using a replicated weak object ptr? 😄
And yes ...that is madness
The thing containing the ref doesn't "own" it, so it's expected to die at anytime
Could use UPROP - though IIRC that would be incompatible with the new GC mode in UE5 and beyond
Why client havent the texture of actor? What should I do to fix it?
Hey, can anyone tell me what im doing wrong here? Ive only just started using C++ again so its prolly just me being dumb
Im pretty much copying it word for word from a video but works for him, not for me 😅
Looks like you're missing the include for that class or the class is generally not defined
-.-
Knew it'd be something dumb 😂
Also if you're using SpawnActor<T> you don't need to feed it the static class again
The function signature is SpawnActor<T>( SpawnParams )
SpawnParams being of type FActorSpawnParameters
my brain is currently breaking.... my client connects to the game, possesses the default pawn, both client and server know that thats the controlled pawn. The pawn receives client side input but doesnt move. it just floats in the air too... does anyone know what could cause that? It used to work fine but suddenly stopped working :c
There is sometimes a need if you're handling polymorphism which is not the case here
looks like nothing give any error
Not completely accurate
Otherwise SpawnActor<T>( SpawnParams ) would have no way of knowing what type it should spawn
For that particular function signature the template argument is the spawn type
If I saw someone trying to open a coconut with a screwdriver, I wouldn't comment on how to best angle the screwdriver. I'd direct them to the better approach
So, yes
I don't feel like arguing semantics. Simplicity is good. So simplifying is good
🤷♂️
And yet they can be, different approaches
@limber gyroHey, maybe a little late but I did some research and figured you would perhaps still like to know. AGameModeBase::Login gets called in the same function (and synchronously before) as AGameModeBase::PostLogin so you can safely use the user ID / URL options. Do however know that the playercontroller it self indeed isn't entirely properly setup yet at Login. If you have engine access see: https://github.com/EpicGames/UnrealEngine/blob/cdaec5b33ea5d332e51eee4e4866495c90442122/Engine/Source/Runtime/Engine/Private/LevelActor.cpp#L1033-L1051
thanks man, thats nice to know, its working now tho so i will keep that info for any other eventual project, strange they just didnt include the "options" in both methods
The fun part is that they construct the URL inside the same function, so it's indeed weird they don't just also pass it on.. But whatever I guess lol.
Also another thing to know is you can very easily construct a FURL from the UNetConnection string you used before:
FURL InURL(nullptr (NULL?), *Connection->RequestURL, TRAVEL_Absolute);
if (!InURL.Valid) return; (OR WHATEVER)
@fathom aspen ^ if you ever update your compendium with the suggestion I made perhaps you would like to know too 🙂
Thanks Thom for the update, I will look into it a bit later and prolly ask you a few questions 😛
nullptr over NULL
I know, but the example I found it in used NULL. So I replaced it with nullptr but with NULL there just to be sure lol.
Probably works just fine with nullptr xD
Where's the best point to spawn an actor that replicates to all clients?
ermmm it is a AInfo actor that holds (and manages) the players "save game" data. The way im trying to do it is that im loading the save game slot data, passing it to the server, the server then has to make that save game data accessible to every client in the session.
I managed to get it to work, though im not sure if its the proper way... i overrode IsNetRelevantFor on the info actor to always return true, and now every server side spawned instance gets replicated to the clients
I wouldn't say it's "wrong", you could also use Game State to be that actor I suppose. In terms of performance or whatever it really won't matter to have one actor less or more. As an alternative to overriding IsNetRelevantFor you can just simply mark the actor as "always relevant" too. Is a bit simpler than overriding things IMO, but isn't wrong or anything 😛
My first approach would be the following:
- Create a savegame gameinstance subsystem - this will handle all saving/loading
- On client login, load this object and then pass it to the server
- Server then takes this, stores it, and then replicates it to all clients, probably using the gamestate as a way to do so.
This would be my prototype implementation. Of course it is quite ripe for cheating, lol.
ima try that in a bit once my list views cooperate 
so probably never AAAAAAAAAAA
🥲
Also unrelated but Iris actually kind of has documentation :0
https://github.com/EpicGames/UnrealEngine/blob/release/Engine/Source/Runtime/Experimental/Iris/Core/Public/Iris/ReplicationSystem/ReplicationSystem.h
Neat
Hmm - I wonder if we'll be able to arbitrarily RPC directly to a specific client with Iris 🤔
I like.
Even more interesting..
NetObjectPrioritizers are responsible for determining how important it is to replicate an object. Priorities should be at least 0.0f,
- meaning no need to replicate. At 1.0f objects are being considered for replication. Priorities are acumulated per object and connection
- until it's replicated, at which point the priority is reset to zero. Bandwidth constraints and other factors may cause a highly prioritized
- object to still not be replicated to a particular connection a certain frame. There is no mechanism to force an object to be replicated a
- certain frame, but the priority is a major factor in the decision.
**Priorities are acumulated per object and connection **
That sounds like how the current system does it though
Same as how it works currently really
Does it do it per connection?
yeah
Oh it is
But again that's same as current system
Be interesting to see how it pans out. Seems to require a lot more actual code to get things done
That’s what my concern was too, there also seems to be some kind of “filter” system for relevancy per actor per connection now.
Instead of “IsNetRelevantFor” I suppose(?)
Wonder when they plan on even actually talking about Iris and the purpose behind it.
All we have is that it is meant to be able to handle more actors
Epic, probably
I personally feel that this will help reducing the CPU footprint per UE server instance
therefore reducing costs
which can translate onto... higher scalability I guess.
https://portal.productboard.com/epicgames/1-unreal-engine-public-roadmap/c/868-iris-replication-experimental
This is all the info we have. These two pieces. At least to my knowledge.
Also, Mass will implement networking with it at a low level layer
I love the "removing antipatterns that constrain it"....which antipatterns? 😅
That reads, to me, like when a game does an update with the comment, "Fixed some bugs"
imagine such a shit would it be, normal repl, replication graph, and iris, they have to remove all old codes instead of keeping backward compatibility for some BP projects
Hopefully Iris simplifies multiplayer down into a single checkbox sort of like Replicates then you just code your game as if it’s single player and everything just works.
That would be crazy lol
That's never going to happen with the way multiplayer works. They can't possibly cover all scenarios that people make these days. They could totally simplify stuff, but it will never be "just press a button"
But I doubt it will be that simple lol
one weird thing, im using WorldPartiton, when a cell is unloaded in client it unloads even those statically placed actors with bNetLoadOnClient=false
in other words I have some horses in the map, charcter posses and ride them then when the cell is unloaded my horse is destroyed as well
it shouldn't be like that
🤔
why not 😄
Mark your horses as not spatially loaded
@pallid mesa yea I exactly unchecked that finally, but I think when NetLoadOnClient is false it should mean not spatialy loaded as well
AFAIK NetLoadOnClient false should treat the actor like dynamillay spawned actor. in other word client should not load it
if they did not load it why they are destroying it
so they loaded it
WP loaded it
🤔
bumpin, any help would be appreciated
A bNetLoadOnClient false Actor doesn't necesarily mean that the Actor will be considered as a "dynamically spawned" one
however not bNetStartup false Actors are
for more info take a read here: https://vorixo.github.io/devtricks/procgen/
@twin juniper there is actor rotation, and some bool property like bUseControllerRotation and also CMC MoveTowardvelocity and ...
hey how can i open a next level in blueprint as a listen server?
OpenLevel for hard travels or ExecuteCommand servertravel command for seamless travels, depends on what you want to --
whats the best way i want to go from the lobby to the main level
most likely OpenLevel
Reliable?
i have the problem after Open Level that the gamemode changes /resets
hey all - is anyone using the oculus subsystem, unreal 5.1.0 and networking/multiplayer... we see that Oculus is stating to use Photon as your matchmaking/multiplayer layer because Oculus Matchmaking is depreciated at the end of the this month. We are developing specifically for the Meta Quest 2. Curious on anyone's takes on Proton vs Playfab etc
For that I recommend you reading this: https://wizardcell.com/unreal/persistent-data/
is there any easy way to switch to spectator mode in non PIE ? just like F8 in ed
EnableCheats and then ToggleDebugCamera in console comand
Fun fact Iris is only plugin that utilizes round robin tick update/tick in the engine 😄 (except graphics API but that doesnt count)
when an actor is outside the range of Net Cull Distance, will it it stop receiving all RPCS? or just multicasts?
afaik it will get destroyed and recreated
so it gets recreated when he gets back into range
but RepNotifies wont be called right?
hey im currently using online subsystem for multiplayer.
how to create session that can only join by code (like Among Us)?
here is my code to create a session with parameter code that will generated random from blueprint
RepNotifies will be called
where's that at? :0
I dont remember, but type round robin to ctrl shift f
only iris appears
other than some esoteric C-looking libs
nothing robin related in Iris itself
I will check the other kinds too
it could be my rider bungling it for all I know
I do have WITH_IRIS I think?
I remember ReplicationGraph.cpp too but there was also an Iris module that updates some sort of objects
iirc
booting rider lets see if I was misremembering
On game start, every controller announces that it is possessing a corresponding player. When the server player activates change arrow color, it replicates to the two clients, and all 3 players see that the arrow has changed.
When a CLIENT activates change arrow color, I get an error that "possessed character" is none.
How can I set up player controllers on the clients to know what they're possessing?
You can just called Get Character on the player controller
I've got "get player character" which requires an index. I'll have the game assign player controllers their index then plug that in and see if that fixes it, thanks
Don't do that
Your on possessed even gets the pawn that they player controller is now possessing
Not sure if it's called on clients though
I don't think I understand fully
When my player controllers possess a pawn they immediately set it as their PossessedCharacter value
it seems like this is not happening on the client
But in the print string I announce when a possession happens, and it's happening to all the relevant actors/ controllers
Clients see this, does that mean that the player controllers all exist on the server, and that the clients are using some sort of proxy?
You haven't got your variable set to replicate, so it's only being set on the server
That got rid of the error, thanks @plucky prawn !
I've got the event working from server to clients and clients to server now
Hi ! What would you use to pass an actor class from a client to the server ?
Mhh i thought it wasn't working, will try again ty !
Will check thank you !
I'm getting a different behaviour
actor goes outside the Net Cull Distance
then, comes back to inside the range of Net Cull Distance
no rep_notifies are called
hello, i've created a weapon, set some properties and then equipped it, however the OnRep function shows RightHandWeapon to be null
UPROPERTY(Transient, ReplicatedUsing = OnRep_RightHandWeapon)
AAvalonWeaponBase* RightHandWeapon;
i am simply setting RightHandWeapon = NewWeapon;
oh!
bReplicates = true;
let me check the blueprint
pretty sure i did
DOREPLIFETIME_CONDITION_NOTIFY(AAvalonCharacterHero, RightHandWeapon, COND_None, REPNOTIFY_Always);
UFUNCTION(Server, Reliable, Category = "Avalon|Character")
void DrawSword_Server();
so the client on MMB calls
that is perfect
my use case is as follows:
I have Client A and Client B
1 - Client A enters car (Possesses the car and attaches to its driver socket)
2 - drives very far away until he's outside the net cull distance
3 - exits the car while being out of range of net cull distance (at this point usually a multicast is sent that unattaches the player from the vehicle socket, this also sets a variable to null that is replicated and has repNotify)
4 - In client B's game, he does not receive the multicast nor the repNotify because he's outside of net cull distance range
5 - So in client B's game, client A is still attached to the vehicle socket, while on the server and on client A's screen he's normally walking around outside the car
6 - When Client A comes back into net cull distance of Client B, no rep_notifies are called
how do I solve/debug this issue?
no errors in the logs
got it!
UE_LOG(LogTemp, Warning, TEXT("has auth %s"), (HasAuthority() ? TEXT("true") : TEXT("false")));
i could be missing something
but i don't know what
i've set the bReplicates = true;
maybe the problem is else where
bReplicates = true;
bNetUseOwnerRelevancy = true;
NetUpdateFrequency = 100.0f; // Set this to a value that's appropriate for your game
bSpawnWithCollision = true;
ok done
oh i think i see where the problem might be
still null, but the logs looks correct
LogTemp: Warning: DrawSword has authority false
LogTemp: Warning: DrawSword_Server has authority true
LogTemp: Warning: Euphronios has drawn their sword
LogTemp: Warning: Equip has authority true
LogTemp: Warning: OnRep_RightHandWeapon has authority false
it only null in OnRep_RightHandWeapon
i've even managed to call equip successfully on the server
the server has all the blueprint mesh references
maybe i don't understand why logging the name is significant
i have a break point
yes
yeah its is darn weird
i agree with you
i can now see in the logs that this is the client (for sure) i can see its also null
also null
i put that in to make sure
what do you mean?
you mean am i calling onrep ?
noooo
i do have other components replicating
yes the hair is pushing through the helm :p
but the server is assigning the armour
its then replicated down to the client
so i changed the code slighting and no replication is happening now
i wondered if it should be
UPROPERTY(Transient, ReplicatedUsing = OnRep_RightHandWeapon)
class AAvalonWeaponBase* RightHandWeapon;
didn't think so
ah i have an idea
ok that broke the replication totally
hmm
is the Name always unique?
so i can spawn many of them, but its not the assignment to the character isn't replicating
those would be
i am trying to find out if the weapon actor has replicated to the client
lets see if i can see a begin play
no the client never had a beginplay
ah i know what i've done 🙂 doh
however, that doesn't 100% why i can't see the character replicate
Is there a UMacro setting for not spawning actors on certain net modes?
im trying to make a multiplayer game and i have searched around a bit but i have no idea where to start, anyone know some good starting points?
did you make any games before?
yes
well, then like you start with any other game, start a prototype for your concepts and while implementing that, get used to the unreal network API, there are some useful links pinned in this channel.
ah, forgot all about pins. thanks :D
Say I'm making a multiplayer rpg with a bunch of inventories and items, where people log on and off. I was wondering if it's normal to store the item / inventory data somewhere besides on the characters or other actors.
Currently I'm making a database in the game instance, where when requested will make a call to look up or create a reference in the game instance database.
Savegame?
You'll want a savegame somewhere unless you do something else with a persistent database or whatever
thanks for your help! we have a sword!
Ok. Thx @dark edge
when we send HTTP request by HTTP module the response callback is called on game thread yes ?
It's been a while since I used it, but most certainly yes
Got an odd one today. Wonder if anyone might be able to shed some light.
I have a UObject that is created as a default subobject within an ActorComponent in it's constructor.
The UObject in question is added to replication via 'AddReplicatedSubobject'
The UObject contains a float value that is replicated.
The bug, is that when the value is replicated, it replicates across all instances, much like a static variable. So, two different instances of the ActorComponent, will share the same value, when they should instead be seperate.
Does anyone have any idea what might cause this? Is this expected behavior? (seems unlikely)
It runs on the GameThread once finished yeah. It specifically enqueues it internally to do so 😄
Maybe showing the relevant parts of your setup would be a good idea, I think it may be a bit difficult to guess what could be the issue by just text 😅
@twilit radish Completely understandable. Apologies, can't share code here as it's work related. Glad though that it's not something obvious that's standing out!
hello, i might be doing something really stupid here,
UPROPERTY(Transient, ReplicatedUsing = OnRep_RightHandWeapon)
class AAvalonWeaponBase* RightHandWeapon;
// assigned the pointer when equipped
UPROPERTY(Transient, ReplicatedUsing = OnRep_RightHandWeapon)
class AAvalonWeaponBase* CurrentRightHandWeapon;
when the player equips a weapon, i will simply CurrentRightHandWeapon = RightHandWeapon; and call the equip method, when equipping, I would Current.. = NULL and when that replicated call RightHand->unequip()
i think i was being stupid spawning a weapon actor when equipping
Im using this when somebody host a server, but when level change happens clients are disconnected, what should I do?
should I add this for every level?
Normally when somebody host server its open a loading level, these happens and level 1 opened
Do default subobject replicated properties get replicated on initial bunch if they haven't been changed?
Or does the engine assume they're not dirty if they're defaults
And if so, does that apply to stably named objects in general?
I have a Replicated NetStartup and NetLoadOnClient actor, and when I come to its Net relevancy its invisible for nearly 2 seconds but collision is there then it becomes visible
🤔
is it normal ?
It is good to use HUD class for all widgets of player in multiplayer game? also for replicated ones?
okay so, with full push model objects, yes
but you have to enable ^ this
how do I handle an actor that is getting back into net cull distance? I was expecting RepNotifies to be called when he comes back into range but that is not happening, even tho the variable changed value
if it differs with default value OnRep_ should be called
yea exactly, but its not
the value differs, its changed on the server
and the OnRep_ is called for players within the net cull distance, but for players who are not within that distance, when they come back, it still wont call onrep for them
Widgets cannot and shouldn't be replicated. Use the HUD as you would normaly in a single player game - to display gameplay data
but health and name are widgets and they need be replicated
or game over widget should be replicated for all whats then?
just replicate the values you want to set on those widgets
and not the widgets themselves
and how handle game over widget? when i will win as team i will check on event tick if game is ended and then will initialize game over widget?
or how
same thing, just replicate something that indicates that the game is over, and when clients get that information you create the widgets you need
and should I check it on event tick ?
because it can change anytime
isnt using event tick bad? for cpu usage?
no, replicated variables have RepNotify events you can use
they will automatically get called on clients when the value changes on the server
okay Lets say I have big plane its AI i will kill it it will set repnotify boolean to true / as dead/ but I need check this value on my player character so i need cast there and check it every second
anyways
if, for whatever reason you already doing checks on tick on the server, then when you change the values of your replicated variables, the clients will get those new values automatically with RepNotifies
i get you question is if I have 2 different blueprints one is enemy AI one is my player and AI has repnotify ?dead how to check that repnotify dead in my player
to make game over widget
anyways I wanted make this widget in class HUD,....
health and name are gameplay things that belong to game code - widgets just need to display them, the replication needs to happen somewhere else
the game over event should he replicated, but the widget should appear independently on each player
When your AI dies, do an event dispatcher call. Have the GameState listen for that (or a subsystem). Then once X is dead, do a multicast to end the game.
now I am doing name like this its in player BP
hmmm what is dispatcher F i need to check it
Personally, I use a world subsystem to be a generic enemy event manager. That Subsystem has access to the game state and talks to it as needed. AI only talk to the Subsystem.
So any global tracker or notification for enemies goes into that Subsystem.
maybe this is good solution? I used it in HUD
has anyone worked with WorldPartion ? its so weird because one of my actor is loaded/unloaded with cell the other one its always there, same actor just duplicated, and they are next to eachother
Is there a console command in UE4 to get detailed information about reliable events? How many are running at a given time, how close the buffer is to being full, and so on? I don’t see anything about it in Stat Net
Guys I am setting this dead variable when AI enemy died its repnotify then inside I am calling custom event to my player where I am creating game over widget but I am just getting server log that base was destroyed and not game over widget why? how to fix it? also getting this error after
So a quick one. Let’s say I built a game with a dedi server. Then made another game with a dedi server of its own. Is there a way to have a client be able to go between these servers? As in the client may be a build of either game, but they can click connect and join the other game some how. Maybe they have to download the content folder off the server first??
Not really, no
How can i know player has sight to other player ?
probably linetracing between them, but depends on what collision settings the other physical objects have, might block or not
I can do that with line trace with visibility channel but found this function in player controller ---> LineOfSightTo
no idea, might be a handy function that does whatever under the hood
also this is not #multiplayer 🤣
😆
@prisma snow This worked perfectly for me
Can someone please tell me why my UI isnt updating the player thats hit by a projectile but its updating the Owners? ```float AFPSCharacter::TakeDamage(float DamageTaken, struct FDamageEvent const& DamageEvent, AController* EventInstigator, AActor* DamageCauser)
{
if (GetShield() >= 0) {
float damageApplied = GetShield() - DamageTaken;
SetShield(damageApplied);
OnRep_Shield();
return damageApplied;
}
else
{
float damageApplied = GetHealth() - DamageTaken;
SetHealth(damageApplied);
OnRep_Health();
return damageApplied;
}
}
void AFPSCharacter::UpdateShield()
{
if (FPSPC)
{
if (IsLocallyControlled())
FPSPC->UpdateShield(GetShield());
}
}
void AFPSPlayerController::UpdateShield(float Shield)
{
if (HUDWidget) {
HUDWidget->UpdateShield(Shield);
}
}
This is giving my head a swirl
its also not consistently updating the shield , its updating only at 0. I have the shield binded in editor
in RTS with many units, would you OnRep an attribute changing frequently likeCurrentHealth or use rpcs? does it matter which you choose?
You mean just Replicate CurrentHealth? "OnRep" is a term used to describe a function that is called when the value of a Replicated variable is changed.
yes, just Replicate
Replicate vs. control through RPCs
Anything that is Stateful should generally always be a Replicated property.
RPCs are just fire and forget events
The results of an RPC will not be reflected on a new Client coming into the Server after they were sent.
Therefore, CurrentHealth is a stateful property, as its describing what the current state of health something has.
Using RPCs to update it would mean that new incoming Clients would not know what the actual real value is.
easy fix for this, but i get your point
@young spoke Why do you want to use an RPC over Replication is the question you should ask yourself?
curiosity... say you have 100 units, all of them regenerate hp at some small fixed rate...
does it make sense to spam this across all clients on each change or batch the updates in rpcs
Blueprint or C++?
cpp
Right, well you have access to PushModel Replication, which gives you direct control over when a Replicated variable will actually Replicate.
So you could in theory setup a mechanism that tells a Unit its regenerating health and can therefore simulate that on the Client.
Instead of always replicating the change every frame.
The easy way isnt always the best way.
originally was wondering why CMC doesn't Replicate it's MovementMode which got me thinking about this
You will find that you will need to do somewhat elaborate optimizations in the future to save on performance.
Get comfortable with coming up with novel ways of achieving this.
CMC does rep the movement mode.
Its just not done via the variable itself.
thats my point
instead of just replicating via DOREP facility, it's passed through RPCs and handled more manually
The CMC is extremely complicated, seeing something done there, does not necessarily mean you should follow that approach without understanding why they did it and why it may or may not apply to what you are trying to do.
when a client joins a map, what variables of an Actor BP get loaded onto the client? Do all variables get loaded, or only replicated variables?
All non replicated variables are loaded from the CDO in their default state.
Like if I have a Actor with an Int variable, it is set to 5 on the server, does it get loaded to the client?
what is CDO?
Only if its marked Replicated.
Otherwise it will be loaded from the Class Default Object default value.
Thanks!
eh actually i don't think it's bandwidth related... probably just because messing with MovementMode state independently would cause havoc with the AP replay buffer or SP smoothing
When would it make sense to use Switch Has Authority on a level placed actor? (not player controlled). Because in the case of setting a replicated variable does it make sense to skip for remote?
I've been using Is Dedicated Server to lessen the work the server has to do when dealing with sounds and particles or minor visual changes, but is there ever a scenario when you'd want to use Authority only on some custom event that a level placed actor has?
So no one can help :/
You use it to tell when you're on the server copy of that actor (listen/dedicated). It wouldn't make sense to use it for filtering the executions for visual changes, as those won't be spawning for the listen-server. IsDedicatedServer is good, or if you have access to cpp, you could make yourself a BlueprintCosmetic function and it should not be running on dedicated servers
Yea I understand what SwitchHasAuthority does for a level placed actor, but I still can't think of a good reason when it would ever be useful. I guess its kind of the same as IsDedicatedServer but would be different if the host was a listen server.
If you want to set something up server side on beginplay, it’s pretty useful
Like lets say the inventory size
If you set that up on both client/server it’ll not replicate as you’d expect.
How can I display ping like this in my game?
how to truly know an actor became net relevant in client ?
@prisma shadow its just UI ping is in PlayerState u can read it
I found ping in player state but I have no idea how to use it so that it will be displayed in game
@bitter oriole @rose egret
UMG
So basically I have to create UI for ping, after that how can I connect the UI to player state - ping
I added these in my player state
And this in UMG
But the values are not changing and it is displaying like this
I think the way I used ping in player state is not right. How can I properly use ping in player state? @bitter oriole @rose egret
I fixed the value to single to triple digit but ping still remains constant as "0". It is not changing
Hi, how would you handle the case having pawns being controlled by an AI, but a specific player is controlling those AI, what would you use as the owner, the PC or a custom AI controller storing the PC, or something else ?
Heya, anyone that can tell me the right behviour to spawn ai actor ? i have an issue that the mouv to update is laggy on clients and even if i do not replicate them it work on the clients after spawning. So i am i bit lost and i think that i did a mistake
guys I dont know where to find help and people from #ue5-general sent me here I am getting this error
[2023.01.18-10.54.49:714][ 0]LogRHI: Display: Opened pipeline cache after state change and enqueued 0 of 0 tasks for precompile.
[2023.01.18-10.54.49:714][ 0]LogRHI: Base name for record PSOs is ../../../DFC/Saved/CollectedPSOs/++UE5+Release-5.0-CL-0-DFC_PCD3D_SM5_79023B0B40C8A84A90FDF3A3965E2C40.rec.upipelinecache
[2023.01.18-10.54.49:715][ 0]LogRHI: Could not open FPipelineCacheFile: ../../../DFC/Content/PipelineCaches/Windows/DFC_PCD3D_SM5.upipelinecache
[2023.01.18-10.54.49:715][ 0]LogRHI: Display: Failed to open default shader pipeline cache for DFC using shader platform 0.
[2023.01.18-10.54.49:715][ 0]LogRHI: Base name for record PSOs is ../../../DFC/Saved/CollectedPSOs/++UE5+Release-5.0-CL-0-DFC_PCD3D_SM5_0CC64E1C46447DB404577DB0A555D5DB.rec.upipelinecache
[2023.01.18-10.54.49:715][ 0]LogRHI: Could not open FPipelineCacheFile: ../../../DFC/Content/PipelineCaches/Windows/DFC_PCD3D_SM5.upipelinecache
[2023.01.18-10.54.49:716][ 0]LogRHI: Display: Failed to open default shader pipeline cache for DFC using shader platform 0.
Now its causing by my HUD class I created new HUD class and changed it in my game mode added there my player hud etc and packaged game when I run client it has blackscreen and those pipeline errors, when I use default HUD by UE its working BUT when I use again my new HUD and disconnect ALL of events its again not working...confusing, I got this problem sometimes also before when I had my HUD for player in player pawn, please any ideas or solutions? I am really lost...
Hey guys, I have an error when trying to run my dedicated server on UE5.1
UE_LOG(LogStreaming, Fatal, TEXT("%s"), *FString::Printf(TEXT("%s: Serial size mismatch: Got %d, Expected %d"), *Object->GetFullName(), (int32)(AsyncLoader->Tell() - Export.SerialOffset), Export.SerialSize));
Something related to audio.
On client build everything is okay and on UE5.0 dedicated server also run properly.
What can it be?
Hey, trying to shortcut here a bit... I'm planning to have different playerstates for AI and Characters, any gotcha/caveat any of you can think of by doing that?
check the callstack and see where this is coming from
Hey there!
When a client joins a server, before they receive a controller, are they supposed to see anything in-game? 🤔 I mean, do they have a camera or something?
anyone that are use to spawn ai on server ?
I don't see the relation here.
You are spawning an AI Pawn/Character and then tell them to move to somewhere
You said you see laggy movement
But I still couldn't decode what's exactly going on, but:
- AI Pawns/Character must be spawned via server.
- In order for these pawns/characters to move, they have to replicate
I don't understand what you meant by "even if i do not replicate them it work on the clients after spawning"
- AI Pawns/Character must be spawned via server.
is it
In order for these pawns/characters to move, they have to replicate
so is it supposed to do not spawn if they are not replicated right ?
Right. If you don't mark them to replicate, they won't show up for clients given they were spawned via server
so spawn will not automatically spawn it on client
No, they won't spawn on clients if replicate is false.
hmmm because even with debug log that are rightfully printed on the server only just before spawning, my actor appear on clients lol
this is my spawn debug part on the game mode
this is the settings for that pawn
and this is the controller
It is async assets loading and the asset that throw me exception related to audio.
I am trying to figure out how exclude audio from cooking for dedicated server.
this has to be on
I never used this node myself so I don't know the differences to SpawnActor
Although I think its just a wrapper
This has to be on too
Is your AI a Pawn or a Character?
but i want to test without spawn, is the code that i have right now is supposed to spwn the MonsterBis only on server and so not on clients >?
with the source code it looks similar as the spawn function base
I still don't get it. If you want to test without spawn, why don't you just place your AI in your level?
is the code that i have right now is supposed to spwn the MonsterBis only on server and so not on clients >?
Yes.
so this is a problem because atm it spawn so i need to figure out why
Baby steps.
Yep
Where are you calling this Spawn function? GameMode? Level Blueprint?
So actually it depends. If you are spawning that on GameState for example without any pre-validation (such as has authority, is server, etc), it may spawn both for clients/server.
is it on gamemode
OK
Where are you calling AIMoveTo?
I mean, where you're giving the command for the AI to move? Inside the AI itself?
on controller, but it should not change anything regarding spawn no ?
You're right, it doesn't change anything related to spawning
Anyways - what exactly you want to achieve in first place?
You want to spawn so all clients can see the AI?
You playing with this option checked?
the main goal with fix the laggy behaviour of ai
but right now i want to know why the ai is replicated without anything that i know.
The code is from someone else of my team so...but...
nah i am in standalone with a dedicated server
You want to spawn something server side only ? With a dedicated server ?
yes
You spawn an actor from your game mode, which is not (your actor) replicated ?
yes as i showed in my screens
🤔
So you have a dedicated server and are connecting to it manually via standalone?
yes
And if you remove the owner is the spawn params ?
right now i use that but it look similar, is it spawned on clients...
Monster Bis is not replicated ?
This doesn't make sense.
yes...
Are you recompiling your dedicated server every time you change something?
i do use the one provided by the editor
And connecting your client to an up-to-date dedicated server?
Lets make a simple test first
Come here
Put 2 here
Click here
And see what happens w your spawning AI
Same behavior as in... all clients are seeing the AI being spawned, right?
is this checked?
Hi guys! I'm building a Metaverse platform using Unreal Engine and pixel streaming. I'm running the Pixel Streaming application along with the Matchmaking server but the stream stays the same on all the devices connected to the server.
It would be great if someone could let me know what mistake I'm doing?
At this point, I don't know what else could it be. But if I were you, I'd create another raw actor and try to spawn it on the server w the same configs you have in your AI and make sure the other clients can see it.
In other words - create a new actor inheriting from Actor, add a Sphere component so you can see it in runtime and mark it replicates, then try to spawn this new actor and see if your other clients can see it as well
okey if i do an anctor is it good but if i do a pawn (or character) is it not
edit : no, replication was defaulted ticked
I'm also relatively sure that PixelStreaming requires one Server/Host per unique "experience".
So you will have to host the Game for every single player. 1000 Players = 1000 Running Games.
Would be weird if Pixel Streaming magically managed to emulate 1000+ players with one server :D
UE's network system is probably also not the thing i would use for "metaverse"
Wasn't the idea of a Metaverse to be ONE thing, decentralized ?
What's the idea with everyone making their own now
Fair
The internet is my metaverse
And I will die on that hill
stonks
every time i read metaverse my stomach go wild
I actually managed to not read about it much the past months until just about now
Yeah sure
But not if there are 10 of them
It also itches me the wrong way that posts about the Metaverse on Blog pages are always written like whatever this adds is gonna happen and is gonna be good.
Question :
Server side : On a pawn, i spawn an AI controller, i set the PC as owner
Client side in PC : I call a RPC on this pawn, the PC on the client is the same as the GetOwner() on the pawn
The RPC is not called, no drop error in the logs
If i remove the AI controller spawn, the RPC is called
Is that the expected behavior ? Didn't find anything talking about exceptions with ownership
I only ever saw posts like these if the actual thing is a scam and the person writing that is profiting from it .D
ha, right?
metaverse is the new Build My Own WoW-like MMO(tm)
You changed the Owner to AI and then called a Client RPC?
I changed the owner to the PC after spawning the AI server side
Yep
You spawn an AIController inside the Pawn
Yep
You set the Owner of the AIController to be the PlayerController
The owner of the pawn
I think Ownership of Pawns is handled by Possession
is the AIController possessing the Pawn?
Yep, the owner is the AI controller then i change it, just after (SetOwner(PC))
Isn’t that what Nvidia’s Omniverse is all about? New tech that allows creators to use a variety of platforms and integrates them all together.
I used a workaround but i found this behavior weird
Because all of them want to do it their way and all of them want to make it theirs and all of that goes against what they are promising
So you Possess with AIController and then you SetOwner back to PC?
Yep
I might honestly think that this won't work
The Controller that possesses the Pawn should also be the Owner
The owner can't change when an AI possess it ?
Ok
No warning anywhere i was surprised :p
I mean
I understand your idea
But it might just be some safety thing somewhere that stops this
void APawn::PossessedBy(AController* NewController)
{
SetOwner(NewController);
This is the default behavior of pawns and possession
Yep, i use another actor to pass orders to AI, a bit more annoying but it works :p
I’m thinking if there ever is a Metaverse it would be something like a massive video game with procedural content made by simply speaking out loud to describe things and AI under the hood making it all work seamlessly.
You could also be running into this
class UPlayer* APawn::GetNetOwningPlayer()
{
if (GetLocalRole() == ROLE_Authority)
{
if (Controller)
{
APlayerController* PC = Cast<APlayerController>(Controller);
return PC ? PC->Player : nullptr;
}
}
return Super::GetNetOwningPlayer();
}
Which seems to suggest that it's looking at the Controller and not the Owner
Which might explain why your SetOwner has no effect on the RPC
But I'm not sure if RPCs use GetNetOwningPlayer
have never looked into it that much
I mean Epic is trying to force there "Verse" language onto "it"
Mhh will check later maybe, thanks ! :p
To allow easier content creation
I think the Metaverse is redundant
Same as Crypto and NFT
The Internet is just fine without all of those things
Future is meta-metaverse
Question - when does the server grants a client their playercontroller?
During preLogin or Login
Hm
It’s already becoming fragmented which goes against the whole idea in the first place. 🙃
During AGameModeBase::Login
But iirc the Client has a fake PlayerController until the actual one replicates
Because otherwise it would be problematic
Thats what I wanted
And do you know if this fake PC is the one set by my gamemode?
I would need to look it up again
Also I don't see a login function on GameModeBase
You meant PreLogin?
Nah, I see it wtf.
There's PreLogin, Login and PostLogin.
Yep, my bad
The fake PlayerController thing is something I Only vaguely remember
Just confirmed here
/** The class of PlayerController to spawn for players logging in. */
UPROPERTY(EditAnywhere, NoClear, BlueprintReadOnly, Category=Classes)
TSubclassOf<APlayerController> PlayerControllerClass;
It uses that one 👆
Yeah I mean the normal PlayerController uses that one for sure
// Give the GameMode a chance to accept the login
APlayerController* const NewPlayerController = GameMode->Login(NewPlayer, RemoteRole, *InURL.Portal, Options, UniqueId, Error);
🤔
I mean, Is there really a fake one?
B/C it only tries to login when this condition is met:
if (Connection->PlayerController == NULL)
With no else condition
What I wonder though is - what is the player supposed to see when they have no player controller
Thus they don't have a pawn/character, meaning no camera
(I mean, not that a camera is bond to a pawn/character, but...)
OK, I'm quite lost here.
When a client connects to a server, there's a screen "blink" from when the server accepted the client until the client possess the pawn and I really have no idea how I can manipulate that screen blink.
This can be quite easily reproducible by just:
- Set your Net Mode to
Play as Client - Set the number of players to
1 - Play
(It's easier to notice if you emulate your network to like, 500 ping)
(And am not sure "screen blink" is the appropriate term; that's just to give you the overall idea)
Two questions:
Why this happens?
How can I manipulate it?
(In really shallow terms, after a client handshakes with a server, this client sees a sneak peak of the level before it gets to the right position, with their pawn possessed. I'm trying to fix this - I don't want my clients to see any sneak peak of the level before they assumed control of their pawn.)
The sequence I'm seeing is this:
- This is what the client sees as soon as I play from editor (PIE)
- Then the player gets spawned somewhere (I bet it's
0, 0, 0)
- And finally they get their pawn and their camera is shifted to the character's one
Turns out I don't know why my client is seeing step two (which is the step I want to do something about).
- This happens before my PlayerController's BeginPlay
- This happens before the
BeginPlayof the Level Blueprint (on the client) - This happens as soon as the server triggers
Begin Playof the Level Blueprint
According to my investigation, this happens before the player is given a PlayerController by the server (it seems to be NULL at that point) but after the server accepted the request to join.
no we're all sleeping
I found it, geez!
ULocalPlayer
ULocalPlayer::ULocalPlayer(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
, SlateOperations( FReply::Unhandled() )
{
PendingLevelPlayerControllerClass = APlayerController::StaticClass();
}
It's a APlayerController 😢
It seems it keeps that class until GameMode::Login
- Black because PIE is booting up (in a packaged build it would be your designated travel map)
- Yes this is 0,0,0 with X forward and happens because there isn't even a player camera to use yet because it hasn't loaded in yet.
- Yes this is 0,0,0 with X forward and happens because there isn't even a player camera to use yet because it hasn't loaded in yet.
That's the thing
I want to intercept that
I don't want the player to see the world while they're still handshaking
And I'm not able to do that because of this
Need to come up with something
I think the way to get around it is to cover the screen with UMG
Yeah thats an option
But... when?
or place a "loading" cube at 0,0,0
omg
and then find a clever way to hide it inside of a normal looking level mesh like a rock or something lul
That’s actually an amazing idea lol
Even though this question persists
Is there any event such as like
OnBeforeTravel or something? 🤔
Built-in one I mean
I knew I remembered that correctly
Pity Unreal doesn't allow me to override it
I mean ofc if it was built from source
Because then these workarounds wouldn't be needed
Damn I tried adding a full screen loading widget directly off the Event BeginPlay of the level blueprint and that didn't work either, still a flicker at 0,0,0
it sucks right
I'm just going to use the 0,0,0 loading cube mesh method for now then
Design around it and move on to other issues
This guy is killer, really. That's what I should do as well lol
But its like if the level is loading before the player controller then how is a widget ever going to be shown on the screen first?
The second day I'm spending on this sh-t
Youre right, nvm
I wonder the reason why Epic doesn't allow us to manipulate the PlayerController ULocalPlayer uses 🤔
(I imagine the scope would be really limited?)
Anyways - alright - you came from the skies with a blaster solution. Will stick to that for now to get things moving. Thank you lawlster!
Hello ! I'm trying to replicate my character rotation but everytime i change it to server the player isnt even rotating, it's working in Solo and a bit laggy with Multicast, i've been trying for 1 hour 😦
Wasn’t the trick to load the widget using GameInstance before you load the level, then get the level to remove the widget when it’s ready?
I think it doesn't work
I mean, how can we trigger something before load level?
I MADE IT BOYZZZZ
No workaround sh-t
class API UCustomLocalPlayerSubsystem : public ULocalPlayerSubsystem
{
GENERATED_BODY()
virtual void Initialize(FSubsystemCollectionBase& Collection) override;
};
void UCustomLocalPlayerSubsystem::Initialize(FSubsystemCollectionBase& Collection)
{
Super::Initialize(Collection);
this->GetLocalPlayer()->PendingLevelPlayerControllerClass = ACustomPlayerController::StaticClass();
}
🌠
cc @graceful flame
Because you trigger it before you even load the level. So on the menu or wherever, you create a loading screen widget. I believe that’s how Lyra does it too.
And by doing it in the Game Instance, it persists across levels.
Anyone could help me ? i'm still trying lol
Hm, I get it
I'm not sure, but that has caveats
For example - if I join a friend of mine through Steam Overlay
Then I haven't interacted with my UI to have a chance to display a black UMG or something
I remember in our last released game we literally ignored this 0,0,0 flicker because we were going crazy not being able to properly address it
Game Instance boots before begin play on a level though. Just load it there?
Game Instance only boots once
If I join you through Steam
It’s still a travel event you can grab and action on GI
Yes
Just gotta find the right hook
This way bypasses that
It doesn't matter how you join a server, it'll work
Ofc haven't played w it enough to spot side effects, but so far so good
(What I discovered so far is that that PC does not exist in UWorld so you cannot do anything world-related; however I think I can spin a widget through there)
B/C like, say you join through EOS - if there's no universal hook to join sessions, I guess you'd have to reimplement things over and over
Although you instigated my curiosity. GI has OnNotifyPreClientTravel
Can anyone explain to me NetLoadOnClient? For example in a late joining game what will happened if a player will join after one of the NetLoadOnClinet objects already destroyed
when a client joins a map, for an actor that the client does not own (ie, a door for example), does the begin play and construction event get called on the client?
for the BP door for example
oh cool - i'll actually play around with this myself tonight - I was working on server joins + "loading screen" stuff myself the other day - so I'm keen to solve this as well.
The Constructor and BeginPlay are called for all Actors, regardless of Owner.
I mean if a client joins after begin play gets called on the server, does begin play get called on the client locally for an autonomous proxy actor on the client side? same too with construction script
Like if I have a begin play on a door that inits some vars, will it also init the vars on the client side?
The Constructor and BeginPlay are called for all Actors also regardless of Network context.
They are ALWAYS called.
Its in the name BeginPlay
Beginning of Play for a newly connecting Client is the moment they finish loading the level.
I see now, thx, i thought it was beginplay for server or game server
In UE5 I believe it was changed to be when the GameState has been replicated.
But the point is, regardless of context, BeginPlay is always called.
Noice! Let me know what you think. TBH, I'm really liking this solution so far. 😛
What would be best practice for network efficiency dealing with an inventory type system? The current two ideas I have is the first being a simple "retain everything in memory as an object", and the second is "retain the row ID for the item and only retain the stuff that changes, perform data table lookup anytime default info is needed".
The 2nd one seems best for memory management, but slower. The game I'm making is multiplayer focused, so it would be running on servers that probably can handle the memory usage.
You would generally treat items in storage as UObjects.
Then just replicate any changes as needed.
Unless you are moving a gzillion items, the few changes would be lightweight when updates are needed.
So call it once from the data table and then retain it in memory?
i.e. "m_inventorySlots[n].itemData = FStItemData();"
dont optimise early - thats the simpliest way.
If profiling shows it to be a problem, you can try for tweaks. But I doubt that would be the issue...
Fair.. Just get it to work 😆
I guess if I got the system working I can just test it myself and see the stats on it.
Prove you can do the system first, then optimize.
You may get insight into how to better optimize something after you have already built it in some way.
You will likely feel the need to rewrite the system entirely, probably more than once. In order to achieve better results.
Prototype code is production code 😈
This is not uncommon and should not be something you should be afraid to do.
can anyone tag me with the most optimal way to spawn items for players? i.e a hospital will have more medical supplies vs a house bathroom
So in order to set up dedicated servers, do I need to use a different engine source? The docs are a little confusing to me
"You must be using a source build of Unreal Engine, which you can download from the Epic Games Github.
If your project is using a binary build from the Epic Games Launcher, you will need to migrate it to a Github source build."
but then underneath that section, when it references setting up a new built target, it says "If you do not have a C++ solution, you can right-click your .uproject file and click Generate Visual Studio Project Files to create one."
The process of working with an unreal project doesn't change whether you're using a source build or a launcher build.
But a launcher build will not build a number of additional configurations (including server configs). Only source builds allow the full set of configs.
Okay the question I'm asking is whether I need to start a new project with the source code, or if I can replace the launcher build with the source code in my existing project
You do not need to start over.
Is there documentation on adding the source code to an existing project then?
simply place your game directory under where you downloaded the engine source to and regenerate project files.
Your game folder should be alongside Setup.bat and GeneratedProjectFiles.bat.
Or modify the uproject to set EngineAssociation to a path to the engine. Or register the build in the registry and modify EngineAssociation to point at it (there's a tool that does this for you but I don't remember the path) https://docs.unrealengine.com/4.26/en-US/ProductionPipelines/DeployingTheEngine/UsinganInstalledBuild/#registeringaninstalledbuild
Hello, I have a question about actor replication. So in short: I hold information about items in a data table which holds a soft reference to a static mesh. I access the data table row after spawning the item (on server) and then I have a static mesh variable (Set w/ Notify) to set the static mesh component to the set mesh.
The problem is while it works perfectly well on the server, I can't seem to get it to work on the client. The actor gets replicated but the variable has no value and on_rep function doesn't get called. Maybe it's a problem with my understanding but what could be causing the issue here? https://blueprintue.com/blueprint/3uxi-f9o/
I have the actor set to Replicates and Net Load on Client, although I've also tried setting it to Always Relevant and it didn't seem to help.
As someone who is messing about with Multiplayer can someone tell me why this isnt replicated to the server or client ? (Now i know someone will chime in using Tick is bad for updates etc its all just me messing about and learning atm not optimising) 🙂
The health bar does not update when i use the custom event UpdateHP if i plug it directly into the Event Tick and then try to update during the game it shows on the Client but not the Server (Which is why i thought Execute on Server would fix)
This is something that I wondered but never tried myself before, but is it maybe because the soft object is not loaded on your client?
Maybe you can convert your replicated variable to soft static mesh and load the actual mesh on notify so you can assure each device have the valid mesh after server decides which one to use
I believe you're using listen server and not dedicated right? Are you sure the widget casting succeeds on the server side? Widgets are considered cosmetic only and shouldn't being created on dedicated servers as far as I know, but it should exist on listen server
Yep i use Listen Server.
If I change from Execute on Server to Multicast it updates on the Client Screen but not the server Screen
not sure how i would check that if something exists on server
I put a print string on the failed cast pin
and see if server fails the cast.
Nope server doesnt report a failed cast.
Wait I'm not sure if I get it correctly, is the widget entirely missing on the server or is it just not being updated?
As you can see the server screen does not update it.
Multicast - Only Client updates, Execute on Server - Neither update.
I actually forgot to mention it but that was one of the first things I've tried. Sadly it didn't work either. It also didn't seem to work for other variables (the Static Mesh Transform variable is set to replicated and also doesn't replicate correctly).
Hmm okay you shouldn't need to use an RPC for this then, if the health is replicated both server and client will have the health value. Both server and client also have the widget. So you should just be able to set your health to your widget's progress bar's percent
Where do you set or update your health?
In the Dummy BP
Ah okay. Thanks for confirming, but I guess I have no other opinion about your question
Can you try doing SetPercent directly in Tick, without any other RPC/event and set your widget variable to not replicated and try like that?
so like this ?
@upbeat basin Works on Client Screen but not in server.
Oh you should keep health as replicated
But now that it shows different, did you set the health from inspector of the blueprint or during runtime?
Are you sure you're setting it on the server?
Tbh im not sure how you can tell what the server value is.
I thought Execute on Server would set the value on the server.
You can just use print in tick to display the health value on server and client
Can you show how/where do you set the health?
this is where i set the value during runtime
Oh
That's I'm not sure if a good practice to change things from
The world outliner shouldn't be showing you all the actors, so it should either showing you the server or the client
If it's client and you change from inspector, then only client's health will be changed
Can you open the blueprint, set the health from there and try?
Then they should both show the same value
this is what it looks like during runtime.
I have 2 windows open running the "game" and then the editor on a second screen where i change the health value.
Well yeah, I guess the default value of your health variable is 0, you change it from the instance on the world, which happens to be the client instance, so only client can see the health being changed
But i can see the health value printed by server is 0.0 but client is 0.25 so how do i tell the server to update the health value.
Ah so do i need 2 functions UpdateServer and UpdateClient
Set your maximum health in the BeginPlay
But only in server
Since it's a replicated variable it'll be updated in the client as well, so you don't need to use RPC to set it on client as well
You can check this with SwitchHasAuthority node/macro
Ok so like this ? should reflect in client and server?
No, we're mixing terms here
I meant the float variable by Health
You need to set it's value in begin play
I set its Default Value to 0.33
SetPercent can still stay in Tick so it can update
Ok step 1 accomplioshed xD
Server and Client see 0.33 as default valye for the Health Bar.
hang on a minute i think a penny might have dropped...
nope xD
Didnt work either I thought Replicated would automatically update the value within the server , Maybe this is a case of RepNotify so when the value of Health is changed it automatically transmits a new value from the server to the clients ?
I have a question, how do you have 1 server run multiple scenes/levels? something like albion online, they have multiple maps?
how comes ?
How do you make it like albion online?
with the maps
it loads a private island for someone, and unloads it
or a guild island
but there are guild islands
a player creates a guild island, where others can join and its increasing each time, you cant just start a server for each island
how?
but can 1 server handle all those maps?
like a new additive level
but they say Unreal Engine can make mmorpg
Is this a rough estimation of how many connections can a server can handle or just a random number?
fortnite has 100+ players and its unreal engine
why do you lie about it
tons of other mmorpg games
they handle 100 players
I see, thanks for the information
Update HP function here won't change anything, it'll just set the same value to itself, I didn't exactly get what's the issue
On the above picture it looks like both server and client can show the health when it's set on both of them right?
Yes but the second I try to update it from the editor window it updates the Client Bar but the Server does not receive the new value from within the Editor so Client will print 0.75 (New value) meanwhile Server Window will print 0.33 (Old Value)
It feels like the Server Values cannot be updated from within the Editor during runtime.
mortal online is made by unreal engine it says on google
and it has over 1000 players
active players
I have a text render object which shows a random text to both players at the same time which is working.
which works.
Unreal Engine 5.1 launched and it finally brings the power of nanite to foliage.
Want to learn Unreal Engine 5 - checkout the UE5 Starter Course:
https://youtu.be/k-zMkzmduqI
Unreal Masterclass:
https://www.unrealmasterclass.com/
Chapters
00:00 - Intro
00:13 - Nanite Explained
1:18 - Nanite Foliage!
3:15 - Large Forest
3:38 - Leaf Scattering
...
As you can see both players see the exact same numbers
but this is happening at a predetermined rate not just "Oh i,ll change this value when i feel like it"
what are you trying to prove with that?
it can handle a lot
🤷♂️
Yes that's what I tried to say
i dont see how any engine handle 1000 players
in here
unity game engine handles thousands in 1 server
like albion online
ive seen 1k+ in a map
and there are multiple maps
but idk if 1 map 1 server or 1 server all maps
After opening the new level, "Is locally controlled" function not working
I found same problem with me but this is about C++, how can i apply to blueprints?

