RPGDXThe center of Indie-RPG gaming
Not logged in. [log in] [register]
 
 
Post new topic Reply to topic Goto page 1, 2, 3, 4  Next 
View previous topic - View next topic  
Author Message
Unknown
Moira's Silly Little Slave Bitch


Joined: 19 Jul 2005
Posts: 82
Location: Behind you...

PostPosted: Thu Sep 08, 2005 2:09 am    Post subject: Qbasic---HELP [quote]

I was tryin ta make a little rpg W/ Qb but...My code is running WAY to slow...Anyone have ANY ideas on how ta speed it up just a little bit ^_*

you can download the source here...http://www.members.aol.com/shadowed10566/QBRPG.ZIP

BUT you can't play it unless you have Qb 7.1pds which you can find here http://www.qbcafe.net/english/
_________________
Most people would succeed in small things if they were not troubled with such great ambitions.
Back to top  
LeoDraco
Demon Hunter


Joined: 24 Jun 2003
Posts: 584
Location: Riverside, South Cali

PostPosted: Thu Sep 08, 2005 6:50 am    Post subject: [quote]

Write the game in a more modern language, which have support for better graphics APIs?</troll>

Um, back when I was coding in QB, the big thing was to use the popular graphics libraries, which were generally written in assembly and afforded minor speedups. So, you could probably either write your own assembly routines to speed up segments of your code, or you could google some of those libraries. I used DirectQB, which, if memory serves me correctly, might have been slightly bloated, but had pretty much everything that one wanted. There was also blast! and dash, which had their own followings.

Also, in looking at your code, you seem to rely a lot upon manual enumeration of all files you are using, as well as very little usage of arrays where they would make sense to have them. Perhaps writing the code with a more logical layout of program variables and what not?

Edit: you also are doing the same exact bit of code all of over the place to load your data (tiles?) into memory, which seems moderately useless: (The following is an excerpt from START.bas, although this seems relatively systemic, from the handful of files I have glanced at.)

Code:
OPEN "npc/boss1sh.txt" FOR INPUT AS #1: FOR y = 0 TO 15: FOR x = 0 TO 17
INPUT #1, a%: PSET (x, y), a%: NEXT: NEXT: GET (1, 1)-(17, 15), boss1sh
CLOSE #1: CLS


You have that all over the place. My BASIC is a bit rusty, but there seems to be a few issues here:
  1. Couldn't you just load the (pixel color?) directly into the variable without having to dump it to video memory and reading it back? I.e. have your double loop, and then just write the appropriate byte in the variable.
  2. PSET (and GET) are, themselves, very slow operations; writing your own versions using PEEK/POKE (or whatever those clever kiddies were doing the last time I played with the language) or using a graphics library, would speed things up.
  3. CLS necessitates the entire screen to be wiped, which can be an expensive operation, especially if you are going to be overwriting the exact pixels --- plus or minus a row or column --- immediately after.
  4. You can wrap that whole loading code into a single function --- forgive me if this is legacy code, and you have done so --- (procedure? I remember BASIC terminology being funny on that point) which does the same thing, but operates on variables for the important bits. E.g.:
    Code:
    sub loadImage( filename$, width%, height%, data% as array )
    open filename$
    loop and load

    Actually, I would have written that out further, but then I started to feel yucky for doing so. In any case, finding places to optimize your engine would be easier if you refactored your design, moving redundant code into functions/procedures to minimize the design.

_________________
"...LeoDraco is a pompus git..." -- Mandrake
Back to top  
tcaudilllg
Dragonmaster


Joined: 20 Jun 2002
Posts: 1731
Location: Cedar Bluff, VA

PostPosted: Fri Sep 09, 2005 12:09 am    Post subject: [quote]

In the case of QB, subroutines and functions are not going to make code faster....

If you aren't going to use some sort of asm library, like Blast!, or DirectQB, then I suggest dropping it. DirectQB, I should note, does have significant sound issues on WindowsXP. It would be better to use FreeBasic, and let QB go.

The reason I let QB go? Because I spent more time optimizing code than I spent making it functional! :\
Back to top  
LeoDraco
Demon Hunter


Joined: 24 Jun 2003
Posts: 584
Location: Riverside, South Cali

PostPosted: Fri Sep 09, 2005 6:39 am    Post subject: [quote]

LordGalbalan wrote:
In the case of QB, subroutines and functions are not going to make code faster....


That is, potentially, true. However, subverting good programming practices just to get some speed gain isn't going to help. For all we know, the (uncompiled?) code ran through the interpreter is having problems because it is so terribly bulky.

I still hold that using procedures to wrap up all of that loading code will help, if only for maintainability; e.g. you suddenly want to change the way files are loaded, you only have to modify a single procedure, rather than a billion 3-block statements.
_________________
"...LeoDraco is a pompus git..." -- Mandrake
Back to top  
Unknown
Moira's Silly Little Slave Bitch


Joined: 19 Jul 2005
Posts: 82
Location: Behind you...

PostPosted: Fri Sep 09, 2005 2:06 pm    Post subject: [quote]

Instead of loading the code in the main program could i "link" a "grafix loading program" and the main game engin??? or would that be just as slow???

hmm...just dropping Qb huh LG...I might just do that after this project is done... ;-)


P. S. SCHOOL SUCKS!!!
_________________
Most people would succeed in small things if they were not troubled with such great ambitions.
Back to top  
DeveloperX
202192397


Joined: 04 May 2003
Posts: 1626
Location: Decatur, IL, USA

PostPosted: Fri Sep 09, 2005 11:50 pm    Post subject: [quote]

Hey Unknown.
You gave up on me. heh.
:\
Life has become a royal pain in the ass lately,
and I havent had time to write any code, nor look over your code.

Check around on any news sites, and you will hear of that damned hurricane Katrina that ruined my life.
I used to live in SouthEastern Louisiana...
that reminds me, I need to edit my profile info..on about 50 forums..damn.

Anyway, I had told you awhile back that you needed to use a different method for your graphics, and that you were repeating alot of things.
If you send me small sections of code, I can help you optimize those sections, but I lack the time to sift through the whole source file.
Dont listen to people telling you to drop QB.
QB Rocks, and its still just as useful as it always was.
Its easy, fun, and fast (not fast like blazing C fast, but fast as in fast to use to write programs with)
I've gotten QBasic to run flawlessly under Linux too.
I'll ttyl man. drop me an email to my gmail account.
ccpsceo@gmail.com
_________________
Principal Software Architect
Rambling Indie Games, LLC

See my professional portfolio
Back to top  
biggerUniverse
Mage


Joined: 18 Nov 2003
Posts: 326
Location: A small, b/g planet in the unfashionable arm of the galaxy

PostPosted: Sat Sep 10, 2005 3:03 am    Post subject: [quote]

Unknown wrote:
P. S. SCHOOL SUCKS!!!


It's been so long since I was in school, and my kids are still too young to go, that I had forgotten it started.

On topic: I can't help. Heh. Sorry.
_________________
We are on the outer reaches of someone else's universe.
Back to top  
Ren
Wandering Minstrel


Joined: 07 Aug 2004
Posts: 130
Location: turn around...

PostPosted: Sat Sep 10, 2005 5:58 pm    Post subject: [quote]

I'd upgrade to FreeBasic if I were you :) 90% of your code should still be useable, depending on how you've done it. If you're absolutely set on using QB i'd suggest GSlib, because it can run natively on 2000 and XP, and I think it's a little quicker than DQB. You'd best give up on music now though, unless you plan to make the FB switch.
_________________
Previous nicks: MidnightDreamer, The_Anarchist, Shroomasta.

ren-tek.net : BGC games and more!
Back to top  
Unknown
Moira's Silly Little Slave Bitch


Joined: 19 Jul 2005
Posts: 82
Location: Behind you...

PostPosted: Mon Sep 12, 2005 2:43 am    Post subject: [quote]

Quote:
Ren: You'd best give up on music now though, unless you plan to make the FB switch.

Music...hmm never thought a that... ;-) how different are freeBasic and Qbasic from one another???

I think I'm gona just sCrEw the current code and do a TOTAL REWRITE


P. S. Thanks all, for the input/help... ;-)
_________________
Most people would succeed in small things if they were not troubled with such great ambitions.
Back to top  
DeveloperX
202192397


Joined: 04 May 2003
Posts: 1626
Location: Decatur, IL, USA

PostPosted: Mon Sep 12, 2005 5:48 am    Post subject: [quote]

Unknown wrote:
Quote:
Ren: You'd best give up on music now though, unless you plan to make the FB switch.

Music...hmm never thought a that... ;-) how different are freeBasic and Qbasic from one another???

I think I'm gona just sCrEw the current code and do a TOTAL REWRITE


P. S. Thanks all, for the input/help... ;-)

you can do music in qb, its difficult, but not impossible.
under windows, I used an app written in vb to play mp3s until told not to, while the main qb game was running using the sound blaster to play wav sound effects.
it turned out nice, but it was a difficult task to get it to run together, as the vb app had to become 'aware' of the running qb app.
naturally this only worked when both programs were compiled to exes.

anyway, jeff if you're planning on switching languages, I highly suggest that you head over to my site and read up on C++/Allegro.
That is, imho, the best 'way out' of the confines of qb, and a major step into modern game programming.
there are other APIs, such as SDL that you could look at, but Allegro is the easiest to get started with.
email me if you have questions man.
_________________
Principal Software Architect
Rambling Indie Games, LLC

See my professional portfolio
Back to top  
DrV
Wandering Minstrel


Joined: 15 Apr 2003
Posts: 148
Location: Midwest US

PostPosted: Mon Sep 12, 2005 6:07 am    Post subject: [quote]

Whatever you do, please don't use QB + Windows slave for audio - that makes it totally impossible to correctly run your program under a DOS emulator like DOSBox and also most likely it won't work very well or at all on modern versions of Windows, so you're limiting your audience to the ever-narrowing range of people still running on old software and hardware.

I have used (and still use) both C++ and FreeBASIC for game programming, and I would have to say that neither is really superior overall - use the one that is most familiar or logical to you. I would encourage you to learn C and C++ in any case just to broaden your knowledge of the possibilities and make informed choices.

Also, Allegro is a decent game programming library, as is SDL (and the various add-on libraries that go with SDL) - both of these can be used from either C(++) or FreeBASIC. Either will give you what you need when writing a game, but perhaps one might be better than the other in certain cases. I won't take sides on this issue as it is rather flammable. :)
_________________
Don't ask no stupid questions and I won't send you away.
If you want to talk fishing, well, I guess that'll be okay.
Back to top  
Unknown
Moira's Silly Little Slave Bitch


Joined: 19 Jul 2005
Posts: 82
Location: Behind you...

PostPosted: Mon Sep 12, 2005 3:32 pm    Post subject: [quote]

what im gona do is finsh the game W/ qb, learn c/c++ and Allegro. after doing that decide which is gona best suit my needs ... ;-)

of course in the mean time trying to keep my head above water in home work... that stuff just builds up so fast ...
_________________
Most people would succeed in small things if they were not troubled with such great ambitions.
Back to top  
Ren
Wandering Minstrel


Joined: 07 Aug 2004
Posts: 130
Location: turn around...

PostPosted: Tue Sep 13, 2005 8:36 pm    Post subject: [quote]

Unknown wrote:
how different are freeBasic and Qbasic from one another???


Freebasic is built to be compatable with QB's syntax, so basically it's the same language. Equally handily, you can replace those DQB array(0), sprite(0), x, y, etc, etc commands with FB's put function, which works exactly like QB's except that it supports clipping, transparancy, and is much faster. Have a go with the IDE: http://fbide.sourceforge.net/ . There's some syntax in the doc's folder that should be handy.
_________________
Previous nicks: MidnightDreamer, The_Anarchist, Shroomasta.

ren-tek.net : BGC games and more!
Back to top  
BadMrBox
Bringer of Apocalypse


Joined: 26 Jun 2002
Posts: 1022
Location: Dark Forest's of Sweden

PostPosted: Thu Sep 15, 2005 2:32 pm    Post subject: [quote]

A tip from one QB user to another; dont use QB7.1. Use QB4.5.
I am myself thinking about upgrading to FB. I have been surfing around for info for awhile now.
_________________
Back to top  
Unknown
Moira's Silly Little Slave Bitch


Joined: 19 Jul 2005
Posts: 82
Location: Behind you...

PostPosted: Fri Sep 16, 2005 1:16 pm    Post subject: [quote]

Fb seems to be slightly better than Qb but if i have already started the project then why switch in the middle of a of it???
Mabey I'll switch after awhile but not yet ;-)


Quote:
BadMrBox Posted: A tip from one QB user to another; dont use QB7.1. Use QB4.5.

Really, why???
_________________
Most people would succeed in small things if they were not troubled with such great ambitions.
Back to top  
Post new topic Reply to topic Page 1 of 4 All times are GMT
Goto page 1, 2, 3, 4  Next 



Display posts from previous:   
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum