I need to simulate cars moving (let's say) on a squared area. Anyone can easily imagine computations (x/y coords, track, speed, acceleration, pause...) The prior version, (Developed across Millenium Bug ... 21 years ago) run into the Application.OnIdle
The current flow sounds like this:
for each aCarArray a call to TCAR.Execute is done (making computation on deltaT using GetTickCount);
for each aCarArray draw the car on then screen and updating some values
Sleep(100) to make the app looking-like responsive
and again ...
This approach can't take advantage of modern CPU. I'd like to move from array of TCAR's object running in the main thread to an array of Class using parallel, but I can not find any sample that shows me the a way of creating class working in parallel; computations should be done the most continuously (about one hundred cars). The goal is to develop a class that
- Create array of those CAR.
- Send a start/stop command.
- drawing cars on the screen (by main thread)
- enjoying the result (of code)
Any suggestion on the best path to start with ?
Regards. Giovanni