Qbasicnews.com

QBasic => QB Discussion & Programming Help => Topic started by: Kofman on April 20, 2003, 09:43:58 PM



Title: How does one store .gifs and other images without a libary
Post by: Kofman on April 20, 2003, 09:43:58 PM
How would someone store .gifs and other images without the use of a libary. I can ofcoarse build the features used in a libary into my program if someone can provide some information on how that would be done.

Libaries are absolutly a NO NO. So what are the steps to be taken in order to do this. Please don't direct me to some of the sites with 5 pages of information on .bmp, .gif and so forth. I could never find enough patience to sit and read all of it through. It's way to black and white. So please tell me in basic terms what are the steps needed to be taken and provide bits of code where appropriet.

Thank You


Title: How does one store .gifs and other images without a libary
Post by: na_th_an on April 20, 2003, 10:17:40 PM
Well, as long as you'll be using someone else's code you'll be using a library. A library is just a bunch of functions with related functionality.

Go check here, at abc. They have several GIF loaders. One of those would fit your needs. http://www.basicguru.com/abc/graphics.htm

My favourite one is rich gieldreich's, as it is in assembly so it is blazing fast.


Title: So, let me get this straight....
Post by: Glenn on April 21, 2003, 03:04:04 AM
Libraries, which I take to mean, in this context at least, as code written by somebody else, are a NO-NO and you don't want to learn to do it with your own code (which would essentially constitute a library, but written by you)?  :)  I'm trying to figure out what you think is in between.  :)


Title: How does one store .gifs and other images without a libary
Post by: toonski84 on April 21, 2003, 05:01:06 AM
*sigh* take this example in writing.

no, plageurizing is a no-no.  but in every topic area, someone else has already written at least something relevant to what you are writing, and to leave out all information pertant to what they wrote would make your paper suck.  so instead, you're encouraged by everyone with a brain to use other people's information, but cite it so others know where it came from.  same goes for programming.  use other people's libraries.  let their hard work which was designed for the sole purpose for you to use in your game not go to waste, and use libraries.  just be sure to list in a text file that you used it, or properly follow the license guidelines (if there is one).


Title: How does one store .gifs and other images without a libary
Post by: Kofman on April 21, 2003, 11:31:50 AM
The problem arises when i physically can't use Libaries not just that I don't want to.


Title: How does one store .gifs and other images without a libary
Post by: red_Marvin on April 21, 2003, 12:16:23 PM
can't use libraries?
do you have qb 1.1?
if so get 4.5


Title: How does one store .gifs and other images without a libary
Post by: wizardlife on April 21, 2003, 05:45:27 PM
He's running it on school computers and can't set up every terminal in the lab to work with some lib.

Not every library is an ASM quicklibrary, tho... Just borrowing someone else's GIF-loading SUB would be a lib, too, and that wouldn't require any special setup.


Title: How does one store .gifs and other images without a libary
Post by: Kofman on April 21, 2003, 06:40:26 PM
yea wizardlie understands the position I'm in and what I want to do. The thing is, is that I never really created a libary and not to sound to novince here.... how do you extract a sub from a libary and implent it into your program. And which one can I use.

*** I will mantion all the libaries I'll be using and wait should I contact someone if I can do that? I won't be selling this game it's simply a game. I don't even think I'll ever use it in a resume. Just something for school.  :???:


Title: How does one store .gifs and other images without a libary
Post by: wizardlife on April 21, 2003, 07:01:58 PM
You're not extracting anything from a lib. You just need someone's SUB that you can cut and paste into your code. A quick google yielded this page, on which there are two code snippets that purport to load GIFs:

http://www.qbasic.com/list.shtml

Just credit the author at the top of your program in the credits for the game.


Once again, I think your concentrating on the details, when you need to do a lot of basic work before how you load a gif will be very relevant.


Title: How does one store .gifs and other images without a libary
Post by: Kofman on April 21, 2003, 07:11:50 PM
naw I'm just gathering information. These four boards cover the major topics I want to learn about before I begin. Once I get a better understanding hey I'll take it step by step. I plan to save all these threads and keep them as notes while I work on the game. Oh and I jut played your game. WOW. Amazing. It's a genious game. I wish I had a friend to play with tho. I just sort of faced them each other and made em launch rockets. It became a quick end. I love how you had different charecters have different speeds, different strengh and so forth. It's one of the things I really want to do.

I forgot to thank you on the the explanation about the libary. and the link. Umm Thanks.


Title: How does one store .gifs and other images without a libary
Post by: Kofman on April 21, 2003, 07:24:23 PM
Alright one last thing before I start my hw. What's the best program for creating animated gifs and what are the general requirements or should I say limitations of those gifs. What's recomanded?

Lastly, now that we have solved the issue with loading gifs what about screen modes. Are their any simular subs that create their own screen modes as I've asked for before (hope it was this thread).


Title: How does one store .gifs and other images without a libary
Post by: na_th_an on April 21, 2003, 09:36:22 PM
You won't need animated gifs. You'll prefer different frames. Any drawing program can be used. My personal pick is Deluxe Paint II v.3


Title: How does one store .gifs and other images without a libary
Post by: Kofman on April 21, 2003, 11:00:22 PM
oh, how many frames would it take to through a jab? 3 or more?

And would I actually animate the frames in the program?


Title: How does one store .gifs and other images without a libary
Post by: wizardlife on April 22, 2003, 12:12:01 AM
Quote from: "Kofman"
oh, how many frames would it take to through a jab? 3 or more?

Depends. How fast is the jab? Start by just drawing the one frame of the jab fully extended. If you want to create inbetween frames later, they should be easy to add.

Quote

And would I actually animate the frames in the program?


Yes.


Title: How does one store .gifs and other images without a libary
Post by: relsoft on April 22, 2003, 03:44:05 AM
Quote from: "wizardlife"
He's running it on school computers and can't set up every terminal in the lab to work with some lib.

Not every library is an ASM quicklibrary, tho... Just borrowing someone else's GIF-loading SUB would be a lib, too, and that wouldn't require any special setup.



Try AF.Lib ;*)  You won't need a QLB to use ASM since it works via call absolute.

Just load QB with the /L option.


Title: How does one store .gifs and other images without a libary
Post by: Kofman on April 22, 2003, 07:22:43 AM
Thing is it isn't just a network, the computers have a limited hardware (no graphics card) and, don't really have an OS. But I will try tho.


Title: How does one store .gifs and other images without a libary
Post by: ak00ma on April 22, 2003, 07:33:36 AM
No graphic card??? How can you see something on your monitor??? And where is the monitor cable plugged in???


Title: How does one store .gifs and other images without a libary
Post by: na_th_an on April 22, 2003, 11:10:04 AM
Quote from: "Kofman"
oh, how many frames would it take to through a jab? 3 or more?

And would I actually animate the frames in the program?


Well, this involve tons of hard work. Pixel art is really difficult. I suggesyt you read some tutorials in animation.

The number of frames is up to you, the frame rate, the detail you want to give and more stuff. Y'know, you can do a walking animation with 3 frames, but the main character of my game Jill has 12, for example.

To animate in your program you just draw subsequent frames one behind another using timers and stuff.

Here is deluxe paint III 3:

http://usuarios.lycos.es/qbsux/utils/dp3.zip

You can use it to produce PCX files that you can load into wiz's program.


Title: How does one store .gifs and other images without a libary
Post by: Kofman on April 22, 2003, 07:49:49 PM
Oh thank you so much. I think I see, but you haven't answered the question. Would you use Deluxe for the animation too?

Does frame rate drop with longer animations?

akooma: It's onboard video input. Not a graphics card.


Title: How does one store .gifs and other images without a libary
Post by: toonski84 on April 22, 2003, 10:18:36 PM
use any gif animator for animation.  you'll only be using it for testing, anyhow (you dont actually import animated gifs into your program, you load it frame by frame into memory, and display it as you go.


Title: How does one store .gifs and other images without a libary
Post by: wizardlife on April 22, 2003, 10:21:29 PM
Quote from: "Kofman"
Oh thank you so much. I think I see, but you haven't answered the question. Would you use Deluxe for the animation too?

Does frame rate drop with longer animations?

akooma: It's onboard video input. Not a graphics card.


ASM libs don't make use of the video cards at all. Don't worry about that.

Most walking sprite sets are 6 or 12, depending if the legs cross over. I still think you should take my suggestion and not be concerned with the inbetween frames for now. Just worry about doing the 'extreme' points of moves -- once you get the engine working, it should be straightforward to add extra frames where necessary.

For each move you should have a list of the frames that comprise the move and the number of vsyncs for each to be displayed. (preferably read out of a data file, rather than hardcoded)


Title: How does one store .gifs and other images without a libary
Post by: Kofman on April 22, 2003, 10:29:49 PM
Thank You both


Title: How does one store .gifs and other images without a libary
Post by: na_th_an on April 22, 2003, 10:31:35 PM
I think you don't quite understand how animations are done in a game. In a program, you have several sprites and you cycle among them. So your drawing program doesn't need to be an animation program. You just draw every frame separately, and then animate them on your program.

Look at this: When I made "jill the goddes" I took deluxe paint and made this bitmap:

(http://usuarios.lycos.es/firstqbasicforum/stuff/JILL.gif)

In my program, I load up this bitmap and I GET every frame. When I am animating the character, I just draw the current frame, and increase a counter.

It can be handy if your program has animation, just for testing purposes.


Title: How does one store .gifs and other images without a libary
Post by: Kofman on April 22, 2003, 11:30:50 PM
god you guys are talented.

well I'm going to try drawing these guys.

Can you tell me if this technique could work

using photoshop

1. I would draw a pose

2. scan

3. downsize

4. than pixel

and then drop into a another file and save as .pcx


Title: How does one store .gifs and other images without a libary
Post by: wizardlife on April 23, 2003, 12:17:34 AM
Too much trouble. Just use DPaint from the start. You're pixel-drawing anyways. If you try to do scanning and then psp and stuff, you'll just get your palettes all messed up and make a jolly mess. You have more control if you go pixel*pixel anyways.


Title: How does one store .gifs and other images without a libary
Post by: ak00ma on April 23, 2003, 03:01:48 AM
Quote from: "Kofman"

akooma: It's onboard video input. Not a graphics card.


Oh,...,I've just wondered...


Title: How does one store .gifs and other images without a libary
Post by: Kofman on April 23, 2003, 07:14:36 AM
:D


Title: How does one store .gifs and other images without a libary
Post by: Kofman on April 26, 2003, 01:18:15 AM
Quote from: "na_th_an"
I think you don't quite understand how animations are done in a game. In a program, you have several sprites and you cycle among them. So your drawing program doesn't need to be an animation program. You just draw every frame separately, and then animate them on your program.

Look at this: When I made "jill the goddes" I took deluxe paint and made this bitmap:

(http://usuarios.lycos.es/firstqbasicforum/stuff/JILL.gif)

In my program, I load up this bitmap and I GET every frame. When I am animating the character, I just draw the current frame, and increase a counter.

It can be handy if your program has animation, just for testing purposes.


I have a question. Let's take on this sanerio. You have a pretty background. You have sprites that have transperency ofcoarse, and you animate them. How do you erase one sprite fromt he screen without messing up the bg? Since you can't simply drop the new sprite onto the old becuase both have transperencies and part of the old would show off the new. How would you solve this?


Title: How does one store .gifs and other images without a libary
Post by: wizardlife on April 26, 2003, 02:30:10 AM
You need to do buffering... You prepare the entire screen in memory before copying it to the screen. So the background is stored in a buffer, and you copy that to your double buffer, draw all your stuff on it, and then copy it to the screen. Rinse & repeat.


Title: How does one store .gifs and other images without a libary
Post by: Kofman on April 26, 2003, 10:20:17 AM
Wouldn't the game be somewhat slow if you forced it to do that every single time. Rinse and Repeat that is.


Title: How does one store .gifs and other images without a libary
Post by: wizardlife on April 26, 2003, 10:32:30 AM
Quote from: "Kofman"
Wouldn't the game be somewhat slow if you forced it to do that every single time. Rinse and Repeat that is.


Obviously. But there is no alternative... except very complicated 'look-up'-type operations to repair the background. And either way you'll need to double-buffer.


Title: How does one store .gifs and other images without a libary
Post by: Kofman on April 26, 2003, 11:45:01 AM
Oh wow, isn't their a way to make layers. If someone could invent layers in QB this could be solved couldn't it? Just a hunch  :-?


Title: How does one store .gifs and other images without a libary
Post by: toonski84 on April 26, 2003, 12:18:51 PM
that is layers.  you draw the bottom layer, the next layer over it, and the top layer over that.  that how it works in photoshop and that's how it work in qb (or any toher language).


Title: How does one store .gifs and other images without a libary
Post by: red_Marvin on April 26, 2003, 01:21:07 PM
Quote from: "wizardlife"
Quote from: "Kofman"
Wouldn't the game be somewhat slow if you forced it to do that every single time. Rinse and Repeat that is.


Obviously. But there is no alternative... except very complicated 'look-up'-type operations to repair the background. And either way you'll need to double-buffer.


you can always get the background where the sprite should be
placed and when erasing the sprite just PUT the "saved background"-sprite...


Title: How does one store .gifs and other images without a libary
Post by: Hard Rock on April 26, 2003, 10:33:33 PM
You could also theroetically do an XOR put, but its just as slow, since it has to read the screen anyways, and you use double memory becuase you need a mask too.

The way wizardlife suggested is the best, unless you need to scroll alot, in which case just redraw the backround EVERY frame, have it erase everything, and then draw the sprites on top (like toonski mentioned, layering)


Title: How does one store .gifs and other images without a libary
Post by: na_th_an on April 27, 2003, 12:13:35 PM
Quote from: "red_Marvin"
Quote from: "wizardlife"
Quote from: "Kofman"
Wouldn't the game be somewhat slow if you forced it to do that every single time. Rinse and Repeat that is.


Obviously. But there is no alternative... except very complicated 'look-up'-type operations to repair the background. And either way you'll need to double-buffer.


you can always get the background where the sprite should be
placed and when erasing the sprite just PUT the "saved background"-sprite...


That's what Jill uses. You just have an extra buffer measuring the size of each sprite. Instead repainting the whole screen, you just repaint the erased portions. This has something to do with "dirty rectangles", if you wanna code it efficiently.

Jill runs at 60 fps in my 66Mhz CX486DX2, although it uses the "SLOW" DirectQB.

Anyhow, repainting the whole background is not that slow if you done it wisely. And it is mandatory if you are scrolling. I've set up a 3 plane scroll in DirectQB and it runs at full framerate (60 fps) in my 233, so it isn't *that* slow.


Title: How does one store .gifs and other images without a libary
Post by: Kofman on April 27, 2003, 04:17:20 PM
I haven't considered scrolling yet


Title: How does one store .gifs and other images without a libary
Post by: Neo on April 29, 2003, 09:07:36 AM
Think about it :D


Title: How does one store .gifs and other images without a libary
Post by: wizardlife on April 29, 2003, 11:25:01 PM
Quote from: "Neo"
Think about it :D


Or better yet, don't. Better to get the basics working first.


Title: How does one store .gifs and other images without a libary
Post by: Kofman on May 03, 2003, 07:44:55 PM
Well I finally finished my main charecter for my game.

The game will be based on anime series called Naruto. Which will use it's charecters. That makes design much simpler. I finally finished drawing the main charecter and here he is.

(http://www.geekshelter.com/naruto/images/naruto.gif)

It took me a near two hours to get this done. Please I'm looking for someone to help me out. I have a deadline for this project on June 6th. And I need atleast two animated and working charecters ready. If anyone at this forum would like his or her name in the credit and wouldn't mind helping out please. I really want to get this done. For this project I decided to team up with another kid in the class which makes this project a little more realistic. This is not one of those projects that will get started but never finished. Reason being is that it's my grade.

Please someone help me out here.

Also I'm about to animate this guy. Using wiz, extraction meathod what's the next step. How do I animate and move him?

I do have a version of him in .pcx in the 320 by some what resolution. Just resize him if you'd like.


Title: How does one store .gifs and other images without a libary
Post by: Kofman on May 03, 2003, 08:10:45 PM
If no one can help than can someone teach me how to animate.


Title: How does one store .gifs and other images without a libary
Post by: toonski84 on May 03, 2003, 08:22:08 PM
the drawings or in the game?  in the game there's millions of ways, it's just having all the sprites stored in memory and displaying them in an order.  for instance you might have an 8 frame running animation and then you'd show sprites 1 through 8 over and over when the character is running.  i'd store them in ems/xms memory and use something like a handle to identify it.  most libraries have functions for this.  but if you arent using libraries, your best bet without writing your own sprite blitter is to use multiple dimension arrays like this

dim sprite (4000, 24) as integer

and then use GET/PUT

but all you could get is the very, very limited memory qb (and near memory itself) gives you.


Title: How does one store .gifs and other images without a libary
Post by: Kofman on May 03, 2003, 08:25:14 PM
wiz showed me the dim way. Could you show me some code that I could work with. And also I'm still hoping someone will raise their hand and offer help


Title: How does one store .gifs and other images without a libary
Post by: Kofman on May 04, 2003, 06:58:15 PM
Is there no where I can go for recruits?


Title: How does one store .gifs and other images without a libary
Post by: wizardlife on May 04, 2003, 10:20:58 PM
Quote from: "Kofman"
Is there no where I can go for recruits?


Nope. You're going to need to cut this project down to a size that fits your allotted time and programming skills.


Title: How does one store .gifs and other images without a libary
Post by: Kofman on May 05, 2003, 02:01:37 AM
:barf:

I'm gonna regret this


Title: How does one store .gifs and other images without a libary
Post by: na_th_an on May 05, 2003, 07:09:35 AM
People don't have time to complete their own projects, so understand that they don't join in someone else's project... And maybe you find help in coding, but in GFX... aw, forget it!  Only 10% of people here can do nice GFX..., and they are way too busy. Also, I don't think nobody would do a bunch of burning GFX design to a project what is likely to be cancelled (I am not saying that you're gonna cancel your project, I'm talking about the 98% of QB projects, which are cancelled -> That's why people don't like to team).

Also, the exams are ... NOW!!! (fear)