What is Thread?

can you tell me what is thread and what function is it?

A Thread is a class that wraps over threading. Threading is a computing term used for parallel processing. Parallel processing using threads doesn’t require multiple CPUs, but it can use them. The idea behind it is that you can do expensive computations in a different thread so your main thread can keep running without blocking while the other thread calculates whatever needs to be calculated.

It can be used for many things and it is a very abstract concept, so it’s not easy to give good examples, but you can see it in action in things like loading screens, texture streaming, dynamic generation of gameplay areas, game character AI decision trees, physics and more.

If you do not know what it is, you probably do not need it, so first figure out if you actually need parallel computation beyond what godot already offers (GUI, physics…) and if you don’t, just don’t worry about it.

1 Like

I’ll add to Efi:

Do not use it if you don’t know what Thread is =) Not until you’ve read like half a book on it, or at least multiple chapters and several tutorials.

Multithreading is awesome but extremely hard and can lead to crazy weird behavior if you make one tiny mistake. Behavior you may not even catch until production time.

It’s very, very likely that you can optimize the app/game in other places and never need to worry about Thread. But it’s a great topic to learn about since in other languages/outside of gaming multi-threading can be pretty common (iOS apps, for instance).