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 / Long command lines, FPS and GOSUB vs Functions

Author
Message
047
20
Years of Service
User Offline
Joined: 4th Jun 2006
Location:
Posted: 18th Feb 2007 17:51
I have 3 questions:
1. Is there a character I can use or some way to tell DBC that I want to continue the same command line on the next row, when it gets so long to read on the screen that I have to scroll it to the right to read the rest? I use a lot of IF/ANDs in my code so it would make the program easier to read if I could keep everything within the screen limits.

2. What's considered a good or acceptable Frames Per Second rate for a game. Mine ususally run at about 19 to 24 FPS more or less and it looks OK. But I've heard people say that their programs run at much higher speeds. I only have a Celeron 1.1 so I don't expect my programs to run too fast but should I strive to increase the FPS of my programs or is this an decent average rate say for a racing game?

3. Is there any huge advantage to using Functions as opposed to just GOSUB. Everytime I've tried to use a Function I end up finding it more convenient to use GOSUB instead because I still don't see the advantange of DBC "forgetting" the values of the variables used on the rest of the program. Is there a speed advantange for instance?

Thank you!
TDK
Retired Moderator
23
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 18th Feb 2007 21:32 Edited at: 18th Feb 2007 21:33
1. Depends on the IDE you are using. If you are not using a Windows IDE (you are using the default 'horrible' one), then no.

2. Anything above 20 fps should give you reasonable animation. TV is only 25 fps isn't it? That doesn't look jerky.

3. They essentially do the same thing and neither has an overall speed advantage over the other. Each have their pros and cons.

Functions have (as you said) local variables and need to have variables passed to them whereas procedures see all variables. One advantage of this is that you don't have to worry about accidentally using variable names more than once.

Functions can only return a single variable whereas any changes to all variables in a procedure stay changed on return.

Function calls can be used as part of statements (like new commands) whereas Gosubs cannot. For example:

X = MyCalcFunc(2,4,3.142) * 12

Some people only ever use functions, but I am like you and prefer Gosubs unless I want to create a 'command-like' function. It's a matter of personal preference.

TDK_Man

Benjamin
23
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 18th Feb 2007 23:39
Quote: "2. Anything above 20 fps should give you reasonable animation. TV is only 25 fps isn't it? That doesn't look jerky."

If developing for a machine that outputs to a TV, yes, otherwise, 60 or even 50 is acceptable, and 60 is the standard. And don't tell me one cannot tell the difference between 30 fps and 60 fps, I certainly can.

Tempest (DBP/DBCe)
Multisync V1 (DBP)
047
20
Years of Service
User Offline
Joined: 4th Jun 2006
Location:
Posted: 19th Feb 2007 00:12
Thanks for the responses TDK and Benjamin.
And TDK, I didn't know that you had created an IDE for DBC. I just downloaded it and it looks great. Next time I get a message such as "error in line 356", I won't be guessing which line that is . I downloaded version 0.1. I looked in your website to see if a new version had been created but I couldn't find anything. Please let me know if there has been any updates to that utility. Thanks!
TDK
Retired Moderator
23
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 19th Feb 2007 00:35
Quote: "60 or even 50 is acceptable, and 60 is the standard. And don't tell me one cannot tell the difference between 30 fps and 60 fps, I certainly can."


You make it sound like I suggested 20fps is a standard to aim for. I didn't.

I was suggesting a minimum fps below which a game wouldn't be as good to play. It obviously depends also on the game type as to what fps you can get away with - and the power of the machine it's being run on.

TDK_Man

The Wilderbeast
20
Years of Service
User Offline
Joined: 14th Nov 2005
Location: UK
Posted: 20th Feb 2007 16:11
Ah, I see TDK made it to moderator rank, about time!!!


Login to post a reply

Server time is: 2026-07-06 10:33:51
Your offset time is: 2026-07-06 10:33:51