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 Discussion / DarkBasic\DarkEdit environment runs faster than built EXE

Author
Message
zazen2
19
Years of Service
User Offline
Joined: 28th Oct 2005
Location:
Posted: 28th Oct 2005 20:42
I am using DarkBasic 1.12 Enhanced.

When I Execute my program from within the DarkBasic IDE or DarkEdit, I get about 50 fps. When I build a regular exe and run the exe, its about half the speed, and drags along at 20 fps.

This is really annoying, because during development everything seems to flow along just fine, and then when you make the exe it runs at a terrible speed and looks awful.

This has been logged many times before, e.g:
http://forum.thegamecreators.com/?m=forum_view&t=57855&b=10
http://forum.thegamecreators.com/?m=forum_view&t=56499&b=10
http://forum.thegamecreators.com/?m=forum_view&t=35423&b=10
http://forum.thegamecreators.com/?m=forum_view&t=34692&b=10
http://forum.thegamecreators.com/?m=forum_view&t=13048&b=10

It seems that this problem is especially apparent when using 2D graphics. For example, my game uses PASTE IMAGE only and nothing else.

The explanation seems to be this:

Van B wrote: "Compiled exes run slower because the interpreter manages the memory footprint better than the code inside the compiled exe. Remember DBC is interpreted so nothing is really compiled, just tokenised - but when coding, DBC is in a good state of readiness for running your program, but when running an exe it's not so well prepared and the exe has to battle for resources more.
"


'bibz1st' has suggested that downgrading to v1.08 will speed things up because the built exes have less modules, but evidently v1.08 is not very easy to get hold of.

So, can someone please advise me of my options:

Would upgrading to the latest version of DBC help at all? I understand that v1.13 is available. Does it suffer from the same problem? How do I get an upgrade?

If I spend the money to upgrade to DarkBasic Progressional will that help, or does it also suffer from the same problem?

Is there a way to launch DarkEdit or the DarkBasic environment from the command line, so that it opens my program and runs it? (Obviously not as good as a standalone exe, but at least I'd be able to have a desktop icon that ran the game reasonably well)



Any help would be greatly appreciated. I've spent a few days solid writing a game and all my time will have been wasted if I can't get the thing to run at a respectable speed.
SimSmall
20
Years of Service
User Offline
Joined: 7th Aug 2004
Location: United Kingdom
Posted: 29th Oct 2005 01:21
If you have an nvidia card - try going to Display > Advanced then the Nvidia, and change system performance to high performance



I've messed about with thes settings quite a bit, and get quite good performance out of most things, perhaps try messing about with all of them, see if it makes it better...

Ultimately, this will only improve the exe on your machine, if run on other machines, without the nvidia optimizers - it may play slowly...

Otherwise, you are using sync rate 0 aren't you? I'd guess so if you get 50 fps, and the default sync rate (unmodified) is 40...

...maybe one day I'll finish a project
Me!
19
Years of Service
User Offline
Joined: 26th Jul 2005
Location:
Posted: 29th Oct 2005 11:18
several options

1)..download the last great update for classic if you don`t have it, that should help matters, you get some message about the demo expansion pack expiring but don`t worry about that.

2)..buy the expansion pack, this may or may not work, but it is cheaper than option 4

3)..techy type wild guess here, either make a huge memblock or load a massive bitmap and then immediatley delete it or delete it once the game starts in full (not sure if that would actualy make a difference), this should make your program grab itself a big chunk of memory that the rest of the program could make use of once it was released, might work and costs nothing

4)..buy pro, makes your code 5-50 times faster (depending on code), but you may have some small translation niggles since backwards compatability is not 100%

5)..maybe you could add something to the icons commandline to increase the task priority or memory usage, or if you are in XP then try running in win98 compatability mode (in properties)



Tyger software
blanky
20
Years of Service
User Offline
Joined: 3rd Aug 2004
Location: ./
Posted: 29th Oct 2005 14:00 Edited at: 29th Oct 2005 14:01
DB's 2D commands always have been much, much slower than it's 3D commands, partly due to a lack of optimisation and again partly due to the fact that (now) 2D is slower than 3D.

After all, our graphics cards only help accelerate the drawing of 3D, whereas with the drawing of 2D each pixel has to be pasted over the last pixel one-at-a-time in software.

Also, try putting 'Set Window On' at the top of your code (get rid of any 'Set Display Mode' lines); Does it go faster then?

Personally, I've never had any of these 'EXE-is-slower-than-inside-the-IDE' problems, and I recommend you use the free version of Fraps as an FPS counter rather than just the 'Screen FPS()', as it doesn't suffer from miscalculation due to multiple sync commands in loops. I half-wonder if it's just the screen fps() command that gets screwed up in EXEs...


[edit]Oh yeah, and upgrade to 1.13; It suffers from the same problems, but you get a couple more commands and you get a 30-day trial of the enhancement pack (if you haven't already got it) when you upgrade ^^.[/edit]
dab
20
Years of Service
User Offline
Joined: 22nd Sep 2004
Location: Your Temp Folder!
Posted: 30th Oct 2005 08:00
Yaay, my post is the first to be shown. So there really is no fix for this? This is what I'm getting out of this. (Gets out the blitz basic website to switch.... No just kidding). I guess, I'll have to learn to make 3d stuff with the shape of my grahics.

Mr Scarab
19
Years of Service
User Offline
Joined: 11th Jun 2005
Location: Kent, UK
Posted: 30th Oct 2005 09:31 Edited at: 30th Oct 2005 09:35
I have DBPro so here's maybe an idea. Write me a small test program and compile it under DB classic. Send me the exe and the source and I'll recompile it under DBPro and let you know the speed difference of the two. Just an idea.

I've also got DB 1.13 so maybe I could check it on there too.

Sig removed by Mod. Please do not use offensive language in your signature (sic).
Sven B
20
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 30th Oct 2005 10:28
The problem is that DBC compiles it's programs itself. And when exporting, it exports it to an exe that will be compiled by the computer itself.
However, this means that the 2 frame rates will never be the same. Andso usually slower.

DBP works different: everytime you comile it (F5), it creates a temporarely .exe file, wich will be directly compiled by the computer. Wich gives a realistic view of the frame rate.

Immunity and Annihalation makes Immunihalation...
zazen2
19
Years of Service
User Offline
Joined: 28th Oct 2005
Location:
Posted: 31st Oct 2005 20:12
OK, thanks for the suggestions.

Its interesting that some users do not get this problem. It is very noticable on my system. If you want to check out the problem for yourself, download the attached demo and run it within DarkBasic and then run it as an EXE. Its a demo of a pixel-scrolling 2d platormer.

For comparison purposes: My machine is a Toshiba Laptop with a Pentium 4m 2.0 Ghz processor, 256Mb Ram and an NVIDIA GeForce4 420 Go video card.

When I run the attached demo within DarkBasic, it shows an average milliseconds-per-frame rate of 31ms (i.e. each frame is taking 31ms to draw). When I make an EXE and run that, it runs at 50ms per frame. You can see with the naked eye that it is much slower.

SimSmall:
My NVidia card is already at max. And because the game is 2D, not 3D, I don't think the video card gets involved much anyway.
Yes I am using Sync Rate 0.

Me!:
I havent tried the upgrade or enhancements yet. I dont think the upgrade will make much difference, but maybe the enhancements will (what are they, btw?)
Making a huge memblock and deleting it did not make any difference.
Compatability mode did not make any difference.
Have not tried the task priority yet (how do you do that?)
I think DBPro may be my best option

blanky:
Set Window On just stops the game from working at all.
Its interesting that you have not had these problems. Can you run the attached demo and let me know what speeds you get?

Mr Scarab:
Thanks for the suggestion. If you could download my demo and try it in DBC, DBPro and the Exes from both, that would be really useful.


At the moment, it looks like forking out for DBPro is the best option. If anyone can run my demo in DBPro and tell me how fast it goes that would be very useful.


Demo of a pixel-scrolling 2d platormer attached >>
No resource files needed, just run the code.

Attachments

Login to view attachments
Mr Scarab
19
Years of Service
User Offline
Joined: 11th Jun 2005
Location: Kent, UK
Posted: 1st Nov 2005 23:10
I hate to be the bearer of bad news but in DB as an executable I get a time of around 65-66ms, in DBPro I get a constant 2ms. Hope this helps.

BTW it was a little faster when I ran it from the DB editor but not by much probably 64-65ms

Sig removed by Mod. Please do not use offensive language in your signature (sic).
zazen2
19
Years of Service
User Offline
Joined: 28th Oct 2005
Location:
Posted: 8th Nov 2005 01:24
Thanks Mr Scarab.

I went ahead and bought a copy of DBPro Online. The demo code now takes 5ms per frame - a six-fold improvement over DBC, and a 10-fold improvement over a DBC executable! (Although the red circle in my demo has disappeared for some reason. Wierd.)

If anyone else hits the same problem with DarkBasic Classic, here's my advice:

1) Buy DBPro (good solution, but takes cash)

2) Forget Exe's, and write a shortcut that launches DarkBasic and auto-runs your code.
On my machine, the shortcut is something like this:
Target: "C:\Program Files\Dark Basic Software\Dark Basic\DB.exe" -x <source file>.dba
Start in: <project folder>

That is, run the DB.exe passing in a -x and your .dba file name in the command line. Also sets the 'Start in' of the shortcut to the project folder containing the dba file. This works well, but obviously is non-distributable.

A couple of observations:

- on my PC, the slowness of DBC EXE's compared to running within DarkBasic is very very noticable. However some people do not get this speed difference at all, with the same code. Hence it may be hardware related in some way.

- I thought it might affect 2d games worse than 3d ones, but the 3d demos that I have tried also slow down drastically on my PC when running as built EXEs

Thanks for your help everyone.

Login to post a reply

Server time is: 2025-05-23 17:01:33
Your offset time is: 2025-05-23 17:01:33