Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / [D3D] Game stability and performance issues

Author
Message
Alaror
15
Years of Service
User Offline
Joined: 9th May 2011
Location:
Posted: 8th Feb 2012 18:57 Edited at: 8th Feb 2012 19:00
I've experienced some issues with D3D ever since I started using it, but I waited to post until I was sure it was the root of my problems. Here are the problems I've been having with D3D. I am not experiencing any of these issues when D3D is disabled.

-Text on the main menu disappears after about 45 seconds of the program running. At times it will randomly reappear, though much smaller and the incorrect color.
-When entering a "contract" (randomly generated scenario), there is a very noticeable FPS drop of about 10-15 fps for the first minute or so of being in the contract. After that it slowly climbs back up.
-The game visuals stop updating at random times, despite the game still running (sounds still work perfectly).


Below is a bit of the code I'm using to display the text. I looked through some examples and from what I can tell my implementation is correct, but I may have the commands in the wrong order or something of the sort.



Has anyone experienced similar problems using D3D? Did you find a solution? If not, are there alternatives that would allow me to use custom fonts?


EDIT: Just thought I'd post the setup code where I call the command "D3D_INIT".



Stab in the Dark software
Valued Member
23
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 8th Feb 2012 19:39 Edited at: 8th Feb 2012 20:01
I have used the D3d text quite allot in my projects.
I will test your code and try to duplicate your results.
I will post here with my results.

FYI: When you use the command "Set Display Mode", setting the last parameter to 1 is setting the sync rate to
match the refresh rate of the monitor i.e. 60 fps .
When you call the command "Sync Rate 0" next your are then setting the sync rate to run as fast as it can.
So calling "Sync Rate" is only changing the rate you have already set with the "Set Display Mode" command.
This is probably not causing the problem but is a common mistake.

Here is how I set up D3D:



To display D3d Text:




[img][/img]


WindowsXP SP3,Vista,Windows 7 SP1, DBpro v7.7RC7
Stab In The Dark Editor
The coffee is lovely dark and deep,and I have code to write before I sleep.
Alaror
15
Years of Service
User Offline
Joined: 9th May 2011
Location:
Posted: 8th Feb 2012 20:15
@Stab in the Dark

Thanks for the insight concerning the Sync commands! Would have probably never caught that.

It's been a while since I first implemented the code, so revisiting it I had assumed that the fonts are loaded using D3D. It looks like I'm actually using a different DLL to load the fonts (where the "ADD FONT" command comes from) and then D3D to display the fonts.

You might have noticed that I use the "D3D_FONT" command in the main code rather than at startup. I wanted to do it this way for simplicity sake while programming (I'd rather not have to reference a list of numbers to see which fonts they correlate with), but I'm beginning to wonder if this puts a burden on the DLL that it wasn't designed to handle.

Stab in the Dark software
Valued Member
23
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 8th Feb 2012 21:11
Using the "D3d_Font" command in the loop is probably not a good idea.
I don't have the dll with the "Add Font()" command, so it seems I can not duplicate the
bug. I'm assuming D3d dll gets the font from the operating systems font directory.
Try installing the font and temporarily do not call the "Add Font()" command.
Which Dll is the "Add Font()" command from?

[img][/img]


WindowsXP SP3,Vista,Windows 7 SP1, DBpro v7.7RC7
Stab In The Dark Editor
The coffee is lovely dark and deep,and I have code to write before I sleep.
Dar13
18
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 9th Feb 2012 04:23
Quote: "You might have noticed that I use the "D3D_FONT" command in the main code rather than at startup."

If the code is run more than once, then that could very well be your problem. D3D_Font is finicky at the best of times, so I would recommend using it sparingly.

Alaror
15
Years of Service
User Offline
Joined: 9th May 2011
Location:
Posted: 10th Feb 2012 04:23 Edited at: 10th Feb 2012 05:16
Thanks for the replies guys. I reworked the code to have the "D3D_FONT" command called once for each font and the stability issues have seem to be resolved (hard to say for sure since a lot of the issues didn't happen frequently and were random).

With that out of the way I've managed to bring the FPS of the game from around 60 down to a steady 25. I don't think it's related to D3D or any of these changes but who knows


EDIT: I figured out that it's the "POSITION LISTENER" command that's causing the slow down, but I've no idea why. It was working perfectly yesterday. I'll probably start a new topic if I can't find any info on it.

EDIT 2: Further diagnoses shows that it's an issue with the number of sounds I have loaded at once. Here's the new topic about it.

Login to post a reply

Server time is: 2026-07-10 06:35:05
Your offset time is: 2026-07-10 06:35:05