Will Godot miss lines if you try run too many things at once?

  • Thread starter Thread starter Darkmisc
  • Start date Start date
  • Tags Tags
    godot
AI Thread Summary
The discussion revolves around a game designed to help users memorize Scrabble's two-letter words, where pressing valid tile pairs should cause them to disappear. However, a bug occasionally prevents tiles from disappearing after a valid selection, requiring a second press to resolve the issue. The developer suspects that the problem may stem from running too many functions simultaneously, leading to missed button states. Attempts to mitigate the issue included assigning individual groups to buttons and switching from the _process to physics_process function, which showed some improvement but did not fully resolve the problem.Further insights suggest that the issue may be related to race conditions between button presses and timed actions, as well as potential delays in the event queue due to high-frequency event firing. Recommendations include implementing detailed logging to trace function calls and examining button enable/disable timing to identify the root cause of the missed interactions.
Darkmisc
Messages
222
Reaction score
31
TL;DR Summary
I have twelve buttons that are constantly moving. Sometimes they don't do what they are supposed to when pressed. Is it because I have too many things running simultaneously?
Hi everyone

I made a game for memorising Scrabble two-letter words. When you press a tile, it lights up and a button_on variable gets set to true. If the two tiles you press form a valid two-letter word, the tiles disappear (and get replaced with new tiles). I have 12 tiles running at any given time. The left column scrolls down and the right column scrolls up.

1702684245-931062-image.png


The game runs fine for the most part, but very occasionally when you press a pair of tiles that form a valid word, the tiles will light up but not disappear. (They will disappear if you press on the tile a second time)

I suspected it was because I was running too many functions at once, and maybe the button_on=true line gets missed. All the buttons belong to the "all_buttons" group and they all have a "word_made" function that gets called when a valid word is made. I gave each button its own group (i.e. one, two, three... twelve) and instead only called functions for two buttons whenever a word was made. This made the problem appear less frequently, but didn't eliminate it.

I also tried using physics_process instead of _process, but I'm not sure if this made any difference.

Am I correct in suspecting the problem stems from running too many things at once? I tried using only ten buttons, but that didn't eliminate the problem.

I had also labelled each button (not in screenshot) and kept a track of which pairs failed to light up. I've retried those pairs and they almost always work as intended.

Am I right in guessing that I'm running too many things at once? If so, can the problem be fixed?

Thanks
 
Technology news on Phys.org
Darkmisc said:
Am I correct in suspecting the problem stems from running too many things at once?
That callbacks should be skipped entirely is not likely, but depending on what your are doing in your callbacks and how you implemented timed actions (GUI-thread timer or separate thread) you likely have a race conditions between button presses and timed actions. Since you say the program seems to miss clicks you may also want to look at you button enable/disable timing if you have any of those. Race conditions can in general be very subtle and difficult to pinpoint even when having the code in a debugger (because debugging usually alters the timing). The right amount of code tracing (logging when entering and leaving selected functions) may provide you with data for pinpointing the situation.

Also want to mention, that if your code firing events at a very high rate (e.g. a burst or a recursive update) you may experience a build up of events in the event queue where user interactions can get perceptively delayed.
 
Thread 'Star maps using Blender'
Blender just recently dropped a new version, 4.5(with 5.0 on the horizon), and within it was a new feature for which I immediately thought of a use for. The new feature was a .csv importer for Geometry nodes. Geometry nodes are a method of modelling that uses a node tree to create 3D models which offers more flexibility than straight modeling does. The .csv importer node allows you to bring in a .csv file and use the data in it to control aspects of your model. So for example, if you...
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...
I am trying to run an .ipynb file and have installed Miniconda as well as created an environment as such -conda create -n <env_name> python=3.7 ipykernel jupyter I am assuming this is successful as I can activate this environment via the anaconda prompt and following command -conda activate <env_name> Then I downloaded and installed VS code and I am trying to edit an .ipynb file. I want to select a kernel, via VS Code but when I press the button on the upper right corner I am greeted...
Back
Top