#multiplayer
1 messages ยท Page 365 of 1
@merry hemlock RepNotify is just a way to react to replication.
Setting a Variable to "Replicate" will send the value to the clients if the server changes it (not other way round).
RepNotify does the same + calling the OnRep function when the value arrives
For you here, we use RepNotify, so you can react to the replicated text and set it to the Renderer
@compact gulch Yeah heard of that approach. We use GameSparks + GameLift
ah, otherwise I'd have to have some Tick or check of the variable's state
we sorta decided aginst gamelift due to the SDK requirement.
GameSparks does Matchmaking, asks GameLift to start a Server and send the Info, and then GameSparks passes that to the players and they connect
RepNotify is a bit like binding widget text's to a variable function?
I wouldn't start comparing this to anything
yeah we're doign that. Gamespark matchamking , gets EC2 to launch server and pull players in.
we did extra logic to make sure we always have fresh instances available
we hardcode the limit like 5 sessions per instance. when 3 is filled up we boot another instance.
It's what I said. Variable gets replicated to Client if Server changes its value.
If the value is 10 and server sets it to 11, the clients will receive that after a few milliseconds (ping).
OnRep just makes sure that, in addition to just replicating the variable, it also calls that function when the value arrives
There is not much more to say about that
@compact gulch Yeah that's basically what GameLift does anyway
I didn't want to reinvent the wheel
And the costs for the instances are the same iirc
have u tried google cloud?
- GameLift has the scaling
we're going to explore both and compare the cost
It's client stuff. I haven't been able to test anything else
I know that both are expensive :D
Can be
ah...just trying to make sure i'm understanding it as well as I can
I'm just happy I figured out how to use GameLift from GameSparks
i've a few ppl who are using cloud . just for the IAAS part. they mentioned AWS is significantly more expensive
right.. i see you're the authority on this topic
eveywhere i search i see your name
gamespark and gamelift
haha
I was probably the only one at that time doing that
probably
Everyone else has either their own backend or is quiet about the process
i also see Ahsan Muzaheed a lot
not sure if you've seen him a bit
it's so hard to find someone who has skills on this..
it's ehtier you , RyanJon2040 , or the Muzaheed guy
Ha, Ryan
Talked with him about it. He had the node.js solution. I explained him the GameLift solution iirc
If I am spawning actors in the game mode, what is a good practice to get into for determine their spawn transforms? I don't want to hardcode values, so should I just GetAllActorsOfTag and then use the transforms of the different target points? Or is there a better way?
Na, that's fine
You'd want to only get these once though
So save them in an array
And onPostLogin, simply do "Length of Array == 0? -> GetAllActorsOfClass"
And if it's not 0, then well, you got points
Is it normal to have a branch where you basically set aside all the server functions? That is where I'd do the initial GAAC
So it will only run once
Well this is not directly Server vs Client code
You are simply doing "First Player" vs "Rest of Players" here
And the FirstPlayer happens to be the Server when using ListenServers
Which for me is going to be the use case
again, this is mainly to get a few initial customers to get enough money to pay a professional
somethign like this -
One of the other things I wasn't clear on is having an actor placed in the level do things to the players
versus having the gamestate do it
I have functions designed to teleport players
Just want to make sure they replicate
you don't need functions to replicate to teleport players
just need bReplicateMovement = true
that means if I can see each actor move around, if they get teleported that automatically works?
you would need RPCs only if you wanted some additional stuff
like waving at the other guy and then going poof
but the teleport would work
awesome
How do events from gamestate replicate to client? I'm confused about ReplicateOnOwningClient? What if you want the gamestate to target a specific player controller?
Hey all! I've got a slight problem here with server replication.
Currently reconfigurating the controls for when the players are aiming and not aiming. Everything works perfectly for the individual clients, but setting the actor rotation is not replicated to all clients. Is this because its an actor and NOT a pawn? Even though they're pretty much the same thing? Bit confused at where I'm going wrong. Hopefully someone has encountered and got over this problem before and might be able to shed some light on where I'm going wrong. Thanks!
grandmaMax what is your character movement from? if it is from default pawn it won't replicate
I see 3rd person so that's shouldn't be an issue though
when you spawn the VR player, save that controller and than you can call any event that is set to execute on client by using that controller
How would I access as a client if it is in game mode?
How do I get the reference to the VR controller if it was spawned in game mode? just cast to game mode?
on server any actor can access it
but if I'm a client playercontroller?
the one on the server or client side?
the client side
if I want to make say, the server stuff do things, from the client's side....i'm using gamestate as my access point because most of my data is there
put a event into controller, set it to execute on server and in that event you access the gamestate
@merry hemlock Why dont it replicate if its default pawn?
@icy nacelle Epic make the character movement module, for the character type actor, they made it replicate automatically
they didn't do that for the default pawn
Thats strange, because my movement was always replicated while using thirdpersoncharacter
because you were using the right character movement
try it with a default pawn and see what happens when you move
How do I reference other player controllers from the gamestate, (if i am a client) remember it is a unique test case
That's my biggest problem I need to be able to target a specific player spawned by game mode, and sometimes these events need to be trigger from the client, on the gamestate
Do I just pass the PC reference to game state?
From the game mode
you dont, you add Event that executes on server into the controller, on client side you call that in your own controller and in that event thats execute on the same controller but on serverside you can send infos to gamestate or the instructor
I seem to be able to call events on the gamestate though (from the client)
I just cant target the correct player because player controller 0 is always client
than set 2 refs on the server when you spawn them (instructor and VR), but based on the nice drawing thats pinned here, gamestate is there but not owned by client
I don't think Server has PlayerController for every Player
I thought PlayerState was for replicating things about Player
server has every playercontroller, everyone has every playerstate
right, if its not splitscreen
I might just use the Unreal Web Server instead of messing with replications...I've got way too much iteration to test
I just need to figure out a way to KNOW on my gamestate what pawn references are where so I can target specific players (and do this from a client)
create 2 variables, InstructorController and VRController, set them and use them to get to the owned pawn.
if you want to send something to the instructor pawn you would call a event on your controller or pawn that is executed on server and from there send it to the instructor pawn, by using the ref to InstructorController
I'm working on it, I'll put screenshots and maybe you'll see what I'm doing wrong
my problem is I only seem to be targeting one player controller, the first one aka server
ack, one plroble mis my pawn doesn't have input from the client
Hey guys, got a problem with actor replication that i can't wrap my head around for a few days. Any help would be much appreciated! From the PlayerBP i have a 'Run on Server' Event that spawns an actor (weapon) and i attach both meshes with Attach Component inside the WeaponBP, i also set the owner in WeaponBP (set owning pawn function is called from the PlayerBP). I have the FPS mesh set to only owner see and the 3P mesh set to owner no see. This all works perfectly when seen on the server. I geuss this is becouse the server is the owner. How do i fix it so it's propely shown for all connected clients?
Did you check Replicate on teh Actor Class Defaults I mean?
Yep, replication seems to be working fine. I just don't know how to set the visibily options. Currently clients see the first person weapon version, not the third person one.
If i run a dedicated server with 2 clients, it works fine for each client but when they look at eachother you see the first person mesh, not the third.
https://www.youtube.com/watch?v=hlDWovBcu7E they do the EXACT thing you are talking about at about 15 minute mark
Announce Post: https://forums.unrealengine.com/showthread.php?139935 Ryan Gerleve, Sr Engine Programmer at Epic Games, dropped in to break down and explain U...
specifically they spawn and attached weapon and change it's visibility based on replication
Thought my search these last few days i watched that video, but i'll take another look.
Yep that sadly doesn't help me. They don't fiddle around with Owner No See / Owner Only See problems ๐ฆ
IsLocallyControlled I think is what you want to explore
I suck at replication and you'll see probably about 100 questions from me in the next 24 hours but based on everything peopel have tried to help me with, I think IsLocal is what you need to look into
Thanks, i'll look into it.
you only need to set owner no see and owner only see, exactly the same for everyone
its the owner, the actor knows who owns him and changes based of that
That was what i was thinking aswell Mizuki. I just don't seem to be able to do so. I think this is becouse the owner of the spawnned weapons is the server?
you set owner when you spawn
Could you tell me where i should be setting these? Here is all im using right now: https://imgur.com/AwRjhQy
Both the Set Owning Pawn and Attach to Owner functions are in the Weapon Base BP
the spawn node has owner pin
do i set a reference to Self? i think i have tested that before
self should work, isnt the 2nd attachToComp overriding the first?
Nope, when i remove the Owner No See / Only Owner See from the Weapon meshes i have 2 weapons in my hands on the server.
Thanks btw Mizuki. Does anyone else have any idea?
we're facing an issue where DIrectX runtime is alreayd installed on a VM ( Aws instance ) , but unreal still says directx runtime component required.. any idea how to solve this.
@thin stratus see if you know about htis? we manage to install it , DXDiag is showing DX12 , restarted , but still unreal won't launch , asking for directx runtime
anyone know why a replicated actor appears to be destroyed by players correctly when i do a normal multiplayer test in PIE (with dedicated server), but when i host a server as a player, then join with my extra PIE clients, the same replicated actor is only seen as destroyed by the server?
(the server that i create manually for my test is a dedicated server, though the player appears to spawn anyway)
hey man
sup blake ๐
Trying to think, I suck at replication
Make a event that replicates on all controllers with a print message that says the Actor was destroyed
and call that from whever you destroy the character
just make sure you can get the events to all link up and replicate
hrmmm
its not multicasted because its the server destroying an unowned replicated actor
the actor itself is replicated but i'm not certain the destruction is
totally guessing here man, you could be completely right
i guess its weird that it works with PIE multiplayer?
thats whats messing with me
but as soon as i host a server it doesnt work
what happens when you set the destroy event to multicast
testing now! ๐
same thing
weird
but i see the building destruction notifications
(like kill messages in CSGO or w/e)
weird...
damn... i really thought i had replication figured
i think youre right though. you need to multicast on the replicated actor, which seems odd
i hope someone corrects me if i'm wrong
but i think it's because even though the actor is replicated, it's destruction is not
like the server sees it as gone
but the clients still do
here's another test
yeah for some reason i thought that a replicated server owned actor would automatically replicate down
becuase thsta how it works in PIE default mp test
when the actor doesn't get destroyed, can you make it change ANYTHING on teh client's side, meaning, does any of the movements move or anything update, or does it just freeze
try this
do a function that makes the actor send something to the client, like update a value continuously
and see if that update keeps happening even if it is destroyed
it SHOULD stop if the replication stops, (because the server destroyed the actor)
ok ๐
again, i'm here on this channel because I have no idea what I'm doing
no worries, when it comes to replication, it seems like no one really knows
๐
yeah confirmed
client thinks it still exists
thats so weird
it works fine for players
just not for buildings
both use the same health component
i should probably just sleep on it. i been working on this for hours. thanks blake!
your advice to verify what the client sees was helpful, verified that it exists and it wasnt just some other weird replication thing
the actual destroy script isnt replicating for some reason
np good luck
ill def let you know when i figure it out
yes please
we should chat about your project as well. ๐
trade show in less than a week
I'm offering it for sale as a class, I have enough content to do that, Fire Chief's don't have to buy any hardware and I give them a credit for the class if they end up buying the hardware
well i hope it works out. its a cool concept
thanks, i'll let you know how it pans out....no idea...I'm the only VR thing there as far as I can tell...
Hey, I'm following the dedicated server guide on the wiki and trying to build for version 4.18 are there any specific target file instructions I have to follow
^^Ignore that i played around and think i've got it building
@reef ingot usually good to check the corresponding ShooterGame build with whatever engine version, and see the targetfile they use there
Anyone here had issues with spawned actors crashing PIE in multiplayer, in RepLayout.cpp
RepLayout::InitFromObjectClass to be specific
If I run two instances of my packaged game and CreateSession in one instance, and JoinSession in the other, it reports back that it was successful, but the two players can't see eachother. Is this purely a replication issue or is there more that I have to do to get MP working? If I play using the in-editor preview with 2 players selected, they both spawn correctly and can see eachother, which makes me think it's not a replication issue.
Trying to JoinSession or DestroySession without first creating a session on either of the running games will fail, making me think they are successful in interacting withe achother somehow. One game knows that the other has created a session. Really new to networking, apologies for the question.
Also if I CreateSession with game window A, and then JoinSession with game window B, then destroy session on game window A, B's player will respawn back at the start after 15 seconds or so. I don't know what to make of this, they are definitely communicating but can't see eachother in a packaged game. Any tips? EDIT: Fixed, I was missing an Open Level node with "listen" in the options
apparently
replicated variables in blueprints make PIE crash when debugging multiplayer
how jolly
im running into a weird problem, my server see the client character playing the forward animation with its back towards the server player when the client is running towards the server player
rotate mesh 180 degrees around Z?
but it works for the server, its just what the server sees the client
@opaque tinsel Are you replicating the rotation in BP? Only position is replicated and thats if you check the box on the actor
yeah but assuming hes using same pawn for client and server they should be equal unless he adjusts mesh rotation with hasauthority
could it be there's already a pawn in your level that one of the playercontrollers take possession of, instead of using bp to spawn it
Alright, Iโm going to be honest. I have no clue how to make a Multiplayer game in UE4. Can someone please help me out? Iโm looking to make a multiplayer game that can be played over multiple computers that arenโt on the same network.
@coarse condor for a holistic solution, there are some good courses for ue4 multiplayer on udemy
How can you delay a players spawn into the map until they finish loading? Im using world comp to allow spawning and teleporting to diffent areas. They spawn and begin to load even if they are not loaded and can cause them to fall thru the world.
Thanks @hazy haven
@inland sun Well, you can always set the DefaultPawnClass to None in the GameMode
And then control spawning them yourself
OnPostLogin in the GameMode gives you the PlayerController of a Player that successfully logged in and joined
You can either spawn and possess the character there or save the Controller reference and do it later
@coarse condor Simply read my Compendium
It's pinned to this channel
No need to instantly pay money on some courses
is it considered legit to sandbox two steam accounts on one computer just to do network testing? will I not get any of the accounts banned? Or maybe there is a better way to test?
@thin stratus how would I find a server online to use?
Or do I use a hosting site?
where do I add PktLag=# to simulate network lag
Recently, I had an email conversation with a Gears of War fan about the differences in networking quality between each of the three games in the series. One thing that we can point to in terms of increasing the quality of the networking experience is our use of the Unreal Engineโs built in network simulation features.
yeah the PktLag stuff in that blog didnt work
it goes over 3 places you can put it
I tried console and defaultengine.ini
and found forum post of peole saying it's not working and to just use "Clumsy"
it's always worked fine for me
and I use it a lot
what value are you setting it to?
I tried 120 and 1200
someone said it's disabled for certain builds
it looks to disable network commands on either
(UE_BUILD_SHIPPING || UE_BUILD_TEST)
you aren't doing this in the editor?
hey guys so like
im trying to figure out how to make my setup reload the gun
the montage needs to be a multicast
but the issue is that
we are reloading "twice"
cauhsing the player to lose twice the number of bullets
because its multicast
is there a way to do this better?
never mind
i got it
๐
added this lol
@ANGUs GAMEs#1421 To host a Dedicated Server, you would need to rent a server where you execute the Server on.
ListenServers are Players who host themselves. Or you provide players with the DedicatedServer exe, and let them create their own
@twin juniper To save nodes, you can always drag out the "MontageToPlay" (or other pins) pin and do "Select"
And then plug the Enum into the Wildcare pin of the select node
That way you only need one PlayMontage node
@thin stratus true
but other than organizational purposes it doesnt actually make a difference right?
Yes, right*
Also
You don't want to go back to the Server after the Multicast
The Multicast should be only for visualy
You can query the length of a Montage and put up a delay
It's helpful to learn a tiny bit of C++ to look through the shootergame weapons
- For better organization, you should make one base class for weapons that handle all the shooting, reloading etc. and have variables for their animations etc.
Then you can simply create a child of that base and only need to fill in the reload montage in the class defaults
This way you don't have to go back to your code if you add a new, similar functioning weapon
yea
But only make a child and adjust the values
thats what i did
but the montage is just separate
coz i only have 3 montage types
Fair enough
๐
Hey, can someone help me how to make an infection game mode? If you dont know how the game mode works let me explain: Normally 12 people are recommended to play in, two or 3 people start as an infected randomly, and the other ones are survivor, once you die you become infected, the last survivor will win. And it must check if you started as an infected last round, if you did 100% chance you won't spawn as an infected next round but if you died and become infected you could still spawn as an infected, but every one start as an infected randomly, and there's a timer in the game mode, about 4/8mins recommended.
If someone can help me then it will be sooo appreciate ๐ I've been trying to make that but I cannot find a way.
That's a very large questionโif you can break it up into small parts that are somewhat easily attainable, you will both most likely be able to do it easier and also get help more easily ๐
How do you set elements in a TMap?
You mean I should repeat in small parts?
when I try with Replicated component turned on it crashes
Breaking the message into parts isn't what he means
oh
I don't really understand then
But do you at least read the full question? Or no?
Yeah, I meant the scope of the question, not its literal size, hehe
Hey can somebody help me construct a space program? I have diet coke and mentos
Ok I'm stuck here:
{
UEquipItemComponent* EquipComp;
if (UEquipmentFunctionLibrary::IsEquipItem(EquipItem, EquipComp)) {
FEquipmentSlot& EquipSlot = *EquipmentSlots.Find(EquipComp->EquipmentType);
if (EquipComp->EquipmentType == EquipSlot.EquipmentSlotType && !IsValid(EquipSlot.EquippedItem)) {
AActor* EquippedItem = EquipComp->OnEquip();
FEquipmentSlot Slot = EquipSlot;
EquipSlot.EquippedItem = EquippedItem; // THIS IS WHAT CRASHES IT!!!!!!!
return true;
}
}
return false;
}```
EquipSlot.EquippedItem = EquippedItem crashes editor when running dedicated server and only when "EquipmentManagerComponent" is Replicated
otherwise this all works fine
uhhh, I mean, the game type in a nutshell is just two people start as an infected randomly, if that's what you guys are able to help me then please tell me how thanks. If I can at least make that its alright
This is run from server by a wrapped Server, Reliable, WithValidation function
Like, how do I be able to get the two random players?
Its just what I'm basically asking.
See, that's a much better question to start with ๐
@quartz vector It would help if you posted an little about the crash as welll.
Check your crash dumps?
where's that at so i can check real fast
Saved folder
probably just a NPE because you aren't validating EquipComp against null
checking
{
OutComponent = nullptr;
if (!IsValid(Test))
return false;
OutComponent = Cast<UEquipmentComponent>(Test->GetComponentByClass(UEquipmentComponent::StaticClass()));
return IsValid(OutComponent);
}```
Can anyone help me please what do I need to do to get two or 3 players randomly? I'm sorry if I'm asking too much but I tried but I have 0 idea how I could do it, I dm UE4 on twitter they read my messages but do not respond.
let me generate another dump i cant find anything in this one
[2018.01.13-21.35.58:231][769]LogWindows: Windows GetLastError: The operation completed successfully. (0)
that;'s last line lol
@agile crane RandomIntInRange with 0 being the first element and your PlayerCount being the last?
Simple stuff really that can be easily googled
oh, I need to do random int in range and switch on int?
@quartz vector Yes its probably telling you that it crashed successfully lol, look further up the log.
I typed some explicit language right before that function is called
and it outputed to log right before the crash
I see the item destroy on client due to replication
and then crash
Is there anything more I need to add after that? cause it prob won't check who will be being infected or smth. I'm kinda confused
You just answered your own question just then didnt you?
Check if they are infected?
If not, do something else
Wait, I'm gonna try smth if it cannot works I'll ask again ๐
This is why @brittle sinew asked you to expand your question into smaller more easily tackled problems
alright!
If you slice up your main problem into smaller parts it makes it ALOT easier to create an final solution by solving the individual parts seperatly instead of trying to figure out an grand master solution
okay
Also, if I were you, I would just try to map out what your flow needs to do, even outside of UE4
Think about the process of what would have to happen to an Player from beginning to end in order for the game to begin.
I'm confused right now, I added random int in range, what do I need to add more? A switch on int?
I cannot find the way to make it with switch on int really, I'm so lost
how to I switch on a random player? Cause I think I can make it if there would be a node like, switch on players who's connected, and with the random integer in range could switch to anyone and become infected
RandomIntInRange gives you an random integer, you use that integer to "select" an Player that has been designated as that number in the list of Players that are connected.
yeah I know
GameState holds an Array of PlayerStates, you could also use the GameMode to track incoming PlayerControllers
Oh
These both represent Players in the Server
You use that Random Integer to select one of those Players
PlayerArray->Get(RandomInteger)
Do I need to do like, Get game state>get player array ?
I dont know, its your code, try it out and see what happens.
This is what I did https://gyazo.com/e5f3439f6fa20b558c889b086528b151
I cannot find a player states with random int nor player array. Can you help please?
Ok mate seriously. This is easy stuff to google. You need to go back and watch some basic Youtube tutorials on working with Blueprint and get your fundamentals down.
uhhh, if you say so
is this a good start? https://gyazo.com/a41f5c4fe2a49066f25704e884dc40a4
Looks right to me
Only problem you have is, if you dont have 12 Players your going to get an Index Out of Range exception
I will setup a save file for the max player for sure, like, when I change the max player value it will save the value and I'll set the save to a variable and the variable will be the max player, hard to explain but I know the way.
Right now I'm trying to find a node to convert array to int or smth, is there a switch on array node that can exist? Just asking.
@fossil spoke Alright. I'm stuck since a long time, I searched for the solution but no help really, I really cannot find the way to make my thing, I don't know what to try anymore. I'm sooo confused and lost, if you could please help me or teach me cause I will never progress right now.
I've been using UE4 since 2 years
Are you an programmer or an Artist?
both, my game aren't really big nor I tried multiplayer. My game are just fnaf fan game
You need to go back and research the fundamentals of Blueprint and Programming in general. I cant hold your hand throughout the entire process. This is really simple stuff and the only way you will learn is if you apply yourself and do the research.
I dont have the time to tutor.
I did all research but I cannot find a way dude! I searched like; Choose a random player or get players connected or get player array random and such
If you could just please tell me which node I need to put really quick it would be so appreciate dude! Its depressing for me
@agile crane maybe you need to narrow your scope
If you can't isolate the pieces that you need to put into place at least at a foundational level
then you need to figure out why that is
my guess is you have a broad thought, don't know where to start, and jumped straight into Unreal with the first mechanic you could think of
and probably haven't put anything down on paper yet
uh. Maybe. Did not really understand what you mean tho
I mean you do not go into Unreal thinking "I'm going to make a Zombie survival horror MMO"
you will end up all over the place
maybe, but there are some stuff I don't understand that I need help with, duh
you need to narrow your scope down because then you will have more specific questions
like what?
Just look up on what I asked earlier
I see questions that are along the lines of "Which button do I push to make an infection game"..not to be harsh
like someone else is going to design this for you
no
I was asking which node I need to put
but I asked for the infection game type earlier
is it multiplayer?
i assume so
there is not a simple node to do what you are wanting to do I don't believe
it requires you to some how store which pawn class to spawn for each player
and then the Server should spawn these pawns where they should spawn and make the playercontrollers possess the correct Pawns
i BELIEVE this replicates, if not, you will be coding that too
how you do all of this is up to you
I know, I was just asking how can 2 random players out of 16 can spawn as an infected or just a different character
You can get all actors of class "PlayerController" from server
that should get you an array of all the PlayerControllers on server
and you pick 2 randoms, spawn their zombies or whatever, possess them and take them out of the array
then spawn all the others as their characters
off the top of my head
u probably do this from GameMode
if you have spawn points...you can get all of those to determine where to spawn ppl
sounds like what I wanted to do, but on array I cannot find a random node or anything that can switch from the character
oh okay
save random int as local variable
and use it for outputs
but should work
and should be Length-1 for max
Also
Random Integer In Range
probably even easier
sounds good
just right click in BP
turn context off
and type "Random Int" you find the same things
but what do I will need to use next? Switch on int?
so uh.
what
If you took that macro and modified it so it didn't have a bug, you could use that to randomly get anything from an array of that thing.
there is no next step
for getting a thing
There's a node already lol... "Random Integer In Range"
maybe didn't exist at the of that post
yeah it gets the array element i believe
its not like you can't use it because a subset of its nodes exists
ya
iunno good luck w/ him then
Its really hard, and so confusing to make that but with what you said I learned that you can put length for put random integer in range
we all come from different backgrounds in these things but imo you shouldn't try to make a game at all right now
you should follow the tutorials on youtube
Okay then..
good luck
thanks
can you replicate Actor spawn from Client -> Server or only Server -> Client
like if u spawn something on client (doesn't spawn on server) and then call Server_SpawnThing(ClientSpawnedActorRef)
what happens
does Server spawn something and then replication spawns another on Client?
clientspawnedactorref has no meaning on the server
it'll either be null or just a meaningless pointer
what youd rather wanna do if going down this route would be to spawn on client, tell server to spawn, wait for client to replicate, then intercept that replication and e.g. make it invisible or whatever, and just have it reference your client-only object
alternatively replace client-only object with the newly replicated one
that would be a "client authoritative" inventory so to speak?
I'm either going to go a route like that, or spawn a DummyItemVisual on client add...like a simulated Add
this thing pulses
and when same function is called on server, it actually adds item, which would replicate to client and tell inventory UI to re-build widgets
which would remove the dummy visual and replace it with real one
not sure which system is better....
essentially the Server is "holding" the items pending Release
client authoritative inventory sounds dangerous, since you could potentially let clients crash server
yeah
but doing 'client prediction', like ACharacter does for movement, is fine obviously
seems like that's a more difficult approach
in that my my inventory bags will have some sort of access time that is server auth'd
nothing crazy, just don't want a twitch inventory
so I have to show something to illustrate this to begin with
plus, I don't know how you would intercept Server replication and swap client and server item...seems like a lot of cleanup that isn't needed with this other approach
with same result to user
"Dragged item...item pulses for like half a second... item adds"
you might just want to let client alone handle access time here...
it could be hacked so client can access inventory immediately, but so it could with server auth as long as client actually has the inventory data
unless you put checks on moving/using objects(to see if inventory is open on server)
on client the item wasn't going to actually be added at all
FInventoryItemInfo was going to be put into a ItemsPendingDrop Array
so not actual item just the image/size data
this was going to generate a false Widget showing where Item is being added
while sending the request to server, which does all of the validation
right, but the client could still say he moved it to the server without opening inventory
yeah
but ItemsPendingDrop would be stored on the ItemContainerComponent
anyway brb, off to dinner
so it's active even when out of UI
If Anyone is available to answer a few questions for me on some basic stuff in UE4 multiplayer please DM me. I am trying to get going in the right direction to get replication learned and so forth to fix my multiplayer project.
I reckon you'll get both more eyes on the question and more help if you ask in here ๐
(plus, it might help others who see it)
i am using a seamless travel in my MP game, however, if the client manages to load the map before the host does none of the actors placed in the level are in sync, any ideas?
The Server shouldn't be able to load the map before the host o.o
Are you sure you are still connected properly?
yes, and late joiners have no problems
actors spawned in the level work ok as well, for all clients
That I haven't heard of yet, sorry
hey whats cheaper for a mmorpg, more peformance friendly. 1. Tree animated by Shader. 2. Tree baked animation...
Shader animation ?
But that's a strange request
You'll have millions of larger issues before you get to that
Why is my Server reliable function not calling from reference in UMG?
umg is client only
is itemcontainer a widget?
no that is a Component
thats ok
the Server function doesn't even call
does the server know that you own that component?
good question, how on earthw ould i know that
similar code works from a UObject I have
who created the component
Component needs to be Replicated and set on an Actor that the Client owns
UItemContainerComponent * OriginItemContainer)
{
if (CanAddAt(Item, CompartmentIndex, SubCompartmentIndex, SlotIndex)) {
if (IsValid(OriginItemContainer)) {
OriginItemContainer->Remove(Item);
}
TryAddAt(Item, CompartmentIndex, SubCompartmentIndex, SlotIndex);
}
}```
Otherwise Server RPCs are dropped
let me double check how the actors are setup
They're all setup like this:
and components are replicated
Now I'm not sure who owns these at this point lol
Server spawned them all
Ahh i never set an owner i dont think
Means if the Server spawns it, you need to give it the Controller of the CLient as owner
or i did but i didnt pay any attention to it
This is not a container that sits somewhere in the world that multiple people at the same time can loot or?
not at this point no
it's in a player inventory
if (GetOwner()->Destroy(true, true)) {
return Cast<AActor>(GetWorld()->SpawnActor<AInventoryItem>(InventoryItemClass, FVector(0.f, 0.f, 0.f), FRotator::ZeroRotator));
}
but yeah i didn't set any owner
this runs from server
Alright, cause you should always split your Inventory into "Inventory" and "Manager"
Where the Manager sits on the PlayerController and just gets "InventoryA" and "InventoryB" passed and performs the moving of items etc
and cant you set it to only relevant to owner?
So you can always go from UI to Server
i do have an InventoryControllerComponent
Cause owner can only be one person at a time and a chest/container that two people are working on would then break
but i think it's on the Character right now...need to move it to PlayerController
it just adds references to all of the Equipped Item's with ItemContainer components on them
for easier access
but I was going straight through the Container through the UI
makes sense
Yeah, if that container is on the Player, no problem
If it's on a chest that the Server or only one person at a time can own, you are f*cked
Cause then only one player at a time can own and work with it
You need a Manager class that you pass teh Container reference
this is a newly spawned Actor so can I set a different Owner?
so let me tell you the events that happen
You could do that on overlap with a collision or linetrace etc
all of these have ItemContainerComponents to make this simple
EquipItem_World is already present in the level
Player interacts with it...SERVER_TryEquip is called
Item_Equip is created and EquipItem_World is destroyed by server and it is equipped
so PIckup is similar to that
it is routed through server which calls some functions to convert it to an Inventory item basically
so if I understand what you are telling me
When the Server spawns this new item with and ItemContainer and equips it
the client doesn't own it or something?
and therefore can't work with it through UI?
and the SERVER rcp's on ItemContainer will be dropped
And this works because it is routing through possessed Character's "InventoryController" instead of directly with ItemContainers?
cant you test with getOwner?
Like this, it doesn't matter if it's on the Player or some actor
You always root your calls through the manager on the PlayerController that allows ServerRPCs
Given "Container" and "PlayerInventory" are the same base component class
@quartz vector
they are not same base class
my Containers are just "ItemContainerComponents" that I add to things
if it also has an EquipItemComponent it can be equipped
and when Equipped to the EquipmentManagerComponent...this event is broadcasted
and picked up by my InventoryControllerComponent
Hm, well you can always add different events to the manager
And handle the containers differently
But I would root it via PlayerController
so if the equipped item has an ItemContainerComponent...then InventoryController makes a reference to it
Easiest thing
so move my InventoryController to PlayerController
and then change the UI to work through there instead of directly with Items?
Server owns it
so that's only fine if you're interacting from the server
to the server owned thing
but UI is client?
Server owned Actors only work with Multicasts
Client and Server RPC don't work
Client not, as there is no owning client
And ServerRPC not, as the client needs to own the actor for that
didnt you read his bible or at least the first 12 pages after that it only repeats everthing until close to the end
@thin stratus hah.. got it working thanks to your help: https://youtu.be/D3462lZuVbo
I just need to get the delegates hooked back in to refresh it
thanks a ton i would have never figured that out on my own
I've got multiplayer set up with advanced sessions, I have a physics object in my world and it is different for each players, how would I fix this?
player*
You can try setting it to replicate movement
The session plugin shouldn't have anything to do with that
Hmm, how would I do that?
bReplicateMovment
Doesn't work :/
is there a standard term for a "Dummy" object that represents something else that will happen in future?
my Inventory Add is done in 2 steps: Client calls some Simulation of Add function that instead of adding the item to inventory, generates a DataObject with some basic data.
If this exists, it means the inventory is handling an item and cannot process other items
2nd: Server_AddItem function is called to perform actual item add
TransientPlaceholder 
this replicates inventory back to player after same duration timer
lol
I might actually use that
Not sure if there's a standard term, sorry.
TransientItemPlaceholder
Just so long as you have a field called PlaceholderName, you know, so you can name them.
rofl
TransientHandledItem maybe?
Now what would you call a function that is intended to be ran by the client on the client
dangit i blew it
before the SERVER_functions are run
because when i don't name things well I get shit in here
true
TransientFunctionToCreateTransientItemUntilServerRemoveIt() like this?
perfect
when i go to the object locatation as pawn 2 it teleports me somewhere random, but i'm standing on the object from pawn 1's view
any help?
I have replicate on and replicate movement
and the object shows up in different locations
is object supposed to be visible or do anything?
did you set replication for it?
yes
great what was it?
I had to add the object and set replication after multiplayer as set up
hey smart people, are custom functions auto replicated or nah?
i thought they were but clients arent applying impulse to a mesh along with the server.
How do you get the location of player 1 or player 2
hey guys. does anyone knows a way to tear off worlds? meaning disconnect but let client stay in world
?
was that question mark for me ? or Normercy or hexia?
Ellaborate
oh
so i want the server to leave
but client to stay in world after game
u know how TearOff() works for actor
i wonder if they can be done for entire world
It could (maybe) be done but I don't really see a real efficient way of going about it
Has anyone here used UDPEcho() to ping anything in ICMP.h before ? I would like to know if it is reliable or unreliable ?
Guys, how many objects can be replicated until it becomes too laggy? I know that the anwser depends on many things, but generally what's the range? 10, 100, 1000? (in your experience, of course)
As you said, depends on many things.
One object, if you have too much data in it
What you should check is how much bandwidth is fine to be used and the see what your actor would consume
It was actually more of a curiosity. I was thinking of Fortnite and was wondering how it worked there, with a hundred players and a big world
They improved the system quite a lot
There is a blog post about it
They push these updates with 4.19
Check the latest pinned message of this channel
@manic agate
@thin stratus thanks, I'll check it out!
Actually now I've got a "real" question. I've got a UObject derived class which is replicated and used in a replicated AActor. It works fine, but now I wanted the UObject class to replicate another UObject. Is that possible?
Don't think so
You always need an actor to drive the subobject replication afaik
But I'm not 100% sure
Can I serialize specified fields in UObject ? It worked good with just iteration over class fields and checking its metas but only with editor. If the only way is like write custom serialization method like MySerialize(FArchive& Ar) then what is the best way to specify blueprint fields in final BP classes ?
@thin stratus what if I put as owner of the new UObject the same Actor?
I mean, something like this:
Actor -> UObject1, with Actor as owner
UObject -> UObject2, with Actor as owner
Don't you need to actually specify the UObject in the Actors replication method?
Can't remember what the name is
The one where you place the DOREPLIFTIME macros in
My current approach in inventory replication is just writing all or partial slots of UObjects into FArchive with that custom serialization method and sending it through Client RPC as TArray<uint8>. I just need to control what is being replicated inside each item class
This is my actor, which overrides the ReplicateSubobjects() method that replicates the subobjects:
bool AUserPawn::ReplicateSubobjects(class UActorChannel *Channel, class FOutBunch *Bunch, FReplicationFlags *RepFlags)
{
bool wroteSomething = Super::ReplicateSubobjects(Channel, Bunch, RepFlags);
if(MyUObject1 != nullptr)
{
wroteSomething |= Channel->ReplicateSubobject(MyUObject1 , *Bunch, *RepFlags);
wroteSomething |= MyUObject1 ->ReplicateSubobjects(Channel, Bunch, RepFlags);
}
return wroteSomething;
}
Then in my UObject1 I manually added the ReplicateSubobjects() method (it doesn't override anything):
bool MyUObject1::ReplicateSubobjects(class UActorChannel *Channel, class FOutBunch *Bunch, FReplicationFlags *RepFlags)
{
// bool wroteSomething = Super::ReplicateSubobjects(Channel, Bunch, RepFlags);
bool wroteSomething = false;
if(MyUObject2 != nullptr)
{
wroteSomething |= Channel->ReplicateSubobject(MyUObject2, *Bunch, *RepFlags);
}
return wroteSomething;
}
I've tried and in the client the MyUObject2 isn't null anymore, yay!
This way I can replicate any UObjects from inside UObject1, and the owner Actor has no knowledge of this
(of course, I've omitted the parts where I do the DOREPLIFTIME macro thing)
That's right, I've misunderstood what you said ๐
@thin stratus I need your help once more. As far as you know, is it possible to call RPC functions from UObject derived classes which are replicated?
I'm trying right know with a Server RPC, but it always gets executed on the client
As far as I know, if there are problems then I should receive a message in the log telling me that the RPC is getting dropped, but here I don't get any messages and the functions is executed locally
You should try setting the owner of the UObject to the Player
if it still drops, then I'd say no
But I mean, you could place a ServerRPC in the Actor and just pass the Object along
Nop uobjects cant send rpcs
The owner is already the Player, but it doesn't matter. Also, I would like to not use the Actor itself for calling the RPC, otherwise I should place A LOT of functions in the Actor's code which are really not meant to be there
Atleat i have a big state system which based on uobject
I was not able to send rpc even if owner was playerpawn, controller or whatever
So i can confirm uobjects cant send rpcs
But uobjects can replicate subobjects, i do this in my system.. i saw you asked this
Thanks Amph. Have you find a workaround for calling RPC from your uobject?
Impossible to do that, because actors open actorchannel or rpc try to use owners actorchannel
Uobjects do not implement owners actually i think
They have only outers
cant you use a actor component that manages all rpcs for the uobject?
True, maybe just inheriting from UActorComponent would work in my case
Yup i do this too..
I have a manager component which handle rpcs
Actually im sure rpcs can be implemented to uobjects
Simple actor component inherit from uobject
Just you need figure out how epic implements networking interface
Ahhhaahha i found that... maybe
Uobject have a virtual function "callremotefunction"
I'm trying too to make it work on uobject
I just tried overriding "callremotefunction", with no luck
It never gets called!
shouldnt it be NetAddressable to do such stuff ?
I guess yes
Probably yes
anyway... Is anyone ever worked with reflection ?
@lean river you're right! I just tried pasting the implementation of those 2 functions from UActorComponent and it works (well kind of, it tells me that there is no owning connection for the UObject's outer, but it's a step forward). Going to launch and I'll keep trying later ๐
Doesn't it comes to reimplementing UActorComponent ?
Yeah, glad to see that :D
I tracked back how epic does this..
Now i clearly see epic using his VM to process rpcs.
When you call rpc that passed to virtual machine, vm do a callback and call those two functions
Your overrided function will pass to owners netdriver, netpack the rpc data
On process side repeat and call vm , overriden functions then call rpc function
Of course this is short theory :D
So every uobjects implements rpc functionality through the vm.. and using owner netchannel
Is Replicated property specifier only adds flag to the property or it also generates code ?
is there something different with SetOwner in 4.17? I dont understand why my actor is simulated proxy on client side, when client is the owner
Well i think that generate code of course..
If you look at datareplication.cpp there is lot of code which collect uproperties
How do you get the location of player 1 or player 2 seprately, in a multiplayer game? someone please help
is there a way to intercept replication of a property
Server changes inventory... inventory structure replicates to client
How can client know when this happens
RepNotify?
repnotify?
Repnotify!
gee it's right there in the name lol
so if not running dedicated server
will that still work?
so have to code a special case for it then
I mean will works on connected clients
since if Client is Authority it doesn't need to rep notify
it just handles itself i guess
Like a purely MP game that features an "Offline" mode for testing/exploration
But listen server will not call repnotify
with nothing saved
guess I can sort that out later...it's really a "simple" thing I am trying to do
Client runs its own TryAdd and calls Server_TryAdd
So for example if you want update ui from repnotify or after repnotify you should check for standalone and listen server netmode after you changed inventory and call repnotifyy manually
@quartz vector yeah what Amph just said- calling the repnotify function manually only on the listen server after changing the repnotify property will mean it gets called everywhere.
is it not possible to pass parameters through OnRep function?
why ? At the time when OnRep called your property must be already updated
Otherwise its more like RPC
i just need to pass a value
let me see if i can add some comments in code to explain better
TransientHandledItem = NewObject<UTransientHandledItem>(this, UTransientHandledItem::StaticClass());
TransientHandledItem->InitProperties(ItemInfo, CompartmentIndex, SubCompartmentIndex, SlotIndex);
FTimerDelegate TimerDel;
TimerDel.BindUFunction(this, FName("ClearTransientHandledItem"));
GetWorld()->GetTimerManager().SetTimer(ClearTransientItemTimerHandle, TimerDel, 1.f, false);
return true;
}
}
return false;
}
void UInventoryControllerComponent::ClearTransientHandledItem(/*Called on timer*/)
{
OnRep_ClearTransientHandledItem();
}
void UInventoryControllerComponent::OnRep_ClearTransientHandledItem(/*Need SlotType to Broadcast*/)
{
if (GetOwner()->HasAuthority())
GEngine->AddOnScreenDebugMessage(-1, 3.f, FColor::Green, "Called On Server: " + bHandlingItem ? "True" : "False");
else
GEngine->AddOnScreenDebugMessage(-1, 3.f, FColor::Green, "Called On Client" + bHandlingItem ? "True" : "False");
if (bHandlingItem) {
bHandlingItem = false;
TransientHandledItem = nullptr;
OnContentChangeDelegate.Broadcast(/*Needs to pass enum SlotType*/); //UI binds to this to update the container in correct "Slot"
}
}```
bHandlingItem is ReplicatedUsing=OnRep_ClearTransientHandledItem ... i don't even know if i have this setup properly tbh
all I need to do is clear the UTransientHandledItem pointer on both client and server
and then broadcast to client what essentially is "Contents in this SlotType have been changed...redraw UI"
oh
The function where bHandlingItem is set to "true" and TransientHandledItem are spawned has signature with "SlotType" already
bool UInventoryControllerComponent::TryAddItemAt(AActor * Item, const EEquipmentType SlotType, const int32 CompartmentIndex, const int32 SubCompartmentIndex, const int32 SlotIndex)
so is it not possible to pass this value through my RepNotify?
I think no, I guess you should either replicate that value through another variable or use RPC
seems like proper inventory system is some kind of global pain
it's just a side thing im trying to add for quality purposes really
Server authenticated Inventory can feel unresponsive
if your handled item is replicated then you can just replicate is variable
@quartz vector you cant pass variable to onrep functions
so I spawn a placeholder thing that is responsive to client that shows it's being done
or also simply have dedicated slot for currently handled item
UObjects can't replicate from UActorComponent iirc
straightforward because uactorcomponent also using owners netchannel aka actor or pawn
AActor can replicate subobjects
but you can serialize stuff into FMemoryWriter and send through RPC as TArray<uint8>
then deserialize at clientside
could I do this same thing by calling a Client RPC?
and just replicating bHandlingItem
yes
ok let me try that...don't think I need repnotify here
also...how do you get the ping of a client
it is in playerstate
basically my Inventory has like a .250s artificial delay and I would like to cut half of the players ping off of that
if someone is lagging more than that then they just receive the actual update slower and their inventory is not as responsive
lol, inventory with lag compensation
@quartz vector You should always show local data to the player directly, without waiting for the server's answer
would even cooler if you move all items in past slots and check if player hit correct slot with cursor like real lag compensation is done in shooters
Sure
i COULD let client move the item if it's legal on client
but i would then need to do something when server updates it
Well yeah
dam, I have correctly working inventory with all the stuff and I really like it
You need to do exactly that
but it only works in editor
that is probably what I will do in the end
No one ever wants to have lag in an inventory, that just screams poor quality
but right now I'm trying to get the UI to update this properly
like if you take a magazine out of backpack to reload, there is a mechanical delay for items being taken out
because there are "bags" that are intended to be used for this
and reloading out of Backpack is slower....also want to reduce some of the "twitch" inventory because being in inventory is risky
@bitter oriole rust has that mechanics where you either move items by mouse between two slots instantly or rightclick to move into inventory directly and it moves with small delay
but rearranging a backpack just internal contents...i agree, that needs to be responsive
@lost fulcrum lot of game have small delay with inventory operations, did you ever played with wow on us server from europe? ๐
I still have to spawn a placeholder for client regardless, because as soon as Server destroys and swaps out items that it owns, it will replicate that to client which destroys the items
sometimes 1 sec was the validation and the result
lol, no
many inventorys i have seen online are purely server authoritative so if your ping is low it's fine
but if you get a lag spike
things start having delays
why not redo the ui each time it changes and remove all transits?
Really, no one wants any local option to wait for a server response. That basically breaks immersion completely
It's really annoying and visible
It also opens up people to hack
It absolutely doesn't
oh wait ur right
You may ignore ping actually, just predict server actions and everything will be okay
Server is still spawning the items at the end of the day
and then replicating inventory
what client side does is purely visual
The fix here is to do what everyone has done for decades : when you do a local action, do it locally, tell the server. The server validates it, and sends an update to every client
If the server tells something different, reset the client to that
that's what im doing lol...it's just not setup that way yet
I am coding a mechanical delay based on the item container so i can use it later
it won't delay 99% of inventory movement
I'm just trying to get that piece in right now before I add the Client side of Adding inventory items back in
for my implementation is kinda simple like
void InventoryInterface::SwapSlots(int SlotA, int SlotB)
{
Inventory->SwapSlots(SlotA, SlotB);
ServerSwapSlots(SlotA, SlotB);
}
ServerSwapSlots is just an RPC that requests same SwapSlots from inventory at serverside
I wish my inventory items were simple enough to just use structs
but you can have Backpacks inside Backpacks inside Backpacks etc...
that would be terrible to not have methods bound to items
lal my implementation also simple
E_InventoryReturnCode UInventorySystemComponent::TrySwapItems(int32 fromSlot, int32 fromQuantity, E_Inventory fromInventoryType, int32 toSlot, E_Inventory toInventoryType)
{
FInventoryArrayData fromItem = SavedDraggedItem.ToInventoryData();
FInventoryArrayData toItem = GetActiveInventoryAsCopy(toInventoryType)[toSlot];
// Check Quantity
if (fromItem.Quantity < fromQuantity)
{
UE_LOG(OGW, Warning, TEXT("ANTIHACK: Tried to moved more quantity as player have! PlayerName:%s "), *GetOwner()->GetName());
return E_InventoryReturnCode::ER_HackMoreQuantity;
}
E_InventoryReturnCode stackAddreturn = TryAddStack(fromItem, toSlot, toInventoryType);
if (stackAddreturn == E_InventoryReturnCode::ER_SuccesfullyStacked)
{
SavedDraggedItem.Invalidate();
return E_InventoryReturnCode::ER_SuccesfullAdd;
}
return E_InventoryReturnCode::ER_None;
}
oops
@quartz vector We've had that discussion before, and you definitely can/should use simple structs for data, not actors, but well, there's no telling you that
you cannot use Structs for that until Unreal lets you have recursive structs
There are many ways to go around that
you would need FStruct Item with uproperty TArray<Item>
Also you can do that
how?
you cannot do that
USTRUCTS do not support recursion of UPROPERTY like that
ohm
Maybe not, but you can definitely have a TArray of FStruct*, which is basically the same thing
but why you need recursion?
yup
Hello guys! ๐
what?
sigh
nope
Anyway, i'm out of that conversation
go create a UObject on server
@quartz vector
you do not get a replicated UObject on client
my inventory system is jigsaw multi sized inventory system
There is just no teaching him
im using lightweight struct for ordering and placing
I wanted your advice on a little thing here
and i have an uobject backend
AActor is first subclass of UObject that implements replication
for every item
you CAN replicate UObject from an AActor
which need special implementation
nop
thats false
you can replicate uobject from actorcomponent too
i couldn't get it to work
then i maybe hacked the engine but for me works
because ActorComponent doesn't have ReplicateSubobjects function
Components need to be tied to an actor to replicate, though
So at the end of the day, it's really still replicating it from an actor
That guy spouts off 24/7 about "You can do recursive structs" never once links any actual article ora nything about it
thats true @brittle sinew .. actually everything replicates through the pawn and local player ๐ mostly
@quartz vector I can link you to my production game's code
"You can replicate UObject just fine"....anything your ead about it will tell you "Caveat is that the replicated UObject has to be on an AActor"
What's the problem with putting it on an Actor ?
you mean like an ActorComponent?
Your inventory isn't tied to a player ?
nope
A PlayerController / Pawn ?
I mean, you're shooting yourself in the foot at every turn
PlayerController has an InventoryController
Are items in your inventory just replicate to all players or only to player which currently interacting with it ?
It's like you're trying to make this more complicated tha, it has to be
@quartz vector you wanna try to do lootcontainers like this? https://youtu.be/0B18vc4Y02U?t=40
How exactly do you Replicate UObjects that are in an ActorComponent
when ActorComponent doesn't have ReplicateSubobjects function
since that is on AActor
hell even Epic themself
use Actors
for inventory things
I'm actually fairly sure my game has overall much more nested data than yours, @quartz vector . Our game data is pretty massive, with dozens of companies storing hundreds of ships storing dozens of cargo slots storing thousands of resources.
Nesting 5 different structs
is not the same as recursively nesting 1 struct
which again, is not supported by reflection
You don't need it
But like I said, there is no teaching you
Please continue what you're doing
I don't care how many levels of nested data you have
if you're not recursively nesting
having 1000 containers that hold resources
is not the sam ething as having 1000 containers each of which that can hold 1000 of the same container
do you have ships that can hold ships that can hold ships .... n
I need to make a separate client for steam that uses a different AppID
We could, if it made any sense
and again
There is zero complexity here
1, 2 or 500000 is the same code
and FChildShip holds what?
FChildShip has to be declared before FParentShip to be usable as property
We have a FShip storing a TArray<FShip*>
It's called forward declaration
C++ 101
yep i tried this last i checked it doesn't work
but i will try it again because I will admit that maybe I am wrong
Because you didn't use a pointer, I guess.
when I use pointer compiler throws an error
You can also have an ID system, and store a TArray of IDs
Which is something we also do extensively
You just need a getShipFromID() method
And voila, you can have flat structures representing infinitely recursed storage
With linear iteration cost
FName does that for you, with close to the performance of pointers
Like I said, you have 50 different ways of handling that
For example, we have "item descriptions" that have a unique named ID, like "spacecraft-typeX", and we store that identifier in game saves, and some structures.
On a network we'd only replicate the identifier
You end up with a flat array of structs that hold FNames
Doesn't get any simpler
Question: When setting up a teleport system (open level, or teleporting) how do I tag the event so it only effects the person entering it and not the rest of the server?
here is the error:
error : Inappropriate '*' on variable of type 'FItemSlot', cannot have an exposed pointer to this type.
struct FItemSlot
{
GENERATED_BODY()
UPROPERTY(BlueprintReadWrite)
AActor* Item;
UPROPERTY()
TArray<FItemSlot*> Slots;
FItemSlot() {
Item = nullptr;
}
};```
from doing that
remove pointer: error : 'Struct recursion via arrays is unsupported for properties.
Would I check the "Only Relevant to Owner" box?
@bitter oriole see above. And yes I do the same thing with an Enum and TMap in a DataAsset
and or the "Net Use Owner Relevant"
@quartz vector How about TArray<struct FItemSlot*> Slots ?
89): error : Inappropriate '*' on variable of type 'FItemSlot', cannot have an exposed pointer to this type.