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 / FPS drop problems

Author
Message
Danza
6
Years of Service
User Offline
Joined: 20th May 2014
Location:
Posted: 20th May 2014 22:16
Hello!

First I would like to say the DarkBASIC is an excellent product. Used it for my College coursework after a teacher recommended it and has helped me so much, including other languages, just games programming in general. Anyway, onto the problem.

I'm just writing a quick 3D engine in DB (I use it as a kind of design language at the moment as its very quick to build stuff, as I intend to use on another language). Everything 3D wise is perfect, Max FPS everything looking good. That is until I use text.

I like to track variables by printing them to the screen, but the problem is that when I print these few variables to the screen, 30 FPS is a struggle to reach. The question is why?

My computer specs are pretty good (can run a lot of high end commercial games/software with ease) and the college computers which have worse specs can run the game fine with variables printed :/

I can easily output the variables to a file but this is bugging me a bit. I just want to know if its a known bug or my code is flawed so I can learn from mistakes.

Thank you, Danza
LBFN
13
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 23rd May 2014 01:47
It seems odd that printing text on the screen slows it down. I typically do the same thing and have not had any speed issues related to text printing.

Have you tried running the program without printing any text to see how fast it goes (i.e. REM out all screen printing)?

So many games to code.....so little time.
BN2 Productions
16
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 23rd May 2014 12:05
One thing I have noticed is that the INK command can be very resource intensive and cause huge slowdowns if called every loop. Perhaps that's what's happening?

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
Danza
6
Years of Service
User Offline
Joined: 20th May 2014
Location:
Posted: 24th May 2014 16:02
Thank you for the suggestions!

When I run the program without text it's perfect. And also I have not used the ink command.
TheComet
12
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 26th May 2014 13:54
If you have text that doesn't change a lot, you can probably get away with printing it to an image, and pasting that image to the screen. That should be a lot faster.

Your mod has been erased by a signature
Van B
Moderator
17
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 29th May 2014 14:36
Would help if we could see your main loop, the text part at least. There are some things that you should avoid, like changing the text size in the main loop, but I don't think printing text should slow your engine down too much.

Maybe adding a debug toggle button would improve your workflow - like pressing a key to enable or disable the debug text. I'd also disable parts of it and see if I can narrow down any part that is causing more slowdown than others. I don't think text can be the whole problem.

I am the one who knocks...
Danza
6
Years of Service
User Offline
Joined: 20th May 2014
Location:
Posted: 3rd Jun 2014 12:47
Quote: "Maybe adding a debug toggle button would improve your workflow - like pressing a key to enable or disable the debug text. I'd also disable parts of it and see if I can narrow down any part that is causing more slowdown than others. I don't think text can be the whole problem."


This is what I have ended up doing. I was thinking that text isn't the only problem, as for my original 2d project I had substantial 2D commands and text and it was fine. I think I am missing something between using 3d and text.

Also, heres my code, it's a bit messy at the moment as I haven't gone to this in a while.

gamerboots
11
Years of Service
User Offline
Joined: 8th Dec 2008
Location: USA
Posted: 10th Jun 2014 00:47
Been a while since I've fired up dbc, but if I remember correctly, dbc has its fps capped so that no matter what you set the sync rate to it will only go up so far.

--------
DBP Archive
Latch
14
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 10th Jun 2014 02:10 Edited at: 10th Jun 2014 02:22
That's sorta right but actually not entirely. When windows XP came along it was a time when CRTs were on the way out and LCDs were becoming big, the operating system and Direct X maintained a sync rate sat the lowest common denominator of monitor refresh rates which for most LCDs defaulted to 50 or 60 fps. This affected DBC capping the FPS at the monitor refresh. Long story short, you can bypass the system imposed limits if you load in a midi or some other file as MUSIC and loop it, it breaks the FPS cap allowing up to 999 fps.

@Danza
If you are using the distance function as a test for whether or not an objects within a certain distance, you can improve the speed of your distance formula by eliminating the sqrt and also the ^2 by multiplying the values times themselves. If you eliminate the sqrt() you check for the squared distance instead of the distance itself. For example:



In the above you aren't calculating the distance between 2 objects but creating a test if two objects are within a certain proximity determined by sqrdist#.

Enjoy your day.
TheComet
12
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 12th Jun 2014 12:35
Quote: " Long story short, you can bypass the system imposed limits if you load in a midi or some other file as MUSIC and loop it, it breaks the FPS cap allowing up to 999 fps."

LOL I remember that hack. Good times.

gamerboots
11
Years of Service
User Offline
Joined: 8th Dec 2008
Location: USA
Posted: 15th Jun 2014 09:49
I had forgot about this as well
and it doesn't have to be a big one either. (any mp3 of the smallest size will do)

--------
DBP Archive
Libervurto
14
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 8th Aug 2014 04:46
Maybe if you draw the text to a separate bitmap and then copy it over?
I know that 2D drawing commands can get really slow because of the way they abuse the screen buffer so maybe it is the same for text, so perhaps drawing off screen will help.

Formerly OBese87.

Login to post a reply

Server time is: 2020-08-12 01:59:41
Your offset time is: 2020-08-12 01:59:41