I am building some logic similar to restaurant city in a Game Jam.So what happens is that a customer walks onto the screen, and there is a certain timer, when it expires, what happens is I send a signal that he leaves and I make the player lose health and then call queue_free.
I do this also when he eats sucessfully and he leaves.
It works normal most of the time, but what I noticed is that when u have a large number of customers like 5-6 that leave at once, u only lose health one time or the update happens really slow like 5 seconds later for some.
Then it also happens when two customers happen to finish eating at the same time. I find other customers that did not eat also walk away.
I tried using a mutex lock and unlock before they update the scores or lives in case something happened with stale copies
I also tried using the call deferred function on the signal cause I read it would defer to main thread and consolidate all calls to a queue.
I even moved the stats out to a global autoload so it may at least have its own thread to signal the other UI components to refresh.
It seems to have mitigated the issue, but I can still see it sometimes. Has anyone experienced something weird like this before that may have advise?
This is only a solution if you’re multi-threading. Are you multi-threading in a game jam?
This shouldn’t be needed unless this is happening in the middle of a physics frame, and then it depends on what you’re updating. My rule of thumb: Don’t use call_deferred() or set_deferred() unless an interpreter error recommends it.
Own thread?
Don’t multithread your project until you are having performance issues, or you will have concurrency issues.
Just to be transparent, if you’re not going to show your code, I’m going to stop answering your questions. It’s too frustrating trying to solve problems for people who will not give us enough information to help them. From your other posts, you sound like a professional developer, so I expect you’ll understand this. It’s like someone from another department coming to you and asking for programming help but refusing to show you what they’re working on.
I’d like to argue that you are paid too much cause you are always in meetings and only paid to talk to your devs as manager and constantly rebutt people on forums
But I do understand u are burnt out from the beggars and vibe coders but even without the code, I described my problem in clear detail and what I tried, so I really do not appreciate that comment you made.
You believe you provided enough information. I told you that in my opinion, you did not. You seem to think that you have a right to be upset by the fact that I disagree with you. That’s a you issue. I do not control your feelings.
If you had described your problem in enough detail, I wouldn’t have thought you were trying to multi-thread a project.
Three different people told you that we needed to see the code. You marked an answer that is not going to help anyone coming after you because there is not enough information about the problem or the solution.
The fact that you do not want to share your code because you’re embarrassed is fine. But don’t try to turn that into something that is my fault because I do not want to help people who refuse to give me enough information to help.
You might not know what you still don’t know. The fact that you presumed some threads are running, shows that you don’t really know what’s happening in your code, so your verbal interpretations will be unreliable and insufficient.
It’s contradictory - you think you exactly described what your code does, yet you ask for help with it because it doesn’t do what you expect it to. How does that make any sense.
You don’t need to show your actual code - that what minimal reproduction examples are for. Make a minimal reproduction project.
Just post your code. By now it’s obvious you vibe coded it, so you’re already naked
Lol. What happened was, I wanted to give the users a cue to serve the customer, to do that, I made the people waiting in line turn around and face the user on the screen to show they were angry and about to leave
What happens is that I programmed them just to walk in one direction and save the direction they would walk based on the animation state and I used ray tracing collision to determine when they would stop and wait in line at a queue
So when customers timed out, I disabled the ray tracing for them and when that happened when one walked off, the other customer waiting in line next to her that was also about to walk did the same thing though her timer had not expired.
Basically not a concurrency issue. Didn’t help that the screen was short and easy to walk off without having time for the timer to expire.
Lol. I think if I had shown you guys the snippets u would also have detected nothing wrong. Anyhow, I would like to apologize for earlier, just a matter of being in an agitated state, and being in that state and full of emotional baggage collected from many years, the way certain things were said triggered me.
If I could, would take you out for coffee @dragonforge-dev as an apology.
Anyhow, I shall leave it in as a mercy because I noticed a balance issue with my adaptive difficulty and LOL, this seems to solve it.
I should go sleep. I think I been staring at code for too long and not being productive
Apology accepted. I am drinking coffee as I read this, so thanks for the coffee!
Perhaps. But if that had been the case, once we had eliminated that we would have known what questions to ask. For example, I would have most likely next asked for a screen shot of your scene tree. People don’t realize how much we can pick up from a picture of that. For example:
A warning that is being ignored.
A wrong node being connected in code.
A node that is not the type the person thinks it is.
A node that we cannot see the type of, and the screen shot makes it clear that is the problem.
Yes, we have opinions about code. But for example, @normalized and I have slightly diverging opinions on code. So you don’t have to take our critiques as value judgements on you personally.
We don’t always know more, but we do have more experience with the engine. And that’s the whole point of this forum - to share that knowledge. Just because we come across as grumpy old men doesn’t mean we aren’t trying to help. (As long as you stay off our lawn!)