#multiplayer
1 messages · Page 387 of 1
CryEngine
Snowdrop is an Ubisoft engine.
i have CE installed lol
i dont believe it uses nodes
yea but that was the amazon one wasnt it
Yes
I mean like the fork that they did since Far Cry 2
Its still an CE fork though
is Snowdrop not available to the public?
No
Well i was just saying, it also has node scripting
Fair enough haha
so my best bet is probably Unity
CE also isnt completely open to all game styles is it?
could a large mmorpg be made with CE
I think usually MMOs are built up from scratch
because they DO need some sorta custom infrastructure
and that's easier if you build the engine from the ground up to be suited for mmos
a company hasnt built one yet with that in mind?
not that I know of really
companies that build MMOs can usually just do that by themselves
I don't think it's exactly trivial to do
you could prolly do some research on it
so my best bet isnt to veer away from UE4, but rather mmos..
an mmo isnt hard to make, its hard to manage the players i guess :\
well I wouldnt attempt those on your own and without coding experience tbh
handling large amounts of players alone isnt a trivial task
i do have coding experience, its just been quite a few years since i last wrote anything. but i learn very quickly for the most part
in the last two years ive learned several hard and organic modeling programs, various painting programs, a few world gen programs and how to make them all game relevant. so i've learned a lot fairly quickly. i just need to spend time researching on mmos and how they are made. in the long run i just want a game where players can make progress and show it off and work together to achieve things.
maybe do a coop sorta game where you can invite other players into your world
if that can be achieved in unreal engine by splitting up players or something somwhow then ill do that. otherwise i think i have to find a new interest in game genres to do on my owen
rather than a "true" mmo
own*
like what you want sounds alot like dark souls kinda
well i was considering that, but how do i stop cheating that way :\
i honestly want to remake a mobile game like Durango but not prehistoric
but that means you need server infrastructure again
but not necessarily a complex consistent world
just something to host coop sessions on
and maybe a few lobby servers
where players can interact and screw around in
but its limited to a very managable area
and is essentially a glorified server browser
tl;dr try to scale down your expectations to something more managable with what you got to work with
and anti-cheat can still be possible with a listen-server sorta thing
just requires that all your clients do consistency checking all at once
could be a bit finicky
im going to give you a message, youve been very helpful. maybe somehow i can make this work. otherwise its back to the drawing boards.
need a bit of help, int32 AZHordeGameMode::GetTotalPlayersInGame() { int playerCount = 0; AZGameState* GState = Cast<AZGameState>(GameState); if (GState) { for (APlayerState* cont : GState->PlayerArray) { playerCount++; } } return playerCount; } should return the amount of players in the game, problem is, when the game first loads up, it returns 1, regardless if 2 or more people are playing. Is there a way to wait till all players are ready?
ill change that to int32, just noticed that
well this is a pure function right?
should be a matter of calling it in the right place
or modifying whatever condition is using this
yeah, this is where i am calling it
{
StartMatch();
}``` inside a timer which runs in a timer GetWorldTimerManager().SetTimer(TimerHandle_DefaultTimer, this, &AZHordeGameMode::DefaultTimer, GetWorldSettings()->GetEffectiveTimeDilation(), true);
i thought that MatchState::WaitingToStart is when all clients have connected?
How does a dedicated server create a session without a PC?
IF it creates its own session, why do clients not find it? (Works fine if a client creates a session, another can find and join)
you run it as a server
and connect the clients on the port the server is running on
or you on about PlayerController?
Dedicated server option is running a few things for you. Normally you’d run the dedicated server yourself on your machine or a host, and other clients would connect to it via IP:PORT
Well its screwing everything up. Its not real world use case. and therefore useless for development.
It is still real world use case.
You can run the server constantly instead of a listen host..
A listen host(alternate option to dedicated) has the first player as the host
Sure, but since the built in dedicated option, ignore the dedicated map option, and automatically connects clients :
It loads the wrong map and then steals my clients!
Therefore if he loses connection, all players lose connection. On dedicated. It could be 0 players and the server would still be running
The map loads based on your map settings in your project settings
hahahahahahah!
You have to setup your server map
Have you tested this?
That’s how a dedicated server works. It is it’s own player without input.
I know how it SUPPOSED to work
I'm telling you, in editor, thats not HOW it works
the dedicated server in the PIE options?
Yeah, no, it'll open the map you're on.
Run in standalone with a dedicated server running and it’ll work.
If you really need the most realistic thing you'll have to spawn separate processes and then set the net simulate stuff
I have Use Single Process turned off
What is this net simulate stuff you speak of?
ping me I'll bbl
Can anyone point me in the direction of some blueprint examples or projects with good multiplayer practices? Kinda been figuring things out as I go and I'm sure I'm doing many things wrong
Don't be so sure of that. unreal has a nasty habit of doing weird shit
What works in editor, breaks in packaged games.
What SHOULD work in editor doesn't work, but works in packaged games..
However, for general networking stuff, look at the pinned stuff, top right
Askori you can ask me some questions I’m relatively new to understanding multiplayer. I’m starting to understand the majority of it now
Majority of how it works *
I also have a question for anyone in here a bit more experienced
Is it possible to host a listenserver and allow players to connect and play (obviously), but then allow certain players (on a list, not the hard part) to also save map changes and allow any of those players to become the listen host at any time to pick up progress without the original host (cheating isn’t a concern)
What number should i be assigning to the player controller index when I want to have them join the game? Right now the hosting player is spawning in perfectly fine but when i click join from the 2nd client it just spawns below the map with no controls or anything like this- https://gyazo.com/2e413f3d2eda4df9757b082d8aef4b27 - But it should look like this (the way the host spawns)- https://gyazo.com/d8b729087454f6e2f2f3405a749bae5f
Here are the blueprints that involve mp ( Gamemode https://gyazo.com/e76e3e3f7bf7b4efb7d8093971ed4a11 ) ( Join Button https://gyazo.com/cdecad57da1175caa62bb847339d9e8e ) (To display join buttons on menu https://gyazo.com/defd60da9704524f389225e78a80ced0 )
Mp doesn’t use player index for controllers actually
That’s only for splitscreen local play
You’ll want to use get instigator or get controller and cast to player controller
how do i differentiate between players and spawn them properly?
They will spawn on their own clients. Are you trying to choose where they are spawned?
Or does it not matter?
Each one would spawn based on joining properties (teams, etc) and spawn based on that
Im trying to choose where they spawn based on player starts that ive placed in the level and tagged
when the game spawns they are put in an array and foreach loop that spawns players (whether or not any players have joined)
I feel like theres got to be a much better way to do it
well normally like i said, youd simply choose a "tag" before joining and in your begin play set coordinates to a matching tag
broken
Hey, this code is part of a function called PlayImpactEffects, on a projectile gun I'm calling it on the server (there it doesn't result in a crash) then replicating it using an OnRep variable, and calliing PlayImpactEffects on the OnRep function, but for some reason these If checks result in a crash when I call PlayImpactEffects from the OnRep function. I even commented the code inside the If checks, so I seriously don't get what's crashing it
If a dedicated server does not have a PC, then how does it destroy or create sessions?
A Dedi Server is the session.
Okay, here we go treating me like the idiot, and not assuming UE editor is just horrible
?
Then how comes clients cannot find sessions on a dedicated server?
alrgiht so
i have net relevancy on characters
and on my itembase/just a static mesh actor thing
when i get out of range characters disappear
why teh fuck doesn't the static mesh
!!!!!!!!
UE4 has many ways in which it is horrible, but that doesn't mean I don't find some way to embarrass myself using it on a daily basis
what do you mean PC
sure, but this ties into using the built in PIE dedicated server, I would hope everyone here knows its got quirks
what do you mean PC
what do you mean PC
PlayerController
To test dedicated sessions, you need to host a standalone dedicated server, and standalone clients and then find session
ah okay gotchya
to test properly *
im pretty sure whe nyou compile a dedicated server it does the setup differently and doesn't require a player controller
basically the session IS the file
this is 100% a guess though
the dedicated server does have a controller i believe, but no input. i could be wrong. its either that, or no controller
pierce do you have a link for testing post compile
like i just wanna get how to connect to a server via the packaged game and stuf
im typing like a retard today holy shit
id suggest for now just using non-dedicated
itll load up a server client and regular client
then you can test sessions, then host dedicated later
@sharp spire dude you are starting to piss me off.
wut why
ive been building around just dedicated though
so there's a ton of bugs for a server that is also a client
can someone tell me why my actor won't hide it self when it's dormant
Because you don't know what the hell your talking about, giving advice around here that is flat out wrong
Pierce
and if you tell me to use stand alone one more time, im going to gladly take an infraction
jesus christ stop filling the chat with edginess
It didn't work the first time, and it sure didnt work again (tried it, just for you, just now, so I could be sure I didnt need to eat my words)
Does anyone know the answer to my issue?
right after i wrote, "i could be wrong and it has no controller"
Fair
Hey, this code is part of a function called PlayImpactEffects, on a projectile gun I'm calling it on the server (there it doesn't result in a crash) then replicating it using an OnRep variable, and calliing PlayImpactEffects on the OnRep function, but for some reason these If checks result in a crash when I call PlayImpactEffects from the OnRep function. I even commented the code inside the If checks, so I seriously don't get what's crashing it(edited)
https://pastebin.com/6yNNKj0z
I've been stuck with this for a few hours. It doesn't make any sense
looking now
uhhh this is just like
I don't have an answer, but have you tried stepping through it in a debugger?
im here because i have questions. if someone posts something and nobody talks because they dont care to answer, ill share what i have to say. looks like this isnt a discussion anymore. ill just post questions.
How can these IFs checks result in a crash?
well like
you said it crashes?
Yes
And there's nothing else, at all in your OnRep
UE_LOG
I've added the logging after
UE_LOG crashing would be cause for concern
try changing the ifs to true?
just to ensure it's actually the variables being called by the ifs or not
I'm guessing one of two things, the more likely is something else in your OnRep being called
^ ye
That's the part that's crashing it
Cause the other is that your object is null when called
if you mark them as true, you know it's related to the variables
I've looked at the crash logs
well like
Post your entire OnRep?
it might be what the variables are being set to
Soren its a check that it isn't literally nullptr
so try just changing them to true so it runs the code without even checking the variables
and the UE_LOG doesn't actually deference it
So either the object is null or its something else
That's what causing the crashes, If I comment it, it doesn't crash
here is the crash log:
i never said ue_log is deferencing it
[2018.04.15-03.44.49:635][834]LogWindows: Error: [Callstack] 0x00000000AF306626 UE4Editor-MicroVoltsClone.dll!AGun::PlayImpactEffects() [f:\epic games\projects\tpsgame\source\microvoltsclone\private\gun\gun.cpp:138]
[2018.04.15-03.44.49:635][834]LogWindows: Error: [Callstack] 0x00000000AF30D735 UE4Editor-MicroVoltsClone.dll!AProjectile::OnRep_Exploded() [f:\epic games\projects\tpsgame\source\microvoltsclone\private\gun\projectile.cpp:99]
this->DefaultImpactSound will crash if the this is null
@misty stirrup change what to true?
just humour me and change defaultimpactsound, defaultimpactfx, and defaultbulletdecal to true
and yeah we'll need the onrep function too to actually get down to the problem
cuz this isnt enough info w/ the code snippet to find it
It's just a linetrace that passes a FHitResult to play impact effects
it's not the issue
What do you mean by changing it to true? Like the if check?
okay then print defaultimpactsound, defaultimpactfx, and defaultbulletdecal
this seems like a multiplayer issue, but only because of the OnRep
or i guess UE_LOG it
like its 100% defaultimpactsound, defaultimpactfx, and defaultbulletdecal, so however you're setting those is janky
It's not the UE_LOG, like I said I only added those to check what the problem is
I'm setting them in blueprints
This crash doesn't make any sense, because I'm not even doing anything
just checking
?
they start as null in c++
ok so
C++ runs first
THEN blueprints
so at the moent that's called
they're nothing
meaning it crashes
you need to set them to something before blueprints
Still doesnt make any sense, I'll explain
- They are EditAnywhere values, so I just change them there instead of doing that in C++
It works just fine everywhere else. On LineTrace guns, and on the Projectile guns as well, but when I'm calling it from the server
- Even if they are null (and they are not), that's what I am checking... why would it crash?
okay so like
im still pretty sure
on the server side
the variables are blank somehow
im prob wrong
who knows
Even if they are, why would it crash?
oh shit okay
This just seems like a really weird bug
i got you now
check if it crashes via blueprint nodes with a similar setup
(hint, this is nullptr)
The thing is that I'm also calling that PlayImpactEffects on an OnRep function in LineTrace guns, and it works just fine
Why you got a nullptr UObject that has its OnRep called @twin juniper
That's fucking weird, don't do that
What do you mean?
that's the only thing it can be, if you've shared your entire OnRep function with us
yeah like you seriously just need to send the onrep function so we can actually look at the full thing
otherwise you're just rubberducking us
If you want outside coder help, PLEASE give us the fucking function
i would still like to see it
I'll, I just don't get why it matters
i dont care if its a fucking single line of code it's nice to know wthe full picture
I'm NOT gonna play guesswork backseat coder
like without the function we're literally guessing
GetWorld()->LineTraceSingleByChannel(Impact, StartTrace, EndTrace, ECC_Visibility, TraceParams);
Gun->PlayImpactEffects(Impact);
That's not why it's crashing tho
I've the logs
Once I comment these IFs checks it stops crashing
that's the onrep function
maybe like
sanity check from default impactsound and default bulletdecal
somehow
like
make sure the actor exists before you run it?
see if that helps at all
So if the if statement isn't there, you don't get a crash?
Which actor?
self
Yes
i know it sounds really stupid
what even
which is why it doesn't even make sense
how does it even crash
so you know how OnRep is a member function?
Self where? on the on rep or play impact effects?
the only way if (ptr) can crash is if the implicit this is actually NULL or an access error
this->ptr
which is why I'm so skeptical that its actually crashing on if (ptr)
no
Print what tho? their name?
🍿
@severe widget It does tho
The weird thing is, I'm calling the same function
once the projectile hits something
and it doesn't crash there
only when calling it from OnRep
can u post full playimpacteffects
alright I'm willing to admit there's some shenanigans going on here that I don't know about... but without the greater context, I'm stumped.
Best of luck, I'm off to crash a f5e
I'm going to try logging the name in a sec, but is there any chance it's some kind of an engine bug?
Like everything else but those IFs checks are commented out right now, and it's still crashing
if you can't find very specifically
what's causing the engine bug
it'll be hard to write it as a bugreport
so it's best to figure out what it is to report it anyways
Yeah I'm aware of that
i personalyl dont think its an engine bug
because like replication is pretty specific in what you're required to send over etc
Here, commented it out and it won't crash
@misty stirrup I'm not even sure it's replication, I honestly don't know what's going on in there
im pretty sure it has to do with like
the vector location of the decal
or whatever
that's why i keep asking for the FULL function not snippets
like
im guessing the trace is done on server
or client
That's not just the decal
like
Post what? I already did
lol
you wanted the OnRep
you posted like
the trace
and not the start of the function name
etc
and the closing of the function
@Itsco#6231 wheb you ask for help please provide full code examples. You really are making this difficult.
@misty stirrup I didn't think this would be useful, the other part is just setting up these StartLoc and EndLoc for the linetrace
i have literally no idea what your decal function does
What may seem irrelevant to you could be part of the problem. Use pastebin and post the entire function
or what these variables are used for
you explaining what you WANT it to do won't get it fixed
@misty stirrup What does it have to do with Decal function? I don't even have one lol
or whatever the fuck this thing does man
it'll let us use proper language for it too
because i have no idea what you're doing with this code, and having the code will help understand how to talk about this variables, hlep find what is causing them to act this way, etc
n the onrep
I've sent it already
GetWorld()->LineTraceSingleByChannel(Impact, StartTrace, EndTrace, ECC_Visibility, TraceParams);
Gun->PlayImpactEffects(Impact);
and the header file
that's NOT THE FUALSDfcalscaocadspfa
full code
from start of function to end
including the ue4 macros u might need to set up the onrep function
FVector Dir = GetActorForwardVector();
const FVector StartTrace = GetActorLocation() - Dir;
const FVector EndTrace = GetActorLocation() + Dir;
FCollisionQueryParams TraceParams;
TraceParams.bTraceComplex = true;
FHitResult Impact;
GetWorld()->LineTraceSingleByChannel(Impact, StartTrace, EndTrace, ECC_Visibility, TraceParams);
Gun->PlayImpactEffects(Impact);
UPROPERTY(ReplicatedUsing = OnRep_Exploded)
bool bDidExplode;
UFUNCTION()
void OnRep_Exploded();
I can remove the if check, and just set ImpactSound = DefaultImpactSound
ImpactFX = DefaultImpactFX
but it will crash
For unknown reason the DefaultImpactSound, DefaultImpactFX are null when calling PlayImpactEffects from OnRep
but that's why I added the IF check
So why in the world does it crash when all I'm doing is an IF check?
did you ever get around to printing the variables
Forget it, hold on
idk if ue4_log does the server: 'print stuf here' client: 'stuff u printed here'
You see now why I said the other code won't help
it is helping
because it's widdling it down
adn you didn't actually give me the full header
you gave me another snippet
lol
and the header file
from the header file......
ok i give up
It's crashing just printing the names
I said it's crashing only when called from OnRep
the function also gets called when the bullet hits something
which happens on the server
and works just fine
What I think is happening is that for some unknown reason, DefaultImpactSound, DefaultBulletFX and DefaultBulletDecal are null when called from OnRep
That's weird by itself, but it's getting more weird when I'M TRYING TO CHECK IF THESE POINTERS ARE NULL and that causes it to crash
UE4Editor_MicroVoltsClone_2695!AGun::PlayImpactEffects() [f:\epic games\projects\tpsgame\source\microvoltsclone\private\gun\gun.cpp:139]
UE4Editor_MicroVoltsClone_2695!AProjectile::OnHit() [f:\epic games\projects\tpsgame\source\microvoltsclone\private\gun\projectile.cpp:72]
UE4Editor_MicroVoltsClone_2695!AProjectile::execOnHit() [f:\epic games\projects\tpsgame\source\microvoltsclone\public\gun\projectile.h:17]
execOnHit is new
make a variable
okay so
make 3 new variables
set those 3 new variables in the beginplay to the defaultvariables you have
then call those new variables one at a time
Call them where?
print in BeginPlay?
no like
set it up in beginplay
whatever the c++ equiviliant to begin play is
i still think im correct about the fact you're calling an onrep in c++ for variable that is set in blueprint
What do you mean?
okay like
it's not related
did you do the thing
like i dont know how to explain this
basically onrep can't point at null shit
like
it's pointing at something
im 100% sure without having to look at the code
basically
like
you can't send null shit upstream
so sanity check it
it is though
yes
sanity check it
which is an unexplained issue
sanity check it
if it STILL crashes after filtering out the null stuff
before you call the sound function
like
sanity check by setting it to a non-blueprint variable like i was saying
in beginplay
How is it related? These variables are setup through the editor to prevent hard-coding these values in C++, they get setup long before the projectile hits something
And also, it works just fine
when it's called anywhere else
I'm calling PlayImpactEffects from a lot of other places
these variables in C++
and it all work fine
the goal is to
okay so
like
set the defaultvariable to the newvariable that is not blueprint editable anywhere
I understand Soren, what I'm saying is that the reason I'm doing it is to not hard-code these values
and it's unrelated
you're not hard coding them though
just do the thing
if it works after doing this thing
its 100% either a bug
or like i was saying you're having this thing in blueprint that's set on the scripting layer
I don't mind doing it, I'm opening the editor since my PC crash
thats then called in C++
I'm saying, that's it's unrelated
and ue4 doesnt like that
like ive done something like this before regarding something else
and i totally get its different
But it's working eveywhere else
It even get's called on a different OnRep function
on LineTrace guns
and it works fine from there
it's just another LineTrace
huh
and then I call PlayImpactEffects
did you ever send the full header
i
you're so frustrating
if it's working in one area
in a different onrep
and its not working in this onrep
Thanks for your help dude, but the other code just got nothing to do with it
there's obviously something different in the header
im asking for the header dude
where you define the onrep
I've sent you everything that's related from the header dude
onreps
I've sent it, I'll resend it
UPROPERTY(ReplicatedUsing = OnRep_DidExplode)
bool bDidExplode;
UFUNCTION()
void OnRep_DidExplode();
is dis a bad time to ask about networked player movement 😇
void AProjectile::OnHit(const FHitResult& Impact)
{
TraceFXComponent->Deactivate();
ProjectileMesh->SetVisibility(false);
if (Gun)
{
Gun->PlayImpactEffects(Impact);
}
if (Role == ROLE_Authority)
{
bDidExplode = true;
}
ProjectileMovementComponent->StopMovementImmediately();
SetLifeSpan(1.f);
}
Here is another place I'm calling it
works just fine
that's also where I change bDidExplode
yeah okay
just add the sanity check for gun
into ur othre code
snipper
and i bet it'll work
It won't, but sure give me a second
i understand that its important for the authoritative server to handle as many things as possible to make it harder to cheat..
does this mean i should be moving players from the server? like if a client presses W to move forwards, should it be asking the server to move the player character forwards?
ive read so much on this but i dont think im really grasping it
uhhhh
gotcha. thats what i was wondering.
thanks guys and good luck with whatever youre dealing with
@misty stirrup crashed
told you it's unrealted
Something really weird is going on there
never sent me the header for onhit
this is why
i asked
for the full header
like 8 times now
i keep h aving to ask for shit
lol
so that isn't another onrep?
that's not crashing it
this is why
i keep asking for a header
do you not udnerstand how much time we've wasted
OnHit is calling PlayImpactEffects, but it's only doing so for the server
just from me not being able to see the header
@misty stirrup Dude, I've sent you everything in the header that's related
the other part is useless
it's too long
there is no point making you go through hunders line of codes
Right, so that's why I sent what you need to know
and feel comfortable with the fact
that you did indeed send me the full thing
so i dont feel like there's anything left out
and i dont have to go
'hey
There isn't
is there another function i dont see here?'
we just spent one minute exchanging if there's another function that might be replicated
but hey
if you sent me a header
that'd be 5 seconds in my head
and it's also calling PlayImpactEffect, only that in that case it doesn't crash
you're basically making me use the language part of my brain to ask you a question i'd know the answer to instantly if i just had the full header
I'm also calling PlayImpactEffects for the LineTrace gun, for the client but I'm also calling it there from an OnRep function
which works just fine
okay well
@misty stirrup Listen, I'm thankful for your help, but if you don't want to listen to me it's pointless since you are just wasting your time
where did you do it
what is an actor?
or the C++ instance
see if i had the header
i'd know if this was an actor or not
an actor is like
the 3d object in engine
like the character is an actor
an item in the game world is an actor
I know what is an actor
a light is an actor etc
I'm asking what are you asking is an actor
an actor is not a 3d object in engine. is a spawned object in world
make a blueprint instance, name it projectileBP set the gun to fire that
AProjectile* Projectile = GetWorld()->SpawnActor<AProjectile>(ProjectileClass, Origin, ShootDir.Rotation(), SpawnParams);
spawnable
I'm spawning a BP instance of that
only spawning the projectile on the server
but replcating it
that's too much to change
oh
i mean like
yeah do that
lol
comment that out see what happens
maybe a second isnt enough due to onrep being weird or somethin
I mean I'm not simulating lag, and even if I were I wouldn't be simulating 1000ms of lag, but lets give that a go
nope
but you're trying to send back to the clients the projectile spawned by the server to spawn a sound at the impact location?
or what are you trying to do?
okay like
he has a editanywhere variable
that can be called everywhere else
with no crash
but when he runs this onrep thing refrencing the variables
it crashes
im pretty sure it's because its all in c++, and its the wrong blueprint variable setting or whatever for onrep
crashed
It's not related to that
That's some really weird shit going on there I'm almost sure
if the variable is created in blueprint it can't be called in c++
It's not
That's an EditAnywhere variable
oh ok
@frank copper It also works anywhere else
Like, I call that function on an OnHit function
works fine
I also have another class for LineTrace guns, in which I call that function from the client and it works just fine
Also in that class I'm calling it from an ONREP fuction and it doesn't crash
It also crashes when the only thing I'm doing is to check if the value is NULL or not
what about right before the uhhh onrep function you set the defaultvariable to the newvariable i had you set up
if (DefaultImpactFX)
{
UE_LOG(LogTemp, Warning, TEXT("DefaultImpactFX is not null"));
//ImpactFX = DefaultImpactFX;
}
lets be clear defaultimpactFX crashes whenever its refrenced
That shouldn't crash
as we tried printing the name in UE_LOG
I deleted it
It like this variable doesn't even exist
when called from the OnRep function
I'll try doing the opposite
did you set the UPROPERTY(Replicated) to it?
I'll check if it's null, then if it is I'll log it
No, it shouldnt be replicated
It's just few effects
do it
Do you want me to send the code?
set it to replicated
oh, ok, but you're still using it in a replication code
@misty stirrup It's unrealted, these are local variables that crash the program
you can't replicate those anyway
Yeah, but there is no need to replicate them
but what type does it have?
Hold on, I'll rexplain everything and share the code again
@misty stirrup It's not, I'm creating these variables on the PlayImpactEffects, so it gets called from OnRep it should create them
what do you mean you're creating these variables lol
Here is the PlayImpactEffects and GetSurfaceType code, but GetSurfaceType is unrealted since I commented it out for now
post the full header in pastebin
@misty stirrup They are local variables
forgive me for all the if checks, I shouldn't need them... but it's crashing so I tried
if (DefaultImpactFX) this variable, where is it declared?
and how do you declare it?
Now. let me explain it further:
I've have few different gun classes
Two of them are the Projectile and Linetrace
UPROPERTY(EditDefaultsOnly, Category = "Config|Effects|FX")
did we confirm if it was only one variable or is it all 3
In the LineTrace class, I call PlayImpactEffect for the client, and then replicate the effects via an OnRep function that LineTrace again and sends the HitResult to PlayImpacEffects
It doesn't crash, because there is no reason to
then in the Projectile class
I call PlayImpactEffects once the projectile hits something, and also once it hits something I change an OnRep value to replicate the impact effects for the clients
on that OnRep function I'm LineTracing to get the the HitResult, call PlayImpactEffects
so this DefaultImpactFX it's sent to the clients
and pass it the HitResult
you set a local variable
to this DefaultImpactFX and then you send it to the clients
@frank copper just a sec
you have one in here that's set to editdefaultsonly
meaning its defaults can only be changed for blueprints
@misty stirrup That's my bad lol
but that's unrealted
unrealted
@frank copper now, take a look at this:
These IFs checks alone are crahsing the program
yeah but you where calling that in a C++ if statement
and what error message are you getting? what is the crash error?
[2018.04.15-05.57.19:948][ 59]LogWindows: Error: [Callstack] 0x000000000F666642 UE4Editor-MicroVoltsClone.dll!AGun::PlayImpactEffects() [f:\epic games\projects\tpsgame\source\microvoltsclone\private\gun\gun.cpp:144]
[2018.04.15-05.57.19:948][ 59]LogWindows: Error: [Callstack] 0x000000000F66D975 UE4Editor-MicroVoltsClone.dll!AProjectile::OnRep_Exploded() [f:\epic games\projects\tpsgame\source\microvoltsclone\private\gun\projectile.cpp:101]
@misty stirrup What do you mean?
change it to editanywhere
I did, but that won't help me
and the line in the crash error is this one? if(DefaultImpactFX) ?
No, these 3 IF checks all cause a crash
I could remove them
but then it will still crash
if I try to access these pointers
first you cloud check against a nullptr
I am checking
if(DefaultImpactFX != nullptr)
2018.04.15-05.57.19:948][ 59]LogWindows: Error: Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x00000450
I'm doing it
second, i would set that property as Replicated
as i showed you above
just for the sake of it
you don't have anything to lose
Sure, but why is an IF check causing a crash then?
how are they local if they're in the
header
is there something im missing here
like
it's commented out
in my version
read it
.26 KB
void AGun::PlayImpactEffects(const FHitResult& Impact)
{
USoundBase* ImpactSound = nullptr;
UParticleSystem* ImpactFX = nullptr;
UMaterialInterface* BulletDecal = nullptr;
if (ImpactSound)
{
UE_LOG(LogTemp, Warning, TEXT("DefaultImpactSound is not null"));
ImpactSound = DefaultImpactSound;
}
those aren't the ones causing the crash though?
are
I'm not even touching the DefaultImpactSound/FX/Decal variables at this point
if (ImpactSound) should be if(DefaultImpactSound != nullptr)
lol
No, I need these ImpactSound, ImpactFX, BulletDecal vars
I'm curious, are you destroying the bullet?
look at how my functions work
kk
@glacial pollen Yeah, only a sec later to let it replicate, but I tried to not destroy it
but you're checking if ImpactSound is valid even though 2 lines above you're declaring it as nullptr
^
Right, I did it in purpose
it used to be
ImpactSound = DefaultImpactSound;l
that resulted in a crash
@frank copper Hold on, I'll share with you the version in which I commented things out, thought it would be better without them
and confirm like
that it's the editanywhere crashing it
Take a look what's commented and what not
@frank copper oh, I forget... the first check should be if(DefaultImpactSound) and not if(ImpactSound)
didn't see that
yes
yea, the other ones are ok though, just a typo 😃
The commented out version does not crash right?
it does
kk
gun.cpp:144
These 3 if checks crash it, which doesn't make sense
which one is line 144?
if (DefaultImpactFX)
in gun.cpp?
does ue4 use nullptr or NULL?
eithre work
kk
ue4 has built in protectoin against nulls
nullptr for pointers
which is why i keep fucking asking for the full header
How come it only crash from the Projectile OnRep?
Anywhere else it works just fine
And it's not like I'm even doing anything, I'm just running an if check... how could it make it crash
because onrep is seeing it as a nullptr or its being derfrenced somehow
like
you should know this as a general rule
shit crashes when that happens
@misty stirrup Ok, but that's why I am checking if it's null or not
I've been programming for 7 years, I know that... there is nothing that should crash it
I'm with @twin juniper on this, a null check shouldn't crash
what im saying is
2018.04.15-05.57.19:948][ 59]LogWindows: Error: Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x00000450
What basically @misty stirrup is saying, is that for whatever reason, its doing a null check against something that for somereason isn't there
so basically the only one that's crashing is DefaultImpactFX
The ONLY reason I can guess this happens, if this function is running on another instance that did not create the variables
no
oh
that's not what crashing
@frank copper https://pastebin.com/evS2At4c
look at this
everything is commented out
but the IF checks
it still crashes
@glacial pollen my idea is that he's spawning a bullet that's the c++ class and not a BP class with set variables
@glacial pollen The variables should be created once the function runs
what line
is the e
error on
no
it shouldnt
the first 3 should be created when the actor is spawned
like
the 3
defaults
Where are the three "default" variables declared?
Header file
in bp?
comment out the local variables
I posted it too
comment out the local variables
@misty stirrup If I comment it out, I need to remove the IF checks too... so ofcourse it won't crash
what?
lol
@glacial pollen ?
first of all, you are closing the comment paragraph wrong
if it's the local variables
If(default) = crash right?
do it right
why the fuck did you keep saying the if statements are crashing it
you are sending us confusing data. are you playing with our minds? =)))
I want to see a SINGLE line, that crashes this. Everything else needs to go
It's the if checks
I don't want to hear x3 again
no
any one of them can crash it
close the comment properly, recompile, and show us the entire output error
not only 2 lines
stop saying it's the if checks
screenshoto the line
and output error
no more copy paste
i straight up don't believe you anymore
lol
you're saying 3 different things
you're saying its not the defaultVariable
you're saying its the localVariable
@misty stirrup chill for a second
now you're saying it is the top 3 if checks
which ARE the defaultVariables
im so lost man
@frank copper I showed the whole function, not 2 lines. The comment doesn't matter, I didn't compile and didn't notice it, I just added them to let you see what was commented out before. I showed you the Output error as well
You saw it all
Please everyone just hold on a second
no, close the comment paragraph, recompile it when you check against nullptr, and print screen the output error log
and show us that
@frank copper I showed you the output log when it was compiled and commented out
[2018.04.15-05.57.19:948][ 59]LogWindows: Error: Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x00000450
[2018.04.15-05.57.19:948][ 59]LogWindows: Error:
[2018.04.15-05.57.19:948][ 59]LogWindows: Error: [Callstack] 0x000000000F666642 UE4Editor-MicroVoltsClone.dll!AGun::PlayImpactEffects() [f:\epic games\projects\tpsgame\source\microvoltsclone\private\gun\gun.cpp:144]
[2018.04.15-05.57.19:948][ 59]LogWindows: Error: [Callstack] 0x000000000F66D975 UE4Editor-MicroVoltsClone.dll!AProjectile::OnRep_Exploded() [f:\epic games\projects\tpsgame\source\microvoltsclone\private\gun\projectile.cpp:101]
@twin juniper Can you please remove everything but ONE of the three that causes the crash?
@glacial pollen They are all crashing it
I know
I just want to see a A:B comparision
A: Should be everything removed (not commented) that produces an ok result
B: SHould be A, but add ONE line, to cause a crash
Sure, my PC crashed so hold om
Alright thank you
Stupid question, but did he try to just debug run the game through VS?
didn't
To see where exactly it crashes and what variables are involved?
Then do that first
UPROPERTY(EditAnywhere, ReplicatedUsing = OnRep_Foo
It crashes on the first IF check
add ReplicatedUsing = OnRep_foo
but only when I call it from the OnRep
@misty stirrup ?
UPROPERTY(EditAnywhere, ReplicatedUsing = OnRep_Foo
add ReplicatedUsing = OnRep_Foo
to all of the editanywhere varaibles
What?
Why would I want to do that
I would be surprised if something crashes with an accessed non on an if
So please debug with VS
Check call stack and variables
Sure, but it does... if the IF checks are commented out it doesn't crash
it isn't
the if checks
its the variables
we ran through this together an hour ago
lol
You can click through the callstack once the break hits
what variables?