#multiplayer
1 messages · Page 727 of 1
i think making it imposible to pickup somthing from across the map is worth it
How would I swap their material within the client event? sorry if im a noob
I know about client events just not sure about swapping mats
With the "SetMaterial" node
Ah kk this is not as hard as i thought lmao
What about setting the normal material which it had been set to before? For example after the ability ends the material goes back to normal
You can store the original material in a variable for when the ability fades
For every player?
then you call again set material
Yeah except if there is another method that i'm not aware of ^^
Wouldn't the variable have every single player material though?
Yes it would be an array of material
Or only one material if all players have the same
Or you can, on player character, make a function "switch to highlight" and in here (character) you store the original material and swap the material
So you get all characters, then you call "switch to highlight", they all store and swap material, and then you can call another function that reset to the original
So should I make an array out of the players mat
Correct you still have to do the trace on the server only if you hit something, i.e the trace is eligible to the client. So you kinda pre-test on client but the server has the final saying and this way you don't bug the server each time you line trace
Ah like that.
So doing it only on the server isn't the answer
Then yeah, totally agreed.
Got a bit of a problem. I have two c++ classes for a local multiplayer project (UE5) and basically upon a key press one of the actors will teleport to the other's location and the other actor will teleport to the other's location. This will only occur if both aren't nullptr. but whenever I try it apparently both are nullptr. (I have an error message that appears if their nullptr upon a key stroke) Does anyone know how to solve this?
How do you get actors references?
does anyone know any tutorials on Multiplayer that start from square 1? I see a lot of them and they expect me to know a bunch and it's very difficult.
Sure, but why do you need to go to the game mode to do a trace? That's something you should be able to do on the class performing the interaction itself.
It's not. The gamemode doesn't exist on the client.
what can i do to make it safe
Do it on the server or somewhere else if it's need to be the client.
(An Executes on Server event is running on the server btw...)
Oh I see now. But
client code
is incorrect then lol.
i mean not client but charafter code so server & clients
Not really a "tutorial" but this is a good start to at least explain some things: https://www.youtube.com/watch?v=JOJP0CvpB8w
An overview of the essential concepts for writing multiplayer game code in Unreal, in under 25
minutes or your money back.
Sample project: https://github.com/awforsythe/Repsi/
Patreon: https://patreon.com/alexforsythe
Twitter: https://twitter.com/alexforsythe
00:00 - Introduction
01:24 - Net Mode
03:33 - Replication System Basics
05:13 - Acto...
I don't really see anything that's 'unsafe' in that specific part 🤷♀️
ok i was just worried a hacker could modify the self reference and do somthing odd
No they can't. They can however adjust arguments passed from RPCs. But you don't have those with this specific one.
Cheaters can't magically change variables on the server. They can only change what you allow them to change.
i do have this but that stuff is only for client stuff
Hey guys, Im having an issue with my player character, the host can succesfully host a lobby and move around, but when another user joins, they cant move, they just stay there statically, here is the spawning of my players within my gamemode, I have the gamemode parent set to "gamemode", the default pawn set to nothing, and the controller set to my multiplayer controller
Does anyone wanna make a game with me
I don't think this works the way you want it to.
I already have the name, lore, and story
this isnt the place for this sorry
Where do I go to?
Pawns don't have replicated movement by default I believe.
Unless you meant with pawn an actual character 😛
This is strange, because it was working before, and now its decided not to, and Ive changed nothing inbetween these events haha, and yeah sorry I mean character, Im using the third person character as a template hahaha
Ah nevermind then. Character does have movement.
wdym it dosnt do what u think it dose
like it seems to work just fine in my eyes
Yeah, but it doesnt seem to work, works fine for the host, but with the client, it doesn't seem to allow it
How do you add input to the character?
So you have nothing, good start. Just go make the thing.
Im using the third person blueprint, so the input is just default
You're calling an RPC on the Client to the Server and then expect right after it has done so that the server fills in the Looking At Actor variable on the client. That doesn't work.
I don’t have a laptop yet lol but I’m going to get one
so what would i do to get the responce back
Don't pull variables across execution paths - you're going to run into problems, especially so if you do it in multiplayer.
Event Tick runs on both server and client.
What you're basically doing right now is having the server and the client both call the "Interact Trace RCP" event on tick. So the server will end up doing it twice, and is effectively completely unnecessary.
The server doesn't need to know what the client is looking at every tick - that's something that can be handled completely client side. It's only when you go to actually perform something with what the client is looking at that any RPC would really need to be made, and you'd pass along a reference to the actor you're trying to interact with. The server can validate if the player is within range/looking at the actor or whatever other checks you want when the client asks to perform the interaction.
I would do the trace on the client, have it call a run on server event, optionally have the server do a check to stop cheating, and then the server does the thing
skip the not cheating part for now, make it work first
The client just calls
ServerInteract(ActorIWantToInteractWith)
@fierce fiber Do you have this enabled on your character?
Where can I find this
Is this a joke? lol
Ever looked at #volunteer-projects ? People ask others to work for them for free on MMORPGs. I don’t consider these kinds of things a joke at all compared to stuff like that. If you can’t afford to pay for people you can’t setup an MMORPG that will succeed 🙂
Sounds maybe a bit harsh. But I truly have the opinion half of the requests in that channel are just a big red flag.
No contracts usually provided for things like rev share or payments at “a later date”, vague details and often the most ridiculous requests 😅
I do think that people coming with the idea of "i'm working on this project, i have X amount developed on X time (so you can at least show something) i would like some partner, we can do payment like xxx" is bad.
But the idea of "yo! i have the idea of the best building ever, who wants to build it?" is just absolutely delusional
I don’t agree with it too, don’t worry. But still miles better than asking for an entire unpaid team for a MMORPG that you have not even started yet.
Which are legit requests from time to time in there.
I was just checking unpaid gigs, damn.
lol what do u think how this whole mmo genre came into existence? it was modders doing shit for free xD
Is it possible to host multiplayer on my own laptop for friends?
depends on the kind of game ure hosting i guess
minecraft should work yes
Minecraft?
yes as long as u dont make the map too big lol
you have to test that yourself
What is the replacement for "get player controller"? I understand that is for local and not client. What is the equivalent of that but for client? I need to have all the clients to share the same camera in the level but I need to understand how to get them. I apologize for being so everywhere and hard to explain. It sounded better when I was in the shower lol.
You can have some RepNotify variable on PlayerController called MyCameraActor and have just set that for everyone
Or do some stuff in PlayerCameraManager to find the camera actor
there's Sam Pattuzzi KrazyKarts project https://github.com/UnrealMultiplayer/4_Krazy_Karts
you can extrapolate this to aerial movement
and if you have resilient server sided heuristics to control gameplay you could give SmoothSync a try https://www.unrealengine.com/marketplace/en-US/product/smooth-sync (They gave it for free months ago)
but bare in mind it is client authorative
If i use replicated movement, is there a way to NOT interpolate the location on teleport?
I am using actor pools and when I set the location on server it jerks a lot on clients, instead of instantly snapping to the final location
Depends, what actor is it?
If it's a character, you just need to turn the smoothing off in the movement component
Hey everyone, I'm having an issue. Someone is able to host a lobby just fine, however, when they go to the server browser, join a lobby then enter, they possess the third person character, but is unable to move the camera with the mouse or the camera itself, here is my joining code
Maybe you forget to posses the character after spawning
This is my code for possessing when logged in
Thats in the gamemode for the map, and the joining session stuff is in my game instance
The joining custom event leads back to the menu and applied to a menu button
Set Input Mode Game Only
Call it for the controller
Like this? Thats my custom controller that I have, it has nothing in it as of yet
Didn't work, I put this in after possess
And received this error
On begin play it is set as a custom variable
Oh yeah you should call it on client 😄
Im using the gamemode for the possessing, shouldnt that already be client side or am I being extremely dumb
Call it OnPossess in Character class and make sure you're the client(using IsLocallyControlled)
You should still call it here but only if IsLocalController(i.e for listen-server/host player)
You don't need to cache the PC
You get it in OnPostLogin as a param. Doing it this way you are susceptible to racing issues
I see, I also tried doing an on possess event and it didn't work, I'm very stumped, would it be too much to ask to join the voice chat? Maybe Im just doing it incorrectly
I'm in another voice. Try sticking to this chat so other people get the info too when they face similar issues
This is how I did my possess event in my PC
Not too sure if this is how I was meant to do it haha
No not this. I meant the one called in pawn which is PossessedBy
But it seems like it's called only for server too

Then call a client RPC and do that SetInputGameModeOnly
Seems like APawn::Restart is a good candidate but it's cpp only
How do you even add the mouse input to the camera in the first place btw?
Ok, after finally researching the terminology you were using, I managed to get it working using your tips, thanks for the guidance!
Are there any alternatives at all for simple move to for dota like movement, that works with GAS? Or am I stuck with using wasd?
Hello guys, I have a little issue with multiplayer (maybe because of ue5). I'm using steam session for host/join. When the server is using open level insdie the game instance, the others clients are teleported to the game default map. Any idea?
@whole grove it does though, because top-down uses simple move with doesnt have replication, so it interferes with GAS
I get that this discord is probably biased towards epic but... Should I try epic online services? I've just finished learning the basics about steamworks and I'm curious if eos might be better in some way? My end goal is to have something that works on quest2 standalone with, if at all possible, crossplay (if that's what it's called) with pcvr.
If they can't find the map specified then they are teleported to the default map
Bit of a long shot, but we're having some issues with Level Instances and replication. We're using level instance actors in the world to load sub levels. They are all loaded when the persistent world is loaded.
Sometimes when we start the game (in PIE, not sure about package yet) some of the objects in the loaded level instance are not replicating. No replicated var changes, no rpcs, etc. Once it's broken it seems to be broken multiple times in a row, then it might start working and work for multiple times in a row. I suspect a timing issue related to loading as it rarely used to happen but now we have more level instances it happens a lot.
While debugging, it seems like the NetDriver on the client has no NetGUID entry for this broken actor, and I don't know why that would be.
Anyone got any ideas?
Do you know how I can check if it's the server who decides the client doesn't need to know about this actor, or if it's the client ignoring the server about this actor?
yea but I'm doing a open level inside the game instance, so it's working if the client is hosting, but when the server is hosting, all the client are teleported to the default map :/
Here is a quick shot of the issue https://streamable.com/chevz5
Another one for the code. Thats so weird, I've done this so many times (in ue4): https://streamable.com/b1pp3h
Hi all, i got a question related to actor and replication versus network latency.
Is there a way to spawn actor locally and transfer ownership to the server so it can be better managed and allow local player to spawn it faster than the server would ?
i wanted to spawn actor(weapon) non replicated on each client so that the local player dosent feel network latency.
An issue i noticed is that if the actor were not logged in or not network relevant the actor dosent spawn, only way i could fix it is setting the actor as replicated.
is there any tricks to make it work, or maybe use repnotify ?
Is it possible? Sure. It is easy? No.
You could spawn it locally and then replace it with the server version.
Don't do that, is my advice
There's no point spawning a weapon to avoid latency if they can't do anything with it
And the race conditions will be nightmarish to try and resolve
well, only thing you would need to solve is have a deterministic naming between server and client for the Actor, and IsFullNameSupportingForNetworking() returning ActorHasTag(TEXT("PredictivelySpawned")), which you add to Actor at the time of the spawning
afterwards you can even turn the replication on, but if you make an error, your clients get booted out of the session
it might need additional lying to the server to open an actual ActorChannel
all in all, i don't recommend the practice for something as often spawned and short lived as bullets
Executing a server rpc from server will just execute as normal right?
yes
are MoveTo Functions replicated and multicasted by default?
question the player charafter code is on the server AND client witch means if a hacker modifies the code antyhing they try to change will only be on thier side because the server is doing it also right
yes
It depends. Think of RPCs as entryways into the server - a client could effectively call any client->server RPC whenever they want. Therefore, if a hacker decides to modify the client code to send an RPC whenever they want, the server will receive the RPC and process it.
Additionally, if you're passing data through an RPC, a client could potentially modify whatever the values are that are being passed through. If your server code doesn't do any validation of what is being passed through, then you have an avenue for someone to cheat. An example would be passing through co-ordinates of where a player wants to teleport to - sometimes you may want to have a client tell the server where they want to move, but if the server doesn't check if that location is within range or is a valid place to teleport to, or that the player should even be able to teleport currently, then the client can effectively move anywhere in the game whenever they want.
So it's not really just a matter of what is on server or what is on client, it's more a matter of what the server allows to happen.
ok so a trace on the charater would happen on the server and if it passes on the server it happens and can be replicated to everyone and if the hacker makes it so it dose happen it only happens on the client right
Is there really no built in basic movement interpolation (cmc)?
A "hacker" making something happen on the client would only be happening on their client. A "hacker" calling RPCs making things happen on the server can potentially make things replicated to everyone.
so any events on the server need checks right
There isn't, CMC is all there is
shit
Any exploitable RPCs, yes.
interpolation seems like such an annoying thing to make work (especially since i have no idea what im doing)
augh
Custom MP movement is indeed a shitload of work
Making an UPROPERTY Replicated
uhh
so if i have a replicated uproperty by default the client cant modify it right?
It can, but that won't change anything for anyone else
Hi all - I'm relatively new to the concept of session based multiplayer games. I've been exploring converting Lyra to support multiplayer gaming via a server hosted on AWS Gamelift. I've got that working, multiple clients can connect and play just fine. The issue I'm hitting is the username/Nickname that is selected for the client seems to be based on the local PC name, with some random numbers appended. I noticed when reviewing the logs on the dedicated server, it shows the connecting client with the Options parameter that includes ?<PCName>_<randomNumbers>... when I'm doing my Open Level call to the IP:Port, I don't include any Option string so it seems like it's being added somewhere else after the fact. After some digging, I found some code in Runtime\Engine\Private\PendingNetGame.cpp at line 253...
ULocalPlayer* LocalPlayer = GEngine->GetFirstGamePlayer(this);
if (LocalPlayer)
{
// Send the player nickname if available
FString OverrideName = LocalPlayer->GetNickname();
if (OverrideName.Len() > 0)
{
PartialURL.AddOption(*FString::Printf(TEXT("Name=%s"), *OverrideName));
}
// Send any game-specific url options for this player
FString GameUrlOptions = LocalPlayer->GetGameLoginOptions();
if (GameUrlOptions.Len() > 0)
{
PartialURL.AddOption(*FString::Printf(TEXT("%s"), *GameUrlOptions));
}
// Send the player unique Id at login
Connection->PlayerId = LocalPlayer->GetPreferredUniqueNetId();
}
}
Can bad network allow for RPC's misordering?
What I'm struggling with is trying to figure out how I can override the nickname that gets sent so that when it does LocalPlayer->GetNickname() it uses a custom nickname, rather than an auto generated one. I tried tracing through but couldn't figure it out
If they are reliable they are guaranteed to be ordered
Thanks
Does anyone have any experience with that or ideas on how to set the LocalPlayer nickname?
@hollow ginkgo
/**
- Retrieves this player's name/tag from the online subsystem
- if this function returns a non-empty string, the returned name will replace the "Name" URL parameter
- passed around in the level loading and connection code, which normally comes from DefaultEngine.ini
- @return Name of player if specified (by onlinesubsystem or otherwise), Empty string otherwise
*/
virtual FString GetNickname() const;
So what you can do is make a custom ULocalPlayer and just override the method.
Not sure if it's the best solution. But it's based on your findings 😄
But I kind of expect you to have at least used Google if you went this deep lol.
or just don't use the null onlinesubsystem for the shipping game
i actually was just digging through this channel history and found a similar suggestion above, I didn't realize LocalPlayer class was defined in the project settings... so I might just inherit from the LyraLocalPlayer class, set that to be my new one and override the GetNickname() function
thanks
I am trying to optimise/reduce character features to run as many as possible on 1 server.
I have noticed Anim Blueprints are running on server, which is not necessary for my case. Is there any button to turn them off on the server (and keep them on clients)?
Set the mesh animation update mode to "Only Tick When Rendered"
Just keep in mind, it means you character PHAT/hitbox server-side is likely in reference pose if you do this. Sometimes it's beneficial to run very primitive anims server-side, or at least set poses
Thanks, that setting makes perfect sense. I was searching for "server" or "ClientOnly" flags and I missed the update mode.
The characters are similar to "Fall guys" blobs, thus I expect capsules to be good enough for hitboxes. But I will keep those comments in mind.
Can any one helpw tih the following, it works on a server but not a client (when running in PIE). It might all be wrong but half works.... basically trying to get a target player state from a left mouse click
Why are you doing the targeting on the server?
That's why it's not working, the hit result under cursor is local only, the server has no clue what the client's cursor is aiming at
This should be clientside
I didnt think it was on the server
Show the whole thing
@dark edge updated it to this as it seemed smaller
print string is returning the ai controller
but again that only works on the server of a PIE and not the client
Don't use a replicated event to show the ui
the run on owning client event
get rid of it
This can all be local, nothing has to go over the network
I thought you needed to if doing listen servers?
Is there a way to tell a Box Collision component of an object it only exists for the server? I end up writing a bit of code on begin overlap and then switch has authority because really only the server needs to be doing that in a multiplayer game if a player is walking into some area, what are best practices for this? One thing comes to my mind is doing something on construction script and deactivating the box collision for clients maybe?
Not for what you're trying to do
You're trying to just pop up some widget when you click a unit right?
Getting this error currently that is appearing in my multiplayer gamemode, when the first player is kicked, it runs through the events and casts correctly, but when another player is kicked, it stops on this node and tells me that its struggling to access it. Essentially, I am getting the player ID and making sure it kicks the correct person, but it wont access this cast when the 2nd person has attempted to be kicked. I am not too sure why on another client, its not running through the same
This above event is also happening within the multiplayer gamemode
Before I ask another question I will tell about my "shared camera" issue. I have a camera being used by all players over network. I put it in gamestate and I set the viewtarget with blend to my camera that is going to be used by all. Then I "get all actors of class" and use my created "player controller". It worked lol. I appreciate the assistance from those helping me.
but my question now is should I have a separate gamemode for Network use and one for Singleplayer use? like would the code and work that is going to be used in the network work for singleplayer modes? such as like an arcade.
Is there a generic/OSS-agnostic way to get a unique ID for a player that is persistent between sessions? Eg a steam ID which is the same for the player each time they join a server. Not sure what other platforms have but I'd like to not tie myself to steam if there's a generic way of doing this
No, that doesn't really make sense. Every platform can do whatever they want for their user ids, there's no singular id to uniquely identify players across platforms unless you make one yourself or use something like EOS that works across different platforms.
Ah OK that's unfortunate but makes sense. I thought that's what FUniqueId was for.. Or FUniqueID
FUniqueNetId is implemented per-OSS
and it's unique for that subsystem
You could store which OSS an id came from along with the id but there's no singular id type for this. How could there be when every single platform uses something different as an id?
Oh OK. That should be fine. For steam this would be the steamid right?
FUniqueNetIdSteam encodes the steamid as a uint64
other platforms may not even use numeric ids
Right. I'm curious how a game like satisfactory that allows both steam and eos to connect to the same server would handle things like bans
it's not
Very interesting
it's a separate platform that connects to a number of other services (including epic's own). Playfab offers something similar.
I'm not familiar with playfab but that sounds cool
If you are using eos can you check if you are using steam?
probably, check their docs
I just love how all my problems evaporated when my team purchased SmoothSync. Just wow. Wow.
I'm trying to study the source code. So far it looks like plenty of intriguing code design choices. I'm in awe.
Glad it worked out
Hi. Anyone knows why - GetOwningPlayer (using for MP) cast to PlayerController BP fails? Trying to get it and cast it in the widget on button click event.
Likely reason is that you're trying to access a remote player
PCs aren't replicated
ummm
its from a widget
all widgets are local, and most of them can access the PC
usually only ones on the widget component will fail to grab the PC, as their outer is GI
ofc if you explicitly put something else other then local PC into PlayerOwner when constructing it, then you broke it
Yeah the issue was weird, dont know how I managed to get it like that. Had the one on the Right. After recreated again, Left one worked. After inspecting other widgets found out that had Construct not Create.
That was the reason why I had a different owner of the Widget.
This is the error. The bool is just a quick fire event for something else.
i have this code running on client & server and i constantly get this error
Blueprint Runtime Error: "Accessed None trying to read property CallFunc_GetController_ReturnValue". Node: Line Trace By Channel Graph: Interact Trace Function: Interact Trace Blueprint: BP_player (it extends character)
any ideas?
With 1 client or 2?
If you and me are playing the game, on my computer, your pawn cannot get your controller (it doesn't exist)
its two clients aswell the controlls and trace work fine
but it should only to be egttong its own controller right
Your pawn on MY machine does not have a PlayerController
Show how you're calling this function
every tick
Yes so on tick, your pawn on my machine is trying to get its controller, which doesn't exist.
My machine has my pawn and your pawn
but only my pawn has its controller here
so how would i only get my controller
There's no need to do the interact trace everywhere
do it either on owning client or server
so do an has authority?
yup that works!
also for this code how would i get this onto the server would i use a custom event that replicates onto a server or is there a safer way?
If anyone has 5 or 10 minutes to look over the code pasted in the pastebin link below and let me know if they can see what I'm doing wrong I would appreciate it. I tried to comment well enough to explain where each blueprint callable function is being used in a Widget BP but if it's confusing I can explain it. When a player clicks on a server button it seems that they join the session but then they do not appear to travel to the map menu.
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Instead of sending the code, send the logs. No one would have time looking at the code really
Even though there are no errors?
For example: #multiplayer message
This guy didn't have errors and we could help him figure out the issue
Ok. Much appreciated. Here is the log.
It's crashing
The UE5-BALLS Game has crashed and will close
LogProperty: Error: Struct type unknown for property 'StructProperty /Game/MetaHumans/Common/Face/Face_AnimBP.Face_AnimBP_C:AnimGraphNode_LiveLinkPose'; perhaps the USTRUCT() was renamed or deleted?
That's prolly the error that causing the crash. The previous errors can be deleted this way: https://forums.unrealengine.com/t/warning-createexport-failed-to-load-outer-for-resource-for-many-blueprints/365898
Hi, we just run into a problem of one of my team mates machine. On that machine we get the warning “Warning CreateExport: Failed to load Outer for resource …” a lot (<800) in many blueprints. And after that the editor is crashing most times. I copied his project folder over to my machine and there is everything running fine. We reinstalled the ...
i have this interface that when triggers dstroyes the item and is MEANT to add it to the inventory so it apears in the gui but either the gui dosnt work in MP or the add to inventory dosnt work any ideas and any code i need to share?
a widget that shows info from vars from other players but yeah. Will update thank you
Thank you. Sorry the crash is happening when I try to launch. I had forgotten that it would show up in the log. I wasn't attempting to address that yet. I appreciate this guidance. I'll get to work on fixing it. I'm not sure how to fix the metahuman pose other than to just maybe remove the animBP from the face mesh?
First thing is: Does that red circled node even trigger?
No idea really. #metahumans might know
Thanks m8
the node after it is leme do a breakpoint
it is indeed triggered
Then the code inside of that is relevant
Also is this called on the Server or on the Client?
Or even both?
Maps aren't replicated
shiii how would i fix this?
Use arrays
is that hard?
i already have a struct
You don't have an array of structs though
You didn't make the map replicated also
But even if you did, it wouldn't replicate
Now you know it doesn't
Go make your research on how you will change it
ok so i should have a struct with the info of the item and a linited array right
Right
is it hard to convert a map to array?
Just a for loop
They are laid out differently in memory too
You can do it your way like Weirder said
There already are GetKeys and GetValues functions for TMap
i need to convert the actual code to use arrays
Well then it depends on the code. Depends on if the code is really using the map structure to the fullest or is just using it for a container
this is how im using it i belive im using it to its fullest
So keys are item name and values are quantities?
and when you hit 0, do you remove the entire entry or is it Apple : 0?
@faint gustJust make an inventory struct with name and amount in it
i just dont know how i would find a spesific named item
Loop through MyInventory until you find the name or don't
would that hurt performance
Not really. What other options do you have?
i guess your right
I mean, are you looping through an inventory with 10,000,000 items every tick?
If not, don't worry about it
Is the GameMode available to the client?
Generally no, with the exception of a Listenserver host. But you should never assume any "Player" has the ability to use the GameMode. Even on a listenserver host you code things so that there is server code, and client code. Keeping this makes it so that your game framework runs whether it's listenserver, dedicated, or singleplayer.
Question: Maps can't be replicate, so I made a struct with keys and values (and using find -> get copy to get an index number to find the pair), also made macros (add, remove, etc), then I swapped all the maps and array macros, but somehow it doesn't work the same. Would anyone have experience or an alternative solution to this?
Are you BP or C++?
BP
That makes sense. So should I store game phases in the GameState? I need to have event dispatchers on phase change.
If you're using the existing framework, the GameMode/GameState already has a replicated "phase" system
It's quite old fashioned tho
Still does the job
Can I ask what the map is for? Generally you can pretty easily replace a TMap by making some basic Add/Remove/Find functions. In C++ it's easy enough to just write predicates for finding/removing stuff. I don't think I've used TMaps for almost anything except static data lookup.
I know some people just replicate a TArray and construct a map out of it for faster runtime lookups.
Is there a specific term for that system so I can look into it?
Might be referring to the MatchState. Not sure.
I have two TArrays each containing 65536 Elements (256 x 256), Each Connected client has its own two TArrays, How can I send these 2 arrays to the server or a different client ?
sup everyone. i'm getting this error when trying to replicate a TArray<UAbilityGrant*>:
LogNetPackageMap: Warning: FNetGUIDCache::SupportsObject: AbilityGrant /Engine/Transient.AbilityGrant_0 NOT Supported.
UAbilityGrant subclasses UObject and i'm creating it using NewObject. anyone have any idea why this is happening? i'm seeing online that i have to potentially modify IsSupportedForNetworking() to return true but i'm unsure if just modifying that fixes the underlying problem
~~ah, i see exactly what's happening. disregard. ~~
i guess we'll play a bit of trivia. can someone see what's going on with this NewObject call?
if (const auto Grant = NewObject<UAbilityGrant>())
so it looks like not having an owner was only half the problem. the object is still not supported for network
The owner needs to replicate them as subobjects as well, and the UObjec itself needs to return true in IsSupportedForNetworking.
The Actor or ActorComponent will need to override this.
virtual bool ReplicateSubobjects(UActorChannel* Channel, FOutBunch* Bunch, FReplicationFlags* RepFlags) override;
super helpful, thanks. so i'm adding these to an array:
if (const auto Grant = NewObject<UAbilityGrant>(Owner, UAbilityGrant::StaticClass()))
{
Grant->SetAbilityAsset(Asset);
// EVENTUALLY: If necessary, calculate levels here.
const auto AbilitySpec = FGameplayAbilitySpec(Asset->Ability);
Grant->SetHandle(ASC->GiveAbility(AbilitySpec));
Grants.Add(Grant);
}
and then the array is replicated
UPROPERTY(Replicated, VisibleAnywhere)
TArray<UAbilityGrant*> Grants;
how would i add the UAbilityGrant as a subobject?
So in the same class that the array of pointers is in. You'll want to override that above.
bool MyArrayOwningClass::ReplicateSubobjects(UActorChannel* Channel, FOutBunch* Bunch, FReplicationFlags* RepFlags)
{
bool WroteSomething = Super::ReplicateSubobjects(Channel, Bunch, RepFlags);
for (UMyUObjectType* ObjectPtr: ArrayOfPointers)
{
if (IsValid(ObjectPtr))
{
WroteSomething |= Channel->ReplicateSubobject(ObjectPtr, *Bunch, *RepFlags);
}
}
return WroteSomething;
}```
cool! thank you for your help. super helpful. i might just end up using structs instead again (UAbilityGrant was a struct, but i had some issues with null functionality)
gonna try to write ReplicateSubobjects now
Took me a minute to find it, but Jambax has a post on it as well that is a little more comprehensive. 😄 https://jambax.co.uk/replicating-uobjects/
@kindred widget so my struggle was with being able to set this "Ability grant" as null. i'm storing it as a pointer in a UUserWidget but its owner is somewhere else.
i originally had it as TOptional<FAbilityGrant> but TOptional can't be replicated. then i had it as a FAbilityGrant with an IsValid() function but then in blueprints i can't call IsValid() on a struct (structs don't support UFUNCTION). so now i've ended up with a UObject
The widget can hold a pointer to it without a problem. Doesn't matter what replicated or owns it. The Widget's pointer can be null or set. Might need a better scope to understand the problem.
it's all working correctly now 👍 thank you @kindred widget for the info on subobjects
well kinda 🙂 but at least now the UObject is replicating. now i'm just trying to figure out why its inner fields are not replicating
ok! now i got it! everything is replicated correctly 🎉
could some one help me i have multiplayer set up and it works in the editor. and you can join the session but as soon as i try to package my project with multiplayer in it. it doesent seem to work when you click on making a host the screen flashes and then when i press it again i get my error message that i set up. and i cant seem to find out why its not working. am not using the advanced session plugin. does it maby have somthink to do with that i need to use a service like steam/epic ?
btw am using ue5 also using blueprints
also done some other testing with a other multiplayer project that i made in 5.0 EA and i know that. that was working but even that cant create a session any more is there a setting am missing or is the multiplayer part just bugged ?
Show your code for starting a session
and btw without an online subsystem you only have LAN sessions
Or rather, they're only discoverable on LAN.
I have found the sad way that TMaps can't replicate at all, but I have used them in a significant amount of logic... How do I do the equivalent of replicating them without rewriting literally my entire project?
just when I thought I was using a better mousetrap
I was really enjoying the find function too, rather than looping through everything
Yes and it has a better time complexity. But I wouldn't say it would make that much of a difference
Considering your array isn't too big
@dark edge ok so if i get it right you can only use the lan then and not just internet. my other project that i made on 5.0EA worked on internet and lan. but in 5.0 it doesent work
Its probably worth me just going and making a couple pure functions for my struct array that match the functionality I need
I was hoping there was a better way, lol
Thanks for the help guys
also just tested lan on the other multiplayer project i have and same problem it kicks me back to the main menu. and i know that .that projected worked befor so its weird
hey everyone, i was told to post this question here because i might get some better answers here: #cpp message
say i've got a character that needs some values prepopulated by the user. i need the user to basically pick some stats for the character before the character is spawned. would i do this in the game mode?
my idea is that basically, the player's controller would already exist in the world but the pawn wouldn't be created yet. i'd present the local game instance with a UI, the player would do their selections, send it to the server, and once the server confirms that everything is good the pawn would be created and the player would be able to move the character around.
is it possible to do this in the gamemode? that would be my first idea.
the second idea is that i just create a new gamemode and map for this.
You maybe better handling this via the PlayerController, as in order to send anything to the Server you need a Net Owning Connection.
eh i'm probably gonna end up doing the second idea. load into a blank map, present the user with a UI, save the details somewhere outside of unreal (or use a save game) then load the player in the new map with the game mode
The PlayerController is your Net Owning Connection.
What you could do is spawn and control a dummy pawn that does nothing while they are selecting and then spawn and control the new pawn with the correct stats etc
(If you require it to be done on the same map)
My bad!
Question: maps can't replicate, so as a workaround, I made a struct with two arrays inside (Key = Vector 2D, Value = Color) and I also made macros (Add, Contain, Find, Remove, etc.) to make it work just the same as maps, but it doesn't. Anyone try doing this before?
You'd be better off making a array of structs and just making some accessors
e.g, something like this:
struct FKeyValuePair
{
UPROP() FVector Key;
UPROP() FColor Color;
bool operator==(const FVector& Rhs) const { return Key == Rhs; }
}
UPROP(Replicated)
TArray<FKeyValuePair> Pairs;```
You can also wrap that in another struct or FFastArraySerializer if you wanted, and add your accessors there.
just slightly dangerous comparing 3 float components of a FVector with ==
Yeah, I don't recommend using any floating point type as a key for anything really
Hello all. I've run into the classic problem of trying to replicate a TArray of structs. Please could I get opinions here on best practices.
Here is some example code:
USTRUCT()
struct FExampleStruct
{
UPROPERTY()
bool value = false;
};
UCLASS()
class AExampleActor : AActor
{
GENERATED_BODY()
public:
UPROPERTY(Replicated)
TArray<FExampleStruct> Structs = {}
virtual void BeginPlay() override;
void DoSomeThing();
};
void AExampleActor::BeginPlay()
{
for (int i = 0; i < 10; ++i)
Structs.Add(FExampleStruct());
}
void AExampleActor::DoSomeThing()
{
Structs[2].value = true;
}
In the example above, how do I ensure that the change to Structs[2].value is replicated reliably?
I have tried removing, and completely replacing the struct in the array with a new value, however, that doesn't seem to be replicated either. This could still be user error, but I didn't want to spend too much time debugging in-case before asking here first
You don't need to do anything, it'll replicate fine. Just make sure you've marked it as a replicated property in GetLifetimeReplicatedProps
Interesting. I have indeed done that.
The actor itself ofc needs to be replicated and relevant
hhmm... As far as I can tell, all of those assumptions are true, yet it is not replicating. I'll see if I've missed anything.
Must be something, arrays of USTRUCT replicate just fine
the 'real' struct is a bit larger, so may end up breaking the 400byte limit (that I read about online the other day and can't remember where).
The limit is way higher than that
Would it be fine to use a server RPC to replicate the Turn value (for turn in place) when marking it as unreliable ?
I feel like it's generally bad to even use an RPC here, so i'm open for better options :D
and limit is 40kB for an array, and can be configured
From Client -> Server or Server -> Client?
that is fine, i unrealiable RPC my mouse projected to world
Client -> Server
Alright, i will probably always feel weird about using RPC's at such a rate
and guess what CMC does each tick?
Does it really do it each tick though?
it does
there are few cases where RPCing anything on Tick is fine
game critical bits of player input are one of those
don't RPC on Tick as a general rule is just a simplified way to guide a weekend warrior away from really bad practices
i saw a guy here replicating a FVector with a Reliable Multicast on Tick, just to relay targeting coordinates of a turret to clients
and turret was targeting a replicated Actor, so just replicating AActor* Target would bad been sufficient
But even then with enough latency it would likely still fall apart.
if you take a minute to think about it what would be the point of Reliable RPC on Tick
reliable means it gets Acked and resent if no Ack happened
so if a RPC send on Tick fails it would send one with newer information before it had any idea it needs to resend Reliable one
which makes it completely and utterly pointless to make it Reliable
Reliable = your 60fps client got no Internet for two seconds? Let's resend 120 packets worth of outdated input data
Reliable definitely has its place. But not for this yeah.
reliable = single events, no input
I mean it can be bound to input, just make sure it doesn't allow the input to be spammed.
Probably don't want it for any input
A "Start Game" button is something you could definitely use it for. Just make the button non-interactable while it's doing its thing though.
Hello, I have a question about game state class. Unreal recommend to use it if we have a timer, because the server and all clients need to know this value. Why can't we use the gamemode, and it we send this value to all player controllers? and the PC will update the widget
I'm not entirely sure what you mean with "all clients need to know" about a timer. Completely depends on the context. Also the GameMode is only available on the server so there's no point in doing anything network related in there.
well I have a timer in my game, displayed on each player. So according to unreal doc, I should use game state class, because this class is present on the server and all clients
So same question, Why can't we use the gamemode, and it we send this value to all player controllers? and the PC will update the widget
Technically you can fire that timer in the GameMode, but still you need to make a replicated actor have the RemainingTime property replicated. That actor is generally called GameState
GameMode exists only on server so you can't have replicated properties in there
why people on yt are using replicated custom events on gamemode x)
ok i got it!
If they do it's likely a bad tutorial. Like Wizard said as well the gamemode isn't present on any clients 🙂
That's why I keep away from YT tuts. So I don't lose brain cells
like the unreal tutoriel for online multi
but Ok I got the point. To be sure, if I set a custom even on owning client, it will be only executed on the local PC. If I set it to server, only on the PC of the server, am I right?
and muticast, own PC and all PC on the server
Correct. It will run on the actor on question. Still there are some little nuisances when it comes to RPCs as you can see them in this table Thom provided
ok great, tks!
so check has authority is useless on the gamemode I guess
but it can be necessary on the game state right?
Correct
I am slightly lost in terms of best practices when it comes to Replication order.
Let's say I have 4 AMyPlayerState which get replicated to a client upon joining the server.
When replicated, each player state downloads a profile image from web and broadcasts Ready.
Once all states are ready (all images downloaded), an UMG should pop up.
I tried few ways to do this, but I am worried about edge cases.
For example, if 3 states get replicated and 1 state gets delayed (packet dropped or limitted), clients waits until the 3 states are ready and then shows umg. After that a 4th one gets replicated and my system is broken.
Thus I also need to send how many states to expect, but that info can also arrive after the they ready up, making the checking process a spaghetti code.
Sorry for the long question, I am very confused at this point what is the "best" practice when execution order matters.
What is the goal you're trying to achieve with this?
again another question, but this one is to be sure to do the things right. To get a value (game time remaining) from a game state, inside a user widget. We can cast to the game state, but it this the right way? Or should pass throw the PC before?
If you mean cast a widget to the game state then no. If you mean cast the regular game state to your own yes (assuming that you have made a custom one of course).
I mean, inside the user widget, cast the my game state to get a variable
That's pretty normal yes. Obviously you do want to make sure that the timer is already initialised on the client.
Unless that doesn't matter to your game.
I want to make sure client has ALL from a set of uobjects/actors before calling a function which changes the world based on the properties from those replicated objects.
Also you need to make sure that the game state it self is already valid if it's directly when loading into a level.
You can't do that
There is no defined order when it comes to replication between actors, so you have to build systems that are resilient to it
you mean check if the cast succeed inside the user widget?
It depends on your game but imagine this: You load into the level and just once want to know the current timer value. Then it may not be ready yet. If it's something that goes on constantly however then it really doesn't matter. Just have to make sure that you don't grab any invalid references during the beginning 🙂
My advice is don't bother caching references when the object has a simple accessors
There's rarely if ever a need to cache the gamestate if you can grab it from the world, and it prevents bugs where data is stale
ohhh this timer is before the game start and only when all players are ready. so not called when the class is created
so your advice is to not store the game state ref, and just do what we need?
What Jambax said essentially. I kind of worded it a bit poorly 😅
yep
Having a similar chat in CPP right now, but if you cache something, you introduce a potential data redundancy issue.
so cast again if I need it again
The GameState can be very easily accessed, so you might as well just grab it when needed and if you need to cast it, do so
btw do use a cast or a interface? is there performance issue?
In Blueprint it doesn't matter
for gamestate only?
For anything
Cast (Inheritance) vs Interface is not a performance choice, it's a design choice only
have the GameMode delay BeginPlay, then send a Client RPC with all the data once you have all the data
I see, I think very basic operations like getting a ref from an instance don't affects performance
Does that mean packing all details into an UStruct and sending that instead of doing it via actors, right?
Blueprints them selves are generally not really performant anyway. If you need performance trying to fix BPs is likely not the solution. Although there's always some things you can do.
with what you described you don't even need playerstates already replicated to make this work
just a bit of data from them
so yes
fortnite is not made of 90% bp? x)
I don't know what they do with Fortnite. They probably just have a mix of both C++ and BPs. I think they said they also use BP nativization.
Thanks! I agree that for replication of the initial state ustruct makes perfect sense. I wanted to make it an actor to track changes (if user changes profile pic url), I would catch it with OnRep, but I guess I need to make it work with structs.
But I can't imagine they use pure BP for their performance critical code.
yea of course
for PlayerStates you don't have an OnRep to hook into
you don't know which Pawns belong to them before both PS and Pawn replicate and you have no Controllers
you can however override Add/RemovePlayer in GameState and hook up a delegate there
It's a misleading statement because 99% of Fortnites "BP" is actually just linking C++ functionality together. The bulk is still C++.
yea I can guess so, this is only commercial discussion
My apologies, I meant ReplicatedUsing, silly mistake on my end.
same difference one is a UPROPERTY specifier, other is a function that gets called if you use it
Hello, it seems like OnPostLogin and OnLogout use different Parameters is there anyway to get the same parameters?
Both are taking a PlayerController, aren't they? OnLogout receives a Controller but it is in fact a PlayerController
OnPostLogin is a player controller object ref and OnLogout is a controller object ref.
Yes, but I think you can safely cast it to PlayerController
Internally, before calling OnLogout, it checks it's a PlayerController
It's a bit weird though because the internal code immediately casts it into a PlayerController and otherwise does nothing with it.
Logout that is.
The game session name can be any name (as long as it is using valid values per the platform's requirements) - how to people set session names per server? Do they just set it in the dedicated server config and just read from it? It has to be unique per server instance right?
So I can't hard code a session name inside of the server and have multiple servers use the same session name I do not believe. I believe session names have to be unique
The session name is kind of like a primary key in a db table. The platform uses the session name and app ID / etc to resolve the server address to have clients connect
Seems like a pain to remember to update the server config for each deployment to have a unique session name in each dedicated server config
sup y'all. you have any idea why a Client function called from the server is still executed on the server?
void UExperienceComponent::HandleExperienceChanged(FExperienceChange ExperienceChange)
{
ClientExperienceGained(ExperienceChange);
}
void UExperienceComponent::ClientExperienceGained_Implementation(FExperienceChange Grant)
{
OnExperienceChanged.Broadcast(Grant);
}
UFUNCTION(Client, Reliable)
void ClientExperienceGained(FExperienceChange Grant);
Hello I am trying to spawn an ai pawn and move it only on the client side
Is it possible?
I want it only for some aesthetics.
When I spawn it on server the ai works (as soon as I spawn it; it drops to the ground and moves)
However when I spawn it on client; it just floats in air and does not take user input.
It might be that if it's not multicast, it may try to find the owning client and execute it there. If there's no owning c lient, it just executes on the server. Is the thing you're running it on owned by a particular client?
Yes..
Client is connected to a listen server
And I am using the character bp on the client to spawn the ai
How do I do that?
naw it's a dedicated server
this is a good call. let me see what the owning client is.
so this is happening a component, and this is the owner:
NetConnection is nullptr, not sure if that matters
this is really odd
i thought GetNetMode was in AActor but i can't find it
its role is ROLE_Authority
yeah i'm super confused. the controller on the server has no player state ??? and hasn't begun play
when i call a client function it's executed on the server
Will setting the aicontrollerclass first and spawnin the default controller on the ai same ?
yeah i gotta admit i'm not entirely sure what's going on here. the controller has no pawn, no player state on the server. is this normal?
this was also working just fine in my previous build... all i did was change where the delegate is getting triggered... i'm thinking it has something to do with that
i asked this question on the forums. i'll get back to this another time. massive waste of time. https://forums.unrealengine.com/t/why-is-this-controller-client-function-no-longer-called-on-the-owning-client/593637
Out of pure curiosity, how much replication is achievable without going too deep into c++?
You could probably pull off a game that does NOT require any prediction or fancy computation.
Chess, sure.
Civ, probably.
Quake, nah.
Minecraft, prolly not.
Ok, thanks! Looks like I'm going to have to hunker down and go deeper into cpp because something as complex as a multiplayer shooter definitely requires prediction
Yeah the only thing I can think of that's harder to get 100% perfect in multiplayer would be a physics driven game with prediction.
But it all depends on your design, are things hitscan or projectile, what sort of abilities there are, etc etc
Also depends on how much you're ok with trusting the client and things being janky. Could probably do a DayZ in BP since the codebase is so jank anyway.
Likely going to test early on with hitscan weaponry as it's simple traces rather than keeping track of a projectile. I'm working on a shooter where your character follows the surface.
You won't pull off an Overwatch tho.
What do you mean by "follows the surface"?
like Aliens vs Predator?
Like super Mario Galaxy as an fps
Yeah good luck, you won't be able to use the CMC without heavy modification
it implies a vertically oriented capsule and constant gravity etc.
The player movement components is a bit of a headache but I was able to get it working with a floating pawn.
You'll probably have to roll your own movement system and/or look at plugins.
Does Floating Pawn do prediction?
No, that's why I'm trying to swap to character movement with slight modifications
Yeah good luck. You'll need it.
make sure you do your testing from the very beginning with lag and jitter and packet loss simulation on
If I was tackling that idea, I'd go physics driven without movement prediction if a slower pace is fitting to the design.
I appreciate the advice, I remember someone telling me to test with like 500 ping to account for any very laggy conditions
500 is a bit nuts but I'd do 200
jesus christ... i moved the delegate subscription from the constructor to BeginPlay and now it's working...
Oh and a physics based movement might be a really good idea I just worry that it might not be reliable
Id have to write my own movement component then
The basic idea is that everyone sees what's happening on the server. Can work for a slower pace but IDK bout a character/shooter game. My project is using it but I have big lumbering vehicles, and vehicles aren't exactly known to respond to inputs in sub-millisecond timeframes anyway.
I'm doing more of a Kerbal Twisted Metal type thing
That sounds like way too much fun
Keep me updated
The other option is to try to do it procedurally through control rig
Which scares me
How would control rig come into play here
Haven't made a video since 5.0 (half my physics broke) but this is the latest clip I made.
https://www.youtube.com/watch?v=NQlw6eoZKKc
Procedurally moving the character using a blueprint to calculate foot locations
The Full Body Inverse Kinematic (FBIK) feature in Unreal Engine 5 allows you to construct IK in Control Rig with a high degree of control and flexibility. In this feature video, we show you how to create a 100% procedural animated character with a highly modular setup.
This would be the effect. I'd take inputs and translate them into foot placements to animate the and move the character
What would that have to do with networked movement thoguh
I'd have to replicate that movement somehow over to the autonomous proxies of each player
hey this looks cool
It's fun to play with and fairly simple to network (without prediction), but it's had some growing pains adapting to Chaos
It's also a bit hacky as the drivetrain is a seperate sim from the physics, making the tire model a PITA to get working well.
idem
if i replicate this:
USTRUCT(BlueprintType)
struct FBestiaryEntry
{
GENERATED_BODY()
UPROPERTY(VisibleAnywhere)
FGameplayTag EntryTag;
UPROPERTY(VisibleAnywhere)
UExperienceContainer* Experience;
UPROPERTY(VisibleAnywhere)
uint32 SpentPoints;
};
by using NewObject<> on the server, what happens to UExperienceContainer*?
would i need to use ReplicateSubobjects on the parent container that calls NewObject?
yes
See hither: https://jambax.co.uk/replicating-uobjects/
Yo
Anyone here know how to add Steam multiplayer to UE5?
Im currently trying to add it to lyra starter game
Since im having waaaaay too many problems with EOS
Can i package it with the licensed UE5?
Cuz i need a multiplayer system to use with lyra that doesn't require me using the source version of ue5
If you want dedicated servers, you need a source build
If that's not an issue, go ahead?
nah i need p2p
If it works with the licensed version can u tell me the steps cuz idk nothing atm im very new, im just trying to get into game dev
I'm pretty sure all public versions of UE come with the same licence.
well yeah unless you're under custom terms with epic, but likely not what is being referred to
if you're very new, then why TF is multiplayer over steam with Lyra your starting point?
"Hey guys, I just got my learner's permit. Anyways, how do I drive an F1 car?"
Technically you need an f1 licence to drive an f1 car.
Hey if you own the car, who's gonna stop you?
I mean, you can't own one. And people who do buy them don't actually get to use them whenever. They are brought to the track when you want to use them.
like the ue5 that u get from epic games
not the src
thats what i do to learn
i learn the most with shit like this
but @lost inlet How would i do what u told me to do?
not really
u can easily pay a good garage to build u one
thats what my uncle did and he sometimes drives it on the road
An F1 car? Sure.
but u need to make it streel legal first
ye
Welcome back to Instagram. Sign in to check out what your friends, family & interests have been capturing & sharing around the world.
@latent heart
Im pretty sure thats where my uncle went
he got as funny car and an f1 car
but only the f1 car is legal
bulletperf can do whatever u want if u got the money
shit like this
I can't help but notice that isn't an f1 car.
ye like i said they can do whatever u want
this is an example
An example of a, granted, expensive car being run on a track (not the road.)
ye but with an f1 car u can easily make it street legal
Feel free to post a picture of your uncle driving an f1 car around the streets.
xD
One made in the last like 10 years.
So you've successfully not backed up your argument at all.
i mean i just shown u that bulletperf can do what ever u want
Sure, you can make an f1 car if you have the technical skills to do it.
What I doubt is that an f1 team will sell you their f1 car to tinker with at home.
Especially if it has any technology they still use in live races.
oh idk about an f1 team selling it but u can go to a lot of places where they can build u one
I will grant you, it is possible. I just don't think anyone does it.
idk about countries other than dubai, kuwait and saudi but i've been to work shops there who would build one for u
Not to the level that an actual f1 car operates at.
i've seen some in my country
but idk if they were street legal
they were all at a street race
The street legal part doesn't really matter I guess.
But still, just because it looks like an f1 car, does not mean it is an f1 car.
It's easy to copy styling.
but with an f1 engine and features it is an f1 car
😂
I highly doubt they even have an f1 engine.
idk but it'
they are fast asf
Welcome back to Instagram. Sign in to check out what your friends, family & interests have been capturing & sharing around the world.
u can find some here
Maybe a f3000 engine or something.
i went to a few of their races
I'm not saying they aren't fucking cool and impressive.
Just that they aren't up to spec F1 cars 😛
You can get your hands on an older F1 car if you got the money
but you don't have the money
https://vymaps.com/KW/F1-Car-Rental-20916/ apparently u can rent them where i live xD
Kuwait City, Kuwait | Car Rental
lol
How much would it cost?
For a custom built one it's like 400k in my currency
A real F1 car is like $20m
you can probably get an older retired one for a few million
And that just the parts.
and a replica that's not as high strung you can probably get for a couple hundred K
ye idk why it's so expensive to get one off a team
Not talking about the hundreds of thousands of manhours that's gone into the design and production.
Even these guys only let you use them on a track.
ofc
it's a rental
😂
they probably have streel version tho
Yeah lemme go get groceries in my 20 million dollar F1 car lmao
but the street ones look kinda ugly
That's hourly income for Jeff.
i think someone did that
xD
It was either that or a drive thru
but coming back to the topic @dark edge would u know how to use steam multiplayer with lyra (UE5)
If you can't figure it out by just poking around with how things were done back in UE4 days, don't worry about it for now.
You should be able to just follow a UE4 guide tho
Nobody's gonna talk you through it.
i found a few but would a ue4 plugin work with ue5?
I mean you might have to modify it a bit but you should be able to do that.
If you can't, don't bother with Steam for now.
Chances are it just works tho
ok thanks
Hello there!
I have such hierarchy:
- AActor Character // Replicated by bIsReplicated = true
-
- AActorComponent Component // Replicated by SetIsReplicatedByDefault(true)
-
-
- UObject Item // Replicated by ReplicateSubobjects in outer component and IsSupportedForNetworking => true
-
-
-
-
- UObject Subitem // ???
-
-
How to properly replicate the last part? UObject property of my another UObject
Easiest solution is going to break that chain
Make that last subitem a struct, or move it up
Oh, that would be awkward
The chains stands for ACharacter -> UEquipmentComponent -> UEquipmentSlot -> UItem
So to make it work like this I must write some kind of proxy from Slot to Item?
Or probably change the chain to ACharacter -> UEquipmentComponent -> TMap<USlot, UItem>
Ok the main question - there is no easy solution that I'm missing somehow and ReplicateSubobjects is the deepest native replication mechanics?
Normally you have Actors that are primary replicators and optionally components/objects below
Then I guess I can replicate TArray of pairs or something, and use it like this or convert on the other side
I'd just think very carefully about whether you really need replicated UObjects at all. They're a very special case, and the problem can often be solved a better way
Keep in mind that every object you replicate this way is hijacking the character actors' network channel - so if you add too much, you'll throttle it
I use replicated slots for my inventory but only because they need to hold state and have some properties of their own. Items themselves are not replicated though, they're either static data assets, or other actors usually.
Yeah I understand it, tho Equipment will be replicated only on changes which are actually happen really rare
Equipment should often just be it's own actor IMO, otherwise you're also wasting cycles comparing it's properties at the same rate as the character
My Item currently is UObject which holds links to DataAsset and instantiated BP Actor of this item
There's very good reasons to split replicated objects into their own actors usually
Equipment/weapons especially
Ok, thanks for advice, gotta think all this up
Have you first checked if HiddenInGame is a replicated property? It well might be
If it is, just set it on server
If it's not, you'll want to repnotify on some bool. Using a multicast for state is bad
Does someone have any idea why the montage isn't playing?
The add impulse function gets called and executed but the montage is only playing on the listen server and not multicasted
Tick the "Reliable" box below the replication method
I also have an issue where multicast events just 100% won't replicate even when no other messages sent
are you sure its not playing? try printing from Interupted, Begin, End
i just did that, the prints don't get called on the client
doesn't make any difference
Does your actor replicate?
Wait, that's a pawn, right?
Make sure you hadn't uncheck the "Replicates" box in the class defaults
how do I use unreal insights for network profiiling correctly? I'm launching my project in standalone mode tracing parameters from the editor. I've tried launching the insights before and after launching the game clients but still even if I see LIVE session its size is always 0 KB and no network information when I'm opening that session.
ok nvm. had to start the editor after I started the insights
hi guys! i've run into a bit of an issue. i have a replicatable actor, which is constructed on left click. One client (on play as listen server) can see the others placed actors, but not vice versa. Any help would be appreciated. Thanks!
heres my code
heres actor properties
the server (ie. the authority) must always spawn the actor in order for other clients to see it
^, in your case the client is the one doing it as input is fired on client
So you have to server RPC after the input is fired
On listen server it's okay, as the local controller is on server
Ticking all these checkboxes won't change anything
done everything in #blueprint , thanks!
if i modify a struct within a replicated struct, should i expect the updates to that struct to be sent to the client?
yeus
The pickaxe mesh appears for the owning player but not other clients, and I'm not too sure why, does anyone have any ideas?
Because you're only sending it to the client
That should be a repnotify tho
no RPC required
just repnotify on ItemID
Should I change owning client to multicast, then have the custom server event run the multicast from the event tick?
No, just repnotify on ItemID
ItemID drives the whole thing right?
Client picks ItemID
Client sends to server
Server sets the variable
Everyone updates on the RepNotify
So my item ID variable is ran from the Q Key. When the Q Key is pressed, it plus 1 to the variable, and when it reaches over 4, it resets back to 0, in the image, I was hoping that the result of when the item ID is 1, it would set the static mesh, it does this successfully on the client, however, on the server, other players cant see it
Q key -> Call ServerChangeItem
ServerChangeItem -> do math to update ItemID
RepNotify -> get ItemID -> Do stuff based on it
It'll Just Work(tm)
RepNotify is a function that fires whenever the variable is replicated (actually whenever its' changed but it's weird in BP)
Ill give the above a go, and keep you updated on the result, thanks for your patience btw, Im still very new to multiplayer programming haha
When in doubt, do it with a RepNotify because they're great.
Holy shit it works, thanks so much man
For anyone in the same situation as me, here is what I did thanks to the user above!
Why the flipflop
You can do the set with math. Use modulo %
Does your RepNotify just call that bottom event then?
Also try out a Select node on ItemID
You can Select mesh given int
Oh yeah, that would make things 10 times easier so I dont have to keep using branches
The flip flop was also just an accident, 4am working haha
Hello Everyone!
I was wondering if it's possible to do the following.
I am working on a multiplayer application for the Hololens2, Oculus Quest II, Linux/x64 Desktop.
I would like to be able to include Plugins that work for some platforms but not others. These plugins would only be used on their supported platforms. But at the end of the day these platforms are still able to connect together in atleast 1 agnostic multiplayer environment.
Is this possible through #if #endif blocks?
Reccomend place to init player HUD? Currently have it as an RPC Event in bp's but can't help the feeling that this doesn't need to be an RPC but rather a inside a function that only gets executed on the client side.
In the HUD
You have a HUD class
it can hold all your widgets
huh guess I missed that. Thanks man!
whats the fastest way to set up online multiplayer so i can test stuff with my friends?
do i need to set up some subsystem or can i just cheese localhost with hamachi or something?
You can always just open IPADDRESS and have the port forwarded
depends if my router will actually let me forward lol
else i will have to use hamachi i guess 😅
Have you tried the advanced sessions plugin? It should be pretty plug and play and then you can use Steam
i have already set up my own sessions thing
im just not sure how to best get it working online because the portforwarding doesnt seem to work on this router
So you want to use LAN sessions. Online.
Something like Hamachi is your only option it looks like, unless you just get Steam going
You might be able to do some stuff with your own onlinesubsystem but that's more work.
is it a good idea to ditch whatever the steam subsystem has going for matchmaking and making my own?
If you have a team of people maybe. If it comes down to just you having to do it I would not. It’s quite a bit of effort, you need to host your own servers for it, write an implementation for the system and maintain it all.
Are you good enough at this to make it worth it?
Even then, assuming it’s not a team then it’s not worth the development time in my opinion you lose on it and having to maintain it.
There’s only so much time one person has 🙂
Yeah. If you're making Valorant, sure, go for it.
If you're making My First Indie Game, hell naw
Yes the actor replicates, and it s the base character blueprint that i m using
Is it possible to use EOS with LyraStarterGame with an installed version of UE5?
<@&213101288538374145>
I will have to work from my car for the next 5 months and needed a good either USB powered laptop or 2in 1 tablet that I could run unreal on, can someone recommend something it needs to charge from USB in my cigarette lighter in my car
That's not a #multiplayer question but didn't we already have that talk last night?
It depends on your budget but anything with a decent Ryzen processor and 16gigs of ram should do the trick. Don't expect to run a heavy scene in editor at 60fps but it'll be just fine for doing dev work.
@dark edge yeah I'm seeing if anyone else used something else, I'm not a big fan of AMD stuff, although I do see a good used one that I might buy, I also wonder if anyone else used remote programs like TeamViewer vs buying a tablet
I have been using TeamViewer on my laptop using my powerful PC at home and it's working pretty good
Good luck doing that from your car
I recommend AMD if you're NOT getting something with a big GPU
If you are it doesn't matter
but for integrated, AMD blows Intel out of the water
I already have like a desktop power laptop but I heard some of the new laptops charge via USBC although I can't see how that would be possible to power a big GPU and CPU
Hence my recommendation
Hey guys, I keep running into an odd problem where I have a TArray containing pointers to objects, and when it replicates, the array has the correct amount of elements, but all of them are null. The objects are just subclasses of UObject with
virtual bool IsSupportedForNetworking() const override { return true; }
so not actual Actors, but AbilitySystemComponent contains a replicated TArray of UAttributeSet* which are also UObjects, so that shouldn't be the problem? If anyone could help, I would greatly appreciate it!
The owner does have the array in GetLifetimeReplicatedProps as DOREPLIFETIME, or do you mean something else?
Did you read what I sent you?
He should have this implemented too : ReplicateSubobjects
UObjects aren't supported for networking with ease
Oh, I see! I had that elsewhere, but not on this parent class it seems! Will give it a whirl, thank you! 🙂
Yup, that did the trick! Thank you!
I use a spline mesh to create sidewalks / other spline assets. When characters are standing on this spline, clients see the character walking in place while the server sees clients standing still like normal. Does anyone know why spline meshes cause characters to walk in place when standing on them? Further, why it would only show up like that on clients?
Clients are probably not able to resolve the component the characters are walking on. Is any of this generated procedurally?
The system will select the mesh whos size fits the spline section best (uses multiple meshes if necessary) and stretch / warp it to fit into place along the spline. Im not sure if this counts as procedural. @chrome bay
Are you spawning the mesh components at runtime?
It is done on construction of the actor
Everything is placed before starting the game
Yeah in which case it the components will not be net addressable
You can try one of two things, make sure every mesh component you place has "Can Character Step On" set to false
or, go into C++ and generate the mesh components with deterministic names, and force them to be net-addressable
(or spawn them on the server and replicate them all ofc, but that would be insane)
The step on worked! Just before submitting this question I did the opposite and set it to true for everything. So close lol - Thank you!!!!
Just keep in mind any meshes/components generated that way cannot be sent over the network (either as references or replicated properties)
Can do thank you! I found success in deleting specific meshes by doing a multicase telling everyone what index to remove. This seems to work so far - let me know if this isnt something i should be doing. Thank you again!
Depends really, if you are making stateful/persistent changes to the world you should avoid RPCs and use replicated properties
Since if a client joins late for instance, or the RPC doesn't arrive, they will be permanently out of sync
Ohhhh you know I am using this to learn replication and was wondering how to sync everyone up on join. That answers that. Would logging the destroyed indexes on the server and having the clients delete them on begin play be a viable option?
IMO not really. The sensible option is to replicate an array of deleted ID's. Whenever a client joins, they will receive those deleted ID's automatically and can apply it to their world at the appropriate time
How do I determine the appropriate time?
Depending on how you're treating the indexes, they may also go out of sync because clients might delete things in different orders as they receive updates. You should assign fixed, deterministic ID's to each item
That's up to you really
What does the character can step on property even do?
It allows the component to be a "base" for movement
E.g, you can stand on it and move with it
it also means your movement becomes relative to that base
But in order for it to work, the CMC needs to send the component reference over the network
Oh, didn't know Unreal had support for movement relative to a platform the character is standing on, neat!
wtf? why is my game state a PlayerController?!
This is black magic
dude i am so confused. i'm adding breakpoints to SetGameState and it's a valid GameState
why in the world is GetGameState returning a controller????
Prolly GameState is the misleading name?
World->GameState is a APlayerController here
by far the weirdest bug i've seen thus far
how in the world is this possible
this is a rider bug. the game state is actually nullptr.
@vague spruce by any chance do you have GAllowActorScriptExecutionInEditor in a constructor?
nvm xD
didnt read below
yeah my game state is actually nullptr. now i just need to figure out why
thats what I wrote is relevant btw
it breaks rpcs
and the whole unreal architecture
my dedicated server had a HUD
(just one off detail btw)
🚑
this breaks the whole unreal architecture?
yes
i don't have any instance of that in my codebase
beyond unimaginable limits
so i have to assume it's not that
so i understand now that rider was showing me the wrong information, but i'm not understanding why my game state is null in my world when i can SEE it being created in SetGameState
i'm on remote desktop so, my bad for the screenshots
and the game state that is being assigned is correct too:
the only thing i can think of is that there's two worlds: one in the server and one in the client
and then the client one is empty
im in a choo-choo 🚅 so... heh pictures wont arrive
Maybe you are trying to get it on client and it's just too early(i.e, it hasn't replicated yet)
yeah so this is a client RPC as soon as the pawn is possessed
im gonna just try to pass the data from the server game state over to the client and see what happens
So the issue is that GameState is a nullptr? Are you debugging on a client or server?
it worked
GameState is a nullptr on the client when i go to check it but it's valid on the server
i just needed to get the state i needed from the server and pass it to the client, things are working now
not sure why the game state is not yet replicated to the client, oh well
Correct me if I'm wrong someone, but I believe actors including the gamestate don't have a specific replication order?
yeah i have to assume that the application occurs at random
depending on the buffer
you need the world event manager ™️
you need the world event manager ™️
safely initialize your network events ™️
lmao u can really tell im in a train
it's MINE
the world has delegates you can subscribe to
jk
Your properties replicate twice?
I'll do ya one better
But how does that help with replication order?
The idea is you bind to CallAndRegister_OnNetworkGameReady(), which is broadcast when all the actors you need are received
^ network event subsystem ™️ ✨
I had to rewrite it recently so chose a better name 😄
okay im redoing the marketing x'D
@chrome bay btw if you have a post that goes along this one piece of code lets get it pinned because its a pretty recurrent topic
oh lawwwwd it coming
Yeah really
Got into a "general network practice" post and it's got out of control so I need to break it into chunks
LMFAO
(and make it coherent)
But that .zip should give the general idea... it's pretty useful
yeah, I'll probably put a sample together
i keep forgetting
anyways thank you for the open source contribs james
tunnel time (nooooo 🚆 )
So if I understand it correctly it just checks if certain stuff has been replicated?
yeah, then pushes an event out when it does
But since the subsystem always exists, objects that are looking for those actors or are dependent on them to initialize can just bind to the event
e.g. you've spawned a UMG widget, and it needs to bind to some GameState events. If the GameState doesn't exist, your in trouble - so this way you can be notified when it exists, then setup your bindings etc.
tbh that's mostly what I use it for, UI stuff
@chrome bayWould you put gameplay dispatchers there too?
OnCharacterDied
OnWhateverElse
Etc?
Like a generic open mouth open ear dispatcher so everything that cares can know if a thing happened
I guess you could, I just use this as a more generic event thing
Just to skirt around the race conditions between actors
I was thinking GameState for it but if gamestate isn't always guaranteed to be there
Especially ones that are quite "core" and need to be accessed by many things
Yeah, well that's what this solves in a sense
So what's guaranteed to exist on client, just the world?
Yeah the world and it's subsystems will be present before actors do anything
The subsystem IMO is a nicer approach to something like a static delegate (which is what I used to do, but then you have headaches in PIE etc. too)
And you can talk to it from BP also
Yeah i love subsystems. I'm starting to wonder why they didn't just add networking to subsystems then you could replace GameState etc with them
the ethereal actors
tbh Lyra is going that way...
but you can ofc combine subsystems with replicated actors also, but you can't get around the actors not being available when ytou need em
I take it the way to "replicate" a subsystem is to have it spawn a replicated actor and use it to do the replication?
If server -> spawn actor
Actor begin play -> hook stuff up -> ready to go
if i have a ready check for each player, where do i actually check if all 4 players are ready? i want to open the level and let each player possess their respective pawns once they are.
If you're asking 'where' as in client/server then on the server. If you're asking 'where' as in on the server I would just do it in your check whenever a player says they are ready and then check if the rest is also ready.
Also @chrome bay question about your system. APlayerController seems to always have bNetLoadOnClient set to true. Which makes me wonder if the actor reference it self isn't technically IsValid before actually being network ready?
hi. this is an issue that bugs me every once in a while so i figured i'd mention it here. anyone know how to stop these kinds of jarring corrections when issuing navmesh movements on the server/client at the same time?
bNetLoadOnClient = true; is the default for all actors I'm fairly sure
(and they are not serialized into the UWorld)
Server spawns them
Ah yeah makes sense, probably because of Seamless Travel.
Controllers have pretty unique behaviour with travel though, I don't think you could do much before they are valid
If they aren't serialised into the world I guess there's no problem yeah.
They do travel accross from the old world anyway IIRC
the check would in the widget itself, which wouldnt be on the server. should i do the check somewhere else?
Is it like a "all players must be ready before the host can start the game" kind of thing?
Player tells server it's ready
Server checks if all are ready
start game
yeah it is, but the host would be a dedicated server
But could it then be the case that the controller is a valid Actor while connected already?
Every time a player updates their own ready state, you do some check and proceed
Player Unreadies -> do check -> oh shit, cancel start
thats right, but i dont know where to actually put the check
The server I would say. The server should tell all clients that all others are ready.
sorry im not being clear lol; i meant as in, what blueprint do i put the check?
in what blueprint does the server actually recieve the ready check and start the match once theyre all ready?
I would just put it wherever the server receives the message from a player that they are ready for the game.
yes but i dont know where that would be 😅
How do you currently tell the server from a client that they are ready?
i don't yet. hence my question
Not entirely sure if Unreal has a built in system for this in specific. But the simple solution would be to just send a RPC through the player controller to the server after they clicked some button.
You could also do it in the player state where you then can immediately use a replicated variable if you want to show other players that specific players are ready.
my problem isnt the sending, its the recieving. as in, in what object should the server store the ready status of each player
PlayerState
I would say either game state or player state.
Game state is nicely able to group it all together so it's easy to just say 'everyone is ready now'.
Player state is likely nicer to see which individual person is ready if you want to show that but you would need to check all other player states to start the game.
Kind of just depends on what you really want honestly. There's also the possibility that you don't want other clients to know who is ready, then I would do it in the game mode.
But that might already exist
ideally i'd have each player see the ready state of others; so i guess ill use player state then? thanks 😄
A part of the STATE of the PLAYER is whether or not they are ready, so I'd say it fits.
Check that you don't already have that variable tho, I thought there was a bIsReady
I don't see anything like that in player state. I thought there was something somewhere though but I don't remember.
Oh wait I was thinking of GameState that has a replicated FName as 'match state'
If you're using seamless travel then it should. If you're not then no.
Except I think local Client player states?
Depends on what persists really mean. The docs are really shitty at explaining this but PlayerStates will be automatically reinstantiated though most of the data won't persist. To persist its data override APlayerState::CopyProerties and put the data you want to persist in there. Though you have to seamless travel in order for this to work
im asking because i have my player select a character and then play in a different level. im using gameinstance to store the selected character at the moment but i was wondering if i should store it somewhere else
GameInstance is local only
Nope
You should tell the server what character you want to play as because in the end the server has to spawn it.
Nothing but this ^ will persist with its data a non seamless travel
"nope" it doesn't keep them or "nope" they are being kept alive?
The data won't be kept if it's a non seamless
They will always be destroyed and recreated
No matter if it's seamless or non
Seamless keeps playerstates on the server though.
That's not correct