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) |
Starting a fighting game - na_th_an - 05-19-2003 In fact, the problems you'll find trying to use pure QB in your project is that you'll only have space for 8 or 9 sprites that size in conventional memory.You need EMS or XMS, or your GFX data won't fin in memory. Starting a fighting game - Kofman - 05-19-2003 Your saying I wont survive without libarie. Alright I'll try again. If you can, please get the tutorial on masking. I'm going to see what I can do with libaries one more time. Your recomnding Direct QB I assume? Wait a sec for Dircect QB I have to edit the CONFIG file. I'm not going to be able to do that at the school computers. !! I'l try to stick with masking Starting a fighting game - wizardlife - 05-20-2003 I go away on a canoe trip for three days and we spiral out of control again. What happened to the simplicity talk of a week ago? Mr. Anderson... Okay, forget the backdrops, forget the transparency. Forget using a lib. You don't have the time for that nonsense. Get the game happening on a black background first... and if it works there (a massive achievement) it will be easy to port to Rel or DQB. Starting a fighting game - na_th_an - 05-20-2003 I was only fearing that sprites of that size wouldn't fit in memory. Anyways, here's the tut on masking: As you may have noticed, the PUT function has those parameters: Code: PUT (x%, y%), array%(index%)[, mode] where mode can be either PSET, AND, XOR among others. That final parameters especifies a logical operation between the pixel data in the array and the pixel data on screen. What is a logical operation? Well, I guess you have heard of AND and OR, and that: Code: 1 OR x = 1 where x can be either 1 or 0. You also have XOR: Code: x XOR x = 0 Those binary operations can be applied to byte numbers, for example, 127 AND 255 will compare each bit of 127 with its correspondent bit in 255, and will build a new byte with the results: Code: 127 = 0 1 1 1 1 1 1 1 This is very useful when trying to avoid the ugly black bounding box around our GFX. With masking techniques, you can get rid of it. First we need to create a mask. Imagine we want a ball. We think on which pixels will be transparent and draw it with colour #ZERO: Code: 00 00 01 02 02 01 00 00 Now, we create the mask. We need a similar drawing, but the transparent zones have to be drawn with colour #FFh (255, the last colour, in binary 11111111b). The non-transparent zones have to be drawn with colour #00h, that is: Code: FF FF 00 00 00 00 FF FF what for? well, let me explain: To do masking, we first need to prepare screen. If we PUT the mask using "AND", the blitter will AND each pixel in our mask with its correspondent on screen. That will make that every pixel on screen that corresponds with a FF in our mask (transparent zone) will remain as it is, 'cause x AND FF = x. It will also make that every pixel on screen that corresponds with a 00 in our mask (solid zones) will be cleared to ZERO, 'cause x AND 0 = 0. Note that this will create a black zone with the shape of our sprite on screen. Now we PUT the sprite using "XOR". Note that x XOR 0 = x and 0 XOR x = x, so the pixels in your sprite that equal 0 (transparent zones) won't have no effect on screen (and those pixels on screen will still have the background, after the AND operation), and the pixels in your sprite different from 0 will be XORed with pixels on screen that equal zero (after the AND operation, if your mask was correctly done). Code: ' Transparent blit using masks: I can't post examples 'cause my webspace can not be accessed tonight, so I can't upload pics to show you . LATER: I've written this piece of code as an example: Code: ' Masking demo by Na Than Assh Antti 2003 Starting a fighting game - Kofman - 05-22-2003 I get it, it's very creative. And very simple too I think. Thanks allot. Before you said this takes allot of memory and is slow. How about this. I. Using wiz's spriter and rendering code get the masks and sprites onto memory. II. Next use masking to create transparency. III. Clear Memory IV. Make new sprites from those on the screen and save them into memory. V. Clear the screen and start playing with them The only problem I see here is I don't know how to clear memory. I mean destroy an array or something like that. This might take some time to load. But just make a little bar that loads everything and without the use of libaries I'm sure it will be very acceptable to wait a few seconds till everything is loaded, unloaded, and reloaded. So tell me if this could work and if so how do you clear an array or clear memory? Starting a fighting game - Kofman - 05-22-2003 I just did that masking thing and all my colors got a little screwy. Really screwy. I'm waiting for the chance to upload it, becuase it's really impossible to describe it. If you know the problem off hand please tell me. Here is my long abstract code collected from what you guys have given me. Code: SCREEN 13 Starting a fighting game - Kofman - 05-22-2003 I know I already have a bunch of posts going here, with different things to discuss but since I haven't been replied to yet I'll keep going : P. Is their a way to take a color from the pallate directly and either manipulate it by changing it, or better yet deleting it from the pallate. Thus making something trasparent. Food for Thought or just my stupidity acting up again. :king: You can read the RGB data for attribute A from the ... - Glenn - 05-22-2003 palette registers via OUT &H3C7, A R = INP(&H3C9) G = INP(&H3C9) B =INP(&H3C9) But changing them and rewriting them to the palette registers, via OUT &H3C8, A OUT &H3C9, R OUT &H3C9, G OUT &H3C9, B won't make anything "transparent." That's not a property of the RGB data. That's a property of how the attribute you're plotting interacts with the attribute of the pixel already on the screen at that location. Starting a fighting game - Kofman - 05-22-2003 oh I know it's not really possible to create a transparent swatch in the pallate. But when you load a program onto the screen in QBASIC the background isn't really black. It's empty theirs nothing their. So what I'm saying is couldn't you take a certain swatch and tell the pallate never to actually draw it. Or something like that. I mean I'm expreminting with ideas that have probably been thought of already but It's worth a try to maybe inspire one you genious to come up with a solution. Also I've bad at understanding what INP(&H3C9) means. Where can I get definitions for all these sybmols : ? Starting a fighting game - wizardlife - 05-22-2003 It's called a transparent PUT routine. It's 50% of the reason to switch to a lib. (the other 50% being a fast double buffer, of course) But like I said, I think you should screw that and just work on a black background. |