V3: Main Game Loop
Displaying 1-19 of 19 total.
1
nimrand
|
I'm working on a demo for V3 and I have a question about the main game loop. All the demos that I have seen so far use a spinning loop to wait for the time to render the next frame. I don't like this practice because it needlessly uses up processor cycles (and it is particularly annoying on my machine because the cooling fan gets loud when the processor is on 100% for an extended period of time). If I remember correctly, you could solve this problem in V2 by using the HookRetrace or HookTimer functions, and just let V2 handle the timing of each frame. I tried this in V3 and it seems to recognize the HookRetrace symbols, but it exited just as soon as the AutoExec function terminated. Is there a step I'm missing, or is there some way to simply cause the "thread" to pause for a given amount of time before continueing (instead of using a spinning loop)?
Posted on 2004-02-18 18:28:34 (last edited on 2004-02-18 22:18:07)
|
andy
|
You have to spin. Calling UpdateControls may (or may not) help.
As I understand it, the v3 alpha (remember that it's an alpha) has no map engine yet. (or offers no interface with which it may be invoked or interacted with)
Posted on 2004-02-18 19:59:16
|
nimrand
|
I thought that might be the case, but I wanted to be sure.
Posted on 2004-02-18 22:17:46
|
vecna
|
Calling updatecontrols directly is supported but not necessary in V3, it is called automatically when ShowPage() executes.
I can add a Sleep command to yield cycles to the OS easily, tho. However, yes, you always 'spin', the only alternative is to set a fixed FPS.
Most games use the majority of your CPU, to get as high FPS as possible, thats how things have always been.
Posted on 2004-02-18 23:00:00
|
mcgrue
|
Yeah, besides, you shouldn't be using Excel, Photoshop, and Outlook while you're playing games!
That'd mean you're not giving the game all of the attention and love that it deserves!
Posted on 2004-02-19 00:02:39
|
vecna
|
Well, I've found v3 has no problem running with lots of other apps in the background. Thats how I run it like.. all the time!
But, I've never really understood the "stuff using my cpu = bad" mentality. I spent cash on the megahertz, I want to use them! V3 is only using the cpu that other apps aren't. To deliver the fps.
Posted on 2004-02-19 02:28:49
|
nimrand
|
For most kinds of apps, spinning loops are a bad idea. And, thus, my habit is to never use them. But, for games, where it is usually assumed that the game is the only program running (or at least the most important one), the point is pretty mute.
Posted on 2004-02-19 03:36:19
|
JL
|
I notice in this PepperX game that the sound stutters from time to time. I have a pretty fast machine (2+ Ghz), and it has no trouble running, say, Winamp in the background while I'm using Photoshop... Could the stutter be caused by the busy-waiting?
Posted on 2004-02-19 07:15:19
|
rpgking
|
JL...I think I remember you. Are you the guy that made that Missile Command clone with Verge2 a long time ago?
Posted on 2004-02-19 07:19:09
|
mcgrue
|
The stutter could possibly be the fault of the sound library which, in that build, is old and busted. There should be a new version of v3 (still very alpha mind you) with a newer, moar awesome sound lib.
Posted on 2004-02-19 07:21:36
|
JL
|
Yeah, that's me. I'd port it to V3, but I don't think anyone would want to play it. :)
Posted on 2004-02-19 07:33:24
|
Tatzen
|
JL! Make a demo. Demos demos demos. I'll make like 500 demos when I'm done with maped3.
Posted on 2004-02-19 08:54:25
|
mcgrue
|
Posted by JL: Yeah, that's me. I'd port it to V3, but I don't think anyone would want to play it. :)
I would want to play it! ;_;
Also, making a v3 demo wins you an avatar!
Also it makes you cool. You want to be cool, don't you?
Posted on 2004-02-19 09:04:29
|
anonymous
|
Wait... nobody told me about the cool! I'll take a look at it.
Posted on 2004-02-19 19:20:15
|
JL
|
Bleah... that was me.
Posted on 2004-02-19 19:21:07
|
mcgrue
|
Heh heh... I knew the cool would get him. >:)
Posted on 2004-02-19 22:09:26
|
zeromus
|
the point is pretty mute.
thats moot
--your resident grammarian
Posted on 2004-02-19 22:38:24
|
mcgrue
|
Now now, Zero... it could be a very quiet point! ;)
Posted on 2004-02-19 22:41:58
|
grenideer
|
Hey JL! Haven't seen you around in a very long time.
Where's my new avatar?!? :b
Posted on 2004-02-19 22:56:41
|