Thanks for all your suggestions! I managed to make the whole thing work, not
with threads but by a central TObjectList that contains all the TMoving
objects, and a Timer which moves each object at a given interval. It seems
that the program does not slow down (at least not on my computer) when too
many objects are moving around, and since the objects quickly get out from
the screen it can hardly happen something like >50 objects will be present
at the same time.

As for the threading solution, I have looked into it, but found this in the
Help file:

Warning: Do not create too many threads in your application. The overhead in
managing multiple threads can impact performance. The recommended limit is
16 threads per process on single processor systems. This limit assumes that
most of those threads are waiting for external events. If all threads are
active, you will want to use fewer.


Does this mean I cannot create more than 16 instances of the same thread, or
that I cannot create more than 16 thread classes? Anyway, I didn't want to
find out the answer with hours of writing test code, so I tried the
mentioned solution with the Timer and it worked.

Finally: yes, I am writing a game. TMoving is the base object for each
moving object,like space ships, guard towers and bullets, and the Timer is
needed to control the bullets :) When the user hits the Space bar then a
bullet is fired in one angle, and it goes in that direction until it gets
out of the screen or hits something.

Off topic: are there many Delphi programmers who use DirectX? Or is that
area reserved for C++ programmers?

Gajo


_______________________________________________
Delphi mailing list
[EMAIL PROTECTED]
http://ns3.123.co.nz/mailman/listinfo/delphi

Reply via email to