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 / Problem when I am swithing with ALT+TAB

Author
Message
Takis76
21
Years of Service
User Offline
Joined: 9th Apr 2005
Location: Greece
Posted: 10th Feb 2011 12:07 Edited at: 10th Feb 2011 12:10
Hi ,

My game works well so far.

But when I want to switch between my game and windows (ALT+TAB) my program breaks and drops me (runtime error 502, image not existing at line 2351)

But image exists and everything works well until press ALT+TAB

How do I fix this?


Typographic error , I mean Switching
Jeff Miller
21
Years of Service
User Offline
Joined: 22nd Mar 2005
Location: New Jersey, USA
Posted: 10th Feb 2011 13:07
That does not happen when I run my DBP programs. I am using Windows 7.
Which version are you using?
Takis76
21
Years of Service
User Offline
Joined: 9th Apr 2005
Location: Greece
Posted: 10th Feb 2011 14:16
Windows XP - version 1.075
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 10th Feb 2011 14:47
This can happen if you are running "fullscreen" exclusive or use "set window off" in your code. If your game looses focus like when you switch programs you'll have to re-load all your game media. Try compiling it as "fulldesktop" instead, you may notice a slight drop in fps but it'll keep any media in this or "windowed" mode.

Takis76
21
Years of Service
User Offline
Joined: 9th Apr 2005
Location: Greece
Posted: 10th Feb 2011 18:46 Edited at: 10th Feb 2011 18:47
I used fulldesktop , but I made and one trick , I used the image exist and sound exist function to see if the first image and first sound is exist and graphics was loaded and then I was called the load data function again, but I had problems with D3D fast text function everything was worked , but I loose my fonts and I decided to use Fulldesktop option in Project options...

The trick is somewhere here , check if some graphics and sounds are exist and reload them and putting this check in your game loop.

The problem is in the fonts. The built in font function are very slow , I have huge drawdown of FPS(Frames per second) when I running built in fonts functions...

From 1400 FPS to 70

This must be fixed in the next version of darkbasic ....
=PRoF=
23
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 10th Feb 2011 19:24
Carry on using D3D and just re-load the font when you re-load the graphics and sound files again?

Or pre-render any text you need beforehand and just use images or sprites to display text in your main loop.

baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 11th Feb 2011 09:39
Maybe try running "d3d_init" again too?

Takis76
21
Years of Service
User Offline
Joined: 9th Apr 2005
Location: Greece
Posted: 25th Mar 2011 15:42
I thing I tried to run 3d3_init again and fonts were screwed up.
Nevermind , I use Full desktop when I am compiling , Frames per second drops very very much , but I don't have the ALT-TAB Problem.

And the built in fonts functions are very very slow and the game creators must correct this and so many updates , no improvements was made.

And we run external plugins.
But there are and other problems that Darkbasic have and needs to be fixed..

When you learning more darkbasic and you start using more functions , you discover more bugs and improvements must be fixed...
JDforce
21
Years of Service
User Offline
Joined: 27th Jul 2004
Location: Sea of Tranquility
Posted: 26th Mar 2011 19:41
Many engines show this problem. It is actually a directX problem. It destroys the handles for existing 3d objects in some conditions>

- when screen saver is called
- when you press ctrl alt del
- when you lock your terminal with winkey-L

These are called winlogon conditions, and the way of preventing your program to fail is either checking if the rendering surface is valid with the dedicated dbpro function, or to program and install a winlogon notification dll. The former is aware of the winlogon "GINA" status on your terminal, and notifies your program just prior of the event happening. Anyway, your program has to rebuild the 3d objects lost in the process.


Some engines have the solution integrated, making the process invisible for the programmer, like conitec 3d gamestudio, unity3d, truevision 3d.

May the 3d force B with U
Takis76
21
Years of Service
User Offline
Joined: 9th Apr 2005
Location: Greece
Posted: 27th Mar 2011 02:57
And how do I fix this problem in my game , in case , I will want an exclusive screen resolution?
If I will install winlogon notification dll , will this corrected?
Where do I find this dll?

And do other people needs to install this manualy to run my game?

Or is it possible this installed when my game runs?

In my game now I use full desktop , I am asking in case I will use exclusive resolution in the future.


Exlusive resolution maximize the frames per second x 10.
Now I have for about 400 ~ 450 fps , with exclusive resolution , I had 4000 ~ 4500 fps before.

Thank you very much...
=PRoF=
23
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 27th Mar 2011 13:55
I just ran a quick test to check my original advice, and It seems to work ok when switching resolutions.

In what way were the fonts "Screwed up"?



baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 28th Mar 2011 10:56
Isn't a framerate of 400 -> 450 fps good enough?

Surely that's about five times faster than the human eye can ever detect...

Indicium
18
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 28th Mar 2011 19:24
Quote: "Surely that's about five times faster than the human eye can ever detect"


And about 5 times faster than most monitors can refresh :p
=PRoF=
23
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 28th Mar 2011 23:12 Edited at: 28th Mar 2011 23:13
As a serious comment, and not an attempt to flame anyones thread, I'm not sure I'd like to run my 8800GT at that FPS (4k-4.5k fps that is, not 400, lol) for any length of time.

>edit<
to clarify which fps I was refering to.

Takis76
21
Years of Service
User Offline
Joined: 9th Apr 2005
Location: Greece
Posted: 2nd Jul 2011 02:17 Edited at: 2nd Jul 2011 02:24
Yes if you don't beleive it , I had 4500 frames per second when I run my game with exlusive resolution with my old video card.
But my old video card , damaged with my motherboard and I purchased a new one. (Burnt from power loss and inductive voltages).

The old one was GeForce 8500 GT 512MG DDR2 and the new one is
GeForce GT 440 with 1024MG DDR5 and I have 250 frames per second now , in both and desktop and fullscreen exlusive resolution.

I think my older video card was better. Even I have more RAM , DDR5 ram and new motherboard now. Things was better , but I don't have formated my windows yet , because I need to make a backup and the system runs with both old and new motherboard drivers.

So might new format will refresh my computer's performance.

450 frames before was very much , but when the game becomes bigger and more loops and other things works in background , then the game starts loosing the frames per second , so if you have 4500 frames later on when the game become big , and there are a lots of monsters , loops , timers , mechanisms which runs simultaneously, the performance drops.

Now I have seen in desktop resolution even and 90 frames per second when I had 1500 in the past with my old video card.

Some time I will make a fresh format in my operating system. With my new hardware , the strange is , I have 250 Frames in desktop resolution and in full resolution.
When I use set display mode function then I have only 57 frames per second.

So the full desktop resolution is the best for now , for my new video card at least.
Takis76
21
Years of Service
User Offline
Joined: 9th Apr 2005
Location: Greece
Posted: 2nd Jul 2011 02:46
I played a little with function Sync Sleep 500 , and my frames per second increased from 200 - 300 little better now.

I will make some experiments until have the best frames per second for my new hardware but I am not expecting 4500 frames anymore.

In my work , with one ATI Radeon , older , I have 1400 frames

some times older hardware is better.

Login to post a reply

Server time is: 2026-07-10 17:19:07
Your offset time is: 2026-07-10 17:19:07