#multiplayer
1 messages ยท Page 304 of 1
Ok
The PlayerState only takes care of getting the name
and setting it to a replicated variable (in himself)
So it only takes care of getting and saving the varaible
Not of setting it in the PlayerCHaracter
Now, as a separated thing, you have your Character and the 3D Widget
Task now is: Get the PlayerState PlayerName into the 3D widget
Now the Character has an already existing pointer to the PlayerState
What you do is creating your widget, giving it a PlayerState variable and bind the PlayerName of that to the Text in your Widget
Then on begin Play of the Character
you simply pass the widget the PlayerState ref that your Character has
That's all
But the player doesn't have the right PlayerState, which is why I'm so confused.
Otherwise, I should just be able to ask for it now
It needs to have the correct one :O
Exactly, thasts wy I'm confused
The Variable "PlayerState" in your PlayerCharacter
To be sure, you could even pass the Widget the PlayerCharacter itself
And then get the PlayerState in the Widget itself
But it seems to me, that I'm having trouble because the UI I made is talking to a different Instance/State than the player once I've spawned
Hm, i don't really think that'S the problem
If you connect to a server
you get a unique PlayerController
A PlayerState
and then you Spawn a PlayerCharacter
and possess it
After that, you PlayerCharacter has a PlayerState pointer
that points to your PlayerState
It would break all net logic if that playerstate would be the wrong one
But I'm typing my name in before I connect to the server, so getting a new unique state is what's breaking
:O It can't be broken. I use the same stuff in all my Network project
Replicated PlayerName in the PlayerState and using the Controller and PlayerCharacter Pointer to access it
Don't say that, I'm pretty good at breaking things ๐
Just do it like I told you above
Ok
@thin stratus So, I got a lot of this code from the Unreal MP Blueprint Tutorial. All my menu logic lives in the Instance.
In that, I GetPlayerController and SetPlayerName to the state
and then I should be able to fetch that name from the Widget, yeah?
What does the Menu Logic have to do with it
Aren't you talking about the Name of the Player above the PlayerCharacters head?
I don't know, just thought I'd mention it. The Unreal tutorial skipped the persistance issue by just loading from a default savegame name after connecting to the server
I've set it up so that once you've typed in your name > server name and hit start, it saves the name to the PlayerState
But that's running in the instance logic. Which seemed weird, but it was on the official channel.
I should scrap that, shouldn't I?
So, what ever you set in the PlayerState before you connect
will be scrapped afaik
You only have two ways, without a subsystem, to do that
Save it in a SaveGame
or in the GameInstance
As both survive the level change
So when you select the name in the mainmenu
you save it to the GameInstance
And then in the next level you retrieve it
but I thought that already worked for you?
hi
But that's what I've been doing and you said not to
I was putting the name in the instance, then getting the player to state to get it back
That worked
The problem is that when I tried to get from the instance/State, I wasn't able to send the info to the right player
The player I was controlling had a new player state and instance
a Replicated Spawned PlayerCharacter
that is controlled by your PlayerController
has a PlayerState linked to it
if not, then something is really broken
And the GameInstance needs to be valid at all times
if not, then shits broken
I am searching for help to package a multiplayer game, using a dedicated server, and a client
But you still haven't told me if oyu've done what I explained above
@steady verge Any specific problems?
I think it is not specific, but I followed this wiki : https://wiki.unrealengine.com/Dedicated_Server_Guide_(Windows_%26_Linux)
I 've cooked with Frontend my content, and I ve build with VS my server exe
but I don't know to launch my server and my client, where to put content and exe together
If your Server is compiled
for moment, my server.exe is launching, and quitting immediately, I don't know where to look at logs, and there is no error in console
And you used front end to package it
I did
then you should have an .exe file for the Server
too
And that's bascially it :x
Hm, it's closing direclty
Are you packaging shipping or dev build?
sorry I got a window error
failed to open descriptor file ../../..Engine/pocshim.uproject
My aim is to package, and to copy it on a server I own
That's the error for the Server?
yes
Afaik, you need to use the Source version of the Engine
and that should also have a Source version of the frontend
both feature the code to actually compile the Server and package it
I haven't done this in a while
but that error is weird, as it shouldn't require a uproject file
yeah, I didn't see lot of documentation.... It seems lot of people did solo game, and/or never deliver it ๐
yeah I agree
There is no topic about, what happens after (trouble, error, how to make it right on a different server....)
One day, I make it run, but I didn't write anything on how I make it successfull.... bad time for me
This time I think I will write some blog post ๐
@thin stratus Your answer still relies on the character accessing the PlayerState to get the name
It won't. because something is very broken in my game
That's what I've been confused over for a week now
All of the things I've tried should work
and I can't see why I'm getting the wrong info
So, I put the code you said in to PlayerInfo and PrintString the info
My character has a valid player state, but the values are the defaults
And get the PlayerState from that ref inside the Widget
In a binding
The Values are the default?
Yeah, that's what I'm saying. The playerstate that comes from the menus is not the same as the ones that players are seeing
They're both valid, just not connected
Sorry, been awake for a while
I mean the player state that gets the right name from the instance
It's able to send that name somewhere, but not the controller I'm controlling
and vice-versa
i.e. it's knackered
Maybe I should write it all again, because this doesn't seem like it should be happening, you're right that this should all be easy
Just so we are on the same end
This is how it works
or should work
PlayerController, of course, only exists on the Server and the Owning Client
Client A doesn't have PlayerController B
They all have the PlayerStates and the PlayerCharacter though
And normally, the PlayerState B is owned by the PlayerContorller B
which would return exactly that on the Server and the Owning Client
Would return Null on the other clients of course
So after possessing Character B with PC B
Character B should point to PlayerState B
if not, then my life is a lie
I think I get that, but I could be wrong, so I'll go through what I think that code we did does and we'll see....
The PlayerState loads and check Auth, which means it only runs on the server version
Then it told the local client to get the name from its instance save it in the server player state
then on the server, it sets the rep notify variable and the client sets its text to the name we sent, which is the one the server version of the PlayerState holds
and that should all happen for each client when they log in to the server
Yeah?
Ok so,
PlayerState A, the one of Client A, spawns. Calls BeginPlay on all Instances.
Means Server, Client A and Client B.
It then limits the call to the Server instance with the Authority.
It then goes to Client A Version (owning Client is Client A!) and asks him for the
Name. Since we are on Client A now, the GameInstance is also the one of Client A.
We are really ON the Game of Client A at this point.
Now we pass it back to the Server (if owning client!, that's why Server RPCs don't work on Server owned actors), and he sets the Replicated Variable.
That Variable will now update (with a small delay based on ping) on Client A and B
At this point, you successfully got and replicated the Variable
Then it comes to getting this Variable to other Actors
Such as the PlayerCharacter
The Idea of getting the Owner in the OnRep Function doesn't work, as OnRep gets called on Client A and Client B
And if the Owner is the PlayerController
Then Client B will get "null"
So you need to do it differently
Ok.
That's where I want you to use the 3D Widget
Because at this point, we have PlayerState A with a Replicated Variable on all Clients and Server
So here you now go and go to the PlayerCharacter
One moment
If I test this by running one instance as a nondedicated server, I'm still not seeing the right name in my player state
So only one Player?
Yeah
Does he call the Authority node?
If you only type in a "1" to the settings and don't use a Dedicated Server, you might start as a Player without any network connection. So he's not even a ListenServer
Could totally be that replication logic fails at that point
In a normal situation, you always have a Server
It shouldn't fail though iirc
It was set using the authority node, I'm just trying to see how I check it from the controller
I thoughtt the controller needed to see it anyway
Forget about the Controller
It's not important here at all
Despite possessing the pawn
Ok
First goal for you, is to have the correct PlayerName, in your PlayerState PlayerName variable
Ok, in the Widget, create a PlayerCharacter reference
Then create a BINDING Function for the Widget Text you probably created in the Designer
Done
In that function, you check if the PlayerCharacter ref is valid, if yes, yo uget the PlayerState of it and also check if it's valid
Then you cast it and get the PlayerName from it
And set that as the out put
aka return value
Done
Then, for the sake of having it properly, copy paste the Return node
and connect it to the "Not valid" and "Cast failed" execs
cause the widgets wants to know what value to use if they are not valid
(general rule, a function needs to return a value on all possible exec ways)
Othterwise you will see blue warning anyway
So now, in your PlayerCharacter
Add a Widget Component
and select the Widget class in teh details panel
And then do this in teh BeginPlay of the Character
And that should be it :x
Ehm
You are not using your own playername variable there
You are using the one that already exists in the PlayerState
That's for error checking, because it's a VR char and that's a pain to look at in game
MachineName-2ds5a4ds
That's what it's setting too
So it's getting there
Er, isn't that readonly?
Yes and no
The variable is read only
But you can change it with either a console command
or a gamemode function
When you are on the Server Version of the PlayerState again
Where you would set the variable
get your GameMode
and call "ChangeName"
And for the Player you get the Owner of the Playerstate and cast it to playercontroller
Simpler would be replacing the Var with your own though
I've got a custom variable in my on VRPlayerState
Yeah then use that?
Cast the PlayerState ref to your custom PlayerState
and use that
Casting on tick is quite mรคh, but it's okay for now
:P it shouldn't
It's setting it on the wrong PlayerState, but it's working on a playerstate
I PrintString the result and it prints the right value
I bet you wish you hadn't started helping ๐
Not true
I just don't understand where it's going wrong
Let's forget about the PlayerCharacter for a second
You know what, it's probably too hard to figure out remotely
In your PlayerState, if you Print the custom PlayerName on tick
Does everyone print the correct PlayerNames?
I know what that's like
I'm going to start a project from scratch and take it in stages, do everything properly.
What I've done here is take 3 different parts and mashed them together and broken something
I have the VRPlugin going, the MP blueprint tutorial and bunch of stuff I wrote myself for single player
Bah, the MP tutorial
Yeah...
I think I understand enough to do that myself
and here was me hoping to get some sleep this year...
Thanks loads for the help, it's been really... helpful ๐
Hmm does anyone have an idea why my transforms are set upside down and offset on the client.. but not on the server pawn. in this case? it's not just clientside. but all pawns but the one who is on the listenserver has the wierd transforms.
This is the repnot function
Hi, Can components call RPCs? I am asking this because I tried to replicate a variable with an RPC function on a component and it didn't work, I did the same thing on an actor and it worked perfectly.
I think components aren't replicated by default.
So you should check the checkbox for RPCs to work.
Are you the guy with the Modular Vehicle on the MP btw?
@signal lance
Thanks, Modular Vehicles are not mine, this is my plugin https://www.unrealengine.com/marketplace/item/dec7a44f06c54ff28d2db5b62574629c
My bad, I mixed stuff in my head, I knew I remembered something interesting related to you: https://forums.unrealengine.com/showthread.php?119270-Marketplace-C-Plugin-Air-resistance-simulation
Hi,
I made a C++ plugin to easily simulate air resistance, I made it for my game to simulate drag on the vehicles. It can be used from simulating drag on the vehicles to making airplanes.
It is easy to add it to any actor in the scene, this plugin comes with custom scene component called Aerodynamic surface and an actor component that needs to be attached to your actor.
Aerodynamics surfaces should be placed on the wings or any other surface that needs to simulate drag.
I plan to submit
I'm particularly interested in buying this
<--- Aerospace background
Is it scripted with basic aerodynamics in mind or does it also include stability/aeroelasticity?
It basically simulates the force based on the current speed of that specific component, it is not really accurate to real world physics but it does the job. I decided to sell it as a part of another plugin that I am working on.
I see.. Thanks! If you could add at least flutter/buffetting, I'd be your no. 1 fan, but I doubt that's too feasible for a generic vid game aircraft
Did that component rep stuff work?
I am going to try it later. I will definitely do some more research so I can improve the simulation before I release it.
hey guys
I can't get the multiplayer shootout example to work over my network
neither the multiplayer code from it in my own project
if i run the program twice on my computer it works fine
What subsystem are you using?
steam on the multiplayer shootout, none on my projects
[OnlineSubsystem]
DefaultPlatformService=Null thats what you mean?
alright, so is steam open on both computers? And is your project using app id 480?
Yea
if you want to do internet you should use steam.
Null will only work for LAN play
yeah, that would be a start ๐
so I just want it to work in Lan for a start
but i can't see games I host on the other computer
Can I see your code for hosting/joining a session?
it is literally the Multiplayer shootout example i am running
but I can send you the code, sec
do i need to run steam even if i only want to find games on lan?
And i mean, if i run the program twice on my computer I can join sessions with no problem
if you use steam you need to have a separate account for each machine
no you don't need steam if you are using LAN
is EnableLAN check to true?
you can set that in the menu
doesn't work with any combination
I am using win 7 on one pc and win 10 on the other
I got it working some time ago, but I think that was with 2x Win7
oh wow i got it running over evolve
Thanks for your help guys!
is there a way to enable the client to use inputs? Currently when my client joins a server they aren't allowed to use input controls from the player character
inputs as in input actions? Yes, clients can use them
Does anyone have a check list of all that is needed for a multiplayer lan setup?
Or an example? I think my blueprints set up but want to compare
I just want my, and my friends computers to play together
Well, a list of what you need for the base of all bases of LAN play: The direct IP connection:
- An "OpenLevel" node, with "listen" as an option, to host a game.
- An "ExecuteConsoleCommand" node, with "open IPADDRESS", to connect, while IPADDRESS the ip-address of your friends PC in LAN or even internet is
And a list of things you need for session based connection:
- A "CreateSession" node to create a Session as the Host, followed by the OpenLevel Node with "listen" as an option again
- A "FindSessions" node on the one who wants to connect to search the LAN for Sessions
- A "JoinSession" node to connect to the hopefully found session
- A "DestroySession" node, for when you enter the MainMenu again, cause you need to detroy your session to actually connect/host a second time (otherwise you might need to restart the game every time
@gaunt kestrel Woudl that answer your request?
@thin stratus this is very helpful!
Does the Open level, listen, and ExecuteConsoleCommand happen in the game mode blueprint?
Is this good for in my player's blueprint? There is only going to be one session over land so I'm trying to keep it pretty simple:
We're trying to get a multiplayer version of our game working in time for SXSW Gaming Expo
Something like this?
Oops the "Find Session" one casts to GameInstance and calls the "Find Session event"
Yes, something like that
Of course you want to make sure that the Session array is actualyl not empty before getting the 0 entry
and you may want to increase the number of results
The CreateSession event should only call the OpenLevel when it succeeds
and not in the normal call
so disconnect the upper exec
the console commadn is not needed
OpenLevel with the listen option is enough
And you should not cast the PlayerController to GameInstance
But the "GetGameInstance"
I mean, makes no sense to cast the PlayerController to the gameinstance :P
@gaunt kestrel
better? I was searching if I should use length or last index for the array.
How do I test this?
And
Which player start would each player use?
For the player starts you'll need to create spawning logic of you want to tell them to spawn at a specific point. This should be done in the game mode class.
if an actor is marked for replication, and I destroy it on the server, will that destroy it for all networked clients too?
or do I need to call it to be destroyed on each client too?
I think it should destroy it on all clients.
LastIndex is Length-1. Arrays start at 0 and go to Length-1.
If you want to know if something is in it, youcheck if the Length is greater 0.
And you are still calling "OpenLevel" on both execs, remove the upper one, otherwise it will open the level directly instead of waiting for the creation process to finish
@gaunt kestrel
i don't suppose any of you know what bIsSystemWide is used for in the voice stuff?
Sorta Ue4 related, I'm trying to pass a message through TCP but I was wondering if any of you knew or had a simple TCP listener so that I can see the read out of the message in that program.
you could use wireshark and just sniff the line
@thin stratus Oh okay thank you! I googled it but apparently read the wrong forum post.
@stiff wasp Would this be the logic I would follow? https://forums.unrealengine.com/showthread.php?2107-Come-Learn-Blueprint-Multiplayer-with-me!-(aka-Tom-s-a-Glutton-for-Punishment)&p=12895&viewfull=1#post12895
Update: Blueprint Multiplayer Movement replication is officially good to go! Here's a shortcut to the tutorial post:
https://forums.unrealengine.com/showthread.php?2107-Come-Learn-Blueprint-Multiplayer-with-me!-(aka-Tom-s-a-Glutton-for-Punishment)&p=19427&viewfull=1#post19427
Hello intrepid UE4 Blueprinters!
Welcome to what is assuredly a fiasco in the making! :D
I'm trying to make a Blueprint-only multiplayer game. I'm going to start VERY small and try and build from there. I want to
I am working on custom client - side prediction system for my project and I am curious if there is anything similar to Tick but for Net updates. Currently I am executing my logic on Tick and if the framerate is low it gets very laggy. Standard Movement replication seems like it is framerate independent. I am doing this in C++, thanks.
@signal lance Try setting a timer that checks every x seconds
the starts on Event Begin Play
Hmm, I will try that, thanks
Hey guys, quick question for any multiplayer pro that might find themselves hanging out in the UE4 Discord. I want to edit a material parameter to change the colour of a player. The 'LinearColor' variable is set in the player state and the DMI functions to handle this are called on the characters BeginPlay. I'm struggling figuring out how to have each players specific colour appear on all clients/server. Anyone got a quick tip or ideas?
You should be able to get the pawn's PlayerState directly, no? @dreamy schooner
Though I'm not 100% sure it's always available at BeginPlay, in which case you could use OnRep_PlayerState
And you probably should use that, just to avoid any race conditions
Even if you find it works on BeginPlay over LAN or in a single instance, it would most likely fail often over the internet
Does LAN include over ethernet?
ie, can I plug my ethernet into my friends computer and using LAN connet with him?
@brittle sinew Where should I access the PlayerState from? Through the game mode using a loop to run through each player character?
Well, you could just access it on the character directly
If you put it in OnRep_PlayerState, it'll get called on all clients as soon as the PlayerState arrives
I'm currently calling a function "SetupPlayerCustomistion" on players BeginPlay which then talks to the PlayerState to retrieve the colour and set the material parameter. But this doesn't show on both client/server.
Could you show me how you're doing it?
And again, if the PlayerState doesn't exist when BeginPlay is called, nothing will happen
So it's best to use the OnRep function
I just used the RepNotify to call "SetupPlayerCustomisation" and am having positive results. The server now has the correct colour displayed on both, but the client is using the default parameter value, set in the material. I'll snap a quick screenshot to show you what I'm talking about.
So if I have a crossover cable, connect it to both computers, should it work?
You might run into network connection issues, I really have no idea
Is there any issue with connecting to the router via wifi or ethernet?
Top is server, bottom is client. Both should be showing the orange circle, which is set in the PlayerState. The purple is just the default value of the "colour" parameter.
Sure, but do you mind showing at least the function and its call? Just want to make sure things are done how they should be
Ah, fair enough. I can't really help a ton on the networking side...all I can tell you is if you get the connection working then UE4 should work ๐
Both of these functions exist in the player character blueprint, but it seems to be only called for the server.
Hmm, so are you saying that the customize function doesn't get called on clients? Because if so, that's something completely other than the PlayerState
It seems that way. Thinking of it now the HUD widget is also not added to the clients viewport, which is also done in BeginPlay. Could there be a reason the client player character is not calling BeginPlay?
That should really never be the case, something weird might be up
When it first loads up the client camera is in the ground, not up in the air like the server, then after a second or so it snaps to normal. Is this normal?
It could be that the possession is happening late? Not too sure, but a timing issue over MP might be in play
And just wondering, how did you get that OnRep function in BP? Doesn't look exposed to BP by default, but I could be overlooking something really stupid hahaha
When I set the PlayerState variable to "RepNotify" in the Replication drop down box, it was created automatically.
Oh, so is this a variable you created yourself?
Yeah. Is that not the correct way to access it?
Well, APawn has a PlayerState variable by default that gets set automatically within its code
That's what I was referring to; it might be hard to get the PlayerStates all working out of the box by scratch
I get the default player state, then cast it to my PlayerstateBP, which then gets set to the variable that I am accessing.
Ah, okay. Then there definitely is a bigger issue with BeginPlay not being called and the OnRep not being called
Well I posted on reddit.
I think only certain parts of BeginPlay are not being called, both characters have weapons spawned and attached to them, which is a function called by BeginPlay. Could be a cast failing. I will inventigate.
I don't imagine the question has much to do with UE4 at all at this point really @gaunt kestrel
More if you can get the network setup at all
I'm pretty sure i have the network setup
my partner is just away for christmas
so I cant test it
So after using delays and print strings I've discovered that it takes a second for the player state to get up and running. So maybe it isn't the best place to store customisation information. What kind of variables and functions are best placed in the player state? Where should I keep customisation information like player colour?
Well, if it works on your PC
then ti works for your friend
despite the fact that he might have a firewall that blocks you
@dreamy schooner PlayerState is used to store information about a specific player, while making sure it's available for everyone else
Score, PlayerName, TeamNumber
Of course, with 4.14 you can limit replication to the owner in blueprints
So you could also not share replication with everyone
So if you have a variable for the color of your player, which should survive the Character death (destroy actor)
and it should be visible for everyone else
then yeah, PlayerState
Yeah it sounds like I have it in the right place. Any ideas why the player state doesn't seem to be accessible straight away on BeginPlay? If I delay the colour setting function by a couple seconds everything works.
You have a few things to deal with
PlayerCharacter and PlayerState are spawned when the game starts. While the PlayerCharacter could also be delayed by taking care of spawning him yourself
In general, you can't say if the PlayerState or the PlayerCharacter are spawned first
The second thing you need to pay attention to is the replication itself
Let's say the PlayerCharacter and the PlayerState spawn in the correct order and you can acces it
Nothing tells you that the color variable is actually already replicated when you try to access it on the Clients
So the best idea might be the following
You'll have the Variable in the PlayerState, either replicated or just on the Server, doesn't really matter.
Then you have the SAME* variable on the character class
Replicated with RepNotify
At BeginPlay of your Character, you try to access the PlayerState
Which is probably not working :P
Cause the BeginPlay gets called when you spawn the Pawn
the PlayerState variable is valid when you possess the Pawn
So the pawn calls begin play probably before you possess it, which makes controller and playerstate invalid in the Character
So you might wanna try the other way round
And on beginPlay of the PlayerState, (Switch has authority -> Authority exec) try to get teh PlayerPawn and pass it the color
And to make sure that you have it save in both directions, you use the Pawns "OnPossessed" function
WHich is called when it gets possessed. Should only get called on the server
In there, you should be able to get the PlayerState from the passed Controller
Might even be that you only need the OnPossessed event
Some good ideas, i'll try them out. Thanks for going over that for me.
I would try the OnPossessed first
Might be that the BeginPlay of the PlayerState isn't even needed
And yeah, cheers :P
I think I have my issue resolved
I'm going to buy a switch and set both computers IPs to static.
@thin stratus Do you maybe have any tips for this, someone suggested a timer but it is still very laggy. "I am working on custom client - side prediction system for my project and I am curious if there is anything similar to Tick but for Net updates. Currently I am executing my logic on Tick and if the framerate is low it gets very laggy. Standard Movement replication seems like it is framerate independent. I am doing this in C++, thanks."
Hm, don't know tbh
Could probably check some stuff out, but no time for that atm, sorry buddy
Ok, thanks
ugh for some reason I can do a POST and send a variable and it works fine. but when I do a GET the same variable isn't coming across
๐ฑ
hm
is SetContentAsString not meant for GET?
should I just be passing the parameter in SetURL instead?
so what are steam leadersboards? is that for storing persistent player data? like level, kills, deaths, etc? does steam have built in stuff like that where it stores to a db?
hey guys
when using sessions
do you still use the regular RPC functions
to replicate stuff over the network
ye
hm
also for sonme reason
ever since we moved to 4.14
steam overlay isnt working now
lul
i'm not on 14 yet, sorry
yeah
they added this new thing
that basically u have to include all of your plugins
inside of your .uproject file
took us like 4 days to figure it out
into plugins..
probably a base one for others to build upon idk
does anyone know how game menus work, like with dota2/LoL when you are at the menus are you connected to a server? currently in my game you don't connect to a server until you join a game. however, I am wanting to do http requests at the menu to retrieve things like the player's profile (stats). If I do this from the server I can't replicate the data to the client yet because he isn't connected to a server. And isn't it unsafe to do http requests directly from the client to retrieve data from a database?
Widgets are Slate
yeah
Slates offers more
yeah
I wouldn't use it until you actually need it
thats what it seems like to me lol
has anyone implemented custom character movement with correct prediction, etc.? I'm using this guide: https://wiki.unrealengine.com/Authoritative_Networked_Character_Movement
and I'm wondering why they send an input vector over reliable RPC for their dodges--isn't the input vector already part of what's being sent normally?
Hm
That code in there seems a bit messy @fringe dove
The Variable Name are kinda off
void UMyCharacterMovement::ServerSetMoveDirection_Implementation(const FVector& MoveDir)
{
MoveDirection = DodgeDir;
}
DodgeDir is only ever mentioned here and I'm kinda sure he meant MoveDir as that's what you get passed from the Client
Same thing here:
if (!CharacterOwner)
{
return;
}
//Store movement vector
if (PawnOwner->IsLocallyControlled())
{
MoveDirection = PawnOwner->GetLastMovementInputVector();
}
CharacterOwner gets checked but he uses PawnOwner
Maybe I'm just missing something, as I haven't read all of the tutorial
hey, dumb question, but my steam overlay doesn't show up in my standalone or in-editor game
i even tried the templates and they won't work either. i'm correctly adding the settings required in the ini, but still no overlay
I know 4.13 moved some of the stuff into plugins, but enabling the Steam networking plugin doesn't solve it either
what documentation did you follow
I remember doing Steam and there was something missing
@vivid siren
I've been following this page : https://answers.unrealengine.com/questions/484873/413-steam-setup-not-working.html
Steam is not available in-editor. You need to use Standalone
i've done full builds as well but they dont work either @fossil spoke
Are you logged into Steam?
is it a BP project
Yes
And I just enabled the Online Subsystem Steam plugin
now I'm going to update the ini file
now I'll restart editor
and im doing a window 64bit build now
oh
i guess i did something different this time
well uh, thanks, it works this time, lmao
lul
i think i had spaced in my ini file the first time tbh
are we talking about a packaged build or a standalone instance right form the editor
standalone
rite, so a question
is adding / updating / whatever Steamworks manually to your packaged builds still a thing
no, as far as i'm aware
im pretty sure all of the steamworks and sdk stuff is now included with the newer versions of ue4
hopefully ๐
When the SDK gets updated id say Epic will include the new version in the next release of the Engine.
hey if i'm testing steam sessions, is it possible to join myself?
say if i run two instances of the standalone version of my game, would i be able to host on one and join with the other?
i assume no because both are using the same steam account, but i thought i'd ask
No you cant. You need 2 accounts
thanks!
2 accounts might also mean 2 pcs
It's a bit annoying to test stuff for steam sessions when working alone
Well, you can install a virtual machine and test it out like that, worked for me
Argh VM's are soo slow for that, but yeah it's normally your only option ๐ฆ
๐
It's pretty common to have like 2/3 computers around I gess, heck I have like 6/7 that I own. Just only 1 that can even run ue4, the rest is 32 bit / waaaay to slow and crashes as soon as I load ue4 up
Hey all, how do I possess a pawn in multiplayer? It seems really random, sometimes the server gets a pawn, sometimes only one client, etc. I'm using GameMode to possess and spawn the characters.
If you mean when a client joins, the gamemode will use some (overridable) logic to try and find the optimal player start. Your issue sounds a bit like that you have a character which autoposessses instead of multiple player starts, but I'm a newbie and could be wrong ^^
Thanks. I do have auto-possess set to disabled, though.
Try removing just a character and only having player start things
Not sure if that'd fix it, but it sure does sound like something caused by that
I don't have any playercharacters in my level, they are all spawned by the with OnPostLogin. However, when a client joins, no playercharacter seems to even spawn.
by the gamemode*
Hm
Welp I'm a MP newbie but perhaps if I summon @thin stratus he knows the awnser? ๐
Oh you are doing it like that, I may actually know the issue ^^
So you are supposed to not be using OnPostLogin for that. ue4 spawns players by setting the player character in the gamemode and using a function in the gamemode to find the best player start object ๐ It'll create and posess the player's pawn there. If that makes sense
Alright, thanks. However, being a newbie, how would I go about doing this then? ๐
Just disconnect that code you connected to on begin play, and place a few of these in your level:
now 1 sec while I boot up my other project ๐
BeginPlay or OnPostLogin? I have no code on my BeginPlay :/
He can totally use the OnPostLogin if he removes the DefaultPawn from the GameMode
Otherwise he will have multiple unused pawns
Also the SpawnActor node should make sure to ALWAYS SPAWN, instead of Default
Cause if it doesn't spawn due to colliding, there won't be a pawn
My "Default Pawn Class" is empty, if that is what you meant
Yeah, then you can totally use the OnPostLogin
Also something I'd personally reccomend is hooking up a print statement to the is not valid, atleast for debugging
The code looks fine, just change the Collision setting of the SpawnActor node to "Always"
@thin stratus doesn't it still spawn in a default sphere pawn?
and also, you don't need the SwitchHasAuthority there
Atleast that's what I had last time
Cause GameMode doesn't exist on Clients
Thanks, trying it out.
@loud sage No
If you don't spawn any Actor, you'll sit with your "Camera" at the PlayerController position
Now my Server and Client 2 do get a pawn, but Client 1 doesn't. :/
And I tried printing if IsNotValid but that doesn't seem to be the error here
Anyone happen to know what's wrong with this code? When I connect a client the client just resets to the default map, and doesn't open the map I open here (the server however does move to the specified open map)
And that's an odd issue. hm
Sorry I can't help with that, I just use Execute console command and "open levelname?listen" :/
aha, I'll try that, ty in advance ๐
If you decide to try that, you'll have to use "open ipaddresshere" on the client
But no problem.
Tried removing SwitchHasAuthority, unfortunately the same thing happens where only the server and the last client that joins get a pawn.
What if you'd add a random unit vector * 100 or something. That'd give them a random offset sothat they wouldn't spawn in eachother
(no clue if that's it, but that's the only thing I could possibly think of)
I'll try it, but don't think it's the case as the server and client do spawn inside eachother but then quickly snap into a new position.
Yeah
I doubt it too, but atleast it's something to stripe of your possible causes list ๐
True ๐
Alright that wasn't the case :/
I feel like OnPostLogin isn't getting triggered by the middle-client.
Apparently it is.
Setting "start players as spectators" made Client 1 a spectator, while Server and Client 2 were correctly spawned.
Are you using a listen server?
I don't think so from what you said, but now I'm doubting
I'm just using the Editor... I selected number of players: 3
This is a bit creepy, because of using GameMode I can see a player on my main menu ๐
Okay so a listen server ๐ Does the client that doesn't properly spawn happen to be in the editor viewport instead of a seperate window?
also lol ๐
No problem
Apparently, after packing the package, it works. So it was just the editor play that didn't work. Weird.
Wierd
Could you try instead of pressing the play button try pressing the arrow next to it?
And then play in seperate viewport (PIE)
*New Editor Window
Still doesn't work
Well then I guess its editor related ยฏ_(ใ)_/ยฏ
Seems like it, yeah. Well atleast it works in the packaged project ๐
Woah. Whole PC crashed while packaging a project.
Hmm. The GameMode spawn/possess still doesn't work quite as I wanted it to. Even though Client 1 and 2 possess their pawns, the server doesn't possess one. There are also 2 extra pawns spawned that no controller possessess.
Is there a way to make it so that the server does not spawn a pawn at all for itself?
Actually, is there a node that first executes one thing, and after being recalled, executes another thing?
Has anyone had any luck with "Server Travel"? I cant seem to drag clients to the new level with the server.
@Minimpoun#3100 I am familiar with seamless travel as being necessary. To verify, I just need to turn it on in the game mode I use for the lobby?
@Minimpoun#3100
Didnt mean to link twice ๐
@drowsy zodiac There should be no need to use seamless travel. I'm not using it in my Lobby
As far as I understood, seamless travel also keeps the GameMode which makes less sense if you move from lobby to gameplay
Though no guarantee on that as i haven't played with it yet
@thin stratusy situation is trying to server travel when connected through steam. My structure is following you workflow from your marketplace item. When i try to travel from lobby to game through steam the client always seams to time out
So I am having sessions if it makes a difference
Hm haven't tested Steam, but ServerTravel shouldn't do anything Steam related. At least i would think so. Does it work without steam?
I haven't tried without steam. I will have to try it next test and double check.
I'm using sessions too
So no idea why it's failing. ServerTravel should just tell the clients to reconnect
Only scenario have had to connect through IP is over a dedicated server, which I hadn't established my lobby system fir
Ill try without steam and see if it works and let you know
Over 2 IP connections rather than lan that is
It could totally be that steam sessions do something different. So simply turn off steam and use subsystemNULL in LAN
If the travel works there, then we can try new things
Off to bed now. Good luck o7
Can I disconnect one of clients when playing game in editor "New Editor Window (PIE)"?
I want to debug disconnection of a player
Or may be some suggestions how it can be done.
I found a simple solution, a player can be disconnected on console command "disconnect" in his console :)
and then it can be connected again on command "open 127.0.0.1"
@wary cedar Thank you, now I don't have to package my project every time ๐
Is there a way to make UMG get a different variable depending on what Pawn you're possessing?
What I'm trying to do is: If I'm controlling FPC1, get the Health of FPC1. If controlling FPC2 (client 2), then get Health of FPC2.
Use an interface with a const function on both pawns and script different implementations for that function on each character to return their own health
@bronze lava
Thanks, I'll try it.
What are the DefaultEngine.ini setting for multiplayer over LAN
@drowsy zodiac @thin stratus no you don't need seamless travel. I was asking because of you are using seamless travel then my answer would have been different.
Has anyone had a sucsessful test of multiplayer on seperate computers after packaging?
I tried packaging and trying to connect both computers while using LAN on the same network but I kept failing to find and join the session
I have had luck
Anything special you did?
I'm trying it now with just the ThirdPersonTemplate
yeah it returned failed on the JoinSession failure
both computers were on the same network, and a session was found on my other computer
@thin stratus any ideas?
Here's a copy of my .uproject and files if anyone wants to look at them and help
https://drive.google.com/drive/folders/0BxgvacvkmDQZY2JEZVFudzJNTUk?usp=sharing
I got it working!
I created a session on one PC
then one the other PC I had to type in console "open [IPADRESS of other computer]" and it worked
@Shanowzer#0144 nice! Always a nice feeling
@gaunt kestrel for IP connect, you don't need sessions
The server only needs to open a map with the listen option
I have a question if it is possiable. I'm trying to show the steam friendlist in game and allow the player to invite them.
theortically speaking, everything should work as the code matches the little documentaion and examples there is and complies without problems, however, I don't get anything when I try and get them.
FriendsInterface->GetFriendsList(LocalPlayer->GetControllerId(), EFriendsLists::ToString((EFriendsLists::Default)), FriendList);
retruns 0 results, shouldn't it retrun the steam friends I have?
So we got it working! We can see each other in VR
However when the client tries to grab anything it doesn't let them
Currently setting every function to multicast, is that what I should be doing?
Are you calling up to the server to do it? @gaunt kestrel
Multicasts can only be called from the server, not the client
I mean running a client->server rpc to do it
RPC? I googled it a bit but only understood it a little
So I would need a separate event for the client to send to the server?
Yeah, you need to make a "run on server" event that runs a multicast event on each client, and updates its position and other attributes
(at least I think, it might be a tad different in VR?)
You would also want to update it locally on the client so there isn't a delay
Hmm well the possession events and movement is working (teleport and thumb pad). Health is working, all other valuables are
Just the grab isn't.
@gaunt kestrel well, possession is handled on the server, movement in the CMC (I think in VR? If not, it's somewhere with an autonomous proxy), and health is most likely a replicated variable
I'm not exactly sure how grabbing works in VR, but you might need to manually replicate it
Ok we've got it to show up on the server when the client grabs.
Now should I add an event that does the same thing called under the same button but replicated on owning client?
Replicated to owning client would just send it right back
If you want everyone to see the location, you would need to multicast set its transform
Or, you might be able to set up autonomous proxy control on the character, but that's beyond my knowledge of implementation
I am running into a weird issue where the server will not tick the anim graph for the animation blueprint of a client. I have unchecked replicate movement from the pawn and this turns off the server's update for the anim graph. A client is able to see another client's locomotion, but the server sees a frozen player. Is replicate movement tied into the anim graph somehow? Strange that it would be, which makes me think its a bug. Any opinions?
@thin stratus So server travel definetly works over lan, using sessions.
Matt Williams Has recently confirmed this
Noob question, im following the unreal multiplayer tutorials and wondering is it hard to create a server that persists when it has 0 players playing? how does that work? can some one please explain breifly?
Your talking about a Dedicated Server.
These are a seperate executable that is compiled by a source build. You cannot have a Dedicated Server with a Blurprint only project unfortunately.
Is it difficult to add that functionality?
No its quite easy actually for a bare bones setup yep.
but if my unreal project is mostly blueprints will it not work?
You need to have a source code build so that you can compile the Dedicated server executable yourself.
heh sorry can you explain that abit simpler? new to all this stuff
Do you have VisualStudio installed and have you compiled the engine from source code before?
no and no, i know im getting waaaaayy ahead of myself, more just curious of how it works
do you have to turn your unreal project from blueprints into source code?
I suggest you start looking into tutorials on how to build the engine from source code and working with C++ before trying to work with a dedicated server. You dont have to turn your BPs into C++ but you need an source build of the engine so you can build the server as well. If your using a Launcher build you wont be able to make a dedicated server.
can you point me in the direction of a tutorial or some more information?
Just google How to build UE4 from source code or something. Im not at a PC right now to find stuff for you haha sorry.
Thats fine, thanks alot!
No worries.
@gaunt kestrel You should really read my compendium before you continue. Going into multiplayer coding without knowing what a ServerRPC is, is not ideal. The compendium is pinned to this channel
@subtle spindle Your Project and the Engine are two different things. While you need to turn your project into a cpp one, by adding a c++ class via the editor, you also need to download the engine as source code. Currently you are using it via the launcher. That's easy to do if you know how, but i would suggest only looking into it if you need it
@JMan afaik, the animBP should not be replicated oO. It gets controlled by the variables that you have in your character BP and if your character is not replicated, then there are no values that you could use in the animBP. Or at least everything only happens on the owning client
Having a tad bit of issue with replication of a Launch Character node within an event. Trying to get a networked dodge function up and running and it's not being friendly. Can someone help?
Got it working! I didn't see that compendium @thin stratus so I'll read through it until I understand
I'm having a similar issue to Shanowzer...I have a multiplayer game where the client connects to the listen server. The server can open and interact with doors which is replicated to the client (the client sees the door open). The client can also open and shut the door, but the server doesn't see the door moving
I've used blueprint RPC's to try to get this to work but something isn't going right
This is what I'm working with, kinda just throwing more and more RPC's and replicated functions to try and force something to work
also, i've been reading through the compendium and trying the things it says but I'm not sure what i'm missing
@flint hedge You are using a Multicast when the button is pressed
that doesn't work
The Client will never call this
as this is saying "If Server"
the other problem is OwnerShip here.
You would need to call a ServerRPC to get the Server to call the Multicast
But ServerRPCs need to Client to own the Actor
Your door is probably placed into the level and owned by the Server
Read the Ownership chapter of my compendium
To resolve this issue, you would need to have a ServerRPC inside of a Client owned Actor
For example the PlayerController
So when V is pressed and (use switch has authority) it was a client, you get the PlayerController, call the ServerRPC( which should have an Input to pass the reference of that door)
and in that ServerRPC, you then call the Multicast on the door (which you passed)
That should solve it
Could you please show that in blueprint screenshot form? Its probably an ownership thing because the door starts in the level, but how would I assign ownership to the client?
in your compendium it looks like you are using an interface to open the door? I was just making a door blueprint that was self contained with a box trigger to turn off and on input (simple stuff) would I need to make an interface for this to work?
@thin stratus sorry, i kinda merged two separate issues when I referenced you lol. Meant to tell you that I confirmed using server travel without steam works. The other issue I was talking aloud about is an engine bug with the anim graph.
Back to server travel, I cant seam to server travel from lobby, connected through steam
@drowsy zodiac If you're using two different game modes, make sure seamless travel is checked on both
IE one for lobby, one for gameplay
@twin juniper ok, I shall give it a try. Ty
@lapis jetty We need more details to be able to help you. If you're doing it in blueprints then screenshots are great
@lapis jetty if your attempting it in blueprints you wont be able to get far as you will have to tie into ue4's movement prediction using c++.
@lapis jetty perhaps try using root motion from a roll animation. You'll need to play the animation as a dynamic montage for networking.
@drowsy zodiac If you inherit from Character then a lot of that is already taken care of
@twin juniper well, I have never had any luck being able to launch a character over the network with 200 ms simulated lag smoothly
The ue4 prediction fights the client's pawn location
Launch character is physics based though right?
CMC?
character movement component
Right
the thing where all the character stuff is really handled
including prediction and it's own builtin physics
Well in general I have tried many ways of doing custom movement types with networking and blueprints and haven't had much luck beating the location presiction
Prediction*
I believe the correct way is to tie into the movement component's flag in cpp
Cant remember the variable name
Hello guys, I don't know why when i run two standalone it's going wrong rendering and most time crash ...
I using 4.13.1
I have had this issue before. Perhaps its an engine bug
Are you level streaming?
Ive had this issue in a single player game
No i don't use level streaming
I was wondering, is there a way to display session results in UMG so that they update in real time? for example when someone new joins anyone who has the server list up can see that another player joined?
You could just refresh constantly i guess. But the current exposed system to BPs doesnt support this. You would have to write it yourself i guess.
Since it returns an array of results and it takes time to query for servers it basically just comes in as an batch
Yup, that's the problem, I show the c++ reults in a blueprint wrapper function but I was wondering if there is a way to keep them updated like on tick or timer without refreshing the whole serverthing because it take time
Hey guys. Can someone explain, how can I replicate montage, wich I call with Play Animation? I need to sync the animation by the time character starts to replicate. For example server starts playing montage in 5th second for himself and others (multicast), but player has entered the game at second 8, so he ain't got any multicast events and character with animation just stand still.
Hey guys, I have a UE4 game and i planning to make it online multiplayer game and wont have much knowledge on this as this is my 1st online multiplayer game. So can any one help me out which service is best and easy to integrate with ue4 games? I heard about Playfab, GameSpark and steam.
Setting up networked games for multiplayer.
The various aspects of multiplayer applied to Blueprints.
I suggest going through blueprints first before digging into C++
Also about integration with Steam etc. https://docs.unrealengine.com/latest/INT/Programming/Online/
Overview of the various systems related to the online platform.
@wary wyvern because the client who joined after the event has executed, never knows what has happened before he joined
An overview of the Network Features example level, example 2.1: Network Relevancy (Part 1 - Not Replicated At All).
@compact oyster hey thanks for those links. I am able to implement local Multiplayer using LAN but i am planning to make it online using services like steam or playfab. Which one will be easy to integrate and to implement into the project and any good resources or links so that i will go through it ๐ Thanks for the youtube link i will check that ๐
Currently I'm using steam myself for a game, haven't tried the others out but steam seems to be reasonable to do with blueprints. Online would be no problem with steam aswell :p
GuuhaN there is a problem.. Montage have some sections. And if I replicate it at begin play (with repnotify), it starts from beginng, but I need to start it at server's animation time.
Or at least at server's current section
so the server/host is keeping track of where on the timeline the animation is playing? and whenever someone joins, it starts playing the animation from where the server is at?
It should work so, yes. I guess
I asked before why IOnlineFriends::GetFriendsList doesn't return anything
if figured that it was because it only gets the stored friends list
first need to read it from the online subsystem using IOnlineFriends::ReadFriendsList and passing on a FOnReadFriendsListComplete delegate that is bound to a function that gets the friend list using IOnlineFriends::GetFriendsList
if anyone is interested
Hello, any suggestions on how I'd go about implementing a team system with blueprints? The gamemode spawns and possesses my players, but I can't make the gamemode do anything if pressing a button from client (select team) :/
So apparently as the gamemode is only present on the server, how would I make it so that when pressing a team select button the gamemode would spawn a player?
I think all the team stuff should be in PlayerState which is replicated to all and you check the team on the GameMode when you try to spawn the player
it'll have some RPCs to be able to set the replicated teamindex variable on the PlayerState though
Thank you. My teamID (red/blue) is stored in the PlayerState. If you have any more ideas on how to properly do RPCs and get this to work, I'd love to hear them
I will, thanks.
Hey what's your best ideas on quickly distributing a game for testing multiplayer? I want a few friends and I to be able to test a game we're making from our own homes but the process right now is very slow
Currently, I have to build the game, zip it, upload to google drive, then they download and unzip, then we can play
Is there a quicker way of going about this? Would Dropbox or Github do the job or something like that?
If your upload speed is the bottleneck, I might even look at Perforce, as it only sends the delta over the network @vivid siren
You might be able to make BTSync work however, as once you start distributing, your other friends can upload to other friends
I use BTSync every day for laptop/desktop file keeping, but not sure how it would work with UE4
These look interesting, but the hassle might not make it worth it
This won't be a long term thing for us, just a small thing for little projects we goof around on
I would agree on Perforce, but BTSync is really simple to set up, and apparently it does support binary delta
You just add the folder, give your friends the key, and they'll instantly start downloading it
(actually apparently now it's called Resilio Sync D:)
Ooh okay, so whenever I rebuild the project, i just throw it in a specific folder and they will be able to download it right away?
Yep, and if your upload speed isn't a bottleneck vs your friends', the P2P portion of it should help
would the individual version be enough for a ue4 game or would I need to use the workgroup version?
If you're technically using it for business I think you're supposed to buy the workgroup... but the features of the free version should be fine, and if it's just friends you'll be good
perfect, yeah it's just for friends for us to mess around with, no commercial stuff or money involved
thanks!
If it works well let me know, might end up using it for UE4 if something arises in the future ๐
But yeah, it's an amazing program just in general
Would it be an ok mechanic to let users host servers for a f2p game? So when someone wants to join a game, they get put in a que and a random person gets selected to host once the que is big enough
If you use reporting etc, cheating should be a relatively minor issue (as if someone cheats, they get banned from hosting/banned from the game. And for people who host I could introduce rewards)
I think that's really too opinionated of a question for there to be "an answer" to it, but thinking that cheating would be minor because people can report probably won't go well, especially if you're relying on that as your form of AC
Some big games go that route though, so it's definitely not unheard of
Especially in a F2P game though, banning won't do anything
Hm
I am just trying to find a way to release a MP f2p game and not having the huge costs of servers ๐
I get it, each way will always have their pros and cons, it's just up to you to weigh them ๐
Hm
even though I use EFriendsLists::InGamePlayers to only get in game friends, steam still gives me the full friend list, any idea why?
Are you using EFriendsLists::Type::InGamePlayers? Or just what you sent
And where are you sending that enum in? I haven't done much with multiplayer, but I don't see where the function actually checks an enum @red ledge
FriendsInterface->ReadFriendsList(LocalPlayer->GetControllerId(), EFriendsLists::ToString((EFriendsLists::InGamePlayers)), FriendListReadCompleteDelegate); =
this
UE_LOG_ONLINE(Warning, TEXT("Only the default friends list is supported. ListName=%s"), *ListName);
๐ฎ
Looks like that's kinda just a dummy parameter?
And it doesn't actually take that into account, it just goes based on default and logs if it's not
is that in the docs or source code?
I Think it might be for other online subsystems then
That's the code, look at FOnlineFriendsSteam::ReadFriendsList
oh ok, thanks
hey
could someone please explain to me why i would want to use PlayerState
instead of just having the data for that player
on the character itself
like
whats the diff between GameState, PlayerState
im still trying to figure this out lmao
also, anything done in the game mode is replicated to clients automatically because it is on the server only? GameMode is server only
because i made a timer on the game mode and i want to know if that timer is going to be automatically replicated to clients or if i need to set it up? I set it up to constantly check every x number of seconds for a condition to be met. If the condition is met, it then does the next step.
I would use the PlayerState if there's info about somebody in a game that doesn't correlate to the character they're currently possessing
ok so like
if i made a value of "int32 NumKills"
how would i use it
for example, when the player gets a kill, how would i increment it... how would i get the value as well? If I want to do a game where it finds the last player alive and gets his/her stats and displays them for everyone to see... how would i do that
thats literally the only two things i need to know
how to access/alter the variable, and how i would get it (would i iterate? is there some sort of PlayerState iterator?)
There's a PS array in the GameState, and you can get the PlayerState from a pawn (and thus indirectly a PC if it's possessing something)
so
how do i get the game state
in the game mode?
is there like
GetGameState
hold up i think ive actually used that before
Or the world, yes
Yeah, and you can access it on the world if you're doing it from a client
oh so it has "PlayerArray" which is a TArray of APlayerStates
and i can just loop through that?
and cast it to my playerstate
There you go ๐
so like
hold on
last thing
oh i did it already
PlayerStateClass = myclass.Class;
lol
i wanted to see if i set up the player state class
ok so like
other thing i wanted to know
do u think its smarter to do what i am doing? Have a timer to check every 5 seconds until there is 1 player left? Or should I set it up some other way
I would run the check every time someone dies
No point to doing it on a timer, when it can only change on a death, and it would update if more than one death in 5s
hm
yeah
that makes sense
i agree
was thinking about doing some sort of event system
@brittle sinew hey do i have to have OnlineSubsystemNull and OnlineSubsystemSteam
both installed and enabled
or can i just have one?
o i got it
lol
i just set it up to use the Null subsytem
in the editor
and steam in packaged builds
@brittle sinew hey where would i want to handle death btw? In PlayerState? or somewhere else? Like I have a health value but should i just make a if (health <= 0) {CheckIfWinner()} inside of the tick function?
lol
like where should i put that at
in my actor
or playerstate
or game state
or game mode lmao
im thinking playerstate, but tell me if im wrong
I wouldn't put it in the PlayerState, I usually only use that for variable storage and their helper functions, not actual logic (though that's just me)
I would put the handling on the server itself, just make sure that's being called from a server location, so the server character does the checks
yea
good thing ive noticed though
anything u do in the GameMode
is replicated automatically
timers...etc
What do you mean replicated automatically
so like
i setup a timer in the preinitializecomponents method
and it basically counts down until the game begins
the "RemainingTime" int32 i made
is the same on all clients
which is what i wanted
because if its 5 seconds on the server it should be 5 seconds on all clients
does that make any sense at all... lul
Is that variable replicated? Just wondering, if it works it works either way ๐
uhm
nope
i think its simply becaue i have the variable
inside of game state
that its automatically replicated
GameState is on Clients & Server
GameMode is on Server
PlayerState is on Clients & Server
Oh yeah, GameState is replicated out of the box
yep
so my question is
if I have an actor
get a reference to playerstate
and tell it to alter "PlayerHealth"
will that be automatically replicated as well?
or would i need to make a replicated function to set the value that is in player state
Only the server can set replicated values (unless you've got some sort of proxy going on, which you don't here)
ok
so i would need to use a replicated function
to set the value thats in playerstate
Yeah, but why would you be altering PlayerHealth from the client?
i dont know any other way
of doing it
lol
like if im being completely honest
lol
Well, what does your calling flow look like right now?
Altering the health
oh
right now its not doing it
i was going to have it be where
the player presses left click
it does a raycast
if it hits the player, it deducts health
i have the raycast setup it just doesnt do anything yet lol
So, you should call a server function with the info about the player hit, then have the server change the player's health
Keep in mind that would allow the player to call a hit up to the server whenever they want, but when you're just beginning that's not a huge deal
Just know that's a thing
lol
yeah i know
but i just dont know what the alternative would be
you know the game Ark Survival?
I dont want my game to do that stupid shit where it moves you forward, then u get teleported back (because the server is correcting the lag..etc)
that type of rubberbanding will make people quit the game
Well, that's just an artifact of the client being allowed to move on its own client-side, like the CharacterMovementComponent does out of the box
yeah
i dont like that
that problem
can get ur character killed
like if u keep moving forward and it doesnt render in changes
That's true, but the alternative is not moving until you call up to the server, and it calls back
So it's all about finding the balance
idk i just feel like that is a massively gameplay intense thing
like... if your movement is broken
then how can u have a competitive atmosphere for a multiplayer game
I'll be honest, you probably won't be getting competitive-level netcode without writing most of it on your own
i mean back in the day i worked in java and setup a server/client connection which could send primitives over a network
and ping back when it got a result or not
like it wasnt too hard lol
Well let's say you're playing a game, and have like a 50ms ping, that wouldn't be unusual, and probably higher for a p2p game, you would have at least a 50ms delay on all movement actions
That would feel really bad
yeah
i agree
but having it teleport the player backwards in time
about 10 seconds
is absolutely ridiculous
Well, that probably stems from the networking not being able to keep up with the world scale if I had a guess at it
But I'm not entirely sure
yeah
ark has some of the worst lag ive seen
u walk up to a storage box, press E and then it does nothing and u get teleportd back to the door to the building
its absolutely retarded
Does anyone know of a tool to send a message to a socket? I'm trying to test receiving a message on an actor component, but I can't figure out the software I'm using to do it. (I can send from UE4 and see them in the program "TCP/IP Builder")
I was wondering if there was something better to use.
Just saw a video on that yesterday https://www.youtube.com/watch?v=_WgQ44x2WnI
I think thats what you are looking for?
Might be a bit too much for what I'm doing, but I should be able to glean what I need from it. Thanks.
Nope, he is using an UE4 server to do the chat on.
I'm looking at doing stuff strictly over TCP.
So, I'm looking at changing game mode using Seamless travel, and from what I gather this is not possible by using the regular ServerTravel options string. However, using this technique it seems to be: https://answers.unrealengine.com/questions/371008/how-to-use-different-gamemodes-for-one-level-in-a.html
My question is, what is actually different from that custom function and just the regular options string?
Hello guys,
I've two different pawns in my multiplayer project for server and client, I want to know how i can run a function on the server pawn class when client join ? Thanks