View Full Version : Professional Opinion

28-07-2004, 07:47 AM
Please respond with your best opinion and possibly a reasoning on this situation.

Would it be more efficient to use a DXTimer or a Procedure GameLoop(); in DelphiX for doing all the game stuff and rendering?

Right now my game is using a DXTimer, and when you focus on a different window like internet explorer and go back to the game, the Timer is oddly stopped for some ungodly reason and I can't figure it out? Any suggestive additives to the above as well would bring forth much gradititude. Thanks alot!

28-07-2004, 07:58 AM
Since I have found out about GameLoop I dont use anything else.

I find a GameLoop makes for better animations.

To solve your problem try make the timer activate whenever the APPLICATION get activated (application.onActivate)

Harry Hunt
28-07-2004, 08:00 AM
I don't know if I qualify to give you a "professional opinion" since I'm not a professional game developer :P but here's what I think:

If GameLoop() is an event handle for Application.OnIdle then don't use it. I know a lot of people use it but it's not a good idea. It might work fine in exclusive mode apps but in windowed mode apps there's too much going on to be able to truly predict how OnIdle is going to react. I remember releasing a game once that used App.OnIdle and it worked fine on all computers that I tested it on. Shortly after the release, I had received dozens of emails saying that the game freezes on start-up. I tested it on a few more computers and found one where I could reconstruct the bug. After I had replaced OnIdle with a real Timer it worked fine on all computers.

I suggest that you use a thread-driven timer and I believe DXTimer is thread-driven.

As for the focus-loss problem: You should handle the events Application.OnMinimize, Application.OnMaximize, Application.OnRestore, Application.OnActivate and Application.OnDeactivate (you will only need two event handlers). In Minimize/Deactivate, pause your timer, in Maximize/Restore/Activate re-start your timer. That should do the trick.

Harry Hunt
28-07-2004, 08:01 AM
Man, you were faster! :o

28-07-2004, 10:06 AM
Thanks for both of you're tips. I got the timer working for now. If it starts acting up again im going to switch to a GameLoop procedure. Anyway, TDXFonts is acting up for me. In a sample included in the DelphiX package, it shows how to type to the DXDraw using DXFonts, but now it's just erroring like heck, even the sample. Any known possibilities?

Harry Hunt
28-07-2004, 10:08 AM
You might want to post this into the DelphiX forum because the DelphiX pros might not find your post here. I don't know jack about DelphiX anymore :P

Useless Hacker
28-07-2004, 10:52 AM
I suggest that you use a thread-driven timer and I believe DXTimer is thread-driven. Actually, DXTimer just uses Application.OnIdle.

Harry Hunt
28-07-2004, 12:18 PM
that's good to know.