How and why to use threading in C++
h
CSharpIsGud (800)

Have you heard of multithreading and just wish you could make your programs faster?
Well... unfortunately just using threads is not enough, you have to use them correctly.
More threads can make things faster, but too many threads or using them on the wrong things can make it slower!

If you are building a house you undoubtedly have a lot of work to do, but if you have a team you can get it done faster.
If you do it all yourself without any help it will take forever, and it will take just as long or longer if all of you are working on the same thing.
So if everyone gets a different task then multiple things can be done at the same time and by the time they are all finished the house is ready to be put together.

Now this isn't a really great example as I couldn't think of a very good example of a program that benefits from threading off the top of my head but the idea is there and if you made it into a game or something with some more complicated logic like physics it would really make a difference.

I also couldn't find a very significant project to demonstrate thread safety reliably but I'll explain it.
To make that house you need wood or whatever you are making it out of right?
Well if everyone needs a piece of wood and two of them want the same piece what then?
Remember that you have a builder team of idiots so instead of just getting a different piece they both work on the same piece! Each one had a different job so the resulting plank came out an unrecognizable mess!
But if you tell them to take turns, everything works how it should. The second person has to wait for the first one to get their piece.

Basically, the whole benefit of threading is that you can do multiple things at the same time, like web requests for example.
If you don't have anything else to do while your threads are working, you might be better off with just a single thread.

You are viewing a single comment. View All
CSharpIsGud (800)

@HeadSucksAtLife Then you won't necessarily make good games, people wouldn't order, let alone pay for a canvas game.

And I know you are going to try to say you don't need one to make a good game.
You technically don't, but almost no one that makes decent games does.
Keep in mind that almost applies to very specific people.
You never asked for anything specific, you just asked for programmers, and most of who you got were website devs.
It is a very small chance that any of them know things like advanced vector math they would need to do something like an advanced game.
And lastly, the above is just a fraction of the work. No game engine means you have to do rendering and collision checks yourself too. (P.S collision checks get much much harder when rectangles aren't the only thing in said game.)

So, you can either just use a game engine and make a game normally.
Or just make them without one and stop expecting that they will make 'revenue'