#multiplayer
1 messages Β· Page 484 of 1
is not working
on client side
im even trying to redraw the whole merchant array
but because of replication the client has a local "version" of the merchant, when the client (who doesn't own the merchant) calls a update from the player controller about the merchant I think the server will ignore the request
it doesnt work , ...
lol..
maybe i can ask a better question
what is the proper way to replicate widgets
from my understanding, you don't. You replicate the values behind them and request on the client to update his/her own widget
thats what i have.. a rpc call from the merchant to update the according widget with run on owning client
but i tried whatever not anymore
who is connected on the merchant
for each loop connected player controllers
update slot at index
no errors no nothing so im clueless where even to start, if someone has a good tutorial or know a good tutorial about this widget stuff, im rlly happy to take any advise
btw, vorage; thx for trying to help,
appriciated
i wanted to try something simple before i started my trade system
but seems i need to study more lol π
try using the node Has Authority and attach strings to both sides to see if the code is running client and server side (has authority = server, no authority = client side )
maybe a dumb question but u put that node inside a run on server event right
I would do it in your rpc nodes to see if they are trying to run client side π
NP, all the info I have is from using RPC's in Conan Exiles and from the Network Compendium in the pinned posts, which is an amazing reference to the way UE4 handles network traffic
ye its good info..
but in a way u cant do anything with it
its to abstract
or im to noob to understand
highly likely π
I think the following is how it SHOULD work in UE4 but I'm not 100% sure
Client request to buy item (cllicks on button) -> Merchent Sends buy RPC from client to server -> Server version of Merchant Updates Items Array -> Rep Notify Array Triggers on Client -> Delegate on client triggers Update of UMG -> UMG Redraws based on new information.
I hope that's all of the steps involved
@brittle karma Your message disappeared but why not ask the Gamestate for the PlayerArray variable?
hey everyone i have a basic question which i couldnt resolve by myself.
im trying to get Player Controller for every player and use it whenever i need, here is the code.
/*here is Player's Constructor which im trying to get PC*/
PlayerController = Cast<AMyPlayerController>(UGameplayStatics::GetPlayerController(GetWorld(), 0));
so i assume by now i have every player's PC.
now i use an RPC function for firing, which i want to pass the shooter's PC like this.
/*in the ServerFire_Implementation time to spawn the projectile*/
if(PlayerController->IsLocalPlayerController())
{
projectile->MoveProjectile(speed, this, PlayerController);
}
now is that PC that im passing belongs to client(if shooter is client) or its servers?
the reason im asking this question is that im using that PC inside projectile class so whenever projectile hit an specific object i want to add score to the shooter, PlayerController->Score(); here is the code i used in Projectile class,
in the PC class however that Score function calls PlayerState's Score function like this :
void AMyPlayerController::Score()
{
AMyPlayerState* PS = Cast<AMyPlayerState>(PlayerState);
if(PS)
{
PS->Scored(3);
}
}
now the problem that led me to this question that the PC might be the same for every player here is that whenever i score a point, it counts for everyone, server and all clients.
its a long question i know, but i couldnt find any good examples to understand it.
I'm not totally sure this is correct but wouldn't playercontroller(0) always be the client so the server would score it out to everyone?
'UGameplayStatics::GetPlayerController(GetWorld(), 0);' works differently
on Server and Clients,
Calling it on the Listen-Server will return the Listen-Server's PlayerController
Calling it on a Client will return the Client's PlayerController
Other numbers than '0' will not return other Clients for a Client.
@onyx minnow i guess PC[0] is just returning the owning player's PC
The local player controller yes
so what is the returning result of ?PlayerController = Cast<AMyPlayerController>(UGameplayStatics::GetPlayerController(GetWorld(), 0));
is this always returns Server's PC?
lets forget about all those questions, how can i get Player Controller for every player so later i can use it?
Why not use the playerstate instead, every client should know about the playerstate of every other player right?
thats right its Replicated
@high current yeah but im practicing to get Player Controller and weirdly i cant really find the answer on the web /:
i want to access to Player State from Player Controller
yeah i dont want other clients to access either
You do know that the GaneState has a playerstates arrsy
yeah but i dont know how can i use the array to find specific player's Player State. for example when a client shoots something, by getting its PlayerController i call a function in its Player State to increase scores, but with getting array of Player States how is this possible
like this :: client shoots-->i use the shooters PC--> i call a function in PS (cuz from PC i can access to PS)
Well, if s client shoots at another pawn
That pawn has its reference to the player stste
so you are telling me i can access to PS from pawn itself?
any idea that i can use GameState's player state array to approach the goal?
Well if you need the specific player state
Then using the pawn's PS is still better
Keep in mind that you cant edit that from the shooters client either
You are still better off changing it from the server's owner
well thats true, server should be responsible for that.
yeah i found it after u mentioned it thanks
Hi, I packaged a multiplayer project and then give it to a friend to both test the game... but he cannot find my session..
some ideia?
Your router might be the problem
@narrow prairie @onyx minnow for a Client or Server RPCs to work, the Actor sending/receiving them has to be owned by a PlayerController
which an Actor loaded from a package usually isn't
clicking on a merchant should have the PC send a Sever RPC, preferably abstracted with some kind of IInteractionInterface in order to avoid RPC clutter
the server version of that PC then calls the interface function on the merchant
He was talking about updating quantity from a limited quantity merchant when 2 clients are both buying from the server merchant. So information coming back from the server to the client to be displayed in a widget, not sure by I thought RepNotify ran in that direction (updates the clients version of the variable on the server owned actor)
it can, but its simpler if you're using c++
FFastArraySerializer is capable of per item callback on clients for add/remove/change
documentation for it is in NetSerialization.h header
(documentation as comment in source code isn't all that uncommon with unreal)
oh, it gives you client sided callbacks?
mfw here I am iterating the array in OnRep to find changes when this exists
when you have something like a pointer to a replicated object in FFastArraySerializerItem
can't always be sure if object replicates before the FFastArray does
but
if the FFastArraySerializerItem arrives before newly created replicated object it points to
PostReplicatedChange will fire as soon as the object's NetGUID is resolved client side
its awesome π
so not using this thing for my weapons inventory (simple resizable array of ptrs to actors) is like, dumb
guess I have to replace it at some point
if i need a per item callback i always go fast array path
its just too convenient not to
yeah that's exactly what I need to update the quickbar hud
I was duplicating the array and manually finding changes 
i did that before i found out about this
never looked back π
all you need to do is write the fastarray(item), add it as replicated variable, and server side call MarkArrayDirty() after add/remove, or MarkItemDirty() after you change the item
i usually add Add(), Remove(), IsValidIndex() and overload the [] on the array, and always overload the == on the arrayitem
@high current you know how I can fix it?
Hey all, anyone know the commandline argument for number of players for a server?
Have you port forwarded the ports UE4 uses
@fluid flower isnt it just MaxPlayers=x
Ik it works in DefaultGame.ini
Maybe it works with a.?MaxPlayers during runtime?
I'll try that π
I'll check that
Not that you would need to change max players during runtime...
why is the gun not destroying iteself? Im sending via interface. It prints the string but does not destory
I have this ProjectID ProjectName bAllowWindowResize BuildConfiguration
so I set max players to 6 when I create game session, but players can still join after the limit has been reached
How I need to edit the DefaultGame.ini?
how would I do it per map?
It's super odd that the steam server browser shows 6/6 but players can still keep joining π¦
exi or james would have more experiance with that, but isnt it possible to limit the number of people able to join via your UI
You still need to read how much players a session allows, so it might be all the same
@fluid flower
the default ue4 subsystem has a soft max player per connection
I have yet to use the steam one, so I don't know if there is something similar to this there
yeah I'm using something similar, but from C++
it shows the correct number of players on steam, it shows up in steam browser, it updates correctly, it's all good. Except..folks can keep joining after it's full haha. I can limit it visually, but they can also connect through the steam server browser, which I can't stop.
Have you looked at the game session class
I'm checking it out now, I think I can override some stuff to make it work, thanks!
np, and also if its Panzer we are talking about, I wanna play that, xD
does anyone know how you can change the owner of a pawn to the player controller without possessing it?
The goal is the have replication working for the ability component but have it be possessed by an ai controller
Something like this.
https://github.com/DaedalicEntertainment/ue4-orders-abilities/blob/develop/Source/OrdersAbilities/Private/AbilitySystem/RTSAbilitySystemComponent.cpp#L37
I got standart replication working for the actor itself by replacing the GetNetConnection
I need to set the Role of the avatar actor from ROLE_SimulatedProxy to ROLE_AutonomousProxy but I'm not sure how
Does anyone know at exactly what point during a SpawnActor on the server, the spawn info is replicated to the client?
I'm trying to set some info in the actor before it replicates but I can't figure out at what point the data needs to be set, the client keeps receiving the spawn without the correct data
LogOnlineSession: Warning: STEAM: Session (GameSession) already exists, can't join twice
i using steam online subsystem + advanced sessions + advanced sessions steam, and somehow my friend cant join to my session
Guys, i wanna make a counter that each client can increment by clicking a UMG button, probably this counter has to incremented on server to prevent cheating, but the question where should I store this counter? PlayerState? GameState? or any other class?
also i want all the clients to know about the value of this counter...
even those who join the game lately
@fathom aspen Is the counter shared or unique per player?
it's shared
So all Players will increment the same counter?
yep
Then use the GameState
If it was unique per player, use the PlayerState.
Both the GameState and PlayerState are replicated to all Clients, therefore they will all have access to it.
ohh great, the thing is if i use GameState i can't send serverRPCs to the GameState
as GameState is a server owned actor
i send Server RPC to increment the counter
Each Clients PlayerController is able to RPC.
Route the call through the PlayerController
ohh great, so i have to send through PlayerController
Yes
The PlayerController has whats called a NetOwningConnection.
This is necessary for RPCs
I see, thanks man π
π
i got back from my holidays but i may need more assistance, there is literally 1 thing in my way to getting a released game, and that's the stupid player class selector i made, I've managed to figure out a way to do it but i cant do it! like idk what i need to do to do. all i need to do is figure out a way that when you(the client) clicks a button the client will changes some Booleans that the server Player Controller has. but I've tried a ton of stuff and it isn't working, been at this for 3 days straight and all I've managed to do is stuff up my multiplayer and spawning system like 400 times.
If anyone has any suggestions it would be very appreciated. π
i will give a basic run down of how the player class selector works. when a player joins a game it will give you a widget with some classes to select(4). now what happens is when you click the class you want it will update 4 booleans making 1 true and the rest false and this will tell the gamemode which character to spawn, now when the server selects a class, it works, it will spawn that player in as that class, but when a client tries to select the class it gives them the servers class and not the class the client selected
so you're setting the bools directly rather than sending that data to the server?
that's probably the reason it doesn't work
do you mean like the gamemode is grabbing the data rather then having it set??? i believe thats how i have it set up atm
when you set a variable on the client, ie through your UMG UI, it doesn't magically set the value on the server
replication is one-way, server to client
that's what RPCs are for (BPs call them "execute on server" events)
yeah ok. ive been using a few RPCs and hasnt been successful yet
would it make a diffrence if i set the booleans to replicate?
no, unless the client needs to know the values of them
thought so
if you made some kind of player class setting RPC then that should affect the values on the server
if an RPC is apparently not working then you should show your work there
yeah ok, just grabbing shots now but ive just have a idea so give me a few min π ill be back
In my spectating system (similiar to PUBG, COD, Fortnite) you can switch between spectating your teammates. My issue I just found was that I use the BindEventOnDestroy for the person I'm spectating. That way if the person I spectate dies then I will start spectating another teammate. My issue is that when I come back to life and that person I was spectating earlier dies, That BindOnDestroyed event executes and I switch to specating a player even though I'm an alive player. lol So Is there a way to cancle that binded event? Or another way to switch between teammates when they die?
@cedar finch couldnβt you just do a bool checking if the player is not alive (!isAlive) and if true call your spectate next person code and if false do nothing
The event would still fire but it essentially wouldnβt do anything
So run the bool check maybe in the tick on the spectator blueprint?
Sure yeah, like right before where you call the spectate next thing
Just check if the player is alive before doing anything else
It's not really before though Its the spectating a player that dies while your spectating him. I used the bind because I didn't know how to tell the spectator his person he's watching died so execute the spectate next player code
Basically sending that bool you were talking about is where I got confused when I was originally making this
Gotcha ok. Well, you could cast to the player controller
Iβm assuming you have the same player controller and are possessing different pawns based on alive status?
Correct.
So I have each players player controller
So I see what you mean. I can just get that bool from there
Yeah that was my initial thought. Store your bool in the player controller, and in your spectate code check in with the player controls bool value
Or maybe even player state
That might be a better spot technically
Yea my logic is actually in playerstate
Yeah that makes more sense. So maybe have the spectator pawn get itβs value from the player state.
Ok cool. Thanks for the quick help. I appreciate it. I should have this working is a few minutes. π
No problem glad I could help π
If my actor is replicating, does that mean a collision change (such as NoCollision to Physics Body) will also be communicated to clients? Or do I have to net multicast / client communicate that?
You have to replicate that yourself
You can't see that on an Per Actor basis
If the Actor Replicates, then that's just the base requirement for variables and rpcs to replicate inside of it
If the variable (here collision) isn't marked as replicated, then this will still have no effect
Also for state changes, always use OnRep variables, not RPCs
Cause late joiners or people who come close after being out of relevancy range, won#t get that update then
@glad sedge
@thin stratus Ahhh okay
Also great point about state changes.
Did not consider that
@glad sedge also, in most cases, collisions need to be turned off/on when some other replicated state changes
in that case, there is no point in replicating it, just expand the callbacks for the state that triggers it
hey guys, i'm sure this has been asked a lot of time, but what is the best solution to reconnect a player to his proper pawn and keep his player state after disconnection? (player has a unique ID already provided)
Which functions should i use to achieve this?
hey, is there someone here who could help me with a line of mysql?
@winged badger really?
That.. may explain something
@cinder steppe What's going on with your sql?
@winged badger any idea why it works that way? In terms of turning resetting collision state?
what i meant is
if(username_verify($username = $_GET["user"])){echo json_encode('result1' => 'success');} else{ // user not found }
im simply trying to return if the user exsist within the DB
monster dies, you turn off the collisions as a response
it being dead is already replicated
no point to replicate collision state as well
as an example
oh I see what you mean
@cinder steppe I may need some more context there mate, that just looks like you're getting a user param from the url
so for example i want to look for a user... so that i can invite him to my friendslist. i first need to check if the given user exists in the DB and return a result
heres the file, maybe that can shed some light onto it
igh
all g
and it works but... id just like to return another result, so incase the user enters a wrong username, it returns "wrong username"
yeah table is set and its all working
$password = $_GET["password"];
// create a prepared statement
$stmt = mysqli_prepare($mysqli, "SELECT username, password, regkey, banned FROM users WHERE username='$username'");
// check if username exists (This code is not working...!!!!)
if(username_verify($username = $_GET["user"])){
echo json_encode('result1' => 'success');
}else{
// user not```
This is kind redundant - $username = $_GET["user"];
what do you mean?
oh Sorry, I mean in the context of this
if(username_verify($username = $_GET["user"])){
yeah i thout so... would you know a workaround?
username_verify($username) should be fine
ok give me a sec. iΒ΄ll check that
It won't really make a different TBH, since you're just passing in a param that you've written to already
if its true... but if its not... then i can put an aktion on that
So, sorry where are you struggling at the moment? You're not getting data back? Is that it/
ah, so you're using the mysql plugin?
yes
Righto
realy gets shit done xD
its all working
There's a few out there - but you're just using the native plugin?
lol
Realistics Breast physics - Unreal Engine Forums
I've used VaRest in the past too
gets shit done ^^
i think its omportant to understand that im echoing 2 kinds of results
result2 returns if username and password are true. and like i said, its working
So this stuff here is echoing correctly?
echo '"status": "' . $status . '",';
echo '"username": "' . $username . '",';
echo '"email": "' . $email . '",';
echo '"banned": "' . $banned . '",';
echo "}";```
oh my bad
yes
echo json_encode(array('result2' => 'success', 'regkey' => $regkey, 'banned' => $banned));
yes
Can you should me this function?
username_verify
if(username_verify($username = $_GET["user"])){
pardon?
This function here username_verify($username = $_GET["user"]))
All I'm seeing is that you're just passing in something to that.
my php skills are like one week old ^^
i guess it doesnt exsist
i wouzld have to write the funktion
if its not in the file then its not there
one mom
<?php
$DB_host = "localhost";
$DB_user = "root";
$DB_pass = "1598753";
$DB_name = "game";
$MySQLi_CON = new MySQLi($DB_host,$DB_user,$DB_pass,$DB_name);
if($MySQLi_CON->connect_errno)
{
die("ERROR : -> ".$MySQLi_CON->connect_error);
}
?>
well that makes sense
Yeah so..
You need to create those functions
OR
find something that already has those functions
nope, thats all there is.
well, there's no function. it's returning text. It's not null. So it'll return true.
well, there's gotta be -some- function otherwise you'd cop an error
Call to undefined function
maybe its a preset funktion from php
so that i dont have to write the funktion. but only the "command" of the funktion
because result1 fails.
so i have to set result1 to result2 (because if result2 is working then logicly also result1 should)
But VARest communicates to the DB direct, no?
security, also you need to register first to make an account
what?
i'm reading the source code now
yep, and you've given it db credentials, yeah?
yes
IP address.. yeah
localhost
okay so.. why are you using the PHP script?
what else could i have done?
Well, if you're just trying to test an API - I'd recommend Postman
But that PHP script isn't going to help you with sorting out the issues you've got.
the php script is basicly part of the webserver that communicates between DB and UE4
it provides a Register system to create an account that is then stored in the DB
It's also kinda recommended to put something like that PHP Script between the Player and the Database
You don't want them to directly contact the DB
yep
Ah okay; I see where you're coming from.
via UE editor, not PHP, right?
via php. (which then effects UE)
you were right that the code around result1 is not working. i just need to make it work and duno how
so in your browser, you've got http://localhost/gameinfo.php?stuff="login"
wait
And that's returning some kind of json file ?
okay good. That's not result2 according to the PHP though
if(password_verify($password, $hashed_password)){
echo json_encode(array('result2' => 'success', 'regkey' => $regkey, 'banned' => $banned));
}else{
// incorrect password
}```
ah let me give you both. just a sec.
oh, actually Mysqli I think contains those funcs. password_verify and username_verify
It's not PHP native though, it's part of Mysqli's library
which this file makes way more sense now lol
yeah but username_verify is not in the library
i guess thats the problem. so i would have to write the funktion
ah not to nitpick, but you don't REALLY need that function though
not to make the the login system work. but to give the user a hint about if the username is wrong or the password
thats true
i also need it for the friendslist im currently working on
and thats a core feature
I'm very surprised there's not something that just works out of the box
Doesn't matter, tbh
k
so. how do i make this funktion?
because even if i dindt need it for the login, i sure do need it for the friends list
Yeah but I don't know how far you'd get with this.
i will have to do that from scratch since every other friendslist is connected somehow to steam. just some simple online subsystem. and that is very bothering me
I'm guess you're using plain-text passwords for the moment?
are you sure? If so, know what they're hashed with?
md5?
Also you don't want to $_GET a password -
okay, so MD5 by the looks of it
also - this will hep
Replace the 'employee' crap with what you want and you're golden
what? i dont follow
thats way over my php skills
but ill gues ill make a mark on it and come back to it some time later
But that's what you're doing
$mysqli = new mysqli($DB_host, $DB_user, $DB_pass, $DB_name);
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
/////// Need to Grab Username And Password
$username = $_GET["user"];
$password = $_GET["password"]; // SHOULD BE POST REQUEST!
$hashed_password = md5($password);
// create a prepared statement
$query = "SELECT username, regkey, banned FROM users WHERE username='$username', password='$hashed_password'";
// verify email
if ($stmt = $mysqli->prepare($query)) {
$stmt->execute();
$stmt->bind_result($user, $regkey, $banned);
while ($stmt->fetch()) {
echo json_encode(array('result2' => 'success', 'regkey' => $regkey, 'banned' => $banned));
}
$stmt->close();
}
$mysqli->close();
}```
anyway, try that
ah fuck
change the query to
$query = "SELECT username, regkey, banned FROM users WHERE username='$username' AND password='$hashed_password'";
i'm rusty on raw mysql
but the password already is hashed O.o
In player bp an actor variable is set depending on lineTrace to find the certain actor. When i use the actor found by line trace to send a function (run on sever) over bp_interface the actor variable is empty??
@cinder steppe it's not, the user is entering their password in plain text
you're then having to convert that to the MD5 version you're seeing in you DB.
That being said the password_verify would still work as it's a PHP/ MYSQLI func too
im pretty sure its doing that some were. thats why i can login with a text password, eventhout the password in the DB is hashed or no?
if(password_verify($password, $hashed_password))
thats that bit
the passwords in your DB look to be hashed - as in they're encrypted through some measure (most likely MD5)
$username = $_GET["user"];
$password = $_GET["password"]; // SHOULD BE POST REQUEST!
$hashed_password = password_hash($password);
// create a prepared statement
$query = "SELECT username, regkey, banned FROM users WHERE username='$username' AND password='$hashed_password'"; <--- checks for password AND username at the same time
// verify email
if ($stmt = $mysqli->prepare($query)) {
$stmt->execute();
$stmt->bind_result($user, $regkey, $banned);
while ($stmt->fetch()) {
echo json_encode(array('result2' => 'success', 'regkey' => $regkey, 'banned' => $banned));
}
$stmt->close();
}
$mysqli->close();
}```
Unless what you're saying is that VARest is Hashing the password before appending it to the URL? Which is possible. And if so, you won't need that $hashed_password = password_hash($password); bit nor the $hashed_password - just $password will do
I doubt if it would hash it automatically. That shouldn't happen on the clientside at all
ok. but there is still a problem i think.
i dont wont to check password and username at the same time i guess.
id like to check for username (result1)
and if true check for password (result2)
or is that echo supposed to be result1?
i think were starting to run past each other
Does result1 have to return if it passes? Can it just continue to verify password?
yes it has to return. it will turn into a boolean that i will need later on
(does user exsist (yes), add to friendslist)
(does user exsist (no), print wrong username (no need to verify password)
(does user exsist (yes), print wrong username (set visibilty of print to hidden) continue to verify password
thats why i need the result1 and result 2, for login and friendslist
I get ya
π
I'm pretty tired, but this might help
Try it with a few test http calls
er
ignore that last one
okay I gotta go. Good luck
thx man β€
not working π¦
oh god is that SQLi-vunerable php code
it's like the early 2000's all over again
including using MD5 as a hashing function
it started going south when php was used
agreed, i'm surprised php still gets any use these days other than legacy stuff
i suppose everyone still likes to use wordpress for their websites though despite all the security issues it constantly has
@fleet raven I just wanted to thank you for answering my question yesterday. I successfully traveled all clients from dedicated server to another dedicated server Took me hours instead of days with your help.
nice
very... It was completely complicated lol
@maiden vine , Do you mind if you give a brief explanation of how you accomplished that? Was it just using ClientTravel or is there more to it?
ill do better one sec
I placed an actor that is replicated in my level
I overlapped a sphere set a bool GameEnded?
then with tick started the update event
What does TravelToMainMenuEndGame look like?
ill remove soon bc ip
Alright, thanks.
@maiden vine that code is a little bit dangerous
Multicasting from PlayerControllers tends to kick every other client out
When a simple vlient RPC would do
Sidenote: most effectivd way to get all PCs on server is GetGameMode->GetNumPlayers->For(0 to NumPlayers -1)->GetPlayerController[Index]
From BP
Basically as soon as you have unfavorable network conditions, people will start getting kicked out
Anybody looking to set up the entire coop dedicated server section of my game for me? π
I have been trying to get online sessions to work with UE4.23 and android.
Finding the session over local wifi works fine but joining a session returns success but does not load into the servers map
connecting via Ip does work
@elfin slate Unless Im completely outdated, sessions are not supported for mobile. You would have to use IP
IP and dedicated servers
Since from what I understand, mobile can't host
thx for the info
the easy work around would be to put the hosts ip into the session name somehow
@cinder steppe bugger - I've probably missed something simple somewhere. Also, PHP is fine. It's just a tool, like any other language. What you've got there at the moment is dogshit, and I'd avoid it like the plague in an actual production environment but for shits and giggles it'll do.
I'm trying to create a restart level button so the host can quickly restart the level if needed. My issues is that I do lots of stuff in my PlayerController which doesn't get destroyed when traveling or restarting levels. So I'm having issues with widgets apearing and getting stuck when I restart. Is there an easy way to simply get a new refreshed player controller when I restart the level?
My biggest issue is: I have two widgets. One called playerHUD and oned called SpectatorHUD. I add them both to viewport and then simply set the visibility based on a Boolean "isSpectator". Works fine until I restart the level when someone is a spectator. That spectator player restarts the level as a player but has the spectator hud stuck on his screen.
@winged badger appreciate the comment is only first way to work when I did the code. also it does kick every client when not using the is local player controller branch.
thanx that is awesome
Idk y but its not working with just client rpc
@maiden vine the client RPC needs to move into the PlayerController
@cedar finch wouldnt simply removing your spect widget from the screen upon restart help?
I have seen people create Blueprint Interfaces for this kind of thing
So that you can specify vars that get reset
Per actor
And then call the interface on everything when restarting
@glad sedge thx ^^
hello is there a way I can replicate the session result from advanced session plugin?
dedicated server. First client connected - working just fine. when second player starts connecting I have a log with this : "UNetConnection::ReceivedPacket - Too many received packets to ack (256) since last sent packet. " and first client kicked from server and second player starts to play.
019.08.06-16.42.38:936][273]LogNet: Warning: UNetConnection::ReceivedPacket - Too many received packets to ack (256) since last sent packet. InSeq: 10677 [UNetConnection] RemoteAddr: 192.168.15.132:59203, Name: IpConnection_4, Driver: GameNetDriver IpNetDriver_0, IsServer: YES, PC: Steam_VR_Player_Controller_C_4, Owner: Steam_VR_Player_Controller_C_4, UniqueId: Null:post07-338075304DD81B60B8E37795B1977553 NextOutGoingSeq: 7251
[2019.08.06-16.42.38:940][273]LogNet: UChannel::ReceivedSequencedBunch: Bunch.bClose == true. ChIndex == 0. Calling ConditionalCleanUp.
[2019.08.06-16.42.38:940][273]LogNet: UChannel::CleanUp: ChIndex == 0. Closing connection. [UChannel] ChIndex: 0, Closing: 0 [UNetConnection] RemoteAddr: 192.168.15.132:59203, Name: IpConnection_4, Driver: GameNetDriver IpNetDriver_0, IsServer: YES, PC: Steam_VR_Player_Controller_C_4, Owner: Steam_VR_Player_Controller_C_4, UniqueId: Null:post07-338075304DD81B60B8E37795B1977553
[2019.08.06-16.42.38:941][273]LogNet: UNetConnection::Close: [UNetConnection] RemoteAddr: 192.168.15.132:59203, Name: IpConnection_4, Driver: GameNetDriver IpNetDriver_0, IsServer: YES, PC: Steam_VR_Player_Controller_C_4, Owner: Steam_VR_Player_Controller_C_4, UniqueId: Null:post07-338075304DD81B60B8E37795B1977553, Channels: 107, Time: 2019.08.06-16.42.38
[2019.08.06-16.42.38:941][273]LogNet: UChannel::Close: Sending CloseBunch. ChIndex == 0. Name: [UChannel] ChIndex: 0, Closing: 0 [UNetConnection] RemoteAddr: 192.168.15.132:59203, Name: IpConnection_4, Driver: GameNetDriver IpNetDriver_0, IsServer: YES, PC: Steam_VR_Player_Controller_C_4, Owner: Steam_VR_Player_Controller_C_4, UniqueId: Null:post07-338075304DD81B60B8E37795B1977553
when game mode is set to None all is right
Anyone know why I can't use the Create Session node inside of a Blueprint Function Library?
Presumably because they're latent
Yop, most likely because of that
Might also be cause they need a world context object
Hey guys I have a packaged game where in the editor when I launch standalone it goes on steam etc but after packaging an laucnhing from desktop it doesnt connect to steam and I can't see other servers any ideas?
Hehe, em yea I put the steam plugin stuff it connects in editor
once I package though it doesnt connect an there's no over lay I just added the steam_appid.txt with 480 too
still no go
But is the appid in the.ini
yea thats where it should be too
steam_api64.dll in the steamworks/steamv139/win64 folder
@high current Do I need visual studio installed on the project or something
Im putting the advances sessions in my engine plugins now see if that works
@high current Yea that's what I thought. I have an event that's "supposed" to do that lol (keyword supposed) but for some reason it doesn't work. It executes but isn't working correctly. The way I setup my widgets is a pain. (i'm talking about my HUD widgets by the way. I noticed you mentioned me a while back)
dedicated server. First client connected - working just fine. when second player starts connecting I have a log with this : "UNetConnection::ReceivedPacket - Too many received packets to ack (256) since last sent packet. " and first client kicked from server and second player starts to play. Please help with this issue! I realy stucked!
Hey guys, is there a way to label the data i send in UE4 HTTP POST requests? I want to send a username and login field but I don't know how to label them when I call Request->SetContentAsString()
@plush mist Any RPCs you are performing on Tick?
Specially related to the Controller, PlayerState or Character Class?
@tawdry flint Perform HTTP Request with Json Payload.
@thin stratus you mean all RPC or only reliables ?
Created JSON Object with the two fields, convert it to a string via JsonUtiltiies and then send the string. On the other side of the request you can convert it back into a json object and read the values. @tawdry flint
Should be enough to google around
UE4 has a json library
@plush mist For now the RPCs
Cause it sounds like you are sending RPCs on Tick that are marked Reliable
Which is a Nono
@thin stratus I'll check all classes you point . And try to test again. Thank you very much.
@thin stratus you was right! it was reliables. Thank you very much.
Reliable RPC on TIck is quite pointless, if you take a second to think about it
by the time it fails, and whoever sent it figures out it should be resent
It was not mine code, dude ))
20 of more current ones would had landed on the recipient already
Are collision profiles not editable on Dedicated Servers?
In my case I'm changing an actor's collision profile, and it triggers a change on the client using OnRepNotify
Ah, onRepNotify only communicates to the client, not automatically the server.
anyone here tried to implement deterministic lockstep in ue4 before?
I haven't, but feel free to ask questions about it anyway
Hi, someone can explain me how works a dedicated server? Like.. I have some maps but the dedicated server is running all of them or just one? If yes, how solve that? to my player change to another map..
It only runs one map
and if I want change the player to another map?
@golden aurora Just one particular player, or the current map on the server for all connected players ?
Your lobby might work without being on a server, depending on what it does
If you do need a server, then it has to be another one
Or a server that same changes level to your actual game
Multiples servers to the same game?
Maybe change a little bit the ideia of the game
Or teletransport the player to another place, who is gonna be a "different level"
You'll need many dedicated servers anyway
Honestly if you need dedicated servers, changing your game idea is the best bet
Unless you've got a solid network team
Can I do some dedicated servers (each one with one map) in the same game?
Is that?
Dedicated servers are not in the game, they are on your company's servers
So yeah you can have as many as you like, depending on your server costs
You'll need multiple servers for each map
Since UE can't have more than 100 players per server
Hum.. I didn't know that
So I can do one map without server, then lobby with server and after more 2 ( with and without server )
Thanks
ok i think i found a way to keep it simple. can someone have a look and see if this should work, because im not getting a return value
if($_GET["stuff"]=="login"){
$username = $_GET["user"];
$passwordAttempt = $_GET["password"];
$sql = "SELECT id, username, password FROM users WHERE username = :username";
$stmt = $pdo->prepare($sql);
$stmt->bindValue(':username', $username);
$stmt->execute();
$user = $stmt->fetch(PDO::FETCH_ASSOC);
if($user === false){
echo json_encode('result1' => 'failed');
} else{
$validPassword = password_verify($passwordAttempt, $user['password']);
if($validPassword){
echo json_encode(array('result1' => 'success', 'regkey' => $regkey, 'banned' => $banned));
}
}
}
what are you getting?
nothing. browser is blank
your php is showing the errors when it gives errors right?
you are in localhost ?
$sql = "SELECT id, username, password FROM users WHERE username = :username"; ( two dots? π
username = :username
maybe its that
yes
nope still nothing
try to put a 'echo' before the second 'if'
to see if works until there
just giving ideias, I dont know what is the error too.. just trying to help you
so without the if statment its returning echos
but with it it just stops returning everything
no matter wehere the echo is
if(password_verify($passwordAttempt, $user['password'])){
echo json_encode(array('result1' => 'success', 'regkey' => $regkey, 'banned' => $banned));
}else{
// "Incorrect password"
echo json_encode('result1' => 'failed');
}
try something like this
Good to know π
its not returning a value if the pass word or the username is wrong
only if both are right :/
does that make any sense to you?
im going nuts
still not returning anything no matter what i do xD
its a fuking boolean... how is that not working
nope
echo json_encode(array('result1' => 'success', 'regkey' => $regkey, 'banned' => $banned));
and this?
that is weird
to me when I enter a wrong password, that say it "Incorrect password" because return1 isnt success
and i make a new echo close to json_encode
you made a php file to test it?
is not in the engine. im testing in the broweser
browser*
let me give you my files
lets see if you can reproduce now
I can put RPCs on the PlayerController right?
Currently working on the interaction mechanics, current plan is to have an interaction rpc so that the owner asks the server to do the interaction
oh boy more vulnerable php code
php is also to connect with database in some multiplayer game π ehehe
Since properties only replicate when they are changed, is there any difference in terms of bandwidth consumption on a property that is marked Replicated (with no condition) but only changes once at the start of a round, and one marked with COND_InitialOnly ?
The reason I am not just setting it to InitialOnly is that the GM has to make a few changes to the property initially which means the correct value might not go out
hello guys. how to get ping from AWS gamelift to UE4?
Quick question: UE4 RPCs - UDP and not encrypted, right?
Hi! I'm having a problem I never faced before and I'm not sure the best approach to solve it.
Context:
I'm doing a test for a coop game.
Player_0 hosts a game (game opens as ?listen), Player_1 joins it, so no dedicated server.
In the game, both players (server and client) can be in different parts of the map.
Player_0 (server) is in a quiet area, no enemies.
Player_1 (client) is in a combat area.
Both areas are far away, meaning that they don't see each other in their respective screens.
Player_1 engages with an enemy.
The enemy is spawn in the server (P_0) and replicated to the client (P_1).
When the enemy attacks, it plays a montage. During that montage an AnimNotify happens to inform when to inflict the damage.
That AnimNotfy notifies back to the owner of the montage mesh, which is the replicated enemy.
Problem:
I need to notify back to the server, not to the client version of the enemy.
I tried having a Custom event in the enemy bp that replicates: run on server and call that from the notify if the owner is not Authority.
The event never gets triggered.
Suggestions?
You should be able to tick somewhere that this stuff is played on the Server at any time or so.
Then the AnimNotify should play on the server, even if they are out of range
AnimNotifies aren't a network construct after all
I tried that, but I think that only works on dedicated servers
They will play on whoever plays the animation
@thin stratus think so
@late wharf So you set "Mesh Component Update Flag" to "Always Tick Pose and Refresh Bones"?
Actually:
This feature is now under "optimization" group and It's called "Visibility based anim tick option"
don't know how to retrieve ping from AWS
@thin stratus
Yep, tried that too. No luck. Also, that's not an ideal solution because that means that every enemy on the map will update in all clients + server every time they play an animation.
But I tried for the sake of the test, and doesn't work.
Hm
I know more or less what the issue is, but not sure what the solution is/was.
It know it's a thing on DedicatedServers, as you mentioned.
@vapid mortar GameLift has a Function in their SDK for the Heartbeat.
If you have that SDK setup for UE4's DedicatedServer, then you most likely implemented a few of their functions already.
One of them being the Heartbeat that just has to return true or so.
They basically ping the Server to check if it's still alive.
@thin stratus if i'm not wrong the function is Health Check right?
I can't recall, I haven't used GameLift in 2 years
But that should be visible in their example code
Hi, how to properly use FIcmp to ping server?
I'm trying to use this code:
void UAlisBPFuncLib::PingAdress(const FString TargetAdress, float Timeout)
{
//FIcmpEchoResultCallback HandleResult;
//FIcmp::IcmpEcho(TargetAdress, Timeout, HandleResult);
FIcmp::IcmpEcho(TargetAdress, Timeout, &UAlisBPFuncLib::OnPingResultComplete);
}
void UAlisBPFuncLib::OnPingResultComplete(const FIcmpEchoResult& Result)
{
}
but have a error:
1> W:\GitRepo\Alis\Source\Alis_0_2_0\Private\AlisBPFuncLib.cpp(38): error C2665: 'FIcmp::IcmpEcho': none of the 2 overloads could convert all the argument types
1> W:\GitRepo\UE_Source\Engine\Source\Runtime\Online/ICMP/Public/Icmp.h(81): note: could be 'void FIcmp::IcmpEcho(const FString &,float,FIcmpEchoResultDelegate)'
1> W:\GitRepo\UE_Source\Engine\Source\Runtime\Online/ICMP/Public/Icmp.h(71): note: or 'void FIcmp::IcmpEcho(const FString &,float,FIcmpEchoResultCallback)
Greetings gents, anyone got any tip on how to approach matchmaking on android phone? I.e how to match players and spawn servers for each match individually
a lot of research, if you don't already know. not really something that can be condensed very easily. your solution will depend on your specific needs.
Im very lost so do u know 1 example?
There is most likely no example, as this is already difficult and a lot of work for PC games
UE4's UDP traffic is not encrypted by default
Anyone know why the ability to change standalone window size is disabled for me?
Nvm, it's disabled unless number of players is >1!
Hey All, I'm trying to implement this function from the steamworks API.
It says here that I must inherit from ISteamMatchmakingPingResponse in order to receive this callback. Does that mean I should create a new class of that type and put my PingServer function there? Has anyone set something like this up before?
Here's what my function looks like at that moment.
If PingServer returns a value, I could then pull the data I need off of PingServerResponse?
Doesn't the Steam OSS already return ping to game servers?
Well, it does - how accurate it is is another question though
I'm trying to get the Steam ID for the server via IP address and Port number
The Server ID will be returned with a session search result as well
It has to be as that's how steam handles the join (provided the ID)
We're using the gamelift and mutiplay matchmakers which only return an IP and port. It was recommended that we use this function (PingServer()) to get the steam ID for the server.
Maybe there's an easier way to handle this...
Theoretically, if I wanted to call PingServer() am I on the right track?
Here's an answerhub from someone with a similar issue: https://answers.unrealengine.com/questions/795636/connect-to-steam-dedicated-server-via-raw-ip.html?childToView=839827#answer-839827
Ah in that case I couldn't tell you RE Gamelift
by default, the steam OSS uses the p2p networking
you can disable that which will allow you to connect by direct IP
We use Steam as a distribution platform only with GameLift and GameSparks. Launching through Steam gives the game the Steam Overlay while still using the IPNetDriver to do direct IP connections to our Servers.
that must be expensive
yeah, still expensive though. cloud-only must be the most expensive way to host game servers, especially through something like AWS
meh. Listen servers don't really give any guarantee's of quality
If you want to offer some guarantee of decent QOS online, hosting dedicated servers is the only real way.
i like how you assumed listen servers over bare metal
bare metal?
You suggest building your own hardware for dedicated hosting??
yes, as in not cloud
Fuck that lol
Yeah nar
and there are many services cheaper than gamelift that will manage the hardware for you
Physically that would be a nightmare for any decent sized game
multiplay, i3d, etc
Just do what we do, pay for some official servers, allow players to rent their own from providers
AWS is the build your own version of dedi servers imo
that's what we do but a lot of players opt for the "official" experience
That would be alright for larger max caps and longer game times, but for match based games i dont think thats an ideal solution
well that's what we do with multiplay
Fair enough
sidenote, but if you allow players to rent their own, you should make sure your interface for tweaking game rules and server rules is top noch
I still remember the battlefield backlash
BFBC2 has awesome server config
well i suppose that's where we're lacking since you just get the server binaries
and there's a bit more involved to get an XP enabled server
then iirc the next one had horrible ones and people cried to the point that they just quit playing the game
BF3 wasnt the greatest as far as hosting went
Then they just ditched it altogether after that
or it was bf3 yeah
doing just binaries means you rely on having a wiki with documented shit
which in most cases what you internally think is good documentation never results in players seeing it that way
at least we are UE4 here, so stuff is all over the net, but man when I see proprietery engines with games that pretend to offer mod support, and then only documentation on wiki...
Distributing binaries isn't an option for us unfortunately, opens up options for hacking etc. Apparently squad has some 'trusted' system where they'll distribute a key for a dedicated server binary but if they catch you hacking or breaking the rules it gets taken away from you, which seems like a good compromise.
Think you have to apply for it or something, don't know the exact details
Yeah you have to have a license to run a Squad server.
So if you dont run the server within their specs they take it away from you
Yeah that makes sense
That way you can guarantee some level of service, protect your servers from h4x and it doesn't cost the community a small fortune to get hosted servers
that is cool ^
Its not an automatic system though
They have to manually review it from community reports
lol
Yeah, if you were talking Battlefield scale I doubt it'd be viable
that is less cool ^
Still a good way to go though
I think their community is small enough that it kind of works
Not sure how often they revoke licenses though
Id say they would just hand out warnings first
Especially now since you can run "whitelisted" mods on servers.
Epic just gave up on anything (or maybe it was planned for later) but UT's server support is horrible
The issue being some server owners might not know whats whitelisted and whats not.
I'm amazed UT has any server support tbh
the communty had to figure most of the stuff on their own
Isnt UT dead though?
UT is more of a developer resource now haha
It's full of gems
Yeah for sure
I worked on UT last novemeber, and I worked on it again a month ago, community is still the same, it is DEAD on a commercial scale, but not dead as in you cant play. Like at any point if you jump in you will have someone to play with
ATM i have 7 separate discords
for UT communities
its about 1500 people combined give or take
a guy made this
But anything you commit for it will never get released? They dont update it anymore?
So its in the same state it was when they last left it
Isnt that right?
The MP would just be the same forever
and then the sys admin guy who manages most servers then wrote some python scripts to automate updates
Well, the UT editor is available
from where you can create maps, characters, taunts, weapons and game modes for the packaged version of the game
But wouldnt you need to share those via a 3rd party?
UT has HUBs
which store all content and always have valid redirects
the game download everything new required for a game when you join a server
the site I mentioned above is kind of like a repo for all of this and every redirect is kept
What kind of stuff have people added? I was waiting for vehicles π’
Enjoyed warfare mode in UT3
But all there ever will be is content updates though im guesssing.
Same James... π I want to slice people with the manta
There has been some progress on vehicles, but not alot
mostly it is the recreation and addition of game modes
the most popular one being Ellminination
which is CS GO style thing
no pickups, around the map, you have full health, full armor on spawn
all weapons
and you dont respawn untill the next round
its best of
and if you kill someone they drop jump boots and small health
re: trusted/licensed servers, we took the approach where a server had to have a GSLT key (via steam) in order to have XP
and that has some requirements
you can revoke access for a GSLT-enabled server which will ban the owner's other tokens and prevent them from generating more
Could anyone help me understand the difference between Logout and Destroy Session?
Logout as in the Event on the GameMode?
Logout on the GameMode is called when a PlayerController has exited, either because the Player left voluntarily or due to network failure etc etc.
DestroySession does what its called, if you have previously created a session using the session nodes, this node destroys that session.
Not the event in this case; I was curious about the similar looking call to the DestroySession call, ala (pic incoming)
I ask because DestroySession is not triggering the Logout even on the Game Mode, and I am looking for a way to disconnect players that successfully raises an event
so with Seamless travel Multiplayer, the Gamemode is persistent through the changes, but how do we tell when a player has loaded in ready or does post login call again or do i just make a event on begin play for their pcs
is this a place where we learn how to make launcher?
hmm I don't know if there's a room that covers that, #ue4-general might be your best bet
hey could i call someone who could help me with some multiplayer stuff
hmu in dms if i can<3
@spare glade with seamless travel (example is travelling from map A with PC class A to map B with PC class B)
when client loads the level, first NotifyLoadedWorld fires on the PC A, then its sends a ServerNotifyLoadedWorld RPC (this is still the controller from previous map, as GameMode hasn't had a time to change them)
after that HandleSeamlessTravelPlayer is called on the GM, where the controller is swapped, this will cause OnSwapPlayerControllers callback to fire
and after that calls the GenericPlayerInitialization (not exposed to BP) - this is where the exec flow becomes the same as after PostLogin
and finally, HandleStartingNewPlayer
the last one will make sure the player has a pawn, etc...
void AGameMode::HandleStartingNewPlayer_Implementation(APlayerController* NewPlayer)
{
// If players should start as spectators, leave them in the spectator state
if (!bStartPlayersAsSpectators && !MustSpectate(NewPlayer))
{
// If match is in progress, start the player
if (IsMatchInProgress() && PlayerCanRestart(NewPlayer))
{
RestartPlayer(NewPlayer);
}
// Check to see if we should start right away, avoids a one frame lag in single player games
else if (GetMatchState() == MatchState::WaitingToStart)
{
// Check to see if we should start the match
if (ReadyToStartMatch())
{
StartMatch();
}
}
}
}
it doesn't do much, so this is the ideal place to override the construction of your Pawn, if you require a more complex object graph
from BP, this is what you get by calling Parent on HandleStartingNewPlayer, and after it executes, client will have PC, PS, and Pawn ready
If we have someone here who did, or currently does, create a multiplayer game for, or including, xbox, do me a small favor and DM me. I'm a bit confused/shocked about some requirements. :D
Nvm. Found some UDN stuff. I love how you are just doomed if you don't have access to UDN. And that for the most basic things you need.
Greetings gents, has anyone implemented deterministic lockstep into ue4 before?
And feel like providing me with some guidelines? π
@thin stratus maybe time for another guide
@glad sedge Lockstep stuff? Hell no.
@keen thorn what u want to know
@twin vault just guideline how it could be implemented, would i for example create a controller class and send inputs or?
@thin stratus nah the UDN stuff
its pretty involved, you can get your inputs on a normal controller class, but send your inputs through TCP or UDP, make sure it gets acknowledged and only run frames when you make sure you have the inputs from everyone
@glad sedge Can't do that. UDN is NDA
normally your whole game will run on a single loop, making sure to use the last frame input
and make sure everything is deterministic ofc
is it possible to spawn the pawn in specific location? i mean like the last location that the player died, and if possible is GameState responsible for this?
Given that something as simple as multiplying two floats isn't even deterministic on different PC's it's not a challenge for the feint of heart.
yep, i had to rewrite everything, collisions, timers, movement, traces, to use a Fixedpoint class
this is not lockstep (it also have rollbacks) but gives a general idea of what you need to keep in mind when doing p2p: http://blog.hypersect.com/rollback-networking-in-inversus/
ok, thanks alot @twin vault , My game is turn based and does not require networked physics or collision so should be fine i hope
did you also implement speed up and slow down of input consumption?
what do you mean?
like if a player lags behind, and suddenly all his chunks of input arrive later, then the other machines would have to catch up by increasing simulating speed
to keep buffer the same
normally you wont simulate until you have all inputs
do you keep history of inputs?
ok
also for lockstep you need locked framerate
ye
mines locked at 60
yep u can get away with much less on a turn based
Im making for phone so trying to save bandwidth
havent tested bandwidth yet
@thin stratus oh for real?
Yeah, which is why it annoys me
I get that some extra support for paying customers is a thing.
But that they basically lock answers to issues behind a pay wall is stupid
Would the PlayerState be the best place to store something like a weapon a player had found and equipped in a previous match when traveling to a new map?
So that when the new map loads, that player can continue using that weapon that was found in the previous map (when the character spawns in the new map, the server would fetch whatever the EquippedWeapon property is on each player state and spawn / equip it )
I guess, but you could also save it on the PlayerController
Question is if you need stuff like ammo saved
Cause just the Class would reset the state of the weapon
Actually
Yeah just mark the Weapon via C++ as keep alive during SeamlessTravel
And then move the Variable over via OnSwapPlayerControllers
Or OnCopyProperties
Whatever you want
@grizzled stirrup
@thin stratus Thanks for the reply! If it's saved on the PlayerController, would it not get lost in the travel? I am planning on using the CopyProperties() function in the PS to allow the data to persist
I don't need stuff like ammo saved
Just a TSubclassOf<MyWeapon>
For primary and secondary
It'll get spawned and initialized in the new map per player depending on that class
It will get lost on the travel anyway
Cause it's an Actor
You have to actively tell the PlayerController or GameMode to persist it via c++
They have an array of actors that should persist
Yep I was thinking the PS CopyProperties is the best way to store that property?
Where you keep the reference doesn't matter thatm uch, but it's easier to move it around with PC or PS
Oh I didn't know the PC or GM have an array of actors that can persist
Thought it was just PS and of course GI
YOp
No you can persist stuff
Just keeping the ref is tricky
If it's not references in the PlayerState or Controller or so, you have to get it differently
E.g. our TeamStates are persisting
have to GetAllActors to grab them again :D
I think I'll use the PS CopyProperties way as it already has to keep track of score, upgrades etc.
Sure
Much cleaner than storing an array of custom structs in the server GI and fetching when opening a new map π
Which was my very naive approach before
I have a question about saving, can we make it so the server save with blueprint but only on server side and server save every 15 mins like but not on the client?
@uncut river yes, just make a blueprint with an event that is set to Run on Server and you can add an isServer node that will only fire if the instance is the server
ok thanks @dense ocean and how do i set the dedicated save folder to save map infos and character infos in a different area ?
no prob, im not sure how to use different folders i just use different save game objects so they make seperate files
Can anyone help me with dedicated servers to host them? send me a private message
Afaik unless you edit the source, savegames will always be saved under the /Saved/ folder
BeginPlay is called after properties have been replicated right?
i was searching for respawning the pawn and i couldn't find any tutorials (c++)or something to help me out. i understand GameMode should be responsible for spawning everything in the world. i have an overlap event which gets called in a specific condition. i want to respawn the pawn who cuzed the overlapping event, any tips? or any links?
@brittle karma Well if you let the spawning happen through the GameMode (so through Epic's code and not by yourself) then you can just call "RestartPlayer" on an pass the specific PlayerController iirc
If you however have the DefaultPawn in the GM as none
and you are spawning yourself, then just get the PlayerController, get the pawn, save it to a varaible, unpossess it, destroy the pawn, spawn a new pawn and possess it again.
@solar stirrup ExposedOnSpawn properties, yeah iirc
well if i use Restart Player where the pawn will be spawned?
That is determined through functions you can override in the GameMode
such as "ChoosePlayerStart"
Where you can e.g. get a random SpawnPoint actor
And return that one
@thin stratus What's the C++ equivalent of ExposedOnSpawn?
so by overriding ChoosePlayerStart i will be able to spawn whereever i want, thanks.
@solar stirrup Most likely using "SpawnActorDefered"
And then setting everything before finally calling "FinishSpawning" on the actor
Already was going that way for spawning a dropped item anyway, I love how it fits, thanks!
Yeah, can't promise that it's the same behavior, but I think so at least
should work perfectly
@thin stratus have they covered these information in docs or wiki? i couldnt find them
Can you make a UFUNCTION(Server, Reliable) BlueprintCallable?
who saw tutorial about steam rich presence ue4?
can't find anything about it, only discord rich presence
Is ReplicateMovement only for actors with "MovementComponents" or does it also replicate Transforms?
it can replicate static mesh movement
Strange then. I have an actor descending from CineCamera that refuses to update its position on my clients
i have this problem for a long time, im trying to get player controller for clients, but it always returns the one for Server, for example i used this code in pawn's BeginPlay :
PC = Cast<AMyPlayerController>(GetController());
```after an overlapping event i call a function in PC, which works for server and not client. why is this happening? i initiate the PC neither in RPC nor inside an if(Role == ...) so i expect client executes and runs the code but it only works for server player.
How did u guys create death function for multiple character?
Do I need to replicate my Components in an actor for them to be updated?
I'm trying to figure out how to replicate the movement on an actor with a SceneComponent as its root.
Is attaching an actor to another replicated by default?
Nope
You might think so if the actor has MovementReplicated
But the actual attachment is not afaik
Alright, I'll try doing a NetMulticast function for my attachment instead. Might fix it
I remember TheJamsh saying that the attachment is actually replicated
but to be safe, OnRep it
When using seamless travel, although the GameMode persists, does it also reset all previously saved settings to default? (like for example if ScoreToWin was increased from the default 500 to 600 at the end of the match before seamless travel, it'll be back at 500 when opening the new level after seamless travel?)
It seems to do so, but I'm just double checking as in that case those values will have to be explicitly stored or sent
@high current it is as long as component you are attaching to is set to replicate
which is often not the case
@grizzled stirrup the actor should not reset to default values
Oh I was about to test it, and then I forgot
most times, you don't replicate scene/primitives on the CDO
as there is little point to it
but setting one to replicate can have... interesting sideeffects
we replicated our subclass of USkeletalMesh, that contained all the logic for prediction when playing montages
suddenly, locally spawned at runtime skeletal/static meshes started falling off our character on clients
as soon as it participated in a grab montage (root motion), as that montage detached the characters skeletal mesh in order to avoid dealing with collisions for the montage
but then skeletal mesh replicated, along with replicating its attachments, and all non-NetAddressable primitive components just fell off
that was an interesting bug to pin down
I never understood replicated components, I don't think I have ever succeeded by replicating em
there are several way to use a component in a network environment
1 - part of the CDO, either added via c++ constructor, or AddComponent button in BP
they exist on both clients and server, they are not replicated by default, but if they are components on a replicated actor, they have a unique name relative to that actor, so a reference to them can be resolved over network
they can also be referenced if they are on non-replicated Actor as long as its loaded from a package
2 - spawned with Authority at runtime, replicated
they have to be part of a replicated Actor, they can be referenced over network as they have their own NetGUID, and they can replicate variables, subobjects, as well as send RPCs
3 - spawned separatedly on Server and Clients, with IsNameSupportedForNetworking overriden to return true
they act exactly as CDO components, but... if you end up spawning a component with a different name on client and server you end up with a NetGUID mismatch which results in a client booted from the game
and 4 - spawned locally, non addressable
they have no value or participate in networking in any way, nor can a reference to them be resolved over network
if you spawn those from something like BeginPlay, results in FNetGUIDCache warning that the component is not supported for networking, if you ever wandered where that came from
Oh yea, I can see #2 being useful
they are all useful
#3 is useful if you wand to add character class or setup specific meshes, without the overhead of them being replicated
you do have to be able to guarantee the name is exactly the same on every machine tho
#1 is pretty much the default way to use components
and #4 is useful for the, say, setup screen itself, as you don't want a player to change a class then wait for round trip of latency for the meshes to change
i also recommend against using #3 in that scenario, as you can't really guarantee a packet won't get lost, and you can't reuse the names for dynamically spawned components
Well, as I get into C++ I need to know all of this stuff, but so far in my BP experience I haven't felt the need for these things
what are you waiting for? i can't stand BP networking π
π
you only can't use #3 with BP alone
as there is no way to override IsNameSupportedForNetworking
C++ sounds neater, I have been hanging out here and at #cpp looking at code, Vor helped me grasp pointers the other day, but I am waiting for the right time to be free to learn C++, which probs wont be until I intern somewhere
its a function on UObject or UObjectBase
which name is not supported for neworking
Like in what instance will UE issue a warning or an error
#endif // WITH_EDITOR
/** IsNameStableForNetworking means an object can be referred to its path name (relative to outer) over the network */
bool UObject::IsNameStableForNetworking() const
{
return HasAnyFlags(RF_WasLoaded | RF_DefaultSubObject) || IsNative() || IsDefaultSubobject();
}
/** IsFullNameStableForNetworking means an object can be referred to its full path name over the network */
bool UObject::IsFullNameStableForNetworking() const
{
if ( GetOuter() != NULL && !GetOuter()->IsNameStableForNetworking() )
{
return false; // If any outer isn't stable, we can't consider the full name stable
}
return IsNameStableForNetworking();
}
/** IsSupportedForNetworking means an object can be referenced over the network */
bool UObject::IsSupportedForNetworking() const
{
return IsFullNameStableForNetworking();
}
so i remembered the function name slightly off π
most of the time you don't need things to be replicated, only that a pointer to them can be resolved over the network
and that is a huge part of saving bandwidth
Yeah, I can get that logic, I do that stuff(the principle) in BP as well
so if you have not declared a pointer to an UOjbect, and then try to replicate it, it will fail because it is not stable?
no
UObjects can replicate just fine
but they have to be added to ReplicateSubobjects override
stable names are there for referencing objects that are not replicated
resolving a pointer to a non-replicated UObject will fail to resolve NetGUID, unless the name is stable
anyways, stable name has nothing to do with being able to replicate objects or not
(edited to avoid confusing someone who might read that later)
replicated objects get their own NetGUID - and they can always be referenced by it, stable name or not
ah
I see
After gamescom Ill sit down and do more work on my UT game mode, properly clean it up and transition to 100% event based. I will probably bother you lot then with questions about proper methodology and perhaps how C++ handles stuff better, so I can directly compare
Can we make a full Steam connection on dedicated server with only Blueprint now ?
https://wiki.unrealengine.com/How_To_Use_Sessions_In_C++
I am trying to follow this link to set my dedicated server to work on Steam but i do not have the same things, like this line
#include "EngineMinimal.h"
to
#include "Engine.h".
But i have, CoreMininal.h and few informations should be outdated there.
Anywhere we can read that is not outdated about Steam + Dedicated settings?
Thanks