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 / ctrl alt del / windows key crash

Author
Message
tiffer
12
Years of Service
User Offline
Joined: 6th Apr 2006
Location: Scotland
Posted: 8th May 2018 20:07
Hey,

Don't know if anyone has a convenient fix for this. Sense using Dark Basic on a Windows 10 machine one of the problems I've noticed is if I use the ctrl alt del keys or the windows key for any reasons my game crashes with image at line xx does not exist wherever the game is trying to paste a pre loaded image. I know for a fact that any time I've played a game recently I've found myself wanting to minimise to open chrome to look for a walkthrough or something like that but if it's going to cause an embarassing crash. Does anyone know if there's a fix for this?
tiffer
12
Years of Service
User Offline
Joined: 6th Apr 2006
Location: Scotland
Posted: 8th May 2018 20:17
Sorry for the repeated post.

I see there is no real fix for it other than checking if the image exists and if it doesn't then reloading it again. Bit rough but might have to do.
tiffer
12
Years of Service
User Offline
Joined: 6th Apr 2006
Location: Scotland
Posted: 8th May 2018 20:31
if image exist(1) then xcenterimage(coordconv(50,resx),0,1) else gosub build_library
Ortu
DBPro Master
10
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 9th May 2018 02:04
In a full screen exclusive directX application, losing focus will result in a lost d3d device, which includes a loss of loaded media. Yeah, the only thing you can do is detect the loss and reload the media.

Windowed mode, or full desktop does not suffer from this
http://games.joshkirklin.com/sulium

A single player RPG featuring a branching, player driven storyline of meaningful choices and multiple endings alongside challenging active combat and intelligent AI.
Mage
11
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 10th May 2018 05:39
This is a solution to the problem.
https://forum.thegamecreators.com/thread/202959
gamehazer
User Offline
Joined: 2nd May 2018
Location:
Posted: 10th May 2018 18:47
Mage there is a problem with his code in your link,

There is a make image command that does not work in dark basic pro so I cant even cheek the demo, but its a good concept.
Mage
11
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 17th May 2018 03:13
You are not correct. The code only works in Dark Basic Pro, and requires no plugins. If that command does not work, then you need to download the update.

I also just checked the code (again) and the code works.
Ortu
DBPro Master
10
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 17th May 2018 04:31 Edited at: 17th May 2018 04:37
Make Image does not appear to be documented in the native command help files. It is present in Matrix1 from Matrix1Util_33.dll

https://forum.thegamecreators.com/thread/85209
http://games.joshkirklin.com/sulium

A single player RPG featuring a branching, player driven storyline of meaningful choices and multiple endings alongside challenging active combat and intelligent AI.
gamehazer
User Offline
Joined: 2nd May 2018
Location:
Posted: 17th May 2018 18:46
So then to make mages demo run I need the Matrix1 from Matrix1Util_33.dll??
Ortu
DBPro Master
10
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 17th May 2018 22:11 Edited at: 17th May 2018 22:12
Matrix1 is a set of dlls, the make image command is specifically in 33

You should install these in any case as they really extend the language with some great functionality

But, looks like you can alternatively just use the Game_CreateImage function included in Mages snippet
http://games.joshkirklin.com/sulium

A single player RPG featuring a branching, player driven storyline of meaningful choices and multiple endings alongside challenging active combat and intelligent AI.
gamehazer
User Offline
Joined: 2nd May 2018
Location:
Posted: 18th May 2018 04:47
Hi,

Yea, I know all about Matrix1 utilities,

I download them and installed them , The code for our game had many errors because his dll's created new commands.

A lot of my commands mix matched with his new commands. So had to reinstall dark baisc pro.

When we are finished with this game I will update them.

Mage
11
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 19th May 2018 07:18 Edited at: 19th May 2018 08:50
I had no idea that I had the matrix 1 utilities installed. I must have just typed that command out and had the editor accept it as a command.

I updated the code, Matrix 1 Utilities is no longer needed.
https://forum.thegamecreators.com/thread/202959

All that was needed was to replace the make Image command with a trivial get image command.

As far as I am aware this is by far the best example on the forums covering this topic. I researched the issue, and basically set out to lay the issue to rest completely. The entire demo can just be pasted into the editor and run. It tells you everything you need to know. No filler. You can even safely animate your loading screen which is a detail that other examples don't even try to address, let alone properly solve the problem.

Rant:
Many other examples on the forums are badly designed. Any example containing SYNC SLEEP or SCREEN INVALID is an immediate sign the author doesn't know what he's talking about. This is because he doesn't know that the game assets only get deleted on the first SYNC after the screen is recovered (tiny exception in some cases were deletion fires 2 times). So he thinks that he can just suspend the program while the laptop lid is closed or app is minimized. Generally speaking it also means there are bad designs elsewhere in the demo also. I mentioned that nobody else animates a loading screen when reloading. This is because it is hard, if the screen is lost again while reloading then the program can crash, so other examples simply don't do it. Not only is this bad but it causes another problem. What happens when your game takes 2 minutes to reload and you accidentally minimize mid way? Other examples load the full 2 minutes, detect the problem and load the full 2 minutes again, while the player wonders if the game has crashed. If you animated the loading screen, it would immediately drop out of the reloading and start over right away. Plus the user would know the game didn't crash. So dare I say it, pretty much every other example (for this issue) on the forums is crap. If you read my demo and understand how it works, then you'll read the other examples and see they are crap too. They straight up have sections of code in them that are pointless, and don't do what they are designed to do. Nevertheless there's many brilliant contributors on these forums. As ranty as I can get I'm not Mr. Perfect either as seen above where I made a small correction.
gamehazer
User Offline
Joined: 2nd May 2018
Location:
Posted: 19th May 2018 19:36
thank you Mage

I guess I could have just updated it to get image myself, lol

But I was to busy to think about it, at any rate thank you.

I will let you know if it works.
gamehazer
User Offline
Joined: 2nd May 2018
Location:
Posted: 19th May 2018 20:32
Ok, ok,

This worked good

My question is I need to reload each level that crashes

so I need to load all my levels objects and images between each loop?
Mage
11
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 19th May 2018 21:35 Edited at: 19th May 2018 22:11
I have not explored every type of asset that gets deleted. So sounds might get deleted or might not. Loaded shaders maybe also. You will find out fairly quickly though when you test the recovery.

gamehazer wrote: "so I need to load all my levels objects and images between each loop?"

Potentially. Basically every time you call a SYNC command, the first thing you do next is check if everything got deleted. Reload if needed.
This means you need to keep track of what needs to be loaded. Be organized.

SYNC
If RecoveryMode_ScreenValid() = 0 Then RecoveryMode_Main()


Inside the guts of the recovery code if it decides that a reload is actually to happen it calls this to actually do the reloading. You would replace this with your own loading fuction.
Game_LoadScene()

This function also periodically calls a function that draws a loading screen of some sort. It aborts the loading if the screen is lost during the reloading.

Game_DrawLoadScreen()
If RecoveryMode_ScreenValid() = 0 Then ExitFunction

If the reloading was aborted because the screen was lost again, then the code will loop back around and start the reloading again.



I also recommend wrapping SYNC in a function, and calling that function instead of SYNC directly.

Function SafeSync()
SYNC
If RecoveryMode_ScreenValid() = 0 Then RecoveryMode_Main()
EndFunction

This will ensure you are performing these checks each time SYNC is called. If a change is needed you simply change the function. Also you don't add extra duplicated lines of code all over your program.
gamehazer
User Offline
Joined: 2nd May 2018
Location:
Posted: 19th May 2018 21:48
I get it

That's fairly simple and you made it easy for us.

Thanks

Its still pretty stupid that our dark basic programes needs to reload after hitting the ctrl alt del any how.

I wish there was a way they could just fix it to where there is no crashes when it happens.

Other programes out there do not crash so why does dark baisc pro crash or loose information?

At any rate I thank you for your time.
Ortu
DBPro Master
10
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 20th May 2018 02:50
As I said, it's not a dbpro issue, it's a DirectX issue and affects anything built on DirectX running in full screen exclusive mode.

Many games don't actually run in exclusive mode and dont worry about it. Change your project settings to 'full desktop' problem solved. (though some are obsessed with having 'true fullscreen' which is fullscreen exclusive, and windowed mode has been known to have issues with playing videos outside of the window with some codecs)
http://games.joshkirklin.com/sulium

A single player RPG featuring a branching, player driven storyline of meaningful choices and multiple endings alongside challenging active combat and intelligent AI.
gamehazer
User Offline
Joined: 2nd May 2018
Location:
Posted: 20th May 2018 03:33
I put my program at full desktop just to test it a week ago after reading what you posted and it still crashed.

No matter what I put it at it crashes.

I did not know this was a direct x problem, that's crazy.

I even put my screen to windows mode and it still crashes.

So I will use his code for sure.

Thanks for your help any how.
Mage
11
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 20th May 2018 06:57
Ortu is correct. I will just add a few things.

Full Screen Exclusive Mode is just the most obvious situation where this occurs, since it will happen if you minimize or tab out of the program. All the other windowed modes are affected too, just not that way. All of the modes are affected if you lock the screen, switch users, switch to Windows 8/10 tiled start screen, sleep the computer and restore, run another full screen exclusive program, and possibly change desktop resolution while they are running. There could be a few exceptions depending on the version of Windows.

As a separate issue, Ortu mentions windowed mode having bugs where AVI/MP4/MOV/MPG animations that should play embedded in the window can screw up and play in a detached window instead, or possibly crash the program due to codec issues. Using fullscreen exclusive mode forces the animations to play correctly embedded in the program on screen. This is what prompted me to make this demo in the first place. It was a pain in the ass that I could not tab out of my program without crashing it. I would often forget and crash the app losing progress in the game. So I made this demo to make that program not crash anymore. I have paid my dues trying to get complicated shader demos to work in games, where the demo was a mess to work with. So I always write demos that can be copy/pasted with minimal effort.

Login to post a reply

Server time is: 2018-08-18 23:08:38
Your offset time is: 2018-08-18 23:08:38