This question already has an answer here:
Many people suggest to write a program, and then start optimizing it. But I think that when it's coming to multithreading with multicore, a little think ahead is required.
I've read about using threads, and experienced it myself during some courses at the university (still a student).
The big question is simple, but a bit abstract:
What thread related steps in game design do I need to take, before implementation?
Now trying to be more specific. Let's say, as an example, that I'm making a small board game (like Monopoly) that I want to be multithreaded.
My goal Is that this multithreaded game will exploit the best of the multicore system, lets say 4-6 cores (like in i7 processors).
My answer to this question at the moment is, one thread for each of these four basic components:
- User Input / Output
- AI (computer rival)
- Other game related calculations (like shortest path from A to B, or level up status change)
I'm not an expert (yet!), and I'm sure there are better answers out there.
Any suggestion, answer, different approach will be helpful.
Maybe splitting the main database is a good way.. (or total disaster.. )