#multiplayer

1 messages ยท Page 74 of 1

winged badger
#

Unless youre BP only, PostNetInit should work for you

faint eagle
#

ok, thanks

winged badger
#

If role matters, its set before that point

#

It means whatever you are using as a floor is not net addressable

#

Which CAC actors usually arent

#

CAC is pretty bad in best conditions

#

Its terrible for multiplayer, i suggest you rethink your approach there

#

CMC keeps a reference to Base

#

Its a component youre currently walking on

#

All movement is relative to it

#

CAC spawns an Actor locally on each machine

#

They cant be really replicated, and pointers to them dont work over network

plush mist
graceful shard
#

is ENetRole "none" when not connected to a server? Or is it authority?
It is authority, and remoterole is simproxy

winged badger
#

Best guess, you manually destroyed replucated actor or one of its subobjects on client

gritty pumice
winged badger
#

It can, as long as they are net addressable

gritty pumice
#

wym by net addressable

winged badger
#

Replicated or stably named

#

Unreal has decent doc page for that

gritty pumice
#

So the floor component must be set to replicated ?

winged badger
#

No

#

Any actor loaded from level is stably named

#

By default

gritty pumice
#

It's spawned at runtime

winged badger
#

Any actor spawned at runtime that has exact same nsme on all machines and is set as net addressabls manuallt as well

#

Make s mistake here and your clients get disconnected tho

quasi tide
#

Pretty much - if you can guarantee that the actor/component have the exact same name on all machines, you can mark them as net addressable. With that, you can do some fancy stuff that wizards like Zlo can abuse ๐Ÿ˜ˆ

gritty pumice
#

My clients don't get disconnected at all nor they really get a position correction (or very small one which is not noticeable)

winged badger
#

CAC Actors = worst possible choice to serve as floor

gritty pumice
#

I see

plush mist
quasi tide
#

@fathom aspen Time is ticking ๐Ÿ•ฆ

plush mist
winged badger
#

I have no idea

#

Find a way to attach s debugger to your DS

#

Crash it

#

Then jupm to that UActorChannel line in callstack and see what actor it belongs to

plush mist
#

got it

#

thanks

gritty pumice
winged badger
#

You can do almost the same thing without cac

#

With normal attaching of actors

#

You can even expand it into full modular data driven spaceship system

#

Not so easy with CAC

winged badger
#

Then you create a data asset that defines a spaceship

#

You have a class for spaceship core actor

#

Array of structs for modules, which contain a class, atrach point name and whatever else you need to slsp it in place

#

Then spawning a spaceship is spawn core, spswn all modules and attach them to correct place

#

With CAC you dont have this flexibility, but without cac your spaceship actor wont look whole in blueprint editir viewport

gritty pumice
#

Yes Yes, No doubt I could use data driven system, I'm working on a project which I do not own that's the way the ship has been built, event tho I had already told them that CAC were bad, now I have to announce them that they need to redo everything xD

winged badger
#

Its not that bad

#

Just setup data and make attachment algorithm

quasi tide
#

I think the big advantage for a CAC is in fact being able to look at it in the BP editor viewport

gritty pumice
#

Will do on the new version !
Just need to take into account the logic that some CAC had

quasi tide
#

I wish they actually cared about the CAC ๐Ÿ˜ญ

faint eagle
#

remind me this - are "core" actors (game state, player controller, pawn) are guaranteed to be replicated to just connected client before any "regular" gameplay actors?

winged badger
#

No

faint eagle
#

eh

winged badger
#

PlayerState wull generally arrive later too

prisma snow
#

what is CAC?

winged badger
#

Engine will try to replicate them in order of net priority

quasi tide
#

Child Actor Component

faint eagle
#

so if some of my replicated actors initialization are dependent on PC I should notify them from PC's autonomous proxy on begin play like "hey, PC has arrived"?

prisma snow
quasi tide
#

I think GameState is like the only one guaranteed to arrive first, because it's what kicks off BeginPlay

quasi tide
#

(I know, it just tells the world settings to dispatch begin play)

faint eagle
#

right, thanks

winged badger
#

As they will fire when netguid is resolved (both actors replicated)

#

But only guarantee you really have is that gamestate will replicate before any actor on client calls beginplay

#

Its still not guaranteed to arrive first or in any particular order

winged badger
#

And set onrep references you need there

#

If ant dependent actors are level actors, they will be there before PC

#

If they are client auth, just spawn them from PC client side

faint eagle
#

hmm I don't really get it what you are suggesting. not sure what do you mean neither by construct object graph nor handlestsrtingnewplayer. Is there any article to read on those?

winged badger
#

Your A is depending on PC

#

HandleStartingNewPlayer is GameMode function that by default spawns Pawna by calling RestartPlayer

#

After Super, you spawn A immediately

#

Then either set onrep A on PC or onrrp PC on A

#

Then ypu dont reallt care which order they arrive in

#

All objects depending on your PC with their references to each other

#

Are object graph

#

Thiz doesnt solve 3 way dependencies (A needs both B snd PC to init)

#

But it does solve 2 way nicely

prisma snow
viscid tapir
#

How can I buy an item on the server from a shop widget without RPCs ?

winged badger
#

you cant

#

the widget can call an rpc on a class that can actually send them, like playercontroller

fathom aspen
#

Unless you're a listen-server o_O

sterile plaza
#

All I want for christmas is for OnRep to happen after BeginPlay.

fathom aspen
#

I mean it makes much more sense for it happen before, but if you want so, you can defer call it with some hack

quasi tide
#

Screw that - give me UHT namespace support

surreal niche
#

CopyProperties is only called on the server right?

fathom aspen
#

Yeah

sterile plaza
fathom aspen
#

Because you want the replication callbacks which are meant to initialize/set stuff to have happened by the time BeginPlay was called

#

Also BeginPlay is the function that gets called when an actor/object spawns

#

If OnReps were not called, it means that data didn't replicate by the time it was spawned and that's not fun

sterile plaza
#

I don't have my blueprint childclass member variable values before BeginPlay though. :(

#

Or, I want to broadcast OnRep calls, but none of the BP listening have been created yet.

fathom aspen
#

Well not all values are there before BeginPlay

#

Only those who can potentially make it

#

With those being POD types as they used to be called in cpp anciently

sterile plaza
#

It just means I can't have my replicated values get sent to listeners by the replicating object, for initialization.

#

and special cases make me sad.

quasi tide
#

I don't see this as a flaw with UE, more like a flaw with your design.

sterile plaza
#

Is there a different pattern you recommend?

#

This is data that changes regularly in the server and there are umg elements that need to be updated to reflect that on the client.

fathom aspen
#

I mean yeah, bind to these UMG widgets where it makes sense to you. Usually BeginPlay is good. And I would at least expect that you initialize your widgets with values (so those OnReps that made it before BeginPlay will be handled by this form of initialization)

#

There is no specific pattern, you have to adapt your code to how things work

sterile plaza
#

I'm not using UMG bindings as they don't change that often. Well, I guess I am for one.
The ones I'm talking about here are cards that change when you play them and draw a new one. I have a delegate on the ActorComponent that's replicating the values, sitting on the player controller, which registers bindings for the delegate and passes them to the widget. Which works great. Except for init. The widget is created last and so I have it request initial values from the player controller in its BeginPlay.

hollow eagle
#

I fail to see the issue - if the OnReps are firing before BeginPlay then the initial data replicated from the server is being set before BeginPlay.
Therefore if your widgets pull an initial value during BeginPlay then they'll receive that initial data even though they missed the OnReps.

graceful viper
#

@thin stratus was your compendium modeled after anything? Wondering if there's anything similar I can read in unity, the knowledge does carry over but I'd like to see some actual implementation, the docs don't really do that from what I am looking at

thin stratus
graceful viper
#

so afayk nothing similar like that in unity?

thin stratus
#

I also gave up on Unity multiplayer cause their native gameobject stuff is half baked atm and I can't be arsed to pay for photon

graceful viper
#

they did an update recently (today), idk what it added though

thin stratus
#

They have a road map for the networking stuff

#

There are still some fundamentals missing

graceful viper
#

I noticed how using velocity on RigidBodys can cause client lag but that's how far I've gotten so just trying to see more examples

#

isn't there like a free version of photon btw? why dont you use that

thin stratus
#

Pretty sure in unity you gotta code the Movement Component from scratch or buy one from the store

graceful viper
#

I heard it's pretty good for a free version iirc

thin stratus
#

Proton is CCU based

graceful viper
#

what's that mean?

thin stratus
#

The free version doesn't get you far if you want to release

graceful viper
#

any major examples? I've asked this question before and got some different responses compared to this

thin stratus
#

Well CCU means Concurrent User

#

So the more users you have the more you pay

#

Free doesn't cover anything

graceful viper
#

(kinda cringe example) but what about that Dani youtuber? Did they pay for multiplayer support? How could they make a game like crabgame since every lobby can have so many people?

thin stratus
#

Dani?

#

You mean Noisestorm?

graceful viper
#

person who created Crab game

#

on steam

#

and Muck

thin stratus
#

The shooter?

graceful viper
#

Crab Game is a First-Person Multiplayer game where you fight for the ultimate cash price in different minigames based on children's games, until only one player is left to claim it all. Definitely not based on any online streaming pop culture korean tv shows, as that would get me in legal trouble, so we're certainly not doing that.Features Up to...

โ–ถ Play video
sterile plaza
#

I'm overriding APlayerState::CopyProperties(). I turned on seamless travel on the game mode. I'm calling UWorld::ServerTravel to initiate the travel, but it's not getting called. What am I missing?

thin stratus
#

No idea

graceful viper
#

it has 35 player lobbies and this was made before Netcode pretty sure

thin stratus
#

Maybe they simply coded it themselves

#

Games like Hero Siege which is done in Game Maker also coded the multiplayer themselves iirc

#

Aka handling the packages and all the underlying stuff yourself

graceful viper
#

coding multiplayer in gamemaker...

#

that sounds horrible

#

well that sucks then kind of puts a dent in my plans

thin stratus
#

Servers are probably not in gamemaker hehe

thin stratus
graceful viper
#

ever try godots multiplayer? Only tried it for a second but it looks like it doesn't have much support either

thin stratus
#

Which is in the GameMode

#

Not GameModeBase*

thin stratus
#

What makes Godot tricky is that multiplayer seemed to have been an afterthought. There are also barely any guides of how to properly utilize it

#

They have rpcs etc and the simple stuff also all works

#

But more complex things seem to be a lot tricker

sterile plaza
thin stratus
sterile plaza
#

I don't see that.

thin stratus
#

Go to the PlayerState and look for usages in the solution of the function

#

Shouldn't be used a lot

sterile plaza
#

I followed it back to a number of calls that are doing server travel stuff, but none of them are hit. I got lost trying to connect the two functions.

graceful viper
#

yeah I noticed there like only 1 video on the new mutliplayer tools that have been added to 4 so far and it's pretty rushed.
alright thanks for your help I appreciate it

sterile plaza
#

so there's not some obvious step I missed?

#

that's mostly what I wanted to know, or if I should keep digging

thin stratus
#

Not sure atm about any small things that could cause it to not call

sterile plaza
#

it's possible it's not doing seamless travel

#
{
    bUseSeamlessTravel = true;
}```
thin stratus
#

Well we are talking about actually traveling as the server right?

#

And taking connected clients with it

sterile plaza
#

oh what, my new game mode is based off GameModeBase and not my game mode. oops

thin stratus
#

Rip

#

Make sure to reparent the GameState too

#

They can't be mixed

#

Either both Base or not

sterile plaza
#

when should you use AGameState vs AGameStateBase and AGameMode vs AGameModeBase?

thin stratus
#

Base when you probably aren't doing a multiplayer game. But honestly I would always use non Base

#

They split that 4.14 or so to give people a Gamemode that is not overloaded

#

But I think that's kinda pointless

sterile plaza
#

I checked SeamlessTravel in the BP, but it's false in CanServerTravel().

#

oh, this is a PIESeamlessTravel

#

interesting, it's an experimental feature

thin stratus
#

You can't seamless travel in the editor@sterile plaza

#

The experimental feature at least for me still crashes the editor

#

Best is to test in standalone

sterile plaza
#

yeah... it's failing to get member variables defined in BP, in the BeginPlay of the component

thin stratus
#

That sounds like a generic programming problem

sterile plaza
#

it doesn't happen when I don't turn on seamless travel
and why would it not be available in the beginplay?

hollow swallow
#

just starting to make my enemies. Am i able to use root motion in multiplayer? or does it require a certain setup or anything?

thin stratus
# hollow swallow just starting to make my enemies. Am i able to use root motion in multiplayer? o...

Not sure I can 100% answer this, but from what I learned and saw:

  • RootMotion on AnimMontages work fine (if used on a Character)
  • RootMotion in AnimBPs might not

I know that Paragon (Epic's cancelled Moba) did the sort of RootMotion stuff by hand. So they basically ended up calculating where a character would stop and blended into stop anims etc. I haven't really encountered a project yet that uses RootMotion in Multiplayer in AnimBPs.

thin stratus
hollow swallow
#

Rogey, was planning on just using them for my attack anim montages, the rest of the animbp will lock in place

thin stratus
#

That should be fine, yeah

hollow swallow
#

i think i just got it working, its not too bad, little bit janky xD

thin stratus
#

It's important that you play them locally too

#

The CMC syncs it iirc

#

But it might be overall a bit janky. Might need to flush server moves before executing the Montage (c++ only function, would need to be exposed to BPs). That's at least a requirement for RootMotionSources.

hollow swallow
#

ah right, ill dig into it more once ive learnt a bit more. Its acceptable for now, will just need polishing later. Im on my first project so trying not to get too hung up on things and will come back once ive learnt better practices

thin stratus
#

Alrighty

hollow swallow
#

yeah i havent even touched C++ yet and dont plan to for a while ๐Ÿ˜‚

#

also, will root motion try to go through a player if it say jumps forward? or will collision stop it?

winged badger
#

Iirc collisions in root motion can be unpredictable

#

Do a capsule sweep to check for room

thin stratus
#

I released the updated version of the already 7 year old "Multiplayer Network Compendium":

https://cedric-neukirchen.net/docs/category/multiplayer-network-compendium

It's now a Docusaurs (React + MDX) page, with proper Table of Contents, Sidebar, Light and Dark Themes, BlueprintUE support for Blueprint Examples and more.

I ultimately want to provide access to the mdx files via a GitHub Repo, so other users can contribute to it.

There is also a new "Additional Resources" section with links I took from the pinned section here.

#

The C++ Session Tutorial is also part of the tutorials now and with the new website I will hopefully have an easier time writing new things.

#

The old pdf and website links should redirect properly, but you may need to refresh your cached websites.

thin stratus
jaunty lodge
#

Hi, I need player specific data to exist only on the client, where should I put it, PlayerController

winged badger
#

local player subsystem

cosmic yoke
#

hello, if i do an open ip address console command, how can i handle the server not responding?

thin stratus
#

In BP or C++?

#

BP GameInstance should have Travel Error and Network Error events you can add and use

#

C++ has them too, but they have to be bound via CoreDelegates iirc

cosmic yoke
#

c++

#

ideally

#

i've been looking at the coredelegates but they are so many ๐Ÿ˜‚

thin stratus
#
// register the engine with the travel and network failure broadcasts
// games can override these to provide proper behavior in each error case
OnTravelFailure().AddUObject(this, &UEngine::HandleTravelFailure);
OnNetworkFailure().AddUObject(this, &UEngine::HandleNetworkFailure);
#

That's part of UEngine

#

So basically GEngine->OnNetworkFailure()

#

The BP ones are weirdly routed through the bindings above

#

Where it tells the GameInstance about it

#

But you can just listen to the callbacks yourself

cosmic yoke
#

thanks i'll take a look at it ๐Ÿ™‚

quasi tide
thin stratus
quasi tide
#

It's networking stuff is quite barebones in comparison to Unreal. And pretty much - you have to handle everything by hand.

#

I've even been seeing bugs with some of the new nodes that are supposed to make things easier - as in, sometimes, they just flat out aren't working.

thin stratus
quasi tide
#

Ohh - this site is fancy

plucky prawn
#

i have to manually select dark mode

viscid tapir
tepid pawn
#

Anyone about?

winged badger
#

you can use player state or player pawn

#

but not gamestate\

#

your pc needs to own the actor for server rpc to work

viscid tapir
#

oh i see, its why the playercontroller is the most used in this case. Because it owns the widget, right ?

#

or not even that

winged badger
#

its easier to acess from widget too

#

getplayerowner

viscid tapir
#

Yeah I see

#

we told me that i should avoid using lot of RPCs

#

so thats why i asked a non-RPC way

winged badger
#

every action client does

#

can only get to server via rpc

viscid tapir
#

Ok ok

winged badger
#

there is no other mechanism available

viscid tapir
#

Some events are server-side like BeginPlay()

#

iirc

#

and client-side

quasi tide
#

BeginPlay is called on both client and server

viscid tapir
#

So every local actions, to be performed server-side, should be sent via RPCs (if replication is needed)

tepid pawn
# viscid tapir oh i see, its why the playercontroller is the most used in this case. Because it...

I have the player controller own a hud reference which has all my widget creation, destruction, and references. The Controller is a great middle man since a version exists on the server and the client. Then the widgets can call server functions from the controller. I find the controller is like the middle man for the client side stuff and the game. I like to have the game state as a middle man for the serverside stuff and the game.

viscid tapir
tepid pawn
# viscid tapir Yeah I see

RPCs I belevie are fine as long as they aren't on tick. If it's 100 things doing rpcs in a 2 minute match, but those rpcs are staggered and about 1 a second, it's fine. It's when you have 100 a second that you run into trouble.

viscid tapir
#

Oh okay nice

prisma snow
viscid tapir
#

but i had a question, what if a basic function/event (set as not replicated) is called from server-side via an rpc. It looks like the function/event is replicated since it is called by server, I might be wrong tho

prisma snow
#

(or avoid it if possible xD)

twilit radish
#

It's not necessarily wrong to have a lot of RPCs though. There are use cases for it. The CMC sends a ton of RPCs generally.

#

But often it's just not needed.

#

Just don't do it reliably if you do so ๐Ÿ˜›

viscid tapir
#

I'm just using reliables for important game features

quasi tide
#

I unreliable RPC on tick. Fite me โœŠ

prisma snow
tepid pawn
#

My biggest issue with networking now is getting my packaged listen server to let clients join. It works perfectly as an editor server. Not sure why the editor version works but not the packaged version. Anyone know if listen servers have been broken?

quasi tide
#

I haven't had any issues. Did a Steam test like 2 weeks ago

twilit radish
#

Is this LAN or across the internet? Should work fine regardless.

#

Unless it's across the internet and you're not properly dealing with port forwarding or using some kind of other system I guess :p

viscid tapir
#

Sorry to ask this but i need to know. What if a basic function is called from server-side via an rpc. The function becomes "replicated" so i don't need to mark it as replicated ?

quasi tide
#

Functions aren't replicated

tepid pawn
#

I have the most basic game ever. I have 2 blueprints in a player controller and 2 maps. J for Open level with the noip address, and H for open level as a listen server. And it's broken. Server just will not work when packaged.

quasi tide
#

Actors and variables are.

viscid tapir
#

I meant Events

quasi tide
#

My statement remains.

#

Events/functions are not replicated.

merry torrent
#

My team needs netcode devs for online play

quasi tide
#

They are RPCs or not. An RPC is not replication

viscid tapir
#

I meant marked as replicated when you use the "Replicated" keyword with UPROPERTY()

twilit radish
quasi tide
#

That's a variable, not a function

viscid tapir
#

Like imagine if i have this function : c++ UFUNCTION(BlueprintCallable, Replicated) bool HasEnoughMoney(float InMoney) const;
The function is called on the server ?

twilit radish
#

Development builds should have logs. "Shipped" packaged builds don't I believe but you should be able to switch pretty easily.

#

Although you can also enable it for shipped builds in some way I just don't exactly recall how though.

quasi tide
viscid tapir
#

but what if in a RPC, i call the same function without "replicated" mark

quasi tide
#

You are bouncing back and forth between concepts

viscid tapir
quasi tide
#

Can you collect your thoughts and ask your question in a less confusing way?

tepid pawn
quasi tide
#

You've jumped between multiple different concepts.

tepid pawn
viscid tapir
#

Yeah sorry let me some time

#

i'm coming back later with a relaxed mind

#

and a good question

twilit radish
# tepid pawn

I would just try 127.0.0.1:7777 instead of that. I've absolutely never seen that before and have no idea why that even works in the editor honestly. With the log thing I was referring to that the engine often tells you what went wrong with connections etc. you don't need to log anything your self but just look at if there's anything in the logs ๐Ÿ™‚

tepid pawn
#

I don't want to screw around with paying money for anything or some hugely complicated set up. I just want them to type in my IP and connect to my server and play.

twilit radish
#

Not sure then. I've never used this in specific but listen servers definitely do just work as long as the server can be reached by a client.

#

I would still recommend making a development build and just looking at the logs though. Perhaps it tells you it simply can't connect or perhaps something else doesn't work ๐Ÿคทโ€โ™€๏ธ

tepid pawn
#

That's what I'm trying to get to work. But I don't know what logs you are talking about

twilit radish
#

In the folder of the packaged build once you've ran it it should create a log in there.

#

Unless your build is set to a certain configuration, then it indeed doesn't do it.

tepid pawn
#

I click file>package project> build configuration>development. Then file>package project> windows(64bit)

twilit radish
#

What Unreal version are you using?

tepid pawn
#

4.72.

twilit radish
#

If you go to your project settings there should be a "packaging" menu with at the very bottom all the settings.

glass vector
#

can you set ownership of an actor on a client? ie, call the function "set owner" of an actor from a client connection?

#

or is it only the server that is able to set ownership?

twilit radish
#

No. The server is the one responsible for setting and maintaining the owners.

tepid pawn
#

Here are my settings

twilit radish
#

Should just be fine ๐Ÿค”

#

I'm currently making a build too to test.

#

Although with my own project. But I'm pretty sure development should just generate the logs.

tepid pawn
#

It's weird. 2 single maps. Start map. Game map. And 2 buttons. Host and Join. LOL It couldn't be more simple of a multiplayer game.

#

I had to do port forwarding on my router though

thin stratus
tepid pawn
#

You can use "What's my IP" on google to get your current IP address. Then you just need :7777 for the port

twilit radish
#

I'm aware how port forwarding works. But I can't really tell you what the problem in specific with your setup is. Hence why I keep suggesting the logs ๐Ÿ™‚

#

But if those are no where to be found it's a bit weird lol.

quasi tide
#

You don't want client's to be able to do it anyway.

tepid pawn
#

Man these are huge!

#

I don't know what I'm looking for

twilit radish
#

Look at the log for your client and see if there's at any point any 'connecting to server' logs or similar.

#

Usually you can skip a decent part of the beginning of the log because it's just initialization nonsense.

#

But do make sure that you actually attempted to connect to the server with the session log you're searching through.

twilit radish
tepid pawn
sly parcel
#

Hi, if you have an actor in the level that emits a long lasting smoke effect trail, is that by default replicated? Thanks

quasi tide
twilit radish
quasi tide
#

So we can rid a lot of cruft in 99% of logs

twilit radish
#

I mean.. Unreal should just enable logs in the first place IMO. It's absolutely nonsense that it's disabled in shipping builds unless you very specifically enable it in some "hidden" build variable xD

quasi tide
#

I feel like it is pretty common for games to do that though - so I have no complaints.

twilit radish
#

It's just weird Unreal doesn't do it yeah xD
It can be so useful. It's not a golden ticket out of all scenarios but depending on how your team implements logs too it can be a huge help. Also pretty sure BP errors get logged right?

sly parcel
twilit radish
#

You can spawn a replicated smoke actor for example sure. It's probably the easiest way although not necessarily the best in a lot of cases ๐Ÿ˜›
The more common way is to bundle VFX based on an event that is already being send to everyone although that definitely depends on the use. Imagine you have a platformer game where if you jump you get some particle effects going on then obviously you would just want to wait for an incoming "jump packet" and then play the VFX based on that. To name an example.

#

But again. Just depends on what you're doing. Spawning an actor my be perfectly fine ๐Ÿคทโ€โ™€๏ธ

brazen glacier
#

Anyone else have this bug with 5.1? Pawns that go out of net relevancy and come back in are still invisible to each other.

Simple test: in a fresh third person project, open up the character's blueprint and change net cull distance to something like 10,000. Put it into 2 clients dedicated server mode. Start game. Run outside of range, disappear, run back in, and never reappear. wtf?

tepid pawn
#

Anyone still here?

fathom aspen
#

From what I can tell, everybody left to party

round acorn
#

Not me, I'm at work. All weekend.

tepid pawn
#

So I did the logs on my listen server. It's weird. The Editor Server which works, gets this:
"LogNet: NotifyAcceptingConnection accepted from: 60.242.81.333:49935"

but the packaged Server doesn't do anything. The client package when it's connecting to the editor server, gets to send this:
"LogHandshake: SendChallengeResponse. Timestamp: 12.670132, Cookie"

But when the server is packaged, the client gets this:
"LogNet: UChannel::Close: Sending CloseBunch. ChIndex == 0. Name: [UChannel] ChIndex: 0, Closing: 0 [UNetConnection] RemoteAddr: 60.242.81.333:7777, Name: IpConnection_2147482532, Driver: PendingNetDriver IpNetDriver_2147482533, IsServer: NO, PC: NULL, Owner: NULL, UniqueId: INVALID
[2023.04.07-12.33.12:477][672]LogNet: DestroyNamedNetDriver IpNetDriver_2147482533 [PendingNetDriver]
[2023.04.07-12.33.12:477][672]LogExit: PendingNetDriver IpNetDriver_2147482533 shut down"

I don't know what it all means. When I have 2 BP nodes in the entire game, what is it that I need to fix?

round acorn
#

GPT4 says this:

#

Firewall: Check if your firewall settings are blocking the packaged server from receiving connections. You can try temporarily disabling your firewall to see if it resolves the issue.

Port forwarding: Ensure that the necessary ports are forwarded correctly in your router settings. Typically, for Unreal Engine, ports 7777 (UDP) and 27015 (UDP) are used. You might need to check your game's documentation for specific ports.

Server settings: Verify that the server settings in your packaged game are correct. Ensure that the server IP, port, and other necessary settings are properly set up.

Network configuration: Check your game's network configuration (DefaultEngine.ini) and ensure that there are no discrepancies between the editor and packaged versions of the game. You can compare the network settings in your editor and packaged game to see if there are any differences.

#

It also said like 4 more but I only thought the first two were really key for now tbh

thin stratus
wheat rose
#

heyy everyone, so can someone help me blueprint out a way for someone to interact with a door, and then teleport somewhere in the map when in a session. However only they teleport and anyone else can follow them through the door. thanks!

#

im really bad with the blueprints and such

blissful talon
#

Hello, I have some replication problems.
That's my structure of things that are related to the problem:

class EquipmentInstance : UObject
{
    UPROPERTY(Replicated)
    UObject* Instigator;

    virtual bool IsSupportedForNetworking() const override { return true; }
}

struct EquipmentEntry : FFastArraySerializerItem
{
    UPROPERTY()
    EquipmentInstance* Instance;
}

struct EquipmentList : FFastArraySerializer
{
    UPROPERTY()
    TArray<EquipmentEntry> Entries;
}

Whenever I create an EquipmentInstance assign a valid Instigator to it, create a new EquipmentEntry I assign the EquipmentInstance to, and mark the entry reference as dirty, the Instigator doesn't get replicated.
On EquipmentList::PostReplicatedAdd entry containing the created EquipmentInstance has a nullptr Instigator.

That's how I create a new entry:

void EquipmentList::AddEntry(UObject* InInstigator)
{
    EquipmentEntry& NewEntry = Entries.AddDefaulted_GetRef();
    NewEntry.Instance = NewObject<EquipmentInstance>();
    NewEntry.Instance->Instigator = InInstigator;    
    MarkItemDirty(NewEntry);
}

I do the following with the newly created EquipmentInstance:

if (IsUsingRegisteredSubObjectList() && IsReadyForReplication())
{
    AddReplicatedSubObject(Result);
}

Does anyone have an idea what may be wrong?

sterile plaza
blissful talon
#

The thing is that I'm using something else to replicate the UObject, hence it should work

#

I have the FFastArraySerializer inside an ActorComponent, which adds the created UObjects into its own replication subobjects list

sterile plaza
#

the uobject can be replicated

#

You implemented all of these?

virtual bool IsSupportedForNetworking() const override { return true; }
virtual bool ReplicateSubobjects(class UActorChannel *Channel, class FOutBunch *Bunch, FReplicationFlags *RepFlags) override;```
blissful talon
#

On my UObject I only implemented IsSupportedForNetworking

#

I shouldn't implement the rest of the functions since it's an ActorComponent the one responsible for deciding when to replicate them

sterile plaza
#

what do you get when you call UObject::IsSupportedForNetworking() on the uobject?

blissful talon
#

What do you mean "what do I get"? My override makes it always return true

sterile plaza
#

ah

#

Even if it was an actor, you'd still have to implement GetLifetimeReplicatedProps

#

why are you using a uobject if you want to replicate its properties?

blissful talon
#

Because I don't need to flood the replication channels for such a simple thing. As you can understand from my code snippets, I'm making an equipment system, and there are many equipment instances, which can be handled by one single component rather than making them handle themselves. In my game the replication channels are very important, and I can't use many of them for things that can be implemented using one single channel instead.

sterile plaza
#

fair enough

#

I haven't personally added replication capability to uobjects, so I don't know from experience what you need to do.

blissful talon
sterile plaza
#

I don't think I'd expect Instigator to be replicated here, as it lives inside something that doesn't support property replication yet.

blissful talon
#

It should be replicated. I have already implemented an inventory system which replicates some UObjects which store 2 replicated objects, but for some reason the equipment system doesn't play well

#

So I'm trying to figure it out

sterile plaza
#

I can tell you what I know based on replicating actors and actor components, but if you're rolling your own replication, I don't know that I'm going to be much help unfortunately.

#

does EquipmentInstance need to be a UCLASS?

blissful talon
#

Yeah, it must to, however, I didn't write the macro in my code snippet

sterile plaza
#

k

#

For the inventory system I wrote, item instances were structs, so I never ran into this.

pseudo schooner
#

I have a general question just to see how people deal with this stuff. I have a few OnRep functions that I use to set cosmetic data on my characters. These onrep functions inject some information from the PlayerState about the network client. During standard gameplay all of this works well, and I have 0 issues.

Startup, however, is an absolute nightmare. The client and server have different initialization orders, and the clients get their PlayerStates long after all of the onRep functions have processed. 50% of the references required aren't available when the rep functions fire because the clients have not finished setting up their pawns, controllers, player states, components, or anything else that's required to actually to bootstrap a player.

How do people normally handle this? Should the onReps call a generic function and I just have to manually call the function a second time?

sterile plaza
blissful talon
# sterile plaza Sounds like you already have a different case working, but maybe reading through...

Apparently I did everything in a correct way, the reason why it doens't work is because I'm using the very same inventory system to store the items the equipment is created from, anad the inventory manager component is stored on the player controlled, which is not replicated to the proxy clients, which means they cannot know the instigator (item instance) that created the equipment, and perhaps that's the reason why it's nullptr.

However, I have a TSubclassOf<T> in the very same struct where the Instigator doesn't get replicated, and it's nullptr as well...

sterile plaza
#

yeah, if other clients need the data, it can't be on player controller.

blissful talon
#

However, the equipment manager component is on character class, so it should work

#

The equipment manager component is the one holding the fast serializer array containing the uobjects I want to replicate

pseudo schooner
# sterile plaza I was chatting with people about this last night. I'm still hoping there's a mor...

It's infuriating to me that the boot orders are not predictable. It's looking more and more that I'm just going to have to write something that is in charge of one-time setup which seems like a pretty large waste of time for something so small. I have a pretty good workflow for general runtime updates and I basically have to deal with all of it in two different ways.

I was kinda just wondering if there was a standard practice for handling stuff like this, or if it's basically a free for all

sterile plaza
blissful talon
#

I think the only relevant ones are the EquipmentManagerComponent that recides on the player character. The component holds the EquipmentList which stores an array on EquipmentEntry that contains the EquipmentInstance that has to be replicated

sterile plaza
#

AEquipmentManagerComponent?

blissful talon
#

It's a component, hence U

sterile plaza
#

right, meant actor component

blissful talon
#

Yeap

sterile plaza
#

what type is equipment list?

blissful talon
#

Fast Serializer Array

sterile plaza
#

I don't think I can keep track of all of this in my head. I'd need to see all the code. Unfortunately work starts in 10 minutes. :(

pseudo schooner
blissful talon
sterile plaza
#

if you get all the classes in a pastebin or something, I'd still like to take a look

blissful talon
#

The Fast Serializer Array is an UE thing

sterile plaza
#

I'm generally familiar with it.

blissful talon
#

Well, since we don't have much time, I'll probably try to figure it out on my own. However, thanks for the help ๐Ÿ˜„

sterile plaza
#

sorry, I have coworkers who've set up uobject replication, but I haven't personally done it

#

and like I said, my inventory system used structs for all my items and things since they're just data

#

and those replicate just fine

#

so I can give you the standard stack overflow answer, "rewrite your entire program to be different, then it will work" :P

blissful talon
sterile plaza
#

at least you've gotten it working in another context right?

#

so in theory you can eventually find the discrepancy

blissful talon
#

Yeah, I will try to follow the whole thing from there

pseudo schooner
sterile plaza
#

I would probably investigate replicating subobjects first. Make sure everything there looks right.

blissful talon
pseudo schooner
#

I briefly looked at your code, I don't see a line adding the new object to the subobjects list in the addEntry function. Is that Instigator already in the subobjects list?

#

Also, I have to mark each one of my UProperties in my uobjects as replicated, or they do not send over the network

blissful talon
pseudo schooner
#

You're trying to replicate this guy, right? Is that variable added to the subobjects list? You will have to nest them if you are replicating uobjects inside of uobjects

blissful talon
sterile plaza
#

oh yeah, does the instigator support being replicated?

blissful talon
pseudo schooner
#

Check to see. If you pass in a UObjectA to UObjectB, you need to add ObjectA to ObjectB's subobjects and set the property as replicated. Nesting objects and replicating gets a little messy

#

You also have to remove them from the subobject list manually once you're done with it or you'll have a reference preventing garbage collection of the object

sterile plaza
#

If my game involves moving between levels often and PIE doesn't support seamless travel, does this mean I'm going to have to test most everything in standalone? If so, that's highly unfortunate.

blissful talon
#

The thing is that I have a TSubclassOf inside the UObject I'm trying to replicate, and it's not replicated either, it's nullptr even though it isn't on the server side

round acorn
sterile plaza
#

You would then multicast a message telling client systems they can go ahead and get their previously OnRep'd properties?

round acorn
#

Yea that's what I was thinking

#

Either multi RPC or perhaps a Run On Owning RPC, not sure tbh. Just thought I'd throw it out there.

sterile plaza
#

it's a nifty time to be aware of

round acorn
#

ya

sterile plaza
#

timing of initialization is always awkward

round acorn
#

I mean it's technically maybe "too late" but during those awkward moments of initialization I think it's okay to have a bit of loading going on

#

I currently use it to animate my player stats in the widget, i.e. health/stam/mana bars grow from zero to full size as the player spawns in

#

Could see it being a bad choice if, for example, you want the player to see the pawn with cosmetics already applied the moment the screen shows anything. Might have to work some weirdness there

#

Something like a full-screen loading widget that hides things for a second heh

sterile plaza
#

Any suggestions for working on a game that switches between ~5-10min combat and then a draft screen? I was switching to a different level and using seamless travel to persist data. But that doesn't work in PIE. I'm hoping there's something to this that I'm missing that would make developing and testing this easier.

pseudo schooner
late marlin
pseudo schooner
#

If you are handing objects to a new owner, you also need to update the outer reference

sterile plaza
late marlin
pseudo schooner
late marlin
#

i try with a clean project and have the same issue

sterile plaza
#

I've literally had this same issue. But I don't remember what I did to solve it.

late marlin
#

didnt change anything on the component just created new character with camera and add movement inputs

sterile plaza
#

can you show the movement component properties?

late marlin
sterile plaza
#

also, did you enable replication for other things like the mesh and the collider?

edit: because I don't think you want to, movement component should handle these on the client

late marlin
#

omg omg i found it ^^

#

i moved net update frequency to 10 ...

sterile plaza
#

there we go

late marlin
#

after changing it back to 100 its not laggy anymore

sterile plaza
#

I had that when I refactored an actor into an actor on the player state. Player state ticks WAY less often.

late marlin
#

thanks for directing me a bit closer to my problem ๐Ÿ˜„

sterile plaza
#

no problem, just talking it out with someone often helps you figure it out

round acorn
#

Even so, I am forced to wonder if that Event doesn't give you the timing you want, Alduron

pseudo schooner
hushed heart
#

Hello! I have a question that's probably not super easy to answer, but I was wondering if someone might be able to explain to me how the CharacterMovementComponent synchronises its server and client deltaTime? I've been combing through the code for a good while now but it's a little tricky to know for sure if I see what it's doing.

Context: I've been trying to implement a simple version of what the CMC does but for my own movement, but unfortunately I can't get the movement to be deterministic, even though it should. There's still slight delays in changes to velocity and acceleration, and as a result it means where something might move past a wall on the client the server may just barely get snagged on it, causing a huge desync that would correct the client back against the wall - even with zero latency. As far as I can tell, the only reason I can think of as to why this happens is because of slight differences in their delta time, which is why I've been combing through the CMC for guidance. But unfortunately I've come up short. Any help there would be super appreciated. Thank you!

pseudo schooner
#

PlayerState calls I believe immediately after controller on server, and calls after pawn, posession, and controller on clients

#

No do-once for that one, but I will probably add it

round acorn
#

May not be needed but I'm paranoid about that

pseudo schooner
#

Like I said, my bootup is a nightmare of code. I'm trying to streamline it so I don't have a bunch of wasted calls. The new messages are part of that effort. I also have an activation function in all my components that returns a failure if a reference is missing then retries to activate in a few frames

#

These feel like Band-Aids though...and not solid code practices

round acorn
#

I'm somewhat surprised there isn't a more standard practice published on this

pseudo schooner
#

I assumed I was just an idiot and there was some simple way to handle all of this. It seems really silly that Server has one order, client 1 has another, and client 2 has another. I don't know how to plan out activation if I can't rely on anything being available from one machine to another. I had a custom dependency manager but I just replaced it since it required specific manual configuration

sterile plaza
#

it does seem like there should be an authoritative article on how to do this in a standard case

pseudo schooner
#

I've looked a bit at some of the project examples but I would need to dedicate a large portion of time to read through and understand their order

ebon zealot
#

does anyone know how multiplayer FPS's replicate a 3rd person model to others while keeping only the arms shown to the client?

#

I imagined having 2 meshes and apply the inputs to both but only show the hand mesh for the client and show the full body mesh for others

#

but wondered if there's a better solution

round acorn
#

pretty sure that's the common approach

#

local player using first person blueprint, clients using third person blueprint for the same pawn, etc etc

ebon zealot
#

huh?

#

so it's a completely different character?

#

I imagined 2 meshes within the same character

round acorn
#

dunno how that would work unless you changed animation blueprints on the fly

zealous saffron
#

No it's the same character, The meshes are different.

round acorn
#

yeah I think it's done multiple ways

ebon zealot
round acorn
#

So with that approach how are you playing animations correctly? some kind of animgraph blend by bool or?

zealous saffron
#

It's either the same mesh with FP/3rdP cameras or two different meshes and animation layers.

ebon zealot
#

each mesh would have its own animations

round acorn
#

ok so when you load into the game you're setting the mesh and associated animbp

ebon zealot
#

i've actually not touched animations yet so I'll have to figure that out

#

just designing it before I get into it

round acorn
#

if it's on one first person blueprint then you have to do some logic to replicate the fact that this is switching to the full mesh and animation blueprint for the simulated proxies

ebon zealot
#

sure I can figure that out

#

the hardest part for me would probably be getting animations and testing with them

twilit radish
# hushed heart Hello! I have a question that's probably not super easy to answer, but I was won...

IIRC the CMC sends over all client delta values and the server uses that to simulate the movement.

What you should note however is that Unreal's physics engine and the engine them selves are not deterministic. You're going to get some amount of inaccuracy regardless. Even with the normal CMC. Also packet loss kind of ruins this anyway.

Another note is I was messing with the CMC input my self at some point and this is a rather important thing to do is that you round the input vector to match what will be send over the network. The CMC has a less accurate version for input because it doesn't need full float precision so it rounds the input vector before doing anything locally with it regards to movement to whatever precision it uses to prevent desyncs. Sounds like that could also be a potential pitfall here.

prisma snow
twilit radish
#

Not the positions.

#

It sends over an input vector to determine what direction it should go towards. However that vector is quantized to have less network overhead. The problem with quantized vectors is that they loose accuracy the further you go. So what they did is round the local input before processing anything with that value to match the value it will be rounded towards when send over the network. But in the end it's to increase determinism yes.

#

The problem is if you don't do that is that very quickly you're building up rounding errors because what you send over the network is slightly different to what you actually process locally. Especially with controllers I would imagine.

prisma snow
twilit radish
#

No worries ๐Ÿ˜›

twilit radish
#

I was trying to make my own CMC at some point and this was one of the things that I was like "Huh. Never actually thought about that" ๐Ÿ˜„

#

But yeah it makes sense once you realise it exists.

hushed heart
#

Thank you for this all! That's useful to know. Hmm. I was hoping just the basic acceleration and velocity in the movement systems were deterministic, that makes things a little complicated since i'm trying to minimise desync to be virtually non-existent before any latency or packet loss is introduced and so far I'm really struggling. I suspect the deltatime isn't helping, and from combing through the code it seemed sort of like the server calculated some deltaTime by grabbing the last received move's timestamp and subtracting it from the current timestamp, but it wouldn't be just that since it would end up being really wonky when inputs weren't pressed but you had a lingering velocity to dampen. (which is kind of my issue right now anyways)

I'm actually not quantising any of the vectors yet, only because I was going to go through and optimise everything after - so I don't think that's an issue for me quite yet, but it is a very good point to round it to the correct precision on the autonomous clients before passing them through. But alas that's an issue for once I've resolved what's causing the greatest amount of desync for me right now.

sterile plaza
#

There aren't alternative ways of moving from level to level and persisting data other than seamless travel right? I want to make sure I'm not missing something before I start debugging this in standalone since PIE doesn't work.

latent heart
#

Use your game instance to store data.

sterile plaza
#

and don't use seamless travel?

latent heart
#

Up to you.

#

If you just want to persist data, GameInstance is the usual choice.

sterile plaza
#

I'm not intimately familiar with the pros/cons of the different systems, which is what I'm trying to learn.

latent heart
#

Seamless won't disconnect clients from a server.

#

I think

sterile plaza
#

it sounded like if you don't use seamless travel it disconnects and reconnects all the clients
is that not a concern?

latent heart
#

Is it a concern to you?

#

It's your game.

sterile plaza
#

I don't know. I don't know what the ramifications are.

latent heart
#

Well do you want all your clients to disconnect?

#

Shrug

sterile plaza
#

does it auto reconnect them?

#

I guess I'm not sure what the user experience is if they're disconnecting. I assumed it would auto reconnect.

latent heart
#

If they disconnect? No.

#

That's what seamless travel is for.

sterile plaza
#

When a client executes a non-seamless travel, the client will disconnect from the server and then re-connect to the same server, which will have the new map ready to load.

#

It is recommended that Unreal Engine multiplayer games use seamless travel when possible. It will generally result in a smoother experience, and will avoid any issues that can occur during the reconnection process.

#

so it sounds like we have to deal with not being able to test this in PIE

#

is that your understanding?

#

if that's the case that's fine, I just want to avoid embracing an onerous work flow if I don't have ot

latent heart
#

Oh? They reconnect? I see. I'm thinking of the browse thing which just resets everything.

#

I mean it doesn't sound like it's much effort to set up seamless travel.

sterile plaza
#

I mostly have it working. I don't think the data on my PlayerState is persisting... but it's hard to tell since it crashes in PIE.

winged badger
#

There is gamemode vs gamemodebase thing too

#

Only one persists pc and ps

sterile plaza
wanton trout
#

Hello everyone!

Could you pls suggest me book or course for C++ UE5 online game dev ?

prisma snow
wanton trout
thin stratus
#

@sterile plaza gotta add that if you target steam you'll need Seamless travel

#

Steam is not at all happy about the reconnecting process of hard travels and will leave some or even all your clients behind

sterile plaza
hollow swallow
#

Whats the easiest way to send a variable from my player pawn to the playerstate, and then get it back again on death / respawn?

latent heart
#

What sort of variable?

hollow swallow
#

well i stored all my player stats on my character ๐Ÿ˜› and its too much to change now. so im going to send all that to the playerstate when they die, then grab it back when they respawn to keep their level / health amount, stats etc...

latent heart
#

I mean I you can just change how they are initialised.

#

But yeah, just add those stats to the player state too and copy them from/to characters?

hollow swallow
#

how would i go about doing that? ive only just realized my problem now that ive killed a player and they reset to 0 xD

#

and which method is less performant heavy?

#

Just as simple as that?

#

and then to save them, make a custom event server and pass through that player state / stats and update them all that way

latent heart
#

You don't need to worry about performance when copy a few stats from one object to another...

hollow swallow
#

its gonna be like 60-70 variables, still new to unreal so dont really know how demanding stuff is

latent heart
#

Don't create server events for backing up stats, that should happen only on the server anyway.

latent heart
#

In that case you want a large struct holding all your shit.

#

And just copy it as a whole.

sterile plaza
#

but yes, none of what you're asking for should be networked

hollow swallow
#

ah rogey, havent even touched stucts yet ๐Ÿ˜›

sterile plaza
#

it should all be on the server

hollow swallow
#

yeah only the server can update the playerstate right? i thought the easiest way is just when the player dies, he calls a server function to send it over. then when he spawns he just grabs it again. What is the proper way?

sterile plaza
#

I'm doing a seamless travel and I implemented CopyProperties on my player state. I'm using that to copy a UActorComponent* from the old player state to the new one. At some point, that pointer goes to null. I'm struggling to come up with a reason why.
The pointer is in a UPROPERTY, so it shouldn't be GC'd... oh I bet the actor component is destroyed when the server travels. Is that what's going on?

latent heart
#

Are you simply doing NewPlayerState->MyComponent = OldPlayerState->MyComponent; ?

#

Actors from the old world will be destroyed and destroy their components. So it's disappearing when the GC finally runs.

sterile plaza
#

yeah, I need to copy all the values over

#

they explicitly destroy them though? even if there are references to them?

latent heart
#

This is why structs are great. You just copy once and you're done. ๐Ÿ™‚

#

I believe so?

#

Honestly I've never looked into it, but it's the impression I get from everyone else who actually uses actors. And levels. And games in general.

sterile plaza
#

hmm, I'll think about putting all the state in this component in a struct

#

oh no, I'm replicating individual members, they can't all go in a struct

latent heart
#

Enjoy writing your 70 copy commands! ๐Ÿ˜„

#

Though I believe structs replicate individual members, not the whole struct. So you could just stick them all in a struct anyway.

#

Unless they have the Atomic specifier.

hollow swallow
#

okay struc is done. much easier to use xD

#

and from my player, do i just get player controller 0 and cast to player state? or is there an easier way to access it

latent heart
#

You can't cast a player controller to a player state.

#

If you have the cahracter, use Get Controller on it (or Get Player Controller). Get the playerstate from that and then cast that.

#

You may need to cast to player controller first if you just get the controller, rather than player controller directly.

hollow swallow
#

rogey, i was trying this before but wasn't working xD

latent heart
#

If you have a character, don't use the global functions (that take an index), just use the character itself to get the controller.

quasi tide
#

I think playerstate is on the controller class. 'Cause AI controllers can have a playerstate as well

latent heart
#

That's what I was thinking, but I wasn't sure.

hollow swallow
#

it reckons player state doesnt inherit from player controller?

latent heart
#

As BP Player Controller -> Get Player State -> Cast

hollow swallow
#

thats the one, ty

#

All working now ๐Ÿ˜„

#

now to find the million variables i need to pass around ๐Ÿ™ƒ

latent heart
#

Can the struct members not ahve their own replicatedusing?

sterile plaza
#

Player state does not live on the player controller or else you'd be able to server rpc.

latent heart
#

Sure it does. And you can?

sterile plaza
#

clients can call RPCs on their player state?

hollow eagle
#

clients can call RPCs on anything they have ownership of

#

which includes the player state by default

sterile plaza
#

huh, I guess I didn't know they owned their player state

hollow eagle
#

clients have ownership over their controller, controlled pawn, and player state by default

#

and any other actors you set ownership for, but that's up to you

sterile plaza
#

huh, controller does create the player state

#

I've rarely used it and apparently what I know is wrong.

#

good to know

sterile plaza
latent heart
#

Set the owner as a struct member (basically a version of a UObject's Outer) and then forward the call.

hollow swallow
#

So, player stats, working, my spell hotbar working. My next issue is, when i learn a spell, i spawn an invisible actor in the world that holds its current level etc... what would be the best way to pass this through the player state and back for death / respawn? am i going to have to change the whole way i store that information instead of storing it on a separate actor?

hollow swallow
#

it pretty much just exists in the world to store the spells level etc when they upgrade it, as i cant change class defaults

#

should i redo it so it stores the level of the spell in the player state?

fossil spoke
#

Probably, it doesnt need to be an Actor.

#

You could create a Struct that holds information about a "Spell"

#

Like its level etc

#

Then hold that in a property on the PlayerState.

hollow swallow
#

yeah, my spell system was my first attempt at making something without any tutorials ๐Ÿ˜› so its a bit messy, but works xD. Yeah i think thats going to be the go, not looking forward to redoing this and breaking it along the way ๐Ÿ˜…

fossil spoke
#

Refactoring is an essential part of programming/development.

hollow swallow
#

and when i make a structure for the spell, and pass it to the player state, is there a way to search through multiple structures by name or something? (only started using structs today)

latent heart
#

What do you mean "search through multiple structures" ?

fossil spoke
#

I think he means if they are in an Array

#

Which is likely what he wants

latent heart
#

I would use a map myself, map the spell class to teh struct detailing its current state.

#

Though maps can't be replicated, so maybe not.

fossil spoke
#

All this sounds like GAS is what he needs lol

hollow swallow
#

i think im going to have to take a bit of time and think through this whole process haha. But yeah for my spells, as an icon its using class defaults, then when i press learn, i was spawning an actor adding it to an array, and if you press learn/upgrade again, it would search that array for actors of class and if it exists, update the level on that actor.

latent heart
hollow swallow
#

GAS is c++ only yeah? im a long way off touching c++ if i can help it ๐Ÿ˜…

fossil spoke
#

Not necessarily.

quasi tide
#

Nah - just the setup portion

#

But you mostly do stuff in BP

hollow swallow
#

i would rather try learn without using it, im still soaking in all this BP stuff, just starting to make stuff without tutorials / guides. im only a few weeks in

fossil spoke
#

GAS is pretty complicated, it might be worth it for you to try your hand at building your own system and then when you are more competent, making the leap to GAS later.

hollow swallow
#

yeah that was my thoughts

quasi tide
#

Yeah - I wouldn't move to GAS until you are passed the beginner stage.

hollow swallow
#

So am i in the right thinking here. Add a struc into the class defaults for my spells. When i press learn, it will update that struc info with the variables. Then add it to an array of "learnt spells" in the player state. When i press learn/upgrade again, how can i check if there is a struct with that class in the playerstate array? then i can grab it, and update it there. And when i cast my spell, it will check again, grab that struct and update the projectile with that info. Am i on the right path here?

fossil spoke
#

Sounds like a plan

latent heart
#

How many spells are you going to have?

hollow swallow
#

Still not sure on that, so i want it to be fairly modular

#

want it to be easy to add / remove spells

latent heart
#

I would add those details to the struct in your player state, not the spell class defaults, but sounds like a plan.

#

I do have a concern about the lookup for the spells. If you have 10 spells, it won't take long to check if you have a spell. If you have 500, it will be another story.

hollow swallow
#

Reason im using class defaults, is i have a master spell bp, then just create childs off that, fill out the details, and add that into my spell book array and it all works pretty smoothly. ive only discovered playerstate today now that im trying to save / load on death / respawn

#

i wont be having 500 haha. maybe like 50 tops?

#

does checking through an array take a fair bit of time?

latent heart
#

Not really, but if you do it a lot, it'll add up. What if you have systems that rely on you knowing a certain spell and it has to check repeatedly?

hollow swallow
#

yeah true

latent heart
hollow swallow
#

for my spell hotbar, it only uses the class defaults as all it needs is the icon really which doesnt change. its more when i go to fire the spell, it will need to get the info to know its level / damage

latent heart
#

Using the class defaults is great for icons and activating spells and stuff.

hollow swallow
#

yeah thats what led me to spawn an actual actor that the player owns to store it. looking back on it, it was a terrible idea

latent heart
#

But for recording the link between your player and spells (levels, etc) it's not ideal.

hollow swallow
#

but its what i knew at the time of making it

latent heart
#

It's not a terrible idea!

#

It's a good idea, just a little off. Instead of an actor in the level, you can use a struct on your player state.

hollow swallow
#

so lets say, i have the struct with the info, and its on the player state. what is the best way to check that the spell class in my hotbar, is linked to a struct in my playerstate?

#

i need a reference between the two

latent heart
#

You could simply search through the array each time for the correct spell.

#

When it becomes a problem, devise a better system.

hollow swallow
#

rogey

#

ill give that a crack, cheers for your help, appreciate it

#

big day of fixing stuff today i think ๐Ÿ˜…

latent heart
#

๐Ÿ™‚

#

Good luck!

#

Designing systems becomes a lot easier when you've learnt about database normalisation.

hollow swallow
#

yeah i havent even touched datatables / structures etc yet haha until today

#

multiplayer rpg was a great first project ๐Ÿ˜‚

latent heart
#

MP as a first project is ambitious!

hollow swallow
#

yeah i knew what i was getting into, but i hate singleplayer games. It will never be a complete game, more so a hobby and to mess around with mates on

#

just 1 thing, i have the array of my spell structs on my playerstate. whats the best way to search through them to see if it matches my spell class on my hotbar?

#

would i use like, contains, then send over the class default struct or will it not recognise it if i have changed values?

latent heart
hollow swallow
#

my only other thought is doing a for each loop and checking the name xD but i imagine thats slow

latent heart
#

What do you think Contains does? ๐Ÿ˜›

hollow swallow
#

yeah rogey

#

it looks nicer okay ๐Ÿ˜‚ i just ignore what its really doing

latent heart
#

๐Ÿ˜›

hollow swallow
latent heart
#

Why are you passing a struct with the "spell to find" instead of the spell directly?

hollow swallow
#

Like that?

latent heart
#

No.

#

Add the spell to find as a parameter of the function.

hollow swallow
#

ahh as the input

latent heart
#

You can just use the class name instead of the "name of the spell" as your name.

#

So "Spell To Find" -> Get Name

sterile plaza
#

also, your struct doesn't need the spell name

#

I would put the spell as a variable inside your spell instance struct

#

a pointer to it

latent heart
#

Yeah.

#

Honestly you don't need a struct on your spell at all.

#

Just have all the variables on the class itself.

hollow swallow
#

so add the master spell class to the struct, then just pass the master spell class through, and see if thats == to the one in the struct?

sterile plaza
#

what class?

sterile plaza
hollow swallow
#

more just using a struct so its easier to send / retrieve stuff

sterile plaza
#

what type are you spells?

hollow swallow
#

Cheers ray, ill do that

#

theyre childs of a master spell bp

sterile plaza
#

what type is that?

#

what's the UE type they're based on?

hollow swallow
#

actor

sterile plaza
#

yeah, then just put the instance data on the actor I think

#
UCLASS(Blueprintable)
class ASpell : public AActor
{
    GENERATED_BODY()

public:
    // Spell definition values
    UPROPERTY(EditDefaultsOnly)
    int32 ManaCost;

    UPROPERTY(EditDefaultsOnly)
    FText Name;

    UPROPERTY(EditDefaultsOnly)
    int32 Damage = 1;

    // Spell instance values
    UPROPERTY(BlueprintReadWrite)
    int SpellLevel = 1;
};```
#

or the equivalent in BP

latent heart
#

He's using the spell class CDO only, though, so spell level shouldn't be there.

hollow swallow
#

yeah sorry youve lost me there, thats beyond my knowledge so far ๐Ÿ˜…

sterile plaza
#

yeah, you can't use the default object anymore, you'd have to instantiate

#

a tutorial on how to do spells might be useful

#

can walk you through how some of the things are pieced together in a way that we can't over chat

hollow swallow
#

yeah rogey, its so hard to find whats good / bad tutorials online though. I hear a lot of people saying theres a lot of bad practices out there so its hard to determine which ones to follow

#

being my first project, i dont expect everything to be perfect, far from it. if it works, it works. But ideally id like to try and learn the best practices

sterile plaza
#

I think you add the instance variables to your spell class, and then create the actor from that and then you can modify any of the variables on the spell instance

#

It's not perfect, but I think it's totally reasonable for what you're doing.

hollow swallow
#

its probably not the greatest xD

sterile plaza
#

what class is this in?

hollow swallow
#

when i press the learn/upgrade spell button, it send it to the player states, if it exists, it will update its level / damage etc. if it doesnt, it will add it to the array in the player state

sterile plaza
#

what is CheckSpell doing?

hollow swallow
#

this is in my AC spell component

#

it is seeing if that spell class exists in the playerstate already

sterile plaza
#

ah

hollow swallow
sterile plaza
#

do you ever create an actor from the actor class?

hollow swallow
#

im trying to get rid of that. Thats how i use to do it

sterile plaza
#

for that loop, you don't need a local variable
if you find one, return true
if you complete, return false

hollow swallow
#

i use to just spawn an actor to store the info when they learnt the spell. but i wanted to change it for if they leave / join the game it seemed like a headache to try store all that

sterile plaza
#

can you show the definition of your master spell?

hollow swallow
#

ah right, didnt know it would end as soon as it did. so i made that extra bool. wasnt sure if it counts as completed when it returns

sterile plaza
#

if you return it stops iterating

hollow swallow
#

sweet

#

Do you mean that?

#

so my hotbar just shows the spell from the class default, then it will check that with the spell in the structure that i send to the playerstate

sterile plaza
#

yeah

hollow swallow
#

i probably dont need to send everything, but ive chucked it in there anyway

sterile plaza
#

are any of those values you can read from the spell definition?

hollow swallow
#

only really need level / damage

sterile plaza
#

CastingAnim for example?

hollow swallow
#

yeah i can grab them from the class defaults

sterile plaza
#

awesome

hollow swallow
#

i just chucked it all in there for the hell of it ๐Ÿ˜›

sterile plaza
#

and then, since you're only using the class defaults, I think a DataAsset is going to be easier to work with than an actor

hollow swallow
#

yeah i havent touched them just yet haha

sterile plaza
#

although I forget how you define the type of the data asset in BP

hollow swallow
#

i done a inventory tutorial that set up all the items from a master item, then childs of that. so i sort of used that logic and made my enemies the same, my spells the same, my harvestable objects the same

sterile plaza
#

sure

hollow swallow
#

pretty much just using what ive learnt so far to continue and learn along the way. after discovering strutures i wish i used them a lot more, but thats the next projects job ๐Ÿ™‚

sterile plaza
#

structs are great

hollow swallow
#

also, with say animation in the structure. Would i send the data for the whole animation over to the playerstate, or just a reference to it? like that actual data would already be on the client right. just wanting to confirm

sterile plaza
#

so, all you're going to need to save on the player state is which spell it is, which currently would be the master spell class, and then level and damage

#

everything else is defined in the master spell right?

hollow swallow
#

yeah thats right

sterile plaza
#

and when you talk about the spell across the network, you can just talk about the spell class, which is going to be fairly light weight, and the other side can look up the values from the CDO

hollow swallow
#

yep rogey

#

hmm, it never finds the spell

#

Its printing that its adding it, but i can see its not in the array

sterile plaza
#

sorry, was putting the kid to bed

hollow swallow
#

no worries. if i manually add it whilst in game. everything else is working. but my add / upgrade isnt working

#

im calling them from server

#

do i need to run check spell from server too?

sterile plaza
#

I would probably do that only on the server

hollow swallow
#

yeah rogey

sterile plaza
#

have an rpc that is, AddOrLevelUpSpell(TSubclassOf<Spell)

#

does that make sense?

#

then on the server you figure out whether to add or upgrade it

#

What is a Data Asset in Unreal Engine 4.

Followup video showing how use Blueprints Only for Data Assets using the Primary Data Asset type: https://youtu.be/hcwo5m8E_1o

Source Files: https://github.com/MWadstein/UnrealEngineProjects/tree/CPP-Examples

Note: You will need to be logged into your Epic approved GitHub account to access these exampl...

โ–ถ Play video

As a followup to an earlier video we show how to use the C++ Data Asset class using Blueprints only using the Primary Data Asset class type.

Original Data Asset Video: https://youtu.be/gLWXZ3FXhO8

โ–ถ Play video
hollow swallow
#

love the titles xD

sterile plaza
#

I think you will find these informative and a more elegant solution for defining your spells, rather than an actor.

#

the first one goes over what data assets are, how you define them in C++, and how you use them
the second one shows how to make them without any C++ using PrimaryDataAsset

hollow swallow
#

Rogey, ill definitely give them a watch tonight

sterile plaza
#

It's essentially the same as using an actor only for the default values, only it's going to be way easier to use and much lighter weight

hollow swallow
#

okay so now its "adding" the spell, and its printing found the second time. although if i check my player state in the outliner, i can see theres nothing in there. and its not showing in the book unless i manually add it to the player state in game then it shows fine. I am passing the player who presses the button's player state through as well and its printing the correct playerstate. so where the hell is it adding it ๐Ÿ˜…

sterile plaza
#

have you tried putting breakpoints at various points in the code to see if it's getting hit and then stepping through to see where it goes?

hollow swallow
#

once i get to a stage where its a semi playable game, which im close to. im going to go back, and learn more optimized approaches to stuff and slowly work back through it

#

i have print strings, and its hitting them all

sterile plaza
#

I would try breakpoints

hollow swallow
#

rogey

sterile plaza
#

breakpoints are to print strings as a ferrari is to my wife's honda civic

#

it gets the job done...

hollow swallow
#

๐Ÿ˜‚ ay theres some civics that can beat ferrari's ๐Ÿ˜‰

#

yep so its going through, adding it the first time, then its finding it the second with break points. but if i view my playerstate in the outliner, i can see the array has nothing in it

sterile plaza
#

on the client or the server?

hollow swallow
#

im playing as client

#

ill check as server

sterile plaza
#

you updated the server instance

hollow swallow
#

does playerstate not replicate?

sterile plaza
#

unless you're replicating that, it won't have changed on the client

hollow swallow
#

i thought only the server can update it

sterile plaza
#

it does, did you make that variable Replicate?

#

?

hollow swallow
#

i didnt, i swear i read everything in playerstate already replicates ๐Ÿ˜…

sterile plaza
#

don't worry about it

hollow swallow
#

with my player stats, i get server to update that on the player state, then the player grabs it, and that works fine

sterile plaza
#

I've been doing this a long time and it took me 2 hours to figure out why my camera wasn't replicating rotation to the client a few weeks ago.

latent heart
hollow swallow
#

Rogeyy

#

Just about got it all working, just need it to update my widget properly and its sorted ๐Ÿ˜„ appreciate all the help guys

sterile plaza
#

of course

hollow swallow
#

seems to be quite a bit of delay from when the player state increases the spells level to when i update the spell book. its around .7-1s is that right?

hollow swallow
#

if i play as standalone, its instant. just not sure how to work around the delay from playerstate to pawn

#

im thinking maybe just keep it all on the client until you die, then it send to the playerstate to save, and when you respawn it gets it back

winged badger
#

Playerstates dont replicate with high priority

#

Just ForceNetUpdate it

hollow swallow
#

ahhh yep, just found that, its set to 1 per second xD

#

i just changed everything back over to client side... rip

#

good to know for future though

winged badger
#

Its ok to have actors that rarely need an update on low priority/frequency

#

And just ForceNetUpdate when they have something important to replicate

hollow swallow
#

Cheers for that. I think ill re do it tomorrow and chuck a force update in there and see how it goes. burnt out a bit from today now ๐Ÿ˜…

kind star
#

Upgraded my project to 5.1 and changed the 'Server Default Map'. I'm able to load into the lobby map, but the game won't connect/load the main world map when I use the 'Open Level' BP Command using the local IP (127.0.0.1). Any ideas?

Server log at the bottom shows multiple accepted connection attempts, I assume this means there's no firewall issues...

Client log at the top just shows a 'timed out' network error. No logic as-to why it timed out.

errant vapor
#

in ue4.27 im having an issue where my fast tarray of structs is failing to resolve an actor reference on the client side when that actor is replicated after the actor with the tarray... the relevant actor does exist on the client, but its as if its net replication does not always trigger a refresh/resolve of the delta serialized tarray actor's references, so the struct property remains a nullptr on client... is this a known issue or something i can work around somehow?

tight isle
#

I created an TArray that is replicated but in blueprint i cant get item by ref, why?

latent heart
#

You can't replicate to the server.

tight isle
#

typo, i mean just replicate

latent heart
#

Might be because it's a pointer?

#

There's no need to get those by ref.

#

(usually)

tight isle
#

the thing is i cant change anything because its copy

#

i also tested to be sure

latent heart
#

Copied pointers still point to the same object. Changing values on the pointed-to object will be the same no matter how many times you copy the pointer itself.

#

Unless you mean you want to change the object it's pointing to? (i.e. change the pointer value tiself)

tight isle
#

no, just object variables

latent heart
#

Then something else is wrong in your code.

tight isle
latent heart
#

Yes, and?

tight isle
#

ah understand, will check other code

latent heart
#

That tooltip refers to the pointer, not the object it's pointing to.

unkempt tiger
#

Is there anything I can do to get my timers to act as tick functions so that they get called every frame, without actually using tick functions? sadthink

#

It's just that I have this timer delegate lambda that's very convenient to use

tight isle
latent heart
#

Is the server event being executed? Add a print string or something.

#

Is "Name" your own variable? Is it set to replicate?

tight isle
#

its not :D

#

ty for help

zenith wyvern
#

This is the hack I need to replicate a change in an array of structs

#

Can I avoid that?

#

set members alone doesnt replicate

unkempt tiger
# dark edge Why not just tick?

The behavior I'm looking for on my actor comes and goes and I want it working independently of tick, which may need to be enabled at all times, and I don't want to bloat tick because it's kinda niche

#

Also woops just realized we're in multiplayer and not cpp

thin stratus
#

@unkempt tiger could wrap your logic into a tickable object

#

Or call a timer for next frame and let it retrigger itself

#

But not sure what the overhead is

unkempt tiger
# thin stratus But not sure what the overhead is

I thought of this but something about using timers felt hacky, I ended up discovering that instead of a timer handle, I can use a FTSTicker::FDelegateHandle MyHandle and do something along the lines of:

MyHandle = FTSTicker::GetCoreTicker().AddTicker(
                FTickerDelegate::CreateWeakLambda(
                    this,
                    [&](float DeltaTime) // Expects functions that accept a delta time float argument to compile
                    {
                        DoSomething();
                        return true; // It's expected of the function to return true to continue ticking or false to stop ticking
                    }
                )
            );

And I can remove it like so: FTSTicker::GetCoreTicker().RemoveTicker(MyHandle);

#

This ended up working wonderfully, plus I kind of expect minimal overhead since this FTSTicker type is used everywhere in the engine at quite low levels

#

I see myself using this a lot in the future, it's so much more convenient than having to setup a tick function imo

latent heart
#

I would advise against using [&].

#

It kinda destroys the point of having a weak lambda?

unkempt tiger
#

Oh, can you explain why?

latent heart
#

It captures things by reference. Including things which you may not want it to.

#

If you're using a weaklambda, why not capture [this] instead?

#

It will ensure this is valid when the lambda runs.

unkempt tiger
#

Doesn't a weak lambda already ensure that this is valid?

latent heart
#

It ensure this is valid. Not everything else it may capture.

#

You might capture a local variable which becomes stale or something. Or you might capture a sharedptr which keeps something alive and causes bugs.

#

It's just generally a bad idea to use [&]

unkempt tiger
#

Makes sense, I'll change it, thank you ๐Ÿ‘

latent heart
#

Unless the lambda is run within the same scope.

sinful tree
# zenith wyvern

If you're accessing the array through a "Get" make sure it's a Get (by ref), then the Set Members should work.

quasi tide
#

Heads up to all who may be interested in the GMC plugin

nova wasp
#

good move I think, definitely an underserved thing

sterile plaza
#

what does GMC stand for?

fossil spoke
summer tide
#

Hi - If I want to set the AI character hidden in game and stop brain logic,etc, I want this to effect only the clients since I'm using viewport. Would I do ClientsOnly events to set them?

short arrow
#

iirc setting hidden in game on server hides it on clients aswell but I can't remember

summer tide
short arrow
#

so things like meshes, capsules, movement components, and anything attached to it

#

you can change/optimize them as you see fit for server and clients, they don't have to be the same

#

but clients don't have a brain component for AI which is why you can't stop it

#

you'll get an error everytime

sterile plaza
#

My HUD is created in standalone, but in play as client, it's not. It's being set on the game mode.

#

client doesn't have a game mode, how does that data get to the client?

hollow eagle
#

...it doesn't

#

don't do it in the gamemode

sterile plaza
#

That's where it lives though... is there another place to specify it? Why is it a member of game mode in the first place?

#

Literally the first thing I found was a call from the game mode to the player controller telling it to set the HUD. I'm confused.

sinful tree
# sterile plaza My HUD is created in standalone, but in play as client, it's not. It's being set...

There's two things involved:
HUD Class and Widgets. Siliex was thinking you were creating widgets in the Game Mode as was I when I first read your message.
Using a base template game, I made my own HUD class with a simple image widget that I add to the viewport on begin play of the HUD class. Works fine on clients.

You discovered how it communicates it to the client - it uses the player controller which is replicated, so the game mode sends the message through player controller which the client receives and it can instantiate and use the appropriate HUD class.

summer tide
#

If I toggle visibility of Skeletal mesh using Client RPC would it work?

hollow swallow
#

So I'm making a multiplayer rpg. Are there any tutorials anyone could recommend on how to store players info on a server so they keep their name / levels / items etc when they join every game instead of resetting each time they join a new server

thin stratus
sinful tree
# hollow swallow So I'm making a multiplayer rpg. Are there any tutorials anyone could recommend...

If your intention is to retain their data on only a single server (ie. player connects to a server, plays, levels up, gets items, quits game, later returns to the same server and they should have all the same data) then all you need to do is utilize Save Games - all data about the player you want to save about the player you would save in the save file, when the player reconnects, you read the save file and load whatever data where you need it.

If you are intending on a player being able to retain that same data across multiple servers (ie. player connects to a server, plays, levels up, etc. quits game, later returns but connects to a different server and they should have all the same data), then you're getting into the realm of requiring a database, but this would also then require that you host all game servers as otherwise malicious actors could upload bogus data to your database or overwrite other player's data as you'd have to allow those servers write access in order to make changes to player data. There's also no native support within UE to connect and utilize a database, so you'd either need to build up an API of some kind to connect into your database server, have a plugin that can make the connection to the database, or you'd need to code it yourself within C++ . There's little point in recommending a tutorial for how to do any of this, as it would depend highly on what database solution you decide to go with.

thin stratus
#

Also, you need a unique identifier for your player

#

For both of those writeups

#

If you aren't intending on using a subsystem like Steam or EOS, then you'd also need to setup some sort of login system with unique identifier

#

Otherwise you can't really track the player.

hollow swallow
#

Thanks for the in depth reply. I'm not 100% sure it will ever be a complete game. More so a hobby for myself and friends to play so I'm not so concerned about malicious intent. I would like to ise the steam subsystem for ease of joining eachother but yeah the idea was store all their data on a database, and they can each host their own server and do their own playthrough with people. As my first project this is sounding to be a bit out of my realm so I might just dig into dedicated servers and run one 24/7 that stores everything and everyone can just play on the one server

thin stratus
#

If you don't care about cheating and a DataBase is too much, then that would be the easiest solution

#

Every client saves its progress locally and on connection tells the Server what their character is

hollow swallow
#

That sounds like a great solution atleast for a long time until I want to dive into it and spend months learning it ๐Ÿ˜… putting all my focus into just learning the engine and blueprints atm

thin stratus
#

Sending the SaveGame data to the Server might be best done i nC++ though

#

just an fyi

hollow swallow
#

roger that. I know im going to have to dive into c++ at some point. Although i havent got much coding experience, only a bit of c#. mainly just getting proficient at blueprints for now

#

and still a long way off that xD

kindred widget
#

Character data shouldn't be that big depending on structure. Could store most all in a struct and just RPC it for the most part.

thin stratus
#

We had to send multiple batches of data for The Ascent

kindred widget
#

To be fair. I'm not considering stuff like history or anything. Was just considering basic visual definitions and stats. ๐Ÿ˜„ It could get pretty complex I guess.

hollow swallow
#

Still working on my damage popups, trying to get the widget to scale depending on how far from the enemy you are. Im running this on the owning clients and setting the scale based off the enemies location and the location of the player. Yet its printing the same distance for every client still. How can i make it only set the scale on the owning client?

thin stratus
#

Not entirely sure why you need so many RPCs

#

Server Damage Popup shouldn't really exist

#

Cause the Server is the one dealing the damage already

#

The Multicast is theoreitically fine

hollow swallow
#

can a player call a MC? i thought server had to

thin stratus
#

Server has to but you aren't dealing damage locally, are you

hollow swallow
#

no thats all on the server, this is just for the damage popup widget

thin stratus
#

Yeah so

#

Why can't you just Multicast

hollow swallow
#

so everyone makes their own, and i want them to all set their own scale locally

thin stratus
#

You are overcomplicating this a bit

#

One single "Multicast_OnDamaged" would be enough in the Enemy

#

Pass in all the info from the damage

hollow swallow
#

rogey

thin stratus
#

And then handle everything you need

#

Also you are getting PlayerController in your image

#

You probably meant to get the Character

#

You also don't need the EnemyToAttachTo

#

Cause the MC should just be in the Enemy you damaged

#

Makes it all a lot simpler

hollow swallow
#

it can also attach to players / trees / harvestables etc so i just kept it on the player

thin stratus
#

I would just put that into a Component then I guess

#

HealthComponent and DamageNumberComponent or so

#

They don't need to know what they are attached to

hollow swallow
#

rogey

#

i just have it as a MC now, but both clients are still printing the same distance from the enemy

thin stratus
#

Are you still using the PlayerController

#

Instead of the Character

hollow swallow
#

That'll do it, works a charm now. Cheers

grizzled stirrup
#

Is this a workaround instead of doing SessionSettings->bAllowJoinInProgress = false; and then calling SessionInterface->UpdateSession(GameSessionName, *SessionSettings, true);?

#

As I've noticed that this never works and players can still join in progress even if that bool is set to false

#

I will try your workaround instead, just curious if it's a common thing that bAllowJoinInProgress doesn't seem to update or take effect if setting it later than session creation time

stoic lake
#

Shouldn't the timer variable be automatically updated for all the clients if it's set to replicate like this? Right now the timer stays at 0 for all the clients

#

This is in a normal actor blueprint

kindred widget
stoic lake
#

damn.. totally forgot to check replicates on the actor itself. Thanks mate ๐Ÿ˜‚

kindred widget
stoic lake
#

Ah good to know, thanks!

hollow swallow
#

I have an anim notify in my characters animation bp, for some reason, that is triggering on all of my clients, how can i make sure it only triggers on the client that actually doing it?

#

If i play as host, it works fine and only fires once. If i play as client it will fire for every client :/

round acorn
round acorn
hollow swallow
#

That gets triggered by the ags anim notify

#

Even running it like that the server prints it twice

round acorn
#

I see "damaging enemy" and in your print in game "damaging player"

#

just want to be sure you aren't printing from some other logic somewheres and not what you shared

hollow swallow
#

sorry, the next line down is the same but for player, thats why the strings different

#

does the same for player and enemies

#

i think i just sorted it with that

#

but should i be doing the trace on the client or the server? it feels a bit janky

round acorn
#

yeah before, you were running that logic twice, on your client and on client 2's version of your client

#

at least that's what it looks like to me...

#

I've decided to try not to have much coffee this morning though so... lol

stoic lake
#

Hi there, is there a way to make sure this does not replicate when ran from the server?

#

I tried using a run on owning client but that also seems to spawn it for the clients

round acorn
#

turn off the actor's replication?

stoic lake
#

The placeable Actor's replication you mean?

round acorn
#

Yeah

stoic lake
#

That is turned off

round acorn
#

Hmm, maybe that BP node is doing it internally then. Not sure

stoic lake
#

Yeah think so

quasi tide
#

V2 will be ready far before Epic actually does anything with CMC

stoic lake
#

whats gmc?

#

cmc*

round acorn
#

Iris is already in experimental, though. But yeah I agree GMC is still going to be valuable for a long time probably.

quasi tide
#

Iris isn't meant to replace CMC

round acorn
#

TBH I am probably going to buy it when I sort out my budget.

round acorn
hollow swallow
#

one other thing mythic, all my enemies are a child of my master enemy bp. If theres 2 enemies fairly close, but definitely not close enough to be hit by the trace, it still seems to damage both, im guessing either the ags combat manager trace is a bit dodgy, or something else is up

round acorn
hollow swallow
#

rogey, its a plugin im using so im guessing its something up with that

round acorn
#

vs. Epic's built-in Character Movement Component

round acorn
hollow swallow
#

yeah ๐Ÿ˜… still pretty fresh to unreal and wasnt sure how to trace inbetween traces

#

and the attack animations are pretty fast so i kept missing stuff