Qbasicnews.com
Starting a fighting game - Printable Version

+- Qbasicnews.com (http://qbasicnews.com/newforum)
+-- Forum: QBasic (http://qbasicnews.com/newforum/forum-4.html)
+--- Forum: QB Discussion & Programming Help (http://qbasicnews.com/newforum/forum-11.html)
+--- Thread: Starting a fighting game (/thread-671.html)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16


How do I begin an animation engine - Kofman - 05-11-2003

My next step is two write some code for an animation engine

where do I start?

i'm going to start making the sprites for animation.
But where do I begin for the animation?

---------------------

Well what I mean maybe is something to scroll frame cycles on command. I saw a glimpse of something like that in cobra. I was wondering if their was any available code out there. If not i'll try wrighting my own.


Starting a fighting game - Kofman - 05-13-2003

geez you gatta explain the whole pallate thing to me. Why do I keep having trouble with it.
Here's the new image and I can't load it in.

http://www.geekshelter.com/naruto/images/naruto.pcx
http://www.geekshelter.com/naruto/images/naruto.til


Starting a fighting game - na_th_an - 05-13-2003

Well. Imagine that you have to paint a picture using oil paints. Imagine that you have your canvas, your brush and your talent, and also you have a palette where there is place for 256 different colours. Depending on what you are gonna paint, you select carefully each of the 256 colours.

That's how VGA palette works. Actually, there are 262144 different colours, but only 256 can be displayed at once on screen. That selection of 256 colours among the 262144 possible is called "palette". To choose a colour, you just especify its three luminic components, red, green and blue. Each one of those components is specified giving a 6 bits number, that is, a number which ranges from 0 to 63 (64 different intensities). That's why we have 64*64*64=262144 possible colours. To associate a colour to one of our slots, we can use the (slow) PALETTE command...

Code:
PALETTE slot, red + 256*green + 65536*blue

Or we can use OUTs to the DAC ports of the VGA (fast)...

Code:
OUT &H3C8, slot
OUT &H3C9, red
OUT &H3C9, green
OUT &H3C9, blue

When you start mode 13h (after a SCREEN 13 command) the DAC registers (that is how those slots are called) are set to defaults values. That arrangement is (IMHO) really ugly and unusable for real GFX. The trick is to choose a better palette, and make all your graphics using it. Programs like neopaint help you converting images from one palette to another.

What I do is beginning with a BLACK palette (in Deluxe Paint, the proggie I use to do my GFX) and I create the colours within the graphics editor when I need them. For example, if I begin doing some grass tiles, I create some green shades. Then, when I need drawing rocks, I create gray shades... That way, your palette will be just like you want. Then, in your program, you just have to find a way to load up the palette and alter the DAC registers as I mentioned above.

Cheerz Smile=


Starting a fighting game - Kofman - 05-13-2003

I generally get the idea I think. You find 256 colors you like save the pallate and keep reusing it. Well I'm confused on why i'm getting the error. I don't think I should be. I know it's photoshop's fault. But It the easiest way for me to make graphics. Even pixel graphics. It has so many useful tools that speed up work. I just don't think it can compare to Deluxe Paint which I did try in the proccess. I can find a way to transfer my .pcx into Deluxe maybe that could solve my agony?


--------------

Almost forgot. I'm a little confused on the OUT ASM thing ur doing. : )


Possible answer... - Glenn - 05-13-2003

I'm not where I can verify it for sure right now, but from loading your .PCX file into MS Word, one thing that might cause you to have a problem with your palette is that it appears that your PCX file is storing 24-bit pallete data (i.e., 8-bit RGB values), not an 18-bit palette (i.e., 6-bit RGB values). I can verify that for sure when I get home (in the so-called wee hours of the morning).

In the meantime, there's a program DEM8.BAS/.EXE in

http://www.geocities.com/gstumpff/pcxpal.zip

that will convert the 24-bit palette in a PCX file to an 18-bit one. You can run that and see if it makes your PCX file work. (At least, I think I included the .EXE in the .ZIP file. If I didn't, just make the .EXE. I wrote the program so that it runs from the DOS command-line with the PCX file name after the "DEM8" command.)


Starting a fighting game - na_th_an - 05-13-2003

Quote:I generally get the idea I think. You find 256 colors you like save the pallate and keep reusing it. Well I'm confused on why i'm getting the error. I don't think I should be. I know it's photoshop's fault. But It the easiest way for me to make graphics. Even pixel graphics. It has so many useful tools that speed up work. I just don't think it can compare to Deluxe Paint which I did try in the proccess. I can find a way to transfer my .pcx into Deluxe maybe that could solve my agony?

Well, try Neopaint. Just use photoshop to draw, then use neopaint to convert palettes. Or use your final palette directly when you're drawing. You can import it to the swatches so you can draw using them, so no probs Smile


Quote:Almost forgot. I'm a little confused on the OUT ASM thing ur doing. : )

Not ASM, but pure QB Smile Let me explain what are "ports". Ports are 65355 kinda mailboxes that your PC uses to communicate with some devices (keyboard, loudspeaker or VGA, among others). In some operations, you just put values in some ports waiting for the device to read them and act consequently (OUT port, value). In other cases you just read a value that some device has located in a port ( value = INP(port) ).

Ports &H3C7, &H3C8 and &H3C9 are use to communicate with VGA's DAC registers. If the VGA finds a value in &H3C7, it will return the colour values in &H3C9 (like some kind of queue: when you read red, it will put green, and so on). When the VGA finds a value in &H3C8, it just waits for you to give it the red, green and blue thru &H3C9.

My 4 OUTs just say:

Code:
OUT &H3C8, slot    ' PC says: Hey, VGA, I wanna change this slot in the DAC registers
' The VGA thinks: ¡cool! Let me wait for 3 values. First "red".
OUT &H3C9, red    ' PC says: Here's the red value.
' The VGA thinks: nice. Now I am waiting for "green".
OUT &H3C9, green  ' PC says: Here's the green value.
' The VGA thinks: well, now the last one, "blue".
OUT &H3C9, blue   ' PC says: And here's blue.
' The VGA thinks: well done, now I have red, green and blue.
' Time to change the DAC registers :)

I know it looks like Sesame Street, but I liked how it looked like Big Grin


Starting a fighting game - wizardlife - 05-13-2003

The standard DeluxePaint palette is fairly good. The main problem with it is that there's some 32+ shades of blue and purple, and I can't ever picture drawing that much water. At any rate, it's a good idea to make your palette in blocks of 16 colours... in consistently either getting darker or getting lighter. It's unlikely that you'll need it now, but if you ever get into doing lighting, you'll thank me then.

Here's a direct download it 'ACE' format:
http://www.abandondata.nl/download/Deluxe_Paint_2.ace

And here's a page that has it (and many other useful things) in 'RAR':
http://www.dossolutions.pwp.blueyonder.co.uk/download.htm


Starting a fighting game - na_th_an - 05-13-2003

I use the default palette to start very often, but soon I make changes. Anyhow, I do start in balck and I create colours as I need them. With simple, tiny lo-res GFX you can do it as your sprites usually don't need many colours.

It is also a good practice to have say 128 colours for sprites and 128 colours for backdrops. That way you can reuse sprites and reuse background tiles just changing a bit the palette.


Starting a fighting game - wizardlife - 05-13-2003

Quote:It is also a good practice to have say 128 colours for sprites and 128 colours for backdrops. That way you can reuse sprites and reuse background tiles just changing a bit the palette.

I don't think our friend will be dealing with backdrops anytime soon... particularly with his intention of staying lib-free. (Honourable, of course, but there's no speed to be had in a pureQB transparent PUT)

Half for background, half for sprites? Hmm... I prefer a consistent palette... But if you insist on dynamic, I'd go with the JJ2 solution: Have the first ~32 colours reserved for characters, pickups, and text, and then allow the tile libraries to completely rewrite the rest of the palette for their specific level.

Of course, in a fighter, it might be more appropriate to just have 16 colours reserved for the interface and then give each character 100 colours to play with...


Yup, whatever program you're using to create the PCX... - Glenn - 05-13-2003

file is generating 8-bit RGB data, not 6-bit data. Windows PCX viewers will generally display that just fine. DOS programs generally won't. (And QB's PALETTE statement really doesn't like 8-bit RGB data.)