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 / DarkBasic Pro Application Crashes when pressing Windows Key

Author
Message
Rylex
21
Years of Service
User Offline
Joined: 5th Nov 2002
Location: Germany
Posted: 17th May 2013 16:34 Edited at: 17th May 2013 16:37
Hi everybody,

I've searched the forum a bit but didn't found an answer so far.
At the moment I'm using the latest version DarkBasic Pro 7.62.
Enabling/disabling plugins (like Matrix1Util-Plugins) doesn't make a difference.

When I run a DarkBasic application/game and press the Windows Key while the application is running, the application will crash when I try to change back to it and continue gaming. This happens with 3D and 2D projects.

My system:
Windows 7 - 32Bit - 4GB RAM (3 GB available)
nvidia Geforce 450 GTS 1024MB
Intel Core i5 680 3,6 GHz

I have completely switched UAC off and I'm working as admin.

Anybody has the same problem or is this "normal" for DarkBasic Pro?
There still seem to be lots of bugs especially with the "new" editor...

I know you can disable system keys (at least you could in DarkBasic Classic), but from time to time it might be important to pause a game and shortly go back to the desktop. With DarkBasic Classic - this never was a problem.

Can anybody help?

And please excuse my bad English.

Rylex
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 17th May 2013 17:12
I think this is standard DBPro behaviour.

It might depend on the project Screen Type setting you are using. I usually use "fulldesktop" and don't get this problem. If I change to "fullscreen" then I get the symptoms you describe. I've never really understood why one works and the other doesn't.

Here's the test code I've just used:

Rylex
21
Years of Service
User Offline
Joined: 5th Nov 2002
Location: Germany
Posted: 17th May 2013 18:18 Edited at: 17th May 2013 22:15
Hi Green Gandalf,

thank you very much for your response. It is exactly like you wrote.
At "fulldesktop" everything runs fine.

The problem is I don't want window mode and fulldesktop resolution is too large. I would like to start my game 640x480x16bit. At the main menu you can select the screen resolution...

When I switch to "fullscreen" the application crashes when using Alt+Tab or Windows key. This is indeed a very big problem, because it makes DB Pro nearly useless for me.

Only possibility would be to turn off the windows and Alt+Tab keys.
If anybody has another idea or could help with this effect ... then please post your ideas.

As long as this bug is not fixed I would stay with DarkBasic Classic 1.13... which seems to be far more stable even though there are lots of effects missing at it is very sloooooooow. Even Classic 1.21 is bugged so 1.13 seems the best version until DB Pro is fixed.

Well... over all those years (from what I've read on this forum) DB Pro was never really stable and final but more beta. I still like the Pro version but this bug is a big fail.

Have a nice weekend and thanks again!

Rylex

Edit:
I really would like to hear how you handle DarkBasic Pro fullscreen applications. Do you just disable the escape and systemkeys? And what do you do if a background program gets the focus and minimizes the DarkBasic Pro application?
Any feedback is highly appreciated!
Anigma
13
Years of Service
User Offline
Joined: 25th Mar 2011
Location:
Posted: 17th May 2013 22:53
Oh where oh where do I BEGIN with this bug...

I had a game written and ready for QA with a major casual portal - one of the largest if not THE largest online PC games portal there is. Sent it off for QA and within a day we got the FAIL report back. The tester reported a crash when alt tabbing the game. Show stopping failure. I had to completely rewrite the game in another engine so we could meet our deadline with the portal or they were going to cancel the project. It was a nightmare.

Here's what you have to do, and it's hit or miss at best: You have to 1. detect that DBPro lost the focus and STOP your game loop in it's tracks right then or else it's "El Crashola", then 2 you have to detect when DBPro has the focus again, then 3 you have to reload all your graphics resources. ALL of them. Because Windows flushed the video memory DBPro used and unlike other "Professional" game engines, DBPro does not retain it elsewhere and handle this problem for you. So you have to load all your images, all your models, all your sprites, all your everything that was on the screen and put it all back just the way it was before the user (oh those darn users... who raises such stupid people anyway?) alt tabbed away from your creation.

This is something that desperately needs to be fixed, TGC. DBPro is hands down the easiest 3D programming tool I have ever used and I love it ever so much, but I can never, EVER, actually release a marketable title with it because it won't pass QA with any of the major portals. Please TGC, if you do nothing else this year, please, I beg you, please.... fix this bug! Other products such as Multimedia Fusion (that's what I ended up using to rewrite my title - thank GOD it was a 2D game and I could rewrite it) handle this out of the box - OUT OF THE BOX, TGC.... ahem.

Anyway, yeah. That's pretty much how it is. Sorry but there's no quick or 100% reliable way to fix this. I should know - I tried.

It compiled! Ship it!
Mage
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 17th May 2013 23:21 Edited at: 17th May 2013 23:41
This is how you write your program in DBP so it won't crash.
http://forum.thegamecreators.com/?m=forum_view&t=202959&b=1

Everything you need is there.

Quote: "I had a game written and ready for QA with a major casual portal - one of the largest if not THE largest online PC games portal there is. Sent it off for QA and within a day we got the FAIL report back"

Thanks for providing a commercial perspective on this. We can use a lot more of that around here. In any case, too bad we didn't speak sooner. Might have saved you some grief.

Quote: "Anyway, yeah. That's pretty much how it is. Sorry but there's no quick or 100% reliable way to fix this. I should know - I tried."

I completely 100% solved this problem and posted a link to a working example above.

Anigma
13
Years of Service
User Offline
Joined: 25th Mar 2011
Location:
Posted: 17th May 2013 23:47
That's pretty cool! I wish I had seen that too but then again this was a few years ago that this happened. I noticed you were in window mode in your code snippet, does this also work in full screen modes?

If not then that still wouldn't have helped. One of the requirements of this particular portal was that the game start out in full screen/non windowed mode.

Thank you for sharing this info! I'll be sure to make use of it when I create my next game.

It compiled! Ship it!
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 18th May 2013 01:20
Quote: "but I can never, EVER, actually release a marketable title with it"


Just to emphasise the point several people have done exactly that.
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 18th May 2013 02:28
you can select 640x480 fulldesktop mode, it just stretches it to fullscreen. I never use fullscreen exclusive mode in my games and have no issues with various resolutions in fulldesktop.

I live for video games! (And beers, and football, and cars!)
See what I live for here: [url]http:\\www.TeamDefiant.co.uk[/url]
Mage
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 18th May 2013 03:20
Quote: "That's pretty cool! I wish I had seen that too but then again this was a few years ago that this happened. I noticed you were in window mode in your code snippet, does this also work in full screen modes?"

Yes it works. You can use fullscreen desktop mode.

Rylex
21
Years of Service
User Offline
Joined: 5th Nov 2002
Location: Germany
Posted: 18th May 2013 13:06 Edited at: 18th May 2013 13:07
Thank you everybody for this information.

@Mage:
Your solution example sounds very interesting. I'll try that. From what I understood this only works in Fulldesktop mode? You wrote "Fullscreen desktop mode"...

I would need real Fullscreen mode. Does this work as well?

I tested Fulldesktop mode yesterday before I posted here. What I experienced:
When I changed the screen resolution to 640x480 in my program code then image aspect ratio still was 16:10 (I have a widescreen monitor). However it should have been 4:3. And the detail level didn't look like 640x480 but I'll have to test this again. It just looked like the desktop resolution 1920x1200 (on my system). Regardless of what I wrote in my program it always looked like 1920x1200.

I'm not able to use my programming computer this weekend because I'm not at home. I'll test this again but I really hope normal fullscreen mode (not desktop fullscreen) works with your interesting example code!

Best wishes and I'll keep you updated!
Thanks again to everybody for your help and time!

Rylex
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 18th May 2013 15:52
You could call this command just after setting the screen resolution:


This will change the aspect of your scene to match your display, and not be stretched as it currently is.

I live for video games! (And beers, and football, and cars!)
See what I live for here: [url]http:\\www.TeamDefiant.co.uk[/url]
Rylex
21
Years of Service
User Offline
Joined: 5th Nov 2002
Location: Germany
Posted: 18th May 2013 18:20
Quote: "This will change the aspect of your scene to match your display, and not be stretched as it currently is."


Thank you very much!
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 18th May 2013 18:25
No worries.

I live for video games! (And beers, and football, and cars!)
See what I live for here: [url]http:\\www.TeamDefiant.co.uk[/url]
Mage
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 18th May 2013 19:30 Edited at: 18th May 2013 19:40
Quote: "@Mage:
Your solution example sounds very interesting. I'll try that. From what I understood this only works in Fulldesktop mode? You wrote "Fullscreen desktop mode"..."


My example works in all modes. Full Desktop and Windowed Mode.
There is no difference, its the exact same issue. Screen mode does not matter.

http://forum.thegamecreators.com/?m=forum_view&t=202959&b=1

Rylex
21
Years of Service
User Offline
Joined: 5th Nov 2002
Location: Germany
Posted: 18th May 2013 23:41
Thank you Mage!

My problem would be that I use a matrix for an endless landscape mode and that this matrix might be deleted when the screen loss occurs. If I understood this right? Or are matrix objects not concerned?
Because that would mean I would need to save the matrix completly and reload it again exactly like it was before. That would be difficult because it should be randomized. I could use an array MatrixHeight(x,y) to store the information but I really would need to check this out. I'll try it on Monday/Tuesday when I get home to my programming computer!

Best wishes and thanks for your patience!

Rylex
Mage
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 19th May 2013 01:09 Edited at: 19th May 2013 01:10
You have the right idea.

More Info On Your Issue:
The images, objects, etc are only deleted on the first sync command after the screen is restored. The game runs normally while you are tabbed out. My example checks after each sync and reloads everything if needed. This is a major point of confusion so keep this in mind when looking at the example..


Rylex
21
Years of Service
User Offline
Joined: 5th Nov 2002
Location: Germany
Posted: 21st May 2013 00:41 Edited at: 21st May 2013 00:41
I just wanted to share this short comment from Richard Vanner about the crashing bug. I wrote that this is very frustrating for many users... and perhaps we can hope for this update!

Quote: "Hi,

Just to let you know that Lee says he'll probably be fixing this during FPSC Reloaded development but until that project is done we can't promise anything for now.

Rick"


Best wishes

Rylex
Stab in the Dark software
Valued Member
21
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 21st May 2013 03:54
Since this is not a bug with DBPro I doubt that Lee will even consider it.

The problem of a "Direct3d lost device" is not a bug or flaw in DBpro.
Dbpro is a programming language. It is not a complete game engine that handles all of
the resource management for your application. You the programmer must write the code
to handle this. If you write an application in any other language that uses DirectX (e.g. C++/C#)
you still have to write the resource management code to handle the lost device.


[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.
Burning Feet Man
16
Years of Service
User Offline
Joined: 4th Jan 2008
Location: Sydney, Australia
Posted: 21st May 2013 05:01
Although Windows Key & Alt Tab have never bothered my projects, I, like everyone else here, bumped into the CTRL ALT DEL lock computer crash when first learning DBpro.

Here is my very dumbed down example of how to fix this problem. In my opinion, this crashing "problem" actually forces good coding habits! So learn how to deal with it.

My current method is nesting a "While - Endwhile" Object check in a "Do --- Loop". If the test object goes missing then the "While" loop is exited and the "Reload_Media" function is executed to restore the game media.



It'd be great to see forum members expand on this, or show their own technique of restoring a game from a would-be crash! Happy coding everyone ^_^

Help build an online DarkBASIC Professional help archive.
DarkBasic Help Wikia
Mage
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 21st May 2013 11:32 Edited at: 21st May 2013 11:56
Quote: "Since this is not a bug with DBPro I doubt that Lee will even consider it."

That's a shame. However if he did and it wasn't instantaneous then I'd rather him not since having the app oddly freeze for half a minute or so would be worse.

Quote: "Here is my very dumbed down example of how to fix this problem. In my opinion, this crashing "problem" actually forces good coding habits! So learn how to deal with it."

This is a solid simple example. For a small program this works. However for a large program this begins to get awkward.

You have nested a while loop inside of a do loop. You don't need to do this. Just use an If statement after the sync to check the test object and reload the media. It would remove one of the loops and be much simpler.

You are creating a cube as a test object. You are checking for its existence as a means to detect when to reload your media. Try using Make Image. Using a 1x1 image is simpler and just as effective.

Another issue is load time. In this example load time is non-existent. To your credit this is just a simple example. However if load time was really long like 2 minutes, you really don't have a system in place to gracefully accommodate this. This system would remain frozen, long enough for the player to suspect the game had crashed. A loading screen would be better, an animated one would be best.

A loading screen is an important point to make. You need to look at this from the players perspective. You need to tell the player what's going on. "Hey I didn't crash I'm loading". Looking at a completely static loading message for a short while makes people wonder if the game crashed while loading. So animating the screen is almost always a necessity since it lets the player know the gears are still turning and makes the game look better. The real problem lies in protecting the load screen from further screen loss. This is an issue not even addressed by your example.

Other then that it looks pretty good.

Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 21st May 2013 18:33
Hmm? Why don't I see noticeable reloading times with commercial games in this situation? How do they deal with the problem?
Brendy boy
18
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 21st May 2013 21:24 Edited at: 21st May 2013 21:26
Quote: "How do they deal with the problem? "

they don't reload assets. They keep a copy of them in memory in a non directx format (which doesn't get lost) so when device lost happens they just recreate everything from memory.

Dbpro also keeps a copy of vertices and indices in a non directx format so that can be recreated quickly, it just needs to be coded in and that currently isn't the case.

Also, in directx you can create assets in several different memory pools. Some of them can "survive" device lost event but assets created in them can't be modified during runtime (if a remember correctly).

Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 21st May 2013 23:14
Interesting. Thanks.
Mage
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 21st May 2013 23:49
Quote: "Dbpro also keeps a copy of vertices and indices in a non directx format so that can be recreated quickly, it just needs to be coded in and that currently isn't the case."

This doesn't surprise me given that every game I have ever played handles this instantaneously and fluidly to the point where I would dare to suspect they aren't reloading anything at all.

Another Issue:
The current methods available to us allow us to detect when to reload media. If you lock windows/ switch users/ tab out/ close laptop screen, the game continues to operate normally. On the first sync when the screen is finally restored the game assets are deleted and the detection occurs and you begin to reload. It would be nice if there was a method to detect when the screen really is in an unused state so I can apply my standby mode methodology and put the program to sleep or in a minimal networking capable state. It would beat having the program run full blast while the laptop is closed or tablet is idle.

http://forum.thegamecreators.com/?m=forum_view&t=202812&b=1

James H
16
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 22nd May 2013 01:43
Meshes and imageblocks appear to still be available when device is lost, this may not be ideal but seems to work;

29 games
18
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: not entirely sure
Posted: 22nd May 2013 02:30
This might be a question to ask Jordi as he seems to have solved this for Future Aero Racing.

You can alt+tab out of the game then alt+tab back into it and the game is instantly there. My guess is that he's used / made some kind of external plug in to do this but it does show this is not an insurmountable problem.

one of these days I'll come up with a better signature
Ortu
DBPro Master
16
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 22nd May 2013 05:55
Quote: "It would be nice if there was a method to detect when the screen really is in an unused state so I can apply my standby mode methodology and put the program to sleep or in a minimal networking capable state. It would beat having the program run full blast while the laptop is closed or tablet is idle."


why not just check the time since last user input? if they havent done anything in x amount of (reasonable) time, assume afk and go to standby

Shazam!
Mage
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 22nd May 2013 08:04
Quote: "why not just check the time since last user input? if they havent done anything in x amount of (reasonable) time, assume afk and go to standby"

This was all along running through my head as a fallback option. Two problems... I don't want to interrupt players that are simply perched somewhere waiting for some event to occur like a baddie to walk by. The analog controls on a literal value level are often jittery when idle. Not an impossible situation but they make using a timeout based method sort of suck. I want it to perform better then that.

Burning Feet Man
16
Years of Service
User Offline
Joined: 4th Jan 2008
Location: Sydney, Australia
Posted: 22nd May 2013 08:46
I wonder, when tracking the mouse via User32.DLL, what status is reported when CTRL ALT DELETE is hit. I suspect the mouse will report as outside the DBPro window, and then from there, you could pause your game until the user returns the mouse to the active game session.

I will try to find time to post some example code tonight.

Help build an online DarkBASIC Professional help archive.
DarkBasic Help Wikia
Mage
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 22nd May 2013 11:31 Edited at: 22nd May 2013 11:33
Quote: "I wonder, when tracking the mouse via User32.DLL, what status is reported when CTRL ALT DELETE is hit. I suspect the mouse will report as outside the DBPro window, and then from there, you could pause your game until the user returns the mouse to the active game session. "

I have created the solution. You are close though. Use User32.dll to track the Active Window Handler. In the beginning of the program record the games handler. Then periodically check the active handler. If they don't match, then slip into Standby Mode. Have Standby Mode periodically check again. If they match then slip out of Standby Mode.

I'll add a separate post about this with a run through.

Rylex
21
Years of Service
User Offline
Joined: 5th Nov 2002
Location: Germany
Posted: 22nd May 2013 14:44 Edited at: 22nd May 2013 14:50
Hi Mage,

Sorry if this is a bit offtopic but I want to thank you very much for this interesting sleep/standby code.
I have one question concerning the frame rate: In your examples you set sync rate to 30 frames, which worked fine for me but stresses the CPU. But I get a clear 30 fps.

This is the lower example SyncScreen using Ian M's plugin.
This produces 21 frames/sec for me in the last two energy saving loops.
Shouldn't it be able to get 30 fps as well?



The code from the top of your thread showed even less frames/second.
On my system I got 11 or 12 fps using the top example.



My real question is how I could set this up to get real 30 fps. Of course I could reduce the scFrameTime from 33 to another value. Is there an easy way to get real 30 fps with this CPU friendly functions?

And I wanted to ask if this is the final/optimized version of the CPU friendly code? I really like it because I love "cold" computers that are not running at 100%. I absolutely share your thoughts about desktop computers that should work energy efficent!!

One more thing about recognizing if the game crashed:

There is a method to detect, when the screen is not working correctly if you switched out with windows key or alt+tab.

SCREEN INVALID
This command will return a one if the application has been switched out and back in.

You wrote that this doesn't seem to work correctly? Here in your thread:

http://forum.thegamecreators.com/?m=forum_view&t=202959&b=1

Thanks for all your great coding examples!

Best wishes

Rylex
Mage
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 22nd May 2013 15:22 Edited at: 22nd May 2013 16:05
Quote: "This is the lower example SyncScreen using Ian M's plugin.
This produces 21 frames/sec for me in the last two energy saving loops.
Shouldn't it be able to get 30 fps as well?"


That's hard to say, you just need to adjust the timing in the code section. The timer being used is the default (precise to only 1ms) timer. So there's rounding errors and such going on there when it reports time. Not a big deal. Just turn 33 to 32 or some other lower number. Also our discussion at the time revealed that DBP Bugs/Quirks were causing some of the examples to interfere with each other. So try and run the examples on their own completely separately for best results.


Quote: "My real question is how I could set this up to get real 30 fps. Of course I could reduce the scFrameTime from 33 to another value. Is there an easy way to get real 30 fps with this CPU friendly functions?"

Yeah, use Ian M's Plugins Hi Resolution Timer. These demos didn't include it to make them more accessible to people. Also you'll probably find for most situations 29-31 fps is close enough.

Quote: "The code from the top of your thread showed even less frames/second.
On my system I got 11 or 12 fps using the top example."

Yeah bug time buddy sorry. Here's a code update. You need a Sync Sleep 0 in there to restore things. Would probably change 33 to 32 also.


Quote: "SCREEN INVALID
This command will return a one if the application has been switched out and back in.

You wrote that this doesn't seem to work correctly? Here in your thread:"


Yeah it's for most people a pretty useless command. This is what it does: You minimize the game. It does nothing. You restore the game window, and just once it returns a 1. So if you minimized the game for 100 years, it would do nothing the entire time. You could say hey when it returns a 1 I know to reload everything. But It will return 1 even if you don't need to. Reloading when you don't need to sucks. Also i'm pretty sure it wont return anything if your GPU driver crashes and recovers. There's probably other situations it bails on you also. So people instead test to see if their media has been deleted/flushed by loss of screen.

Quote: "And I wanted to ask if this is the final/optimized version of the CPU friendly code? I really like it because I love "cold" computers that are not running at 100%. I absolutely share your thoughts about desktop computers that should work energy efficent!!"
Yeah well my loud wailing Gaming PC overheats. My Laptop roasts my legs, and dies on me. Necessity is the mother of all invention.

Quote: "Thanks for all your great coding examples!"

Yeah np, great to know people are reading them.

Rylex
21
Years of Service
User Offline
Joined: 5th Nov 2002
Location: Germany
Posted: 22nd May 2013 16:17
I have to ask you again and I hope I don't annoy you. First concerning the speed calculation:

Quote: "That's hard to say, you just need to adjust the timing in the code section. The timer being used is the default (precise to only 1ms) timer. So there's rounding errors and such going on there when it reports time. Not a big deal. Just turn 33 to 32 or some other lower number. Also our discussion at the time revealed that DBP Bugs/Quirks were causing some of the examples to interfere with each other. So try and run the examples on their own completely separately for best results."


When I change the number from 32 to 3 I get 33 fps. See below:



My question now is if this speed will be valid for all CPUs/GPUs if they can handle it? If they are too slow they get less fps that is OK.

I mean sync rate 30 means a max. of 30 fps and that worked.
I just want to make sure if I use this code and get 33 fps now that nobody else later gets 76 fps and would play the game too fast. I hope you understand what I mean.

Now for the topic with the reloaded media again. I tried your example but it didn't work for me.

http://forum.thegamecreators.com/?m=forum_view&t=202959&b=1

The example itsself worked even on Fullscreen. I included it into my programm and so far it works as long as I don't use a matrix. I have matrix 1 and matrix 2. If I try to use them it will not work.

Have you ever tried this solution with a matrix or two?

Here take this as an example:



I create these two inside your function Game_LoadScene.
Then I press windows key or alt+tab and it crashes. It crashes every time until I completely remove it. Then it works with normal objects.
Am I doing something wrong?

Best wishes

Rylex
Mage
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 22nd May 2013 17:37
Quote: "My question now is if this speed will be valid for all CPUs/GPUs if they can handle it? If they are too slow they get less fps that is OK."

Certainly. The timing is off by up to 1ms since it's just the regular timer but that's usually not a big deal.

Quote: "I just want to make sure if I use this code and get 33 fps now that nobody else later gets 76 fps and would play the game too fast. I hope you understand what I mean."

Yes. The code will keep everyone at just about 30fps.

Quote: "I create these two inside your function Game_LoadScene.
Then I press windows key or alt+tab and it crashes. It crashes every time until I completely remove it. Then it works with normal objects."

Unlucky. Seems DBP crashes when ever a matrix is loaded and all of the game media is flushed. It's not crashing on any line number, it's an unhandled exception. This could be a DBP bug. Hopefully it isn't, hopefully someone posts a solution. However I tested it, and it doesn't look like a matrix can be recovered after screen loss. Wish I had better news. You'll probably have to use another type of terrain.

Mage
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 22nd May 2013 17:54


Even this program will crash. I don't think there's any way to recover from screen loss if you have a matrix loaded. DBP just completely collapses.

Rylex
21
Years of Service
User Offline
Joined: 5th Nov 2002
Location: Germany
Posted: 22nd May 2013 18:49 Edited at: 22nd May 2013 18:51
Thank you Mage for all your effort and testing!

Quote: "Yes. The code will keep everyone at just about 30fps."


OK, then I understood and if it always runs exactly the same speed on all machines (except the much slower ones) then this is indeed a perfect solution. Thanks a lot! I love it!

Quote: "Even this program will crash. I don't think there's any way to recover from screen loss if you have a matrix loaded. DBP just completely collapses."


Okay so far so bad. I understood the reloading of the objects and media files, but this DB Pro bug concerning the matrix is ridiculous!
I could live with re-creating the matrix and trying to reload my previous state but only a crashing DB Pro program ... really sucks.

Thank you for confirming my problem. I really hope that Lee or whoever is in charge of DB Pro programming can fix this bug. However they will not find the time to do so in the near future... and perhaps a smart person will say again: It's not a bug.


Why I needed the matrix for my program was because I wanted to create a completely randomized terrain for my boat game. You can steer a boat through a canyon that is a randomized matrix and you mustn't hit the cliffs or the landscape. The boat gets faster during the level so there's lots of terrain passing you by. I think I would not be able to do this with the advanced terrain function, am I?

I programmed the first version of the game back in 2001 using DarkBasic Classic. In 2002 I changed the game and added a few extra features. It was a very simple game with simple graphics and very simple gameplay. I know the game is ridiculous compared to all your (everybody here in the forum) new games...

Here are some screenshots (from 2001/2002):
http://theboat.rylex.de/theboat_bilder.htm

You can still download it and it even runs using Windows 7 but you need to save the file d3drm.dll into the game folder. The site is German but the game is English...

However it has been downloaded lots of 1000 times over all those years and I still get feedback from people playing this old game. That's why I wanted to re-program it after 11 years.

I wanted to use DarkBasic Pro because I could use more models and create a smoother landscape with more matrix tiles and more detail. Because the detail was very very low... but the game was fun, however.

If I may ask you: Do you see any other way instead a matrix to achieve such an endless fast scrolling landscape with cliffs and hills and so on?
If you say now use heightmaps and advanced terrain, then I would need to generate a few complete landscape squares with heightmaps and put them together? A canyon needs to be on the left and right side of the landscape...
But how do I randomize those heightmaps? I don't want to create lets say 500 heightmaps for the whole game.

Just wondering what to do now. Perhaps the only way to go on is using DarkBasic Classic. This doesn't crash with a matrix and the windows key.

Best wishes

Rylex
Ortu
DBPro Master
16
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 22nd May 2013 21:25 Edited at: 22nd May 2013 21:26
Quote: "Why I needed the matrix for my program was because I wanted to create a completely randomized terrain for my boat game. You can steer a boat through a canyon that is a randomized matrix and you mustn't hit the cliffs or the landscape. The boat gets faster during the level so there's lots of terrain passing you by. I think I would not be able to do this with the advanced terrain function, am I?"


you can randomize/modify a mesh with the vertexdata commands, blitzterrain is also a good and very popular plugin which can handle realtime terrain manipulation. it has free and paid versions, so you can give it a try before you buy

Shazam!

Login to post a reply

Server time is: 2024-04-16 23:32:45
Your offset time is: 2024-04-16 23:32:45