#multiplayer
1 messages ยท Page 653 of 1
is it basically like this?
and EOS just start more dedicated servers as needed?
No gamelift would do that based on your scaling rules. It essentially checks how many servers are full and spins up new ones to keep X amount ready for players. It scales down as well.
Generally if you're using Gamelift, you'll use Flexmatch, which is gamelifts matchmaking.
is it better than AWS + EOS?
Gamelift = AWS
i've worked with Gamelift in a shipped game, it's decent, but can quickly get expensive.
and we were running 10 game servers per EC2 instance.
How bad is it to send 80 bytes to a RPC while i may only use 4 bytes in worst case ?
I'm still having a hard time to decide such things.
I know you shouldn't really send unneeded bytes, but on the other hand it would really improve the code workflow(even though that shouldn't be the most important thing)
depends on what you're sending and why.
you may want to approach the problem differently
It's basically the equipment bonus you get for wearing it.
The struct i'd send contains all kind of bonus types
does the client not have that information already?
So it's only a 1 time send for equipping/un-equipping it
ie, what the equipment does?
The client would have it, but the server would also need the information if the player equips a new item or de-equips an item to apply the bonus stats
This might work for e.g. the additional defence stats, but i think this wouldn't really work for stuff like Current/Max Health
In general, I found it easier to just send desired equipment IDs with equip or unequip commands. Server does equipping, sets new values, values get replicated. Client can have access to same functions and data for UI display. So in the end your only data sent is what you want to equip, and then the return replicated values of anything changed.
But realistically, you don't equip things that often. So I don't think that send size is really going to matter much. It's not like you're doing it 10+ times a second all game long.
yeah, if it's only once in awhile, it's fine
@meager spade@fading birch do u have a doc or something that explains all of it in details?
I still dont understand how to approach it from the game side of things...
like what does the dedicated server(the server version of the game) suppose to do and stuff
the dedicated (game) server just handles gameplay stuff
matchmaking, launching servers, etc that's on you to implement outside of the engine
and what about sessions?
Sessions can be used for matchmaking, but that depends on the Online Subsystem
so basically the dedicated server start a game on a lobby map, it wait for players to join and then load the game map when ready, and when it finish it return to the lobby map and wait for the next players to join?
generally sessions are the servers way of telling an Online Subsystem they're available for players to join, as well as set parameters of what that game server is doing. Ie playing Free For All, Team Death Match, etc.
or does it need to load directly to the actual game map?
you can set it up to have Lobby -> Game Map
You can also set it up to have a dedicated server lobby, then travel all players to a different server for the actual match
i've done it both ways
and which subsystem is most suited for unreal games?
EOS?
and easiest to use
with the most support and stuff
Arguably, Steam.
However this is very clearly #online-subsystems so we should move over there
and to use the subsystem in general do I use the built in session class?
Do RPC's really need the full definition for parameters ?
As in you can't forward declare a struct which you use as parameter ?
you should be able to do void foo(struct FStructFoo& StuctFoo);
Think it also have to be const since a async RPC shouldn't be able to modify it.
But yeah, that's what i'm doing and it doesn't work :S
"'Blah' - type must be a UCLASS, USTRUCT or UENUM".
(Also is a USTRUCT)
const would be fine too
that was just an example
you may not be able to forward declare it if it's a UFUNCTION, in that case I would move your struct to somewhere a little more global to avoid circular dependencies and just import that into your header
Well yeah. Since it's a RPC it has to be a UFUNCTION >_<
yeah
I would just move your struct definition then
It's annoying, but such is programming
Has a replicated variable value to be changed in a server event to be replicated to all other clients ?
Can you restate that question please, I don't understand what you're asking.
When a variable is setted to replicated ( or repnotify) , have i to change its value in a server event? or multicast event? for the replication to work ?
sorry for the bad question before
Ok, let me see if I understand
Yes, you have to change the value on the server.
Otherwise it will only be a local change which will quickly sync up with the value of the server
You have a variable, which is marked to be replicated. You're changing the variable from where?
If you're changing it on the server, you won't need to do anything else, it'll replicate on it's own
from the client ( a simple custom event)
Yes, you'll need to call a Server RPC
the server is the only one that should be changing variables
so i need always variable repicated + server event?
Not always, but basically yes.
The server will e.g. also tick. So you can do if(HasAuthority) { Change the value } inside of the tick
ok
my case is special because the variable change is triggered by a keybaord input event
so always client side , if i understand well
so it will never have authority no?
Most replication changes are driven by player input, this is no different
when you want to fire a weapon, you press the "fire" button on your mouse. Then you call a function to fire your weapon. That function checks if you're the authority, if not, it calls the server version of the function.
Replication is Server -> Client, never Client -> Client or Client -> Server
Is there an easy way ( ie console command) that will display the hitboxes of a character?
in play mode
show collision ?
on AWS make a secured Api Gateway http endpoint that runs a lambda function when invoked, the function just write to a data table.
And unreal would just make a https request to that endpoint.
Hi, does anyone know how to setup the network profiler tool?
Okay yeah. That's simple!
quick question
when GameMode::PostLogin() runs, does the Controller already have a valid Player State?
It should yes.
If a multiplayer game uses sessions, is it possible for players to determine the IP address of all other players in the match?
I want my game to be a success, but I'm struggling with the decision of using host sessions vs dedicated servers because I know streamers avoid playing games that leak their IP at all costs, and using dedicated servers costs money.
That's not really a session thing
Sessions are used with listen servers or dedicated servers
The IP issue is an issue regardless of whether you do use sessions at all
Thanks for the correction, I'm still learning all the proper terms and lingo. I meant to say a listen session.
And yes, most listen server setups do expose the IP, session or not
The only way to prevent that is to have your own network layer, like Steam does with their net driver, by having the IP address as a concept removed from the board
Most or all?
Destiny moved to that last year to cut down on players DDOS'ing themselves
So if I'm using steam integration the IP addresses are hidden?
Not just Steam integration, the Steam net driver that goes through their own servers for the entire networking
I'm using that, playing as standalone, then "hosting" or "finding a match". Would connecting clients be able to determine the IP address of other players and/or the host?
By default you're using regular IP networking so yes, every client knows the server's IP and the server knows every client's IP
How to enable the Steam network protocol layer for Unreal 4 projects.
This is what you want instead
So would Client-A be able to read the IP of Client-B given they are both connecting to HostPlayer-C
ooooor you can use a steam plugin from the marketplace to handle a decent amount of things for you
Link?
Wdym? There're several options
Any recommendations?
the basics are covered with Advanced Sessions Plugin (Free I think).
I'm personally using SteamCore right now; the docs are kinda lacking but the author is incredibly responsive.
"P2P listen servers always use Steam's communication network regardless of this setting." ๐ That sounds about right....
Advanced Sessions does not add any functionality to the engine
Just a simple Blueprint layer
Ah I see. I haven't really used it for a full project; just remember checking the basics of it back in the day
the IP is still exposed when the client connects via the network driver, not much you can do about it.
So for a game like VRChat does that leak IP to all connecting players?
I find it odd how some streamers are very concerned about hiding their IP from potentially malicious players in the same match, but others aren't concerned at all.
So one work around without having to use dedicated servers is to allow for private sessions between trusted friends. Correct?
With a listen server style setup, that's nearly impossible
So if I used the free advanced sessions plugin I could set it up so that players can host a game and others can connect via friends list, but im not seeing anything about setting up a password.
that's a completely different type of thing
you'll need to read up on online subsystems
I have been lol
if you're talking about password protecting servers, that's something a bit different
Yes I'm talking about them all because I want to weigh my options
Sorry for the confusion
What would you recommend for a 5vs5 game. I want to allow for private friends / password based matches but also just standard host a public game and join a game via matchmaking.
All while avoiding dedicated servers if possible.
I would use dedicated servers tbh
Do you think performance is likely to be significantly impacted with 9 other players all connecting to a host player's PC?
That's probably why dedicated would be better ya?
well, there's a few reasons why I wouldn't use listen servers, ever if I can avoid it
the main one is you have to trust your clients
which means they can hack
bandwidth and stability is also an issue
if the host lags, everyone lags
Ahh okay
if your doing a game like VR chat, then that doesn't really matter
So then I guess the question becomes barrier to entry vs multiplayer experience. hmmmm
as there's no real gameplay going on
Most of my gameplay is movement based, but there's some collision and hit detection RPC
That depends on if you're making chess or Garry's mod.
Having to do 10 times the CPU work will always take longer than not, whether or not that's a big deal depends on how much work it is to begin with.
Unfortunately I am having the same problem I had with my previous approach. Just like the ec2.describeInstances causes my lambda to quit with no errors and doesnt execute, same thing happens with DynamoDB.putItem.
I am new to aws and lambda but I can see my console.log is not happening inside of the callback nor after the putItem call.
Ih wait actually a log after the putItem call does appear. So I guess the callback just never happens
Check your Lambda configuration, by default it can run up to 3 sec, I change it to a minute. It probably timed out.
And put a promise() at the end of describeinstance to await.
var ec2Instances = await ec2.describeInstances(EC2Scan).promise();
Btw what langauge are you using?
nodejs 14.x
It still times out at 60 sec.
I'm sure I just misunderstand something very basic about Lambda functions.
const dynamo = new AWS.DynamoDB({apiVersion: '2012-08-10'});
exports.handler = async (event) => {
//exports.handler = function(event, context){
const response = {
statusCode: 200,
body: JSON.stringify('Hello from Lambda!'),
};
var putItemParams = {
TableName: "UnrealServers",
ReturnConsumedCapacity: "TOTAL",
Item: {
ServerName: {S: "MyServer"},
NumPlayers: {N: "5"},
MaxPlayers: {N: "16"},
GameMode: {S: "Impostors"},
GameStatus: {S: "Lobby"}
}
};
console.log("about to putItem", putItemParams);
var putAttempt = await dynamo.putItem(putItemParams, function(err, data) {
console.log("callback reached.");
if (err){
console.log(err, err.stack); // an error occurred
}else{
console.log(data); // successful response
}
}).promise();
};```
Im just hardcoding it in for now until I can get it to work, then I'll have it take HTTP request params.
'use strict'
const AWS = require('aws-sdk');
AWS.config.update({ region: "us-west-1"});
exports.handler = async (event, context) => {
const documentClient = new AWS.DynamoDB.DocumentClient({ region: "us-west-1"});
const {table_name, server_name, current_players, max_players, region, isacceptingplayers, ip_address, isliveserver, isqatestserver, accepting_matchmaker} = JSON.parse(event.body);
var d = new Date();
var currentMinute = d.getMinutes();
const Putparams = {
TableName: table_name,
Item: {
Name: server_name,
current_players: current_players,
max_players: max_players,
region: region,
isacceptingplayers : isacceptingplayers,
lastupdate: currentMinute,
ip_address: ip_address,
isliveserver: isliveserver,
isqatestserver: isqatestserver,
accepting_matchmaker: accepting_matchmaker
}
};
var data = await documentClient.put(Putparams).promise();
var response = {
statusCode: 200,
body: "Ok"
};
return response;
};
(yes I made an Among Us clone, but I won't be distributing it to the public - I made it to teach myself what I would need to make a game with similar movement and user interface and networking, but the final product will have very different rules and gameplay and of course, art)
Try that, you don't need to catch error since it is just updating server, for me at least every 30 secs
OK, thanks
Oh interesting, you still need to return a response object. Maybe that's what was wrong with mine.
still timed out though when I did yours
Maybe it's a permission problem?
By the way, thank you so much for taking the time to help me out
Could be, make sure its the right region too.
And check the error log.
I would think the logs would tell me if it's a permission problem. But it just looks like this in the Test tab on the Lambda page:
END RequestId: 2c4802bb-34e6-4590-8c02-c6edfcc468db
REPORT RequestId: 2c4802bb-34e6-4590-8c02-c6edfcc468db Duration: 60034.31 ms Billed Duration: 60000 ms Memory Size: 128 MB Max Memory Used: 88 MB Init Duration: 383.82 ms
2021-07-30T23:31:56.983Z 2c4802bb-34e6-4590-8c02-c6edfcc468db Task timed out after 60.03 seconds
oh yeah, region is us-west-2. I thought it was us-west-1.
(on my side too, not just in your code example)
The code works for me, been using it for months for testing our game.
Btw const {table_name, server_name, current_players, max_players, region, isacceptingplayers, ip_address, isliveserver, isqatestserver, accepting_matchmaker} = JSON.parse(event.body);
This only works if you call from api gateway test. Or make up the variable.
I know. I just put strings into the Item object for now to test from the Lambda function page
const AWS = require('aws-sdk');
AWS.config.update({ region: "us-west-2"});
exports.handler = async (event, context) => {
const documentClient = new AWS.DynamoDB.DocumentClient({ region: "us-west-2"});
//const {table_name, server_name, current_players, max_players, region, isacceptingplayers, ip_address, isliveserver, isqatestserver, accepting_matchmaker} = JSON.parse(event.body);
var d = new Date();
var currentMinute = d.getMinutes();
const Putparams = {
TableName: "UnrealServers",
Item: {
ServerName: "MyServer",
current_players: "5",
max_players: "16",
region: "us-west-2",
isacceptingplayers : "true",
lastupdate: currentMinute,
ip_address: "5.12.34.567",
isliveserver: "true",
isqatestserver: "false",
accepting_matchmaker: "false",
}
};
var data = await documentClient.put(Putparams).promise();
var response = {
statusCode: 200,
body: "Ok"
};
return response;
};```
but it still results in a timeout with the same very short logs - no errors other than the timeout after 60 s
Yea that should work, even if permission is wrong it would give error and not timeout.
Maybe AWS having issue with that region or try create a new lambda.
hm had the same problem yesterday and the day before
Does VPC settings matter for just testing within the Lambda page?
VPC is optional.
Mine isn't using any.
oh this is interesting. I turned off VPC and now I'm getting some useful errors:
"errorType": "AccessDeniedException",
"errorMessage": "User: arn:aws:sts::854977663781:assumed-role/unreal-listinstances-role/UpdateUnrealServerInfo is not authorized to perform: dynamodb:PutItem on resource: arn:aws:dynamodb:us-west-2:854977663781:table/UnrealServers",
"trace": [
"AccessDeniedException: User: arn:aws:sts::854977663781:assumed-role/unreal-listinstances-role/UpdateUnrealServerInfo is not authorized to perform: dynamodb:PutItem on resource: arn:aws:dynamodb:us-west-2:854977663781:table/UnrealServers",
" at Request.extractError (/var/runtime/node_modules/aws-sdk/lib/protocol/json.js:52:27)",
" at Request.callListeners (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:106:20)",
" at Request.emit (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:78:10)",
" at Request.emit (/var/runtime/node_modules/aws-sdk/lib/request.js:688:14)",
" at Request.transition (/var/runtime/node_modules/aws-sdk/lib/request.js:22:10)",
" at AcceptorStateMachine.runTo (/var/runtime/node_modules/aws-sdk/lib/state_machine.js:14:12)",
" at /var/runtime/node_modules/aws-sdk/lib/state_machine.js:26:10",
" at Request.<anonymous> (/var/runtime/node_modules/aws-sdk/lib/request.js:38:9)",
" at Request.<anonymous> (/var/runtime/node_modules/aws-sdk/lib/request.js:690:12)",
" at Request.callListeners (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:116:18)"
]
}```
So putting it on that VPC was probably what was blocking it from even making it this far.
woohoo! It works now. I just attached the dynamoDBFullAccess managed policy to the Lambda's role
Thanks very much for all your help!
Nice!
And what did you need VPC for?
Well I thought my Lambda could only see my EC2 instances if it was on the same VPC as they are.
And I wanted to gather a list of all the IP addresses so the client can pull that list up inside their game and choose a server to join
and then the game would just "open 123.456.78.910"
whatever IP address was on the server they choose from the list.
so I still need to figure out how to find out the IP address to set on that dynamoDB table.
Anyway maybe my EC2 instances don't need a VPC either? I just put in what sounded like they needed when I was setting it up
Interesting. Lambda VPC turned off can still see my instances that are on a VPC, at least when I run it from within the Lambda console.
(I got my describeInstances lambda function working too ๐ )
And it looks like it is using the elastic ip associated to the ec2 instance as that instance's Public IP, so that's good. Now I just need a way to match the ec2 instance's public IP to the database entries being generated/updated by my dedicated servers.
@kind ember I have this C++ function in my game instance class:
{
TSharedPtr<class FInternetAddr> HostAddr;
bool canBindAll;
HostAddr = ISocketSubsystem::Get(PLATFORM_SOCKETSUBSYSTEM)->GetLocalHostAddr(*GLog, canBindAll);
UEngine* DasEngine = GetEngine();
if (!ensure(DasEngine != nullptr)) return FString("ShowMyNetInfo could not get Engine");
//DasEngine->AddOnScreenDebugMessage(0, 5, FColor(255, 255, 255, 255), HostAddr->ToString(true), true);
return HostAddr->ToString(false);
}```
But I think that will only get the private IP address and not the public one.
I will definitely need to set up VPC later as well.
Because your instance metadata is available from your running instance, you do not need to use the Amazon EC2 console or the AWS CLI. This can be helpful when you're writing scripts to run from your instance. For example, you can access the local IP address of your instance from instance metadata to manage a connection to an external application.
Okay thanks
Hi Guys xoxoxoxo, having a bit of trouble setting my equipped weapon on the client. The server receives the correct weapon but the client receives null and idk why :S
I set the equipped weapon on begin play and it is not replicated so idk how the server knows and the client doesnt
im new btw dun bully me ๐ฆ
wait does beginplay always play on the server? that probably explains it
if thats the case tho, how do I set it for the client? :S
Can you show what the EquipWeapon function looks like?
OK I see. So it works correctly on the listen server's player, right?
If that's the case then the problem is that the effect is not replicating to the connected clients.
I'm not sure the best way to do this but my inclination is to change CurrentlyEquipped's replication type to RepNotify, and in the repnotify function that is generated from choosing that, simply do exactly the same thing as you have for your beginplay.
Then instead of doing that in the Beginplay, set w/notify your CurrentlyEquipped variable
the server should be the one equipping all players. You should do that via an RPC
in begin play you should try call a function that sets the variable. Check if they have authority, if they don't then set it as the server. Then call the RepNotify
Yes, @fading birch that is the other thing. @fair lantern nothing happens to the character across all the connected machines unless the server is the one doing it. So additionally you must create a Server RPC event (probably in your playercontroller), call that (blue node) with the Equip index you want to use, then have the red node part of the server RPC do all the stuff I said.
To keep things simple, I think you don't have to check for authority, because a server calling a server function on itself I think will just run the function normally won't it?
the client will call it since the client also runs begin play
Oh I see. You want to prevent every machine from calling it for every pawn, and only do it for the pawn which the client machine is controlling. Correct?
Just a sidenote. If that would be the case then BeginPlay would be the wrong place
Because a pawn doesn't need to be possessed on BeginPlay, removing any chance of knowing who that pawn belongs.
Event Possessed (calling only server side) would be an easier place.
not seeing movement replicated across client1 > server > client2 for a custom pawn class that has bReplicates set to true...my question though, is do I need to calculate my non-physics based movement on the client or the server?
Both, very time consuming.
Why don't you use the Character class?
I have a ton of functionality into these pawn classes already, so can't migrate at this point to a character class
thanks for the suggestion though
You can re-parent the pawn to a character class.
Else you'll have to write client prediction movement system.
I should probably add that I will be putting in code for lag "compensation" to lerp and slerp location and rotation to where they are supposed to be as well, which i can do easily now, just need to figure out the fundamental reason why i'm not seeing the replication occur ... client prediction movement sounds exactly what i just mentioned ๐
and yes time consuming lol
Are you using NetworkPrediction plugin?
Its a plugin for making writing network prediction somewhat easier.
It shipped with Unreal, but still in beta.
Its really nice, you should check it out.
i'll take a look, thnx
How does one create a session on a dedicated server that doesnt have a player controller because its a dedicated server?... ๐ค
keep getting errors that the player state is invalid because the player controller is invalid.........
I'd imagine you use the client's role to determine if it's a client (player) or a server, if server, don't create the PC, pawn, etc at beginplay
Hi, i would like to generate my map in a multiplayer game, but i don' know where i should put the generation code, i thought about PostLogin but i'm not sure
Shouldn't need either on a dedicated server, normally they create the session as soon as the game is initialized.
so many people are saying that and so many people complaining that they cant find those sessions
also I couldn't find this session, so if the session is actually there how do I find it?
Yes I should have mentioned that too.
Not really sure what you mean, a controller/player state isn't required to create a session or find one, those systems are completely separate. On a dedicated server you don't have a local controller or playerstate anyway.
u said that the dedicated server already creating the session for us
No you have to create the session yourself still
But it's usually done right at game startup
on the dedicated server, correct?
but here u said that it already creating the session when the game start...
and I cant create a session on the dedicated server because it requires a player controller which a dedicated server doesnt have
Nothing creates a session by default - you have to setup logic to create it
You don't need a controller to create a session
IOnlineSubsystem::Get()->GetSessionInterface()->CreateSession();
Suggest checking out the ShooterGame example project from Epic
If you're creating a game that requires dedicated servers you need C++ anyway.
CreateSession require a valid player controller which u dont have in a dedicated server
the ShooterGame example doesnt work on a dedicated server
no?
The function I showed above doesn't need a controller
Blueprint isn't very good when it comes to managing or dealing with sessions
It has very limited functionality
okay ill give it a try
So In 1 client, my BT gets stuck here. https://gyazo.com/2766fbc03b6165aaab2b006b55899ebc
Anybody knows how can I debug this if it works in standalone?
@summer tide AI is only simulated on authority
So I only should test them in dedicated server mode. So would it work in coop settings ?
Ok thanks
Does anyone know what server spec Fornite uses?
Specifically their server that host the 100 players battle royal, I am wondering what the cpu and ram is.
Not sure about Fortnite, but a 3rd-party 100-slot rental for us is about ยฃ40 GBP a month. Not cheap.
Don't know what sort of markups are on those though. Minimum specs is 3.8Ghz with 5GB RAM.
Cool, are you using AWS or what company is that?
So HLL is not on that server spec right? Cuz I imagine it need more rams.
Fairly sure that's the spec, we're not using AWS I know that much
Zeuz I think.
Plus some third-parties for communities
Ok thxs!
Hi. I've put VaRest on my dedicated server. if I cURL from the command line on that EC2 instance's Windows environment to my Lambda endpoint, it succeeds, but if I use vaRest, it says
JSON(
{"message":"Not Found"}
)JSON```
I don't use VaRest, I use the unreal HTTP modules.
But likely the url is not found is due to wrong method GET or POST, or url
I highly recommend you test your https request with Postman first.
ok
C++ Client RPC function question:
I want my function "ClientPlayReload" to be called from the server and run on the client.. but for some reason, I can't get it to work.
As you can see from my breakpoint/callstack.
ClientPlayReload_Implementation is only being executed on the server! Shouldn't it only be executed on the client?
Is there something wrong with how I'm calling it? declaring it?
Do you know if that "message: not found" is an AWS message?
No, I am certain its not from AWS.
It can't find the url for some reason.
Use Postman and test the https request to get better error log.
Hi iโm trying to setup a self hosted server with photon server, i need to make a crossplatform game, someone have already setup this ?
Looks like it prefers PUT
Not with photon but I'm in the middle of trying to set up cross-platform on AWS (but not GameLift). Hmm, what does GameLift do, exactly, now that I mention it....?
Then ur api gateway method was PUT.
Gamelift ends up using EC2, but just have its own pain in the @$$ sdk.
Basically EC2.
Does it cost different than rolling my own the same?
It uses same EC2 rates, but there matchmaking system might cause money, i don't remember.
Hey all, trying to wrap my head around something; I have a hypothetical question.
Imagine if you developed an MMO in Unreal - so you have a server somewhere running the server and everyone connects as a client. In that situation, every player would have their own controller, right?
If that's the case, would that mean it would be safe to run logic on the controller? Or in an MP environment is it generally better to keep all logic on the pawn?
Controllers exist on the server too. You just run that functionality as the server.
So are there generally things you should do or not do when developing in an environment like that vs a couch coop where everyone's using one controller?
Obviously not looking for a list if that's the case, but just a general should I be aware.
Hi I have a question
I have a WebSocket / SocketIO server connection in Game Instance I wanted to pass it to other Objects , But I can't make it BlueprintCallable
BlueprintCallable is for UFUNCTIONS. is your websocket a function or a variable?
TSharedRef
Unable to use UPROPERTY
Gives me error. ๐ฆ
What error does it give you?
hey, is there a way to make an actor replicate to only non-owners? other than overriding is IsNetRelevantFor(..)?
Replication condition, Skip Owner
Nvm
IsReplicationPauseForConnection() maybe
I'll just use IsNetRelevantFor, I thought there might be a variable like ReplicateOwnerOnly
OwnerOnly is just for variable
bOnlyRelevantToOwner
Can you show the part of the .h file that's from? this might be more of a #cpp question.
That's interesting because it's fine with the FString below it, which is not one of those 3 things.
Maybe what it doesn't recognize the type of is the FSocketIONative
Did you #include the needed .h files about sockets in the .h file that declares that UPROPERTY?
And if you open up the .h for FSocketIONative, is it a UObject, AActor, USTRUCT or UENUM?
I might not be much help since I'm new to UE's C++ types myself
It really does seem more of a #cpp question and maybe someone there knows what is wrong.
Yea I did.
Anyone worked with WebSockets here?
I see will switch to websockets then
Instead of using SocketIO
Or just recode it to UObject -> to be callable
Yeah. Only types that can be exposed to blueprints are unreal primitives, classes, structs and enums tagged with UCLASS(), USTRUCT() and UENUM() respectively
does anyone know if the advanced sessions plugin has a discord?
<@&213101288538374145>
:no_entry_sign: Linda#6766 was banned.
Hi, i would like to handle global events in a multiplayers game, what's the good way to handle the synchronisation ?
Maybe running one timer on the server then using rpc ?
Probably run your event server side and then do a multicast to replicate it on all clients?
Ok, how can i run the timer server side only ?
Ok maybe this is not the best solution but I normally just do it in the GameMode since it only exists server side. I'm still new to UE so maybe this is not the best solution.
It works though ;-)
It also depends on your use case
I have an event every X seconds and i want to notify the clients
Then it seems ok to me to do it in the GameMode
Ok i will try with that thanks :p
You can call your Multicast from the GameMode, but don't declare it your Multicast event in the GameMode though, since it only exists server side. One solution is to declare the Multicast event in the Game state.
But still call it from the GameMode obviously.
Ok thanks !
Yw :) hit me if you still have issues
Hey everyone! Has anyone tried making an online multiplayer game using pixel streaming?
can a dedicated server use the save system of ue4 to for example save a level name so it know what to load when the server starts? I'm wanting to release the dedicated server files for my game to my community. I want them to be able to choose what level the server is on but now sure how I can do that. Would need to set a variable on runtime that the gamemode blueprint can load
Quick question, imagine a survival game like multiplayer Forest, or Minecraft. Which cases I should use Player State?
For the State of the Player 
Yes it can, but the data is barely readable and not modifiable.
Map for Dedicated Servers can be done on the commandline when starting the Server
ok so could I have the server load the saved map string when starting it, then use it to open a level?
and then also is there a way to edit the save file manually so it can be changed before starting the server?
how can I make online matchmaking where multiple players can play
My experience most of the time; this is done using command line arguments when executing the server. Alternatively you could use config vars or access save data in the game instance to get a level path
yeah that what I was thinking, like on a shortcut of the server file right?
Yeppers!
Open Level is already a command line function
So thatโs going to be your best bet
Yes. Or utilize config files
Pretty sure google is your friend here
Savegames are not how to do this
hmm I will have to google these. thank you
Any tip on how to replicate physic simulated objects properly? I'm trying out the Wheeled vehicles but after a bunch of collisions I have different positions in the level for the owning client, the non owning clients and the server
Are there any good starter templates / blank projects that just have basic networking? Trying to make a quick prototype but now I'm realizing I'll have to implement a bunch of connection stuff...
I can't find any on github or on google searches :\
I'm looking for a blank project that just has a simple menu for connecting to internet servers
what are you expecting?
just being able to connect to a server? if you build a dedicated server you can join it by IP with the null OSS
I'm trying to have a rapid prototype where I can distribute builds on itch to playtesters and have them connect to each other
so non-lan enabled multiplayer out of the box template
with all the boilerplate for multiplayer
well, session connection boilerplate
well if the IP address of the server is known, well you can do that pretty easily. but since you're not using an online service, then it'll be an uphill battle since itch.io doesn't provide very much
maybe you can use EOS with itch? that has p2p connections
As a client i want to interact with a chest. I only want to allow one client to interact with a chest at a time. So since rpcโs cant return a value, and the server should do the occupy check. What is the preferred way to solve this?
Also, rpcโs that are marked as reliable. Are they guaranteed to arrive and always in order? So if two reliable rpcโs are made, will they always execute in the order they was called?
999999 out of 1000000 times, they'll probably arrive in order. But you shouldn't count on it.
As far as I'm aware, reliable simply tries to send the rpc constantly until it's received.
i thought reliable rpcs were held when received if the previous rpc hadn't been received so they could be executed in order
im gonna google now
Ah. Yeah, they are supposed to be executed in order as long as they're done on the same actor.
according to a random answerhub answer, they are guaranteed order on an actor basis
thats a relief i was about to have to check a bunch of rpcs to make sure i wasn't depending on ordering lol
reliables are only in order if called from same actor
between different actors, no order is garaunteed
yup
Only realllllly garaunteed for non-multicast too, as if the actor isn't relevant they may not receive a multicast
what situations would you want a reliable multicast anyway
Rarely tbh, I've only needed them a couple of times
One nice use-case is sending a bunch of "death" data before destroying an actor, as you know it'll arrive before the call to destroy - whereas properties may not.
I used gamemode for the timer and i added a multicast delegate, but how can i bind something if i can't get the delegate in the gamemode ?
Wish the engine supported sending an arbitrary data packet with the "destroy" packet to make that cleaner, but alas.
Hello, are the properties of type BP object reference replicable?
If you mean a blueprint class variable, yes you can replicate that
I want to replicate the BP actor referenced by the variable
It's the armor of the character and the character change is armor
That's fine so long as the BP actor itself is also replicated, or part of the map.
Hey, I'm having some problems with something.
I'm trying to test my game using the Play As Client, just 2 players for now.
When the game loads up, I get two characters, but only one controller - this is a problem because I have logic on my controller and that means that only one of those players is 'working'. How does one ensure a controller is spawned for each instance of a player to test it out?
I think you can do it several ways. Probably the simplest is if the pawn is placed in the map.you can set auto possess player to player 0 for the first one and player1 for the second
Or if you are using player starts then you can spawn a controller and a pawn and then possess the latter with the former
@kind ember.I heard someone on here was running multiple dedicated servers off one AWS EC2 instance. I want to try that because 20 EC2 instances costs about $165/mo
I wonder if I can do that by setting port numbers differently for each dedicated server that is executing on the same ec2 instance and just making sure to include that in the info on the server list.
But how are port numbers set for straight up IP connection like that? Is it in a .ini file?
Whatโs with the tag?
Sorry.
I am using the network player start - do you know where you set whether it spawns a controller or not? I've seen a few places online give similar advice, but I'm not sure what controlls what it spawns.
Hi, i call broadcast() in my gamemode from a multicast delegate stored in gamestate, i bind a function with addDynamic but the function is called only on server
yes, because you didn't replicate it anywhere
The gamestate is not replicated ?
it is
function calls are done via RPCs, though, not delegates.
If you want clients to broadcast that delegate too, you need to call a netmulticast RPC that calls broadcast on the delegate
No i want server to broadcast
yes, so you call a NetMulticast function that makes clients call the broadcast
"Open 123.123.123:7777(what ever the port is)" Should work.
Though you can just pick a smaller EC2 spec and just use one executable.
Yea just set port number differently.
delegates are not replicated. If you want the server to trigger a function on all clients, you use a NetMulticast RPC. If you have a multicast delegate that needs to be triggered by the server on all clients, you call a NetMulticast RPC which then triggers the delegate.
Hum i got 2 different solutions so what s the good one ? :p
Well i will try stuffs, thanks
Yes that works to join the server but do i need to make the server listen on that port too? And if so, how do I tell it to listen on that specific port?
Also the cheapest ec2 type I know about is t2.micro and t2 nano but those are what come to $165/mo if I have 20 of them
Ok it works if i make the call from gamestate and not gamemode
-port=xxxx
Use that as startup argument.
So you can have 2 batch file for running 2 server on start up.
That probably can only handle 1 simple server.
@kind ember thank you. I'll try that and see how many I can run before it starts overloading
(With player activity)
Hi! does anyone know about resources to learn how to implement NFT on UE4? (want to make some NFT items for my game)
lol
Discord rule 7, please.
sorry, not sure on wich channel that should be : (
Dunno. but it's highly frowned on to spam messages in multiple channels.
The cost of a blockchain dev is really high. And there is no tutorial on this subject.
If it were easy then would it be worth so much?
Idk, hard work = reward, lol
Buy in game items that require the entire annual power consumption of a small nation to process
Some blockchain consume insane amount of power and some isn't much.
Depends how it was developed.
Hey all. I'm developing a top down game where the player aims at the mouse position. This is how I am handling that logic:
// this is located in the Tick of the Character
FVector MouseLoc;
FVector MouseDir;
if (PC->DeprojectMousePositionToWorld(MouseLoc, MouseDir))
{
FVector Intersection;
float T;
UKismetMathLibrary::LinePlaneIntersection_OriginNormal(MouseLoc, MouseLoc + (5000.f * MouseDir),
GetActorLocation(), FVector(0.f, 0.f, 500000.f), T,
Intersection);
FRotator Rot = UKismetMathLibrary::FindLookAtRotation(GetActorLocation(), Intersection);
Rot.Pitch = 0.f;
Rot.Roll = 0.f;
GetBulletSpawnPoint()->SetWorldRotation(Rot);
}
This works great on the client because that is being executed locally. When the player fires a projectile the client version goes where the player is aiming because it is using the client's spawn point transform. However the server projectile does not. The problem is the server's aim isn't synced with the clients aim.
How would I go about solving this problem? I don't want the server to do the actual aim updating because then clients will feel laggy, but I also obviously cannot have an RPC every frame to update the server.
Any suggestions on ways to tackle this would be much appreciated.
Here is the GAS logic that is spawning the actual projectiles:
@kindred widget thx for the reply. So as to my 1st question. Do you happen to have an advice for that? I mean, my own idea would be to make a rpc call to server to occupy the chest and from the server make a rpc owning client call to tell the client if it was successfull and also send content of the chest in some kind of array, so it can be pressented in an inventory hud. Plus multicast a timeline to animate the chest opening.
Does that sound right?
Chest opening should be state based. Set replicated state for that. If you open the chest and then someone wanders into range afterwards, they'll still see the chest closed. As far as the usability, that's difficult. I haven't tested enough, but I wonder if setting a value to replicate to owner only would work when switching owners. Cause if that works I'd just set the chest's replication timer to something very high, like only try refreshing every few minutes. Then you can trace, RPC to server, server sets owner, calls force net update, and then the OnRep could open the inventory. If someone else comes along and tries to use it, ignore it if there's a valid owner. Make sure to call forcenetupdate when changing items, then remove owner as an RPC when exitting the chest with some serverside checks on a semi often timer while Owner is valid for like distance or whatever to make sure the owner gets removed if the old owner fails to notify, etc.
Hmm interresting approach.. iโll tinker around with that. Thanks for the detailed description. I may try out a few options though to see what is most reliable and easy to implement. But like the idea of setting the ownership. Not sure why i didnt consider that. Iโll post when i come to a preliminary result.
Would be interesting to know. Alternatively, I don't know how much networking code is available, but ARK does the same thing, and a lot of their game code is available in their editor. May or may not be something there, but that is a massive download. ๐
Hey guys, can I get some advice on something? I'm trying to learn replication, just basics for the most part. In my project, there is a procedurally generated, endless voxel terrain. Chunks are spawned around the player as they move and then despawned as they get outside the render radius/distance. This works fine. But if I wanted to make this multiplayer-- I'm thinking listen server, rather than the tediousness of a dedicated one-- would I do the spawning ON the player controller and have it replicate, or should I run all spawning through something like the Game Mode?
I did try and test it via gamemode but it was really wonky. There's a little bit of lag which is making the chunks spawn deformed or with holes.
Currently it runs on a tick (I promise it's the only tick in the game) in the player controller, just checking if they moved.
I was thinking something like having a master timer function where the Game Mode gets every player in a player array and runs the Moving check, but I'm not sure how taxing that'd be or how efficient. I think it'd cause a lot of lag problems.
I could spawn from the player controller and then replicate but I'm really fuzzy on the safety of that.
Do the chunks need to be replicated actors?
Because the maybe better way is to only replicate the required information to generate the chunk and let the client figure it out locally
Usually only requirement is a single seed
What safety are we talking about
You want to use listen servers. You have no safety :P
Hi, I need to replicate a struct periodically, I swear that calling an RPC in event Tick is not a good idea so how can I do it?
Maybe, but how can I send client data to be replicated like location and rotation? I'm trying to do some physics simulations adjustments(idk why but It doesn't replicate well by default) and I was thinking of using timers or just send player input directly to the server, the problem Is that I'm not sure how good this solutions could be
fatal error C1083: Cannot open include file: 'OnlineIdentityInterface.h': No such file or directory
{
"Name": "OnlineSubsystem",
"Enabled": true
},
{
"Name": "OnlineSubsystemUtils",
"Enabled": true
},
why cannot i include 'OnlineIdentityInterface.h'?
Hi Awesome UE community !
I'm quite new to multiplayer, trying to figure things out.
I've an actor placed in world, which is accepting input. On pressing 'Spacebar' key, it will spawn an actor.
Actor that is supposed to be spawned has 'replicates' tick marked.
if I spawn from server, it works fine on both (client n server)
but if i spawn from client, it only spawn locally but not on server.
and not even on other clients. (tried multicast and run on server both.)
is my approach correct ?
any idea/suggestion would be really helpfull.
thanks in advance ๐
the RPC are not arriving to the server as you are calling an RPC on an unowned actor
you should RPC to the server(through some other owned actor like character/pawn/controller) and server should spawn your desired actor
ohh yes, you are right.
I was spawning from unowned actor, let me try spawn from Pawn.
thanks for your response ! ๐
do you guys have any issues with OnPostLogin? It seems to just not fire sometimes for my game
I need help i can't pass a BP object reference to the server
when i print it its null
is the object you are passing to the server replicated and spawned server-side?
oh thank you its spawned client side
How do you ensure something is spawned server side? What if itโs just placed in the world. Is ticking replicated good enough?
If you want to add some replicated properties to that actor then yes. If not you don't even have to set it to be replicated it will be available server and client-side
I think this was an issue for one of my objects only working on server and not client, I donโt believe I ticked replicated. Basically I try to spawn an emitter and for some reason the emitter works on server but not client itโs bizarre
I did server -> multicast and still nothing , itโs weird just a sound and emitter on collision..
on a dedicated server all players sync their game state with the server game state?
or is it like any other actor that replicate?
lets say that I chance how many kills a player did, and I'm calling it from the game mode it will update for all of the players, correct?
I mean there is no need for replicated variables or repnotifiers or RPC to do that since its always syncing
or does it count as an RPC call because it coming from the game mode?
Not directly related to ue, but do you know any resources for creating matchmaking system for a multiplayer game? A matchmaking where player joins a queue and when he finds an opponent a new server is started
Better suited for #online-subsystems
It depends on ur subsystem, some already have a built in matchmaking system some doesn't
When dealing with a RTS's resources, the resources belong to the player, but should be dictated by the game mode somehow?, not up to the player how the resources work (let say you have a income)
Anybody know how to recreate an online mutliplayer( or allow player connect to another player's map by lan or not) for existed game but servers was shutdown, if u have any real info which could help ping me plz
They should be dictated by the server
mmhh I see, in the end the UI is the one that should react to the server dictating the resources
example, some units/buildings to buy should be grayed out if the resources are not enough
but they should become available to buy once they do.
Is a scene capture component a bad idea for minimap rendering in an mp environment?
I assume it's going to get expensive.
Indeed, but i think it's easier if it's with NFT, the tokens cost way less and there's apis for those already (i think)
if you are interested i can share the info on this topic that i can found later.
@lost dunefor the future, it's in the pins.
I was thinking they did, since if two players cross paths or are mining something together, the chunks need to look the same for them both. And I realize it's not as safe as dedicated servers, but I don't want the clients able to cheat.
So let one of them generate the chunk client-side and then have that replicated to the other players when in range?
That's kind of how it is currently, but I just wasn't sure what method was best. I've made open world MUDs before but this is quite different, lol.
I believe the most common way to tackle that kind of thing is seed-based deterministic generation + a replicated authoritative random seed?
Could you uh, break that down a little? Sorry, I'm not sure what you mean.
The chunks are currently generated using seeds with perlin noise, though
It's been some time since I've had to tackle something like this - but the idea would be that the seed used to generate things in a deterministic way (reproducible) would be controlled by the authority, whether that's a listen server host or a dedicated server, and replicated to the clients - who would then handle generating based on that seed, so it's consistent across clients despite generation happening locally, requiring perlin noise on the clients might complicate it and it's likely very use-case dependent
Ah okay. Well it is reproducible, so I've got it that far at least. So... okay, I think I understand. The server sends the seed, the client generates their own chunks from the seed. So then the only real hardship after that is determining how to store the updated chunk whenever a block is removed. Which I'm thinking, get that specific chunk vertices and store them in an array, then as each chunk is loaded, check if the position is in the area and load the edited chunk instead?
But the Server is a client that hosts.
That one can cheat
Also all the mining is happening on the Server side
it doesn't matter if the client can change the way the map looks
that one is more of a math and efficiency question, hopefully someone else has good advice
That's true. I'm just not sure if I understand enough about dedicated servers to manage it properly, you know? It's really hard to find information on saving changes. I have read a lot and have a big ol' library full of documents, links, videos on multiplayer and replication, but saving the data via a dedicated server is confusing.
also yeah, if theres a client that's the authority it'll always be vulnerable to exploitation
if they're distributed to players to run def not
You know what I mean
When I had my MUD it was a big openworld MMO, and I integrated it with Django to save data. But this is really different.
Here is the thing
You'd need to host the Dedicated Servers of all your Players
Because if they host them, they can cheat.
That means you have to pay all the hosting costs
With maybe never getting enough players to even pay that
It's not worth the effort
it's not cheap and especially when you start needing DDoS protection
I get that, I just don't know how to pass information from an online server. I have a server through aws that hosted my MUD, and I still could use it, but doing it with something like this is so different that I don't know where to start.
I'm pretty sure you'd need sql or json files or something like that?
I know you can't use Save Game
You mean for a persistent database?
Yeah, because I'm pretty sure that'd be needed.
Depends
To save terrain altered by players as well as player data
You can use savegames too if the Server a player joins is the only one needing the info
Yeah, you'd probably need to send some data from Server to Client
i think there's a SQLite implementation in the engine that isn't totally busted you can use too but don't quote me on it
you could have the server save data per client locally. If you're doing something along the lines of a Valheim server, the server would just need to send the player the latest saved data for the world.
I've always been told to avoid using SQL stuff because of the way queues work
It might also be helpful to maybe to split the code into landscape and dynamic actors
The landscape can be generated on the clients
the dynamic actors spawned replicated by the server
That way the server can load their state
isn't it super bad to save anything client-side though?
I'm not sure how that would work with a Voxel landscape
Yeah landscape changes are probably not so straight forward
You're not really saving it client-side, you're caching it
the server maintains the authority
and you can check it periodically to ensure the client isn't trying anything funky
What I was going to do was just save the coordinates of any changed chunk in one array, and the chunk vertices in another array, and then whenever a location is checked to load a chunk, if that chunk coords exist in the coords array, load the edited chunk instead.
that sounds like a decent way to do it
you don't necessarily need to update it either if the client isn't in the area
Yeah exactly
would be a waste of resources otherwise
as for how to do that
gl
above my head lol
the only chunks that ever 'exist' are within the range of the client currently.
So it gives really decent performance
I would load them a bit past the client
And since it's based on a simplex perlin noise it's always consistent. So if you leave, the chunk is destroyed, if you come back, the chunk is recreated and has the same vertices
same shape as before
so they don't run into a weird area where something is different on the client than the server because the server hasn't sent them the update for that chunk yet.
Well the range is currently set to a variable so it's very easy to adjust. I was going to attach that to client settings.
So if they need lower settings the range is small, if they have higher settings, it's larger
i'm not talking about their visibility
Each block is 100 unreal units, each chunk is 100 blocks, range is currently x6, so 6x6 chunks around player.
i'm talking about their network culling
Ohh
Yeah, it's currently the defaults. I haven't even messed with it yet.
Which come to think of it probably explains the flickering of chunks in the distance.
Hi, I'm a beginner to multiplayer stuff in Unreal and I would appreciate any help!
I'd like to start with making a game with listen server support, and I created a prototype pawn.
I found that there are three aspects I want to retain: 1) the pawn has a custom box-like collider. 2) The pawn can collider with other objects and simulates gravity. 3) From my understanding, the pawn should use a movement component in order for AI support to possible in the future.
I've created a demo project with a Character which supports movement replication as its built right into the CharacterMovementComponent. It works great, however its specifically made for humanoid characters with skeletal meshes. I can't use Characters as they are very restrictive and can only use capsule collision.
To isolate this specific task, I've created a simply project: A custom pawn blueprint, with a box-like collider, a static mesh, and a FloatingPawnMovement component. Now, I am unsure of where I should go from here. FloatingPawnMovement doesn't have (good) movement replication built-in and I want to create a system where both the client and server simulate the movement, the client simulating for responsiveness, and the server simulating for authority.
I'm open to exploring other possibilities like creating my own movement component, and I have intermediate understanding of C++. I'm just not sure where to start!
tldr: I want to create a custom pawn that does not use CMC and replicates movement, with the movement being simulated both client and server side and the server being authoritative. I'm not sure where to start.
I did some searching here and found this interesting: #multiplayer message
Unfortunately I can't find a single trace of this course on learn.unrealengine.com, and all links online seem to be dead. (for example, https://twitter.com/gamedevtv/status/1375485977372803079)
How to get the pawn controlled by the current client?
this get player controller ask for the player number
i want to get directly the pawn controlled by the current client
in what context?
@rose raft start by shamlessly ripping off parts of the CMC you need, or alternatively look for epic's network prediction plugin on github and start from there
if you're planning on mixing physics with movement though, you're in for a world of hurt
Thank you!
Structs variables are not replicated? ( i have an array of struct setted to replicated but it don't replicate)
Do you think it would make sense to start with FloatingPawnMovement as starting code, and then try to port CMC parts I need over to it?
let's say the player controls a pawn, and I call "SetReplicates(false)" on the pawn, does the player lose ownership of the pawn immediately if it stops being replicated?
Hey guys, I'm trying to replicate this custom event but it is not working.
I have this set for the custom event
@vital bough are you making sure to run the multicast off the server? if you try to fire a multicast from a client, nothing happens.. you have to already be on the server
that function image looks fine, as long as what's calling that event is ON the server
Hey, following https://docs.unrealengine.com/4.26/en-US/InteractiveExperiences/Networking/HowTo/DedicatedServers/ To get a dedicated server up and running for testing. I have converted my project to C++, but do I still require the source build for UE?
How to set up and package a dedicated server for your project.
Im trying to fire this event from the client
From each player
then it needs to be rigged to a client->server event first...
and then the server fires a multicast for everybody
think of client machines as little kids at a firework show.. they arent allowed to light any of the fireworks.. they have to hand it to an adult
or.. idk, whatever lol
Dw, I understand what you mean
Make a custom event run on server, that calls that event multicast...have whatever is spawning it call the server rpc
So make Explode be called from the server?
ShooterGame, why cannot find Server between 2 cellphone
Yes then the server calls that multicasted event you pictured above...
Particles, sounds, and root animations all require that extra effort since they are not replicated at all
Server event-->multicast event...multicast event--->your code.
By the way, the Explode Node
was what I set to multicasted before
Yeah that was fine...
But you still need the server to call it
So your npc or whatever calls the server event you create, which then calls that multicasted event
Why on earth multicast node doesnt automatically run the code on server by default is still a mystery to me...but it doesnt...it only multicast it if the server is the one calling it....so 2 extra nodes every single damn time you want to multicast....
Wait till you try replicating particle template that changes on a projectile with multiple templates, such as elemental magic spells....that will have ripping you hair out. Stupidest thing ive had to deal with so far with ue4 replication.
Something like this?
ServerCall on server than multicast for Explode
But beginplay should be calling server call...not the multicast after that delay
Its literally monkey in the middle...
Beginplay calls server call which calls explode
Oh ok
Understand what I mean by 2 extra nodes every time
You would think just calling multicast that ue4 would default to running on server with it
But it doesn't
Begin Play calls server
then server calls explode
Yeah that should do it
Do a print screen after explode
Sorry print string
It should write out to server and clients
What
It prints screen for the specific client
but the explosion or projectiles dont spawn
Where's it pulling location from?
The print string should go right before the particle spawn
After the red explode event
I put it there and it works the same way
If it said server:hello ...client:hello...client:hello... Then it's correctly multicasted
That code above will only say server: hello
It should say server:hello...client: hello...<--client that fires it
Otherwise it's not replicating
It's the actor set to replicate?
Yeah that's not replicated....
Move that delay to before the particle spawn
I hate for it to sound like "did you turn it off and on again"... But try closing and reopening your project
Sure Ill try that
There's no reason i can immediately think of that the above code isn't calling the servers "hello"
It's the server spawning the projectile or whatever that is?
The server should be the one spawning them
Not the clients
If they're set to replicate they'll automatically spawn for the clients
That's the only thing i can think of that would make it only print to the owning clients
Umm
Let me show you the C++ code as well
Turning it off and on again didnt work
Aside from the particle are the actual projectiles spawned for everyone?
You can see them in server and other clients?
No
This tutorial project has a line trace that is spawned on both clients
I cant get the rocket launcher projects to work tho
Can you show me the input code on the character for firing the weapon
This looks fine, i mean the on button pressed input on your character for firing the weapon or did you handle that all in c++
The tutorial handled it in C++
I tried to do the implemenation and validation thing
but it didnt work
is that the tom looman tut?
Yeah just a lot harder to follow in c++, not that i can't but i gave up coding in c++ in ue4 when they announced blueprint nativasation produce code that was just as fast as projects written purely in c++
i'm happy to help, just show me the code from your input component
You mean the Fire() function in the weapon class?
no
in your player controller or pawn
the binding where you setup what "Fire" does from your inputs
The input binding, the code that when you press a button it calls the fire()
it's where you setup stuff like movement, button things
not that
1s
something like:
PlayerInputComponent->BindAction("TogglePerspective", IE_Pressed, this, &AExcursionCharacter::TogglePerspective);```
I dont see something like that in the character
character class
Trying to find out where he put it
Wait
hmm
it's very strange that the server call isn't happening
i would remove the delay, it's not really needed.
since the server is the one creating the shot, the server call shouldn't be necessary either.
The server is spawning the projectile correct?
Each client
is spawning it on their own side
but its not spawning on each others sides
if that makes sense
it does, that means it's spawning local client only
Yeah
I'm learning Unreal Engine 4, Im a Unity Developer mainly
ah ok
what I would try to do is have the projectile actor class be a variable in your weapon, such as:
UPROPERTY(EditDefaultsOnly)
TSubclassOf<ASProjectile> ProjectileClass;
class ASProjectile* SpawnedProjectile;
You would then spawn it like:
// Fire code above
SpawnedProjectile = GetWorld()->SpawnActor(blah blah, ProjectileClass);
SpawnedProjectile->Multicast_ProjectileEffects();```
Notice how i used `ASProjectile`. I would also make a C++ base class for your projectile. In that class I would make your NetMulticast call, Multicast_ProjectileEffects in this case, and do what you were doing in BP there.
TSubclass allows you to assign a blueprint that inherits from that class. SpawnActor takes a class object variable, which a TSubclass is.
Let me try that
So make a class called ASProjectile?
yes
do you have a server running?
open 127.0.0.1 would do that.
what level does your server have open?
how are you trying to test this?
in PIE?
i'm not sure if null works in an exported project ๐ค
is your session actually getting created?
it could be that you're server never actually opens the map
I would also launch your client and server with -log
so you can read what's happening
ok, so that's that solved.
and on the client?
that's really strange
you're not using a custom net driver are you?
Hey, does anyone have the command lines for a listen serer and client?
I built a package and my server has ?listen -server. My client has server-127.0.0.1 -game
@granite badgeso you packaged the server and the client?
Are you using dedicated servers?
Give me a second need to open my p2p project.
@granite badgeok, so after my session stuff is done i'm doing this:
try that
you may need to start it
but honestly
for now, remove the create session stuff entirely
and just flat out open the level
like you can bypass all of that
and just do open MainMap?listen from the console on the client you want to host
Hi , hope everyone Have a good day ๐
I will try to explaing my question as simple as possible :
I have pawn already spawned on server and have rutime added component .
but when client join to the map , it sees pawn with that component but not the value setted on component .
what is weird here is :
-
if its not replicated , so why client have that component ๐
-
if its why it dosent have that values I set on server ๐ซ
Will apperciate any answer , thanks
idk then. It should just work. What engine version are you on?
Would you explain it more please?
you mean construction called seperatly on devices , I got this but it should be replicated after , am I wrong?
yea construction is called on all devices. if you want something to only happen on the server, you should use the node "Has authority"
Yes , I understand this .
I want the component fully replicate which created on server , but just the empty component showup not the value I have been set again on server
btw , I can set it with RPC in development stage just for test , but with production it isnt possible @granite badge help please ๐
i just wanted to ask that which dedicated server will be best
Hey guys I have a cube that is being spawned on the server what is the best way to change the properties from a pawn that will update the cube on the server?
The best for what? Dedicated Server is a term that doesn't go hand in hand with "the best" :P
You mean the best way to modify the cube ?
Yeah
What is this based on? Key Inputs of the user?
Its based off a widget
Then you usally need a place for your RPCs
On the pawn?
May it be the Pawn itself (if possessed), the PlayerController or PlayerState
Or a component on those to keep code clean
wdym
to edit the cube
Well, I assume you have some buttons in there?
Yeah and a slider
Yeah then when those get clicked, get your PlayerController or Pawn and call the RPC on it with the new data
Brill will give it ago
The part that is lacking is how to get the data to the Cube
But if you have UI up, you should already have a reference to the Cube
At least if that's your order
If you don't, then you need to use a LineTrace or overlap etc to get one
Nice one ta
Hi All, I would like to know if I can store a value in game state and forward that to the dedicated server? Do I have to use RPCs to do it or because game state exists both on server and client it will get replicated from client side? Thank you all.
Replication is ALWAYS Server -> Client
NEVER Client -> Server
You always need an RPC in a Client owned Actor to go from Client to Server
Thank you for the reply so I guess I will have to implement the RPC then. Cheers
I have a problem ; my character 's inventory have a array of struct , but it doesn't get replicated.
you might want to provide some code^^
does anyone know about eventpostlogin in blueprints? It seems to just not fire sometimes when a player joins the server. It's causing issues related to initialization.
I just modify the array server side like that
with set array elem
The array is replicated
but when i print the array's all elements , they are all null (client side)
replication dosen't occure
i have verified the array is correctly modified server side
on the net some says an array is optimized and not all elements are replicated
some says its a problem with structs variables not replicated
well your actor also needs to be replicated
If all those are in a component. Make sure the component is replicated also.
The actor is replicated , and the character who have the inventory itself (its a BP) is replicated , and the inventory object reference is replicated also
just to be sure, what do you want to show in the second image?
i show that i am selecting the whole actor giving this details (showing setted to replicated)
I see, ok
Arrays elements are not all replicated when one of them change OR there is a problem with structs replication
I have noticed a lot of other problemes with structs in UE
i'm thinking about reimplementing everything without using structs
I still don't think it's an issue with struct replication. I had a similar setup for one of the earlier iterations of my inventory system and structs, with their contents replicated just fine
its is the server who call the addItem function of the inventory
the item is spawned server side
maybe doing a multicast should be a good perpective? but not good for the security
If the actor is replicated it should be spawned on client after it gets spawned on the server.
Are there any downsides to having a TMap replicated via reliable RPCs for adding/removing elements vs using a TArray of (Index, Value) pairs?
@tranquil eagle Can you even send TMaps over RPCs? I know they're not replicatable.
I am not sure about the whole map as an argument, but what about just sending individual elements when change occurs? If the map can't be sent as is, maybe it can be turned into an array before sending and put back into a map after receiving it?
Can't replicate TMap/TSet, or send them via RPC
Hello, is anyone familiar familiar scene capture 2d for scopes In a multiplayer game ?
I confirm , arrays of struct are not replicated , i have just tried to use an array of BP objects instead and it works fine
Hello! how do i go about to profile what the MP is doing so i can optimize it? ๐
i just want to see what actors use most network
Wait what? you can replicate an array of struct
Why does my weapon drop keep duplicating in this setup for the client
if its set up for owning client the server player cant pick it up
Not really showing a lot there
If itโs got a spawn actor node, then itโs spawning a client side actor
Ah, net code in BP
Hoping someone can help with this. I made a minimap on my character by adding a scene render component to the class and then outputting that to a material which then outputs to the HUD. However, when I start a multiplayer game on a listen server with two players, the minimap on each actually is displaying the render target from the other. I can't figure out why.
If I close the client, the server's hud goes back to normal.
I'm reading that scene capture component maybe doesn't work in a Multiplayer environment?
Didnโt we have this conversation before?
I was having another issue related to this, but no nott his exact issue.
Scene captures will obviously work but writing to the same render target in PIE might not give you an accurate representation
Yeah, if I add more clients it seems everyone starts using the latest client'
SCC
But I still think itโs a bad way of implementing a minimap
I'm starting to see that now.
I figured at the very least performance would get worse anyway
Is it possible to have a server client connection but have the server be on a different map than the client ?
I'll try the alternative method - output an image and then display that based on coordinates.
Thanks for your help
Thatโs what we do, pre-rendered map images and icons
well the way my weapon drop is setup is using stored integers and adding and subtracting them. Somehow the client and server is counting the same integers
Yeah because youโre using a multicast or whatever the BP equivalent terminology is
If theyโre replicated vars then they get touched by both
is there a way to find out which player is dropping the weapon?
Well since you can only do client to server RPCs if you own the actorโฆ the owner will tell you
this added skeletalMesh with IK is invisible by other Player while MultiPlayer, do you know what reason might it because? Thanks!
VR player can see the PC player's skeletalMesh, but PC cannot see VR, and VR cannot see other VR
by default, the SkeletalMesh with IK is visible by other player while MultiPlayer?
not set Only Owner See...
by default, this new added IK SkeletalMesh should also be visible by other Player while multi-player ?
should i Enable the Component Replicates for the IK SkeletalMesh? but now the Component Replicates is also unchecked in the Text but it's visible by other.
I'm having some trouble getting the print string to work on all clients, it only shows up on the server
"CheckIfEveryoneAccepted" runs on both client and the server at the same time but I only want the server to execute it, then notify other players
Any idea why this isn't working?
So what is the "best" way to do hit detection in a multiplayer game. As far as I know, by default the server and client animations are NOT in sync, so when a character is running, the location of the head will be different on the client vs the server. I'm told there's two ways of handling this
-
Run a traceline on the client to detect which body part the player hit. If there has been a hit, then send a message to the server telling him that the client hit somebody. The server then runs a verification traceline to determine that the player did indeed hit the other player's collision capsule. The server cannot 100% verify which body part the client hit because the animations are not in sync, so the best that the server can do is say, "Yea the player did indeed hit the other player's capsue". Apparently, this is how PUBG does it.
-
Through some heavy modifications, ensure that the server and client animations are in sync and only do the traceline checks on the server. Apparently this is how Valorant does it (and I'm told it's not an easy feat to accomplish this ).
Solution 1) seems the easiest to implement but is hella prone to cheating.
Do you guys know of any other methods to handle this situation ?
I'm coming from the Source engine where solution 2) is the standard way of handling things but because the animation in Source is much much simpler than UE4, it was far easier to keep the client/server animations in sync
Generally when I run into this problem I use an anim notify. That then triggers an event on the server to run the trace from the location of the animation at the time stamp on the animation. Attempting to keep everything 100% in sync is nearly impossible afaik.
ahh cool, I'll look into that
so basically.. Trust the client, but verify on the server
Solution 1)
The challenge is my animation blueprint is pretty complex. There is a lot of variables that go into the Final pose.. So I may have to send an RPC to the server with quite a few variables
everytime I do a hit check
Well sort of. The animation start should be coming from a server event. You can keep track of an animation state with a custom enum and check that on the server.
Ie:
ServerStaftMeleeAttack()
{
SetAnimationState(EMeleeState::Attacking);
}
//then function that responds to notify
void DoMeleeTrace()
{
If(MeleeState != EMeleeState::Attacking)
{
return;
}
i see.. I'll look into this, thank you
Hit rewind system.
And for detecting arm/non well synced limbs, you may have to trust the client and count on anti cheat software.
This how Hell Let Loose does it, credits to Jambax.
chers, thanks. Do you know where I can read more about Hell LEt Loose solution?
we use CSHD with validation
it was a bit easier in source since the animation state was simpler and had a lag compensation system
yea, tell me about it
no wonder people always hold the source engin eas a gold standard for hit detection
but their animaton system was primitive as fuck
compared to the UE4
what's CSHD ?
ClientSide hit detection?
yeah
the validation is the verifying the client input on the server#
just keep a ring buffer of player positions for that
Idk but you can check out his web page.
Also Unreal Tournament has good example.
I believe they did something similar for hitscan weapons in UT
the shootergame sample uses CSHD but is validated on the principle that you're looking vaguely in the direction of the victim
I got excited for bit of CSHD with validation, thought it was a new technique haha.
Had any game tried to NOT use hit rewind and just predict where other player would be based on ping?
also doesn't help that you're referring to a web page without a URL
Theres none I found for Hell Let Loose and James hasn't post hit detection on his blog. ๐คทโโ๏ธ
cheers, thanks guys. I'll look into it some more
Do you know if Fortnite uses CSHD ?
Does ur bullet has travel time?
It's speculated Fortnite does everything client side and uses a heavy amount of anti cheat detection.
Yea I do like this route very much, its less of a hassle
At the very basic.
You can server rpc shot location and direction.
Have the server do the trace and look back in time of the other player past position based on ping.
other than UT, is there a way to see an implementation of that? I've always done it a bit differently, so curious how that looks
I could be wrong, but I think someone told me that Shooter Game has an implementation of what aaronUE4dev mentioned
Its very project specific, but same principle.
I got my mind on ECS recently, so probably ECS style.
what's ECS?
Brief overview of Entity Component Systems in game development and a demo of such system in Unreal Engine 4.
0:00 Introduction
0:19 Understanding the Problem
3:24 The ECS Architecture
7:56 Why Care?
9:34 Proof of Concept
11:17 The Code
14:08 Conclusions
#UE4 #ECS #GameDev
// ~~
Marketplace assets used in the Demo
https://www.unrealengine.com...
oh hey, that's my coworker xD
we tried to create a custom datachannel to serialize entities
based on a component that stores a network ID to sync them
ah cheers thanks
oh is it UT that uses CSHD?
oh, you're probably right..
I should look at the UT code
Thats you?
Very nice! More videos please haha.
Ok
Oh you know mazy @nova wasp ?
nope, I think I watched this at some point though
I made a plugin that uses FLECS as the ECS lib
it's very simple to integrate
but serialization is up to you
there is also a marketplace plugin called apparatus
that even has blueprint support which is cool
How good is it?
haven't used it much yet
the editor integration is the main draw
but I doubt it's as fancy as the popular C++/C ecs libraries
Cool
I would say it's probably most effective to just keep data oriented design in mind and just make stuff instead of going crazy about ECS workflows
it really is the future but it's kind of a big task for a solo dev to basically reinvent the wheel here
if I hadn't gotten obsessed with this stuff I would be a lot further along towards finishing something
i think the big difficulty comes from reinventing your mindset of programming. Especially if you're used to OOP principals
the biggest thing for me is how to define "one off" events that happen in the same frame
weird to think about
I did "hit" events as a component that gets added
but depending on your ECS style the component add might be deferred to the next frame!
I was going nuts seeing bullets pass through stuff for one frame until I realized
Yea I like to learn new things.
Btw how do I go about replicating ECS Entity? Off of AACtor?
custom udatachannel
(in our case)
you need to figure out how to serialize the entity and send it over the network
lots of questions like if you can get away with syncing the entity IDs directly or if you have a component network id
if we ever get it working well I'll let you know I guess but we are probably shelving it
Hm ok.
So ECS System reading AActor replicated data would defeat the purpose of ECS? I am thinking to just use Unreal replication system for the sake of easy-ness.
Are there good articles on custom UDataChannel?
nope, we are literally aping engine code
I imagine if you just had the ECS read the actor data you could just replicate the actors normally
but that's kind of a glorified ticking manager
Ok gonna see how it goes.
Is it possibly to do local multiplayer splitscreen with both players using mouse and keyboard?
I know keyboard and mouse are default player 1. Plugging in a 2nd keyboard wasd still controls player 1. Any way to redirect a 2nd source of input to the 2nd player?
It's already being done somewhere by default for 2nd controller going to player 2, 3rd controller going to player 3.. but not designing a game where 2 players have different controls. Want them both to be on mouse and keyboard.
Please @ me if anyone has things to try or has got this working thank you!
not set Only Owner See...
by default, this new added IK SkeletalMesh should also be visible by other Player while multi-player ?
should i Enable the Component Replicates for the IK SkeletalMesh? but now the Component Replicates is also unchecked in the Text but it's visible by other.
i did more test and find the Head&text rotation, Z(stand/squat) & leg IK, Hands movement are OK.
BUT the whole body location, the Gun attached to the Hands are not OK...these are only goes into the Right state from own View; from other player's view, these are not changed...
eg. Gun is not visible from other's view; when the HMD movement value is larger than threshold, the SkeletalMesh's position will move, BUT from other's view my SkeletalMesh is still at that position & seems like the HMD(head) is trying to move to that new position BUT the other parts of body are just infulenced by the full body IK BUT not moved to the new position.
does multicast events only multicast the trigger of the event or with the whole code attached to the multicast event? nvm, tested it out and is only multicasting the trigger of the event
multiplayer sync to server problem...
class UIKBodyComponent : public UActorComponent
{
UPROPERTY(EditAnywhere, Replicated, Category = "IKBody")
FVector BodyCurrentLocation = FVector();
}
void UIKBodyComponent::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
{...
USkeletalMeshComponent* Body->SetWorldLocation(BodyCurrentLocation);
...}
i SetWorldLocation in TickComponent, now found the location is not update in other player's view while multiplayer, seems also not update in server. Using DedicatedServer from unreal tutorial.
in TickComponent, just before SetWorldLocation
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "IKBody")
USkeletalMeshComponent* Body = nullptr;
not yet
UPROPERTY(EditAnywhere, BlueprintReadOnly, Replicated, Category = "IKBody")
USkeletalMeshComponent* Body = nullptr;
should i change to this?
And only the server sets it I assume?
And i also assume you added the vector via DOREPLIFETIME macro in the GetLifetimeReplicatedProps function
You might want to give us more code
Too much guess work required
UCLASS(ClassGroup = (Custom), meta = (BlueprintSpawnableComponent))
class UNREALBODY_API UIKBodyComponent : public UActorComponent
{
this?
all the variables that Replicated must DOREPLIFETIME ?
DOREPLIFETIME(UIKBodyComponent, USkeletalMeshComponent * );
DOREPLIFETIME(UIKBodyComponent, UPrimitiveComponent * );
DOREPLIFETIME(UIKBodyComponent, UCameraComponent * );
these ptr also need to DOREPLIFETIME?
you do this in the overridden GetLifetimeReplicatedProps function and replace the ptrs with the actual variable names. Don't forget to call Super::
ok
UCLASS(ClassGroup = (Custom), meta = (BlueprintSpawnableComponent))
class UNREALBODY_API UIKBodyComponent : public UActorComponent
{
GENERATED_BODY()
public:
is this need to modify ?
and i found the Gun attached to the Hand, the pickable cude, these are still keep the original position and state in other player's view...seems also not sync their state to the Server, even to the other player.
class YOURMODULE_API UHInventoryManager : public UActorComponent
{
GENERATED_BODY()
public:
UPROPERTY(Instanced, BlueprintReadWrite,EditDefaultsOnly, Category = "Container Structure", Replicated)
TArray<UContainer*> ContainerStructure;
protected:
virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;```
an example of how you would do it.
in your header file
void UHInventoryManager::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
DOREPLIFETIME(UHInventoryManager, ContainerStructure);
}```
in your .cpp file.
@tender badger
Are actors the only type you can control net relevancy for? Anyone know if there is a way to control relevancy for sub objects of an actor shared via ReplicateSubobjects ?
slice procedural mesh is not working in multiplayer
i mean the slice cutting is not showing in mutiplayer
Does anyone know about setting up microtransactions with inventory?
like where would I get started if I wanted to know about that
particulary, transactions using steam wallet
You would have to RPC the slicing
I kinda wonder.
If you are doing smth like this here
Server_DoSomething();
Where the definition looks like here
void Blah::Server_DoSomething()
{
Server_DoAnotherThing();
}
Will the Server_DoAnotherThing(); call be another RPC or will it avoid it since it knows it's already the server ?