1.

Solve : Delphi Parts?

Answer»

I'm trying to make a particle system in delphi/pascal and i don't know how i should present them like display the particles... I have properties to make the particles but do i use DRAW or run a image as a template and use an array to be each individual particle and then have the particles move via a timer..? The problem with this is that the more instances that their are the timer can't handle it cause it is trying to process to much at once and gives a lagging seeming effect. Does any one know how i could draw the particles on the form and have them controlled through some means?

If i was to use draw how would i move the individual specs of particles?

Thx,
Tan_Za

PS: if it doesn't make sense i dunno how else i can say it but how can i use draw functions in delphi to make moving images or particles?Not sure if this helps or not, but a long time ago I was playing with  Basic and sprites with CGA graphics and I had the screen mapped out, and if I withheld DISPLAYING each sprite change until all sprites were changed to their next transition, I was able to get rid of the blur, wave, and trail effect.

My programming teacher showed me this frame method to display all at once vs display every sprite transition which made for a strange wave and blur effect. Not sure if this is sort of the same issue your having where you need to withhold displaying each particle until all particles have changed in the whole of what you are doing. My next issue I had from this withhold display was that SLOWER computers like the 4.77Mhz 8088 showed an annoying flicker with each transition while a 80286 12 Mhz was NICE and smooth. With todays computing power I dont think you would hit the same issue withholding before displaying to have a flicker unless you are addressing too many particles with each cycle to where you actually get a delay that is longer than 70hz. How many particles are you addressing?logic, two threads.

One runs the Game Loop, let's call the routine GameProc, the other is the UI thread that you get for free with your app.

Basically, to start a game you initialize any variables, create the thread, and launch GameProc(), gameproc repeatedly performs a game tick and then calls back into the UI thread to perform a repaint, and in the appropriate event you draw your particles to the game screen.

Most games use this method. the UI thread needs to be as disjoint from the actual game logic as possible. Any necessary frame-timing code should be placed at the start of the loop,and  the gameProc() routine should be an INFINITE loop, or a loop that is waiting on a flag to exit. The reason for this is that the Operating System calls back into your program for desktop/window events, button clocks, menu mouseovers, and all that. And if you are hogging cycles with the loop to perform game logic, there is no time left to do any logic in the main thread, or it responds very slowly.



Discussion

No Comment Found