Search the web
Sign In
New User? Sign Up
delphigames · Discussion of game programming in the Delphi development environment.
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want to share photos of your group with the world? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
DXTimer Problem   Message List  
Reply | Forward Message #7605 of 7611 |
Re: [DelphiGames] DXTimer Problem

Maybe this wont be so helpful but...

I would keep the running on max fps, and update game state at
different speed. For example: instead of moving a sprite by 10pixels
on every update and using fps to regulate how much pixels per second
that amounts to, I would let the game run at max fps, but i would
measure how much time passed since last update and move the sprite
accordingly - 100ms passed and game is at slow so move it by 10px,
100ms passed and game is at fast so move it by 20px.

On Tue, May 26, 2009 at 3:55 AM, ericmort19 <barberic19@...> wrote:
>
>
> I am developing a game using UNDelphiX with Delphi 7 and have a problem with
> the DXTimer. The game has 10 game levels and 3 levels of difficulty.
> The game speed should increase in a linear progression from 20 FPS in Level
> 1 Beginner to a max of 40 FPS in Level 10 Expert or whenever the 40 FPS is
> achieved.
> My code is this, where aDifficultyTime is a local variable and FLevel is the
> game level variable with a range of 1..10.
>
> // set game speed - runs at 20..40 FPS
> case FDifficulty of
> gd_Beginner: aDifficultyTime := 0;
> gd_Advanced: aDifficultyTime := 5;
> gd_Expert: aDifficultyTime := 10;
> else aDifficultyTime := 0;
> end;
> DXTimer.Interval := 52 - aDifficultyTime - (FLevel*2);
> if DXTimer.Interval < 25 then DXTimer.Interval := 25; // max 40 FPS
>
> The FPS output runs like this, starting at 16 FPS instead of 20 and jumping
> to 21, 24 and finally a max of 32 :-
>
> Level Beginner - 16 FPS. Should be 20.
> Level Expert - 21 FPS. Should be 25.
> Leve3 Beginner - 21 FPS. Should be 21.
> Leve3 Expert - 21 FPS. Should be 27.
> Leve5 Beginner - 21 FPS. Should be 24.
> Leve5 Expert - 24 FPS. Should be 31.
> Leve8 Beginner - 21 FPS. Should be 28.
> Leve8 Expert - 32 FPS. Should be 38.
> Leve10 Beginner - 21 FPS. Should be 31.
> Leve10 Expert - 32 FPS. Should be 40.
>
> I ran the DX Diagnostics tool from Start>Run>dxdiag and that found no
> problems. Relevant sections of the report below. If I leave the dxdiag
> window open and run the game it behaves as it should with a gradual increase
> in speed as it progresses through the level. When I close the dxdiag window
> the timer resumes it's weird behavior.
>
> Please has anyone any ideas how to fix it.
>
> DX Diagnostics output report - relevant bits.
> ------------------
> System Information
> ------------------
> Time of this report: 5/26/2009, 10:22:48
> Machine name: ERIC-XP3
> Operating System: Windows XP Professional (5.1, Build 2600) Service Pack 2
> (2600.xpsp_sp2_rtm.040803-2158)
> Language: English (Regional Setting: English)
> System Manufacturer: GBT___
> System Model: GBTUACPI
> BIOS: Award Modular BIOS v6.00PG
> Processor: AMD Athlon(tm) 64 X2 Dual Core Processor 6000+, MMX, 3DNow (2
> CPUs), ~3.0GHz
> Memory: 2046MB RAM
> Page File: 372MB used, 3566MB available
> Windows Dir: C:\WINDOWS
> DirectX Version: DirectX 9.0c (4.09.0000.0904)
> DX Setup Parameters: Not found
> DxDiag Version: 5.03.2600.2180 32bit Unicode
>
> ------------
> DxDiag Notes
> ------------
> DirectX Files Tab: No problems found.
> Display Tab 1: No problems found.
> Sound Tab 1: No problems found.
> Sound Tab 2: No problems found.
> Sound Tab 3: No problems found.
> Music Tab: No problems found.
> Input Tab: No problems found.
> Network Tab: No problems found.
>
> --------------------
> DirectX Debug Levels
> --------------------
> Direct3D: 0/4 (n/a)
> DirectDraw: 0/4 (retail)
> DirectInput: 0/5 (n/a)
> DirectMusic: 0/5 (n/a)
> DirectPlay: 0/9 (retail)
> DirectSound: 0/5 (retail)
> DirectShow: 0/6 (retail)
>
> ---------------
> Display Devices
> ---------------
> Card name: NVIDIA GeForce 7300 SE/7200 GS
> Manufacturer: NVIDIA
> Chip type: GeForce 7300 SE/7200 GS
> DAC type: Integrated RAMDAC
> Device Key: Enum\PCI\VEN_10DE&DEV_01D3&SUBSYS_82501043&REV_A1
> Display Memory: 512.0 MB
> Current Mode: 1024 x 768 (32 bit) (100Hz)
> Monitor: Philips 109B50
> Monitor Max Res: 1920,1440
> Driver Name: nv4_disp.dll
> Driver Version: 6.14.0011.6218 (English)
> DDI Version: 9 (or higher)
> Driver Attributes: Final Retail
> Driver Date/Size: 6/29/2007 02:43:00, 5690624 bytes
> WHQL Logo'd: n/a
> WHQL Date Stamp: n/a
> VDD: n/a
> Mini VDD: nv4_mini.sys
> Mini VDD Date: 6/29/2007 02:43:00, 6807328 bytes
> Device Identifier: {D7B71E3E-4293-11CF-B96B-5BA200C2CB35}
> Vendor ID: 0x10DE
> Device ID: 0x01D3
> SubSys ID: 0x82501043
> Revision ID: 0x00A1
> Revision ID: 0x00A1
> Video Accel: ModeMPEG2_A ModeMPEG2_B ModeMPEG2_C ModeMPEG2_D ModeWMV9_B
> ModeWMV9_A
> Deinterlace Caps: {6CB69578-7617-4637-91E5-1C02DB810285}:
> Format(In/Out)=(YUY2,YUY2) Frames(Prev/Fwd/Back)=(0,0,0)
> Caps=VideoProcess_YUV2RGB VideoProcess_StretchX VideoProcess_StretchY
> DeinterlaceTech_PixelAdaptive
> {335AA36E-7884-43A4-9C91-7F87FAF3E37E}: Format(In/Out)=(YUY2,YUY2)
> Frames(Prev/Fwd/Back)=(0,0,0) Caps=VideoProcess_YUV2RGB
> VideoProcess_StretchX VideoProcess_StretchY
> DeinterlaceTech_BOBVerticalStretch
> {6CB69578-7617-4637-91E5-1C02DB810285}: Format(In/Out)=(UYVY,YUY2)
> Frames(Prev/Fwd/Back)=(0,0,0) Caps=VideoProcess_YUV2RGB
> VideoProcess_StretchX VideoProcess_StretchY DeinterlaceTech_PixelAdaptive
> {335AA36E-7884-43A4-9C91-7F87FAF3E37E}: Format(In/Out)=(UYVY,YUY2)
> Frames(Prev/Fwd/Back)=(0,0,0) Caps=VideoProcess_YUV2RGB
> VideoProcess_StretchX VideoProcess_StretchY
> DeinterlaceTech_BOBVerticalStretch
> {6CB69578-7617-4637-91E5-1C02DB810285}: Format(In/Out)=(YV12,0x3231564e)
> Frames(Prev/Fwd/Back)=(0,0,0) Caps=VideoProcess_YUV2RGB
> VideoProcess_StretchX VideoProcess_StretchY DeinterlaceTech_PixelAdaptive
> {335AA36E-7884-43A4-9C91-7F87FAF3E37E}: Format(In/Out)=(YV12,0x3231564e)
> Frames(Prev/Fwd/Back)=(0,0,0) Caps=VideoProcess_YUV2RGB
> VideoProcess_StretchX VideoProcess_StretchY
> DeinterlaceTech_BOBVerticalStretch
> {6CB69578-7617-4637-91E5-1C02DB810285}: Format(In/Out)=(NV12,0x3231564e)
> Frames(Prev/Fwd/Back)=(0,0,0) Caps=VideoProcess_YUV2RGB
> VideoProcess_StretchX VideoProcess_StretchY DeinterlaceTech_PixelAdaptive
> {335AA36E-7884-43A4-9C91-7F87FAF3E37E}: Format(In/Out)=(NV12,0x3231564e)
> Frames(Prev/Fwd/Back)=(0,0,0) Caps=VideoProcess_YUV2RGB
> VideoProcess_StretchX VideoProcess_StretchY
> DeinterlaceTech_BOBVerticalStretch
> Registry: OK
> DDraw Status: Enabled
> D3D Status: Enabled
> AGP Status: Enabled
> DDraw Test Result: Not run // ran OK when tested
> D3D7 Test Result: Not run // ran OK when tested
> D3D8 Test Result: Not run // ran OK when tested
> D3D9 Test Result: Not run // ran OK when tested
>
> -------------
>
>



--
Pozdrav,
Igor Stojkovic mailto: stojkovic.igor@...
Join new social network and get you share of the company at
www.me2everyone.com/208754



Tue May 26, 2009 2:39 pm

jimyiigor
Offline Offline
Send Email Send Email

Forward
Message #7605 of 7611 |
Expand Messages Author Sort by Date

I am developing a game using UNDelphiX with Delphi 7 and have a problem with the DXTimer. The game has 10 game levels and 3 levels of difficulty. The game...
ericmort19
Offline Send Email
May 26, 2009
1:56 am

Maybe this wont be so helpful but... I would keep the running on max fps, and update game state at different speed. For example: instead of moving a sprite by...
Igor Stojkovic
jimyiigor
Offline Send Email
May 26, 2009
2:40 pm

Thanks Igor but that would result in a very jerky movement. The sprites need to move in small increments at frequent intervals to get smooth movement. It's...
ericmort19
Offline Send Email
May 26, 2009
10:15 pm

Hello, This forum is a bit quiet these days (as are most Delphi forums). You may want to try the forum on the Pascal Game Development website. They have a...
Ian Munro
ianathome12345
Offline Send Email
Jun 4, 2009
7:30 am

Thanks Ian I will give that a try but I don't hold much hope for a solution. 2 very good computer shops I have used before have had a go at my machine and...
ericmort19
Offline Send Email
Jun 4, 2009
8:05 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help