[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 264: mysqli_fetch_assoc(): Couldn't fetch mysqli_result
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 326: mysqli_free_result(): Couldn't fetch mysqli_result
Pete's QBASIC Site Discuss QBasic, Freebasic, QB64 and more 2010-02-26T04:27:56-05:00 http://www.petesqbsite.com/phpBB3/app.php/feed/topic/3199 2010-02-26T04:27:56-05:00 2010-02-26T04:27:56-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=20480#p20480 <![CDATA[Organization]]>
I'm storing all my "GET"ted data in txt files. My tile editor just GETs the data into an array and dumps that to the file. When a level loads up it simply loads up the appropriate files into the gfx tile array and the game PUTs them as needed.

That's for tiles. For sprites it stores strings containing the ASCII characters (one char per pixel) pertaining to each color. That's ASCII 0-255 representing 0-255 colors. The only problem is character #26 which QB interprets as an "EOF" end of file indicator and therefor color 26 can't be captured. I use this for sprites because when the game draws these graphics back out onto screen it ignores color #0 which i'm treating as transparent.

Kind of archaic and n00bish, but I came up with it by myself over 10 years ago with no formal training. maybe my next game will be better?

Statistics: Posted by coma8coma1 — Fri Feb 26, 2010 4:27 am


]]>
2010-01-17T14:15:18-05:00 2010-01-17T14:15:18-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=20325#p20325 <![CDATA[Organization]]>
I have more info if needed.

Ted

Statistics: Posted by burger2227 — Sun Jan 17, 2010 2:15 pm


]]>
2010-01-17T11:51:37-05:00 2010-01-17T11:51:37-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=20323#p20323 <![CDATA[Organization]]>
Does this BSAVE command apply to .bmp files? If I were to make a picture in ms-paint, how would I load that .bmp file?

This could be useful.
(Burger, remember this gem?)

There are two ways that I remember. FB just uses bload, otherwise you have create your own subroutine to load a .bmp manually. It's not that hard, actually, bitmaps are fairly straightforward to read from. I'm familiar with 32/24 bit stuff, but it's pretty much loading the image width and height from the header (byte offset 18 and 22? I might be off by one, you may have to play around with it first), and then the offset to the actual image data. That's where the pixel data is, and you may have to ask somebody else about the specifics on that, I'm not too familiar with that pixel data orienting thingamabob stuff.

Wiki link: http://en.wikipedia.org/wiki/BMP_file_f ... itmap_data

Statistics: Posted by Mentat — Sun Jan 17, 2010 11:51 am


]]>
2010-01-12T22:49:48-05:00 2010-01-12T22:49:48-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=20316#p20316 <![CDATA[Organization]]>
You need to use a bitmap loader program to place the image on the screen in QB. Since bitmaps use their own color settings, you have to index the RGB color settings into an array(at the beginning is best). Then index the GET Image after it. I have QB programs that can create BSAVE file(s) for you at: www.qbasicstation.com in the Member Files section or in my 4 Shared folder at the link below.

Screen 12 is good for drawings, cards, artwork or cartoons. 13 is best for pictures.

Ted

Statistics: Posted by burger2227 — Tue Jan 12, 2010 10:49 pm


]]>
2010-01-12T22:22:46-05:00 2010-01-12T22:22:46-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=20315#p20315 <![CDATA[Organization]]>
This could be useful.

Statistics: Posted by bongomeno — Tue Jan 12, 2010 10:22 pm


]]>
2010-01-17T14:07:32-05:00 2010-01-09T20:58:17-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=20294#p20294 <![CDATA[Organization]]>
In SCREEN 13, you can almost get the entire page. I'd just use 2 GETs of half the page in that case and BSAVE them. Your map array could be about 20K or less.

Are you using EVERY sprite on every level? If not, then share arrays to keep memory down. BLOAD can load the images quite fast. If some sprites don't move, then use one array for all of those.

The hero movement will need three arrays for him, the mask and the background to erase. Try to determine the smallest arrays possible without distortion. Use the backward loop in my BSAVE code above to determine how much space is used in an array. It returns the last data filled element(index). Adjust accordingly.

The movement going one or 5 pixels is the same. You use the keypresses to add or subtract an amount to the current screen coordinates each press. So nothing really needs to be added codewise. You can adjust that.

Ted

Statistics: Posted by burger2227 — Sat Jan 09, 2010 8:58 pm


]]>
2010-01-09T19:08:39-05:00 2010-01-09T19:08:39-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=20293#p20293 <![CDATA[Organization]]>
However, what I meant by memory is, say I have 500 SHARED ARRAYS, won't that take a jimongogantis chunk of the 640k? Also, I'm in Screen 13, not 12, so the three files isn't something I have to worry about, I have one map filling most of the screen, with an area below and on the side for stats. Those 500 Arrays, that's my estimate of How many BLOADS I'm going to have, and each needs and array to hold what I BLOAD (that's just sprites, not even counting maps). So my main question is, will that take away from memory?

I'm not advanced enough to program in chains, or scripting engines or whatever, I have my .bas file, (which now contains all the subs, variables, etc. it ill have) and my sprite files (BSAVED). So, I'll probably do what you said and QB64 compile the ENTIRE butt-load, although QB64 catches errors in programs that run fine in Qbasic. . .

Also, if I do 1 (or five) pixels at a time, is there some formula to find what two tiles my "HERO" (Controlled Character) is on, so I can re-place those two when he moves?

Statistics: Posted by Prosper — Sat Jan 09, 2010 7:08 pm


]]>
2010-01-09T16:14:35-05:00 2010-01-09T16:14:35-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=20292#p20292 <![CDATA[Organization]]>
You can load each map portion into the same array you used with the first page. You just gotta remember which files are for what. Like Map11.BSV, Map12.BSV, Map13.BSV, Map21.BSV, etc. Fullscreen needs one 26K array to hold 1/3 of the data and PUT it on the screen. Once the maps are saved to files you NEVER have to draw them again!

One pixel at a time is probably too slow. In SCREEN 12, pixels are very small so you could try bigger moves. Try 5 pixels. That works pretty smooth. Want to move diagonally? Let me know!

Game programs can get pretty large! They may not compile over 100K modules. However you can CHAIN the modules to do different parts of the program or use QB64 to compile one BIG module. You may have to combine them if Qbasic runs out of memory. I use Notepad for that.

Ted

Statistics: Posted by burger2227 — Sat Jan 09, 2010 4:14 pm


]]>
2010-01-09T11:27:16-05:00 2010-01-09T11:27:16-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=20289#p20289 <![CDATA[Organization]]>
I have three more questions, if you wouldn't mind patronizing me:

1. The limited memory in QuickBasic, does it apply to the compiled file? I. e. Spore, a popular computer video game, written in C++, has no memory limit besides the memory on your computer, even though it's IDE may have had limits. Does this work with BASIC? As in, while the IDE (QuickBasic) may have memory limits preset, the compiled, stand-alone file doesn't? And what is the specific memory limit? 640K?

2. How do I put something OUT of memory. I BLOAD in my map, put it down, and thanks to you, got my walking engine working, but once I move to a new map, how to get the old map OUT of memory? Do I BSAVE it? I was thinking, if I made all the map files as numbers, and didn't correspond to the Array name:

Def seg = varseg (Map(0, 0))
BSAVE "010102.map", VARPRT (Map(0, 0)), 160

Could I do that so I can load my maps when I want them, and replace the previous one in the same array?

3. What is the preferred movement style? I attempted at "ZELDA-Freestyle" with Pixel-by-Pixel movement (Press "W" go up one pixel) or Tile by tile movement (with animations, so it's not jolty).

I've decided against scrolling by step, and to have four map portions, and ONLY scroll when transferring between them (Like NES ZELDA) (Best video game ever written).

Thank you so much for your time, I'll be giving you a credit at the end of the game ( I'll finish it, I've got everything done, except the engine).

-Prosper

Statistics: Posted by Prosper — Sat Jan 09, 2010 11:27 am


]]>
2010-01-09T16:22:44-05:00 2010-01-08T23:43:49-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=20287#p20287 <![CDATA[Organization]]>
I doubt your character looks like a box so you will have to make a mask for the character and save it to an array too. You can do the mask at the start of your program by PUTing the image: PUT(0, 0), Hero(0) on a black background. To create a mask, you alter the image to black and white only. This will keep colors from mixing using PUT XOR(the default):

Code:

FOR xx = 0 TO 30  ' max column of box area    FOR yy = 0 TO 30 ' max row of box area        IF POINT(xx, yy) = 0 THEN PSET (xx, yy), 15 ELSE PSET (xx, yy), 0    NEXT yyNEXT xxGET(0, 0)-(30, 30), Mask ' 31 X 31 box area
GET the box area to the mask array. Then place the map.

Set the position where the hero will start and GET the same box area as the hero from the map(without the hero!). You will use it to erase your hero when he moves.

So now we have the hero, mask and background placed in 3 arrays. Place the mask before the hero at the designated area. Don't forget to replace the background first!

Code:

IF x <> px OR y <> py THEN ' draw the image at new position   PUT(px, py), MapBG PSET ' pset covers any color without color mixing   GET(x, y)-(x + 31, y + 31), MapBG ' get new BG before placing hero   PUT(x, y), Mask AND  ' And allows background to show in all white areas.    PUT(w, y), Hero         ' PUT action is XOR default on top of the maskEND IFpx = x: py = y
When the hero moves, simply PUT MapBG(px, py) and move to the new coordinate placing mask and hero each move. px and py are the previous coordinate values to erase the previous hero image. I'd use px and py to check for a move so that it does not keep redrawing over and over.


Ted

Statistics: Posted by burger2227 — Fri Jan 08, 2010 11:43 pm


]]>
2010-01-08T22:43:16-05:00 2010-01-08T22:43:16-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=20286#p20286 <![CDATA[Organization]]>
An example (Not Exact) of the code I'd use

Code:

 Do   Press$ = INKEY$  IF Press = "w"    DIR = 1    IF HY > TopofScreen then HY = HY - 1  -----The rest (a, s, d)-----  END IF  IF HY <> OLDHY   CLS   Call DRAWMAP   Call DRAWHERO   ENDIFLoop 
When I do this, there is a sort of animation (Basic is SLOOOOOWWW) of the map being drawn, tile by tile, then the Character looks jacked up.

On no background, my Hero looks fine, but on the map, he looks like the vomit of a drunk koala bear. ???

Statistics: Posted by Prosper — Fri Jan 08, 2010 10:43 pm


]]>
2010-01-08T20:20:32-05:00 2010-01-08T20:20:32-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=20285#p20285 <![CDATA[Organization]]>
So you can only GET a 640 X 160 portion of a fullscreen image at a time. Make a BSAVE loop to GET and BSAVE each portion to one of 3 filenames.

You cannot GET off of the screen so 639 is the actual max width since 0 is the minimum pixel coordinate. (0 TO 639 = 640). Same with depth. So the first row coordinate is 0 to 159. STEP 160 each loop.

Code:

FOR y = 0 TO 320 STEP 160         GET (0, y)-(639, y + 159), Image(0)         FOR a& = 26000 TO 0 STEP -1 ' get the array size               IF Image(a&) THEN ArraySize& = a&: EXIT FOR         NEXT         Num = Num + 1   'add to 7 digit file name by number 1, 2, 3          SaveName$ = SaveFile$ + LTRIM$(STR$(Num)) + ".BSV"         BSAVE SaveName$, VARPTR(Image(0)), (2 * ArraySize&) + 200NEXT y
QB64 has no screen array limitations. But it also can PUT any array data directly into a BINARY file:

Code:

DIM myarray(80000) AS INTEGEROPEN "myfile.ext" FOR BINARY AS #1PUT #1, , myarray()CLOSE #1
Variable string lengths will not work so use fixed length strings to save them. DIM Myarray AS STRING * 20

Ted

Statistics: Posted by burger2227 — Fri Jan 08, 2010 8:20 pm


]]>
2010-01-08T09:13:37-05:00 2010-01-08T09:13:37-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=20284#p20284 <![CDATA[Organization]]>
I figured out how to use BSAVE and BLOAD (thanks a ton) all though I have to be using QB64 to run it when it does (my 64-bit computer requires me to run DOSBOX for Qbasic, which I prefer, but the mounted drive won't let you "BLOAD"). I much prefer Qbasic because separates subs, but I guess I can deall with QB64.

So. . .can I design a 4gig map like "LEGEND of ZELDA" and only worry about on-screen portions, or should I make each screen a separate map, and link them?

Statistics: Posted by Prosper — Fri Jan 08, 2010 9:13 am


]]>
2010-01-08T05:52:28-05:00 2010-01-08T05:52:28-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=20283#p20283 <![CDATA[Organization]]>

Code:

LB% = LBOUND(Array): bytes% = LEN(Array(LB%))filesize& = ((UBOUND(Array) - LB%) + 10) * bytes% ' calculate file sizeDEF SEG = VARSEG(Array(0)) BSAVE filename$, VARPTR(Array(LB%), filesize&DEF SEG 'resets segment to QB default'  ........BLOAD reloads the array data from the file:DEF SEG = VARSEG(Array(0))BLOAD filename$, VARPTR(Array(index%)) ' index to an array. Usually 0.DEF SEG    
You can also use them to save ANY array type data including FIXED length strings or TYPE arrays. Variable length strings don't work without manipulation.

Ted

Statistics: Posted by burger2227 — Fri Jan 08, 2010 5:52 am


]]>
2010-01-08T02:41:15-05:00 2010-01-08T02:41:15-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=20282#p20282 <![CDATA[Organization]]>
CODE:

Code:

 dim grass(4 * (32 * 32) + 4) dim graph$(33) screen 12 ' load graphics open "grass.dat" for input as #1  for i = 1 to 32   input #1, graph$(i)  next i close #1 ' draw graphics for y = 1 to 32  for x = 1 to 32   a$ = mid$(graph$(y), x, 1)   ' check colors   select case (a$)    case "A"     cl = 10    case "B"     cl = 11    case "C"     cl = 12    case "D"     cl = 13    case "E"     cl = 14    case "F"     cl = 15    case "."     cl = -1    case else     cl = val(a$)   end select   if cl <> -1 then pset(x,y), cl  next x next y ' grab image get(1,1)-(32,32), grass(0) ' clear screen and draw new image! cls put(200,200), grass(0)
GRASS.DAT:
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
this does the job instead of BSAVE and BLOAD for me!

Statistics: Posted by BigBadKing — Fri Jan 08, 2010 2:41 am


]]>