#Finneganmac mysterious static dictionaries
1 messages ยท Page 1 of 1 (latest)
Do you have Unity set up for IDE debugging?
thats the little bug in the bottom right?
More than that. What IDE are you using? (Fancy text editor)
Visual studio?
or is IDE something different
Okay, so you've probably already got most of you need. Yeah, just turn on the little bug, let it recompile, then start putting stops at every step of working with the dictionaries, then press the little play button at the top of Visual Studio.
What you're looking for the exact point at which things go wonky.
How do you put in stops again? I have done this before I just forgot
Click on the empty space to the left of the code lines.
uhhhhhh
VSC, but basically the same principle.
When you reach a break point, VS will let you check on the state of all your variables.
I probably have to enable debugging in VS too aswell as unity dont I
Did you get VS as part of Unity?
Press that, and then if it doesn't start automatically, run the game from Unity.
I just figured it out lol
i clicked the little one to the right of the play button and now its debugging
okay ill plot out the breakpoints
I'ma be back in a minute. Been at this for hours, gonna grab some food.
please do, by all means you deserve it
Dinner roll acquired. On that note, tangzhong is an amazing technique and the bread it makes is delicious.
noted
okay, so what exactly are we looking for in the breakpoints?
because they seem to be a pain in the ass to work with right now
Hm, well first we need something to track.
Guess first thing to verify is whether the dictionaries are the same, or different between players.
Might as well at this point.
You know Discord will let you drop the file in and automatically syntax highlight it?
Hm. Looks like ClientPredictionTick isn't called anywhere in this script.
Yes its called by another script that uses logic from the networking solution i chose
I can just zip the entire project because at this point if you have nothing else to do and are willing to go that far to help then I will
Would be much better if it were a git repository. Or maybe just the scripts folder.
Please don't send the entire project via zip.
Google drive?
Unity precompiles a bunch of crap with the project and it bloats the files up huge.
Just the assets folder or a script folder if you have it would be ideal, if you can't use git.
Okay scripts folder its is.
Ah, good ol' double negative boolean. private bool dontLerp = false;
thats what amateur programming does to a man
theres a couple so Ill just categorize them in discord
here is the player-scripts:
ye ill send again
Try a zip instead.
Trying very hard not to optimize while looking through this.
and dont judge my comments either
oh please god no
One in Player.cs and one in PlayerManager.cs
Pick one, delete the other, and see what errors pop up.
oh hold on
I think im not smart but in a different way
I think I sent you the files from the client
I meant to only send server files
let me check
Okay so PlayerManager is a client file
I did not mean to send that
Player.cs is the correct file
my bad lol
You may have just taught me something about dictionaries in foreach loops.
how so?
foreach (Player player in Player.PlayerList.Values)
I've been using foreach(var keyValuePair in someDictoinary)
From which I'd have to extract the value/key if I just wanted one of them.
There are still a couple critical functions I can't find the callers of.
Spawn and ClientPredictionTick
they are both a part of serverhandle
Spawn is line 24 and ClientPredictionTick is on 19
Gets the Id of the client that sent the packet
it should be the same as the player Id because it goes in order by when they connetced
So clientTick gets passed from a message, to ServerHandle, to Player. I can't track it earlier than that, so I don't know when it's generated.
My hunch is that the problem is there. The assumption that it will never generate the same number for a tick twice must be false.
...Though, then again, the actual bug suggests it's a different, much weirder problem.
It can generate the same tick number
the client sends their position at each tick up from 0
and it counts up every frame per player
which probably isnt super efficient but thats how I built it
You know what, I think my early intuition was correct. I think this is a clientside problem.
Your client has two players on screen, right? Is there a guarantee it won't send ticks for both of them?
for each client to send a message per player?
for example if theres two players connected each client will send a packet ending up with 4 messages?
is that what youre suggesting is happening
oh
I think thats what is happening
let me change it ill see if it worksx
I called it, if so. #archived-code-general message
Well, It appears to be working now. I seriously cant thank you enough for 3 hours of your time on Christmas eve
the secret santa we didnt deserve
But yeah, no problem. Coding is my jam, helping people with their code is also
my jam.
Or cranberry sauce, in this case.
And it of course all wouldn't be possible without the help of Unity
being such a trash engine >w<
'Cause I usually don't touch these channels unless I have a problem of my own. I try to return the favor for at least one person.
You are not that person, I just got super roped into this and wanted to figure it out.
lol
Anyway, yeah, merry christmas, glad I could help, invest in learning software architecture, try Rust lang sometime, have a good night.