The Kiyote On A Variety Of Subjects
Written by Kiyotewolf
Legacy support and you, what it means to go DOS again.
Like I said in my letter, it is possible to take a fully assimilated computer, yes, a laptop, and get it to boot back into real good old fashioned DOS. If you are fortunate to have DOS disks, or a disk with DOS boot files in the root of the floppy, IO.SYS..MSDOS.SYS,.., you can buy one of those external USB floppy drives, and put the boot disk in, and if your BIOS is configured to search for bootable media in the proper order, it will use legacy compatability to actually boot from the external USB floppy drive. If you are lucky enough to have a laptop with an LPT1: port, you might be able to load up the GUEST.EXE driver for an external ZIP drive through the parallel port, and be able to manage 100MB of data while playing around in DOS booted from a floppy. If not, you could install an EMS/XMS/RAMDISK driver set into memory and expand a ZIP file of your program into memory and run under those conditions. If not, a small quaint demo of your program squished and squeezed down into 1.44MB minus other files, so you can at least show off your creation on any random computer that does not have a floppy drive of it's own.
One thing I did run into, copying my DOS install disks, there was a weak copy protection on the disks. They were named in the Disk label, DISK[SPACE x 6]1, etc.. and trying to format a disk with the DOS shell on it and setting the volume label with spaces in it only caused an error in the DOS format command. What I had to do, was use my USB drive to change the volume name after it was formatted with the /S command, and the WinXP environment let me put spaces back into the volume name without arguing with me. Cheap copy protection, broken! I could have never done that with DOS alone. I tested out my copies of my DOS install disks to see if they would really pass a real REAL test of them on a brand new system. It's very good I did, cause I figured out how to bypass the copy protection in the process.
Hardware and more hardware -- playing with your tools.
I have a dead oversized computer, that I was able to put DOS back onto, but the cage did not match up for the drives, both the floppy and the hard drive. So, instead, I built a cage using Erector Set pieces. You might think this is childish and stupid, but actually it wasn't a bad way to go. It is rather secure, and much safer than trying to rest the drives on random things in the case without properly being secured down. Another reason for the funny mounting is the front panel for the floppy drive is in an odd kind of spacing. I used the custom cage to make the drive reachable from the front.
Also, wiring in the case, clear duct tape makes great electrical tape. It does not have any of the conductive silver trace in it, (do not use silver duct tape ever), and is very very sturdy and grips good. I have been out to buy real electrical tape and found the glue is horribly weak and falls right off after a few days. It's very sad.
7x7x16 colors in EGA
I have came up with radical ways of making the color palettes do over and under techniques for sprites and backgrounds, but a much easier path to try this all out is in EGA. Plus, once you grasp the idea in EGA, understanding the VGA and SuperVGA versions will make more sense.
Take the LSB bits and make them your 4 colors, and take the MSB bits and make them the other 4 colors, (of course one will be shared, the background color), then make the intersections of the colors what they should be when they mix. If you want, set the intersecting colors to be a blended color, or keep the colors as either the same as the MSB or LSB, depending on how you want the over-under technique to react for you.
...........LSB........: .0000 0001 0010 0011 . .0100 0101 0110 0111 . .1000 1001 1010 1011 . .1100 1101 1110 1111 :MSB
If you take the color 0000 (Binary), and set it the background color for the whole set, you can then take 0001, 0010, 0011 and set those as 3 colors.
If you take 0100, 1000, 1100 and set them to the other 3 colors, you can plainly see the colors will overlap, but not affect each other.
You now have two sets of colors. To make them work in the over-under fashion, you simply go either horizontal or vertical, taking the MSB or LSB colors and copying them across the adjacent colors, so that when the Lefts intersect with the Ups, if the Ups are going vertical through the matrix, the Ups will stand out over the Lefts even if they share the same space on the pixel screen.
0000 = Black 0001 = Gray 0010 = Dark Blue 0011 = Light Blue ...........LSB........: .0000 0001 0010 0011 . .0100 0101 0110 0111 . .1000 1001 1010 1011 . .1100 1101 1110 1111 :MSB
Now, to get those other colors right, set 0101 to Gray, 1001 to Gray and 1101 to Gray.
Set 0110 to Dark Blue, 1010 to Dark Blue, and 1110 to Dark Blue.
Set 0111 to Light Blue, 1011 to Light Blue, and 1111 to Light Blue.
Now, draw a background screen using 0000, 0100, 1000, 1100 as something like black, gray, dark red, light red, and then put your sprites all over the screen as LSB colors, once you PUT XOR or PUT OR, the bits will overlay each other, but not collide, and once the palette settings come through, the color displayed on the screen becomes, what the final bit result is mapped to.
I know I tried to explain all this in my last few submissions, but sometimes the simpler examples are the easiest to follow.
Plus, Bonus, EGA has those extra pages for doing off screen double buffered animation, so if you like Super-Gameboy color stylings in your games, you can take this idea and run with it.
Frankly, you don't see alot of 100% full color games make it very far or very long unless they are coded in C++++++++ with gobs of 3D and all kinds of stuff. For those of us coding for the rest of the crowd, sometimes the most catchy games are the ones that have a style about them, not taking full advantage of everything, but using what is there in a way that catches your attention.
Rules and the Retro
What do all gamers love. RETRO! What is Retro? Well, to put it simply, rules, and strict rule following.
Want to take a game you are designing and make it instantly recognizable as an attempt to go back in time to, (what do we wanna hear?), RETRO?!?, well..
Go back to Apple colors, not GR, but HGR.
We Apple programmers were limited to 7 colors, 8 if you were lucky.
Black, White, Green, Magenta (Purple), Orange, Blue and sometimes Yellow. Yellow was tricky, and I only saw REAL yellow mixed into a Might and Magic (tm) game on the Apple, but needless to say, it became "" officially a color in the HGR mode to me once I saw that.
What is rather nice, is my VGA technique of the 7x7x16 colors will take an apple color scheme rather nicely. You can drop in 7 colors (black being already in the 0 location), and do up another 7 in the MSB direction, and have an instant Apple styled game ready to go. What is even more interesting, is you can double those colors on both the LSB and MSB directions, and this time, invert the bars running across the matrix and you can have background elements with double the interactivity. You can run in front of some background elements while passing behind others. I will code an example of all this and post it next issue for people to look at.
Commodore? Well, Sprites in multi color had 3 colors, 2 which were shared between all 8 sprites, and one indivudual color that could be selected for each sprite. So, you have to colorize your sprites using 2 colors through them all, and also double width the pixels, and that gets you becoming creative.
Nintendo? 4 colors per 8x8 block.
Atari? 8x8 pixels, one color per scan line, double or quadruple width depending on the use of the missle (sprite).
If people take those rules they had when they were coding on older platforms and carry them over into their new projects, we can all have "" RETRO! computer games again, and I'm sure people would most likely question you if that was an actual old system game you were touting, especially once you posted screen shots of your work.
Visual Basic doing QBasic handywork.
Visual Basic is not the easiest thing to code in. But, with a little bit of backing and some explanations, I think alot of the front end stuff people struggle with could be handled by a VB script easily and much more smoothly.
Visual Basic, by itself, has many flavors, coming in this release and that, but the one I understand and like is the Macro VB language found inside of Excel.
VB under Excel runs on threads, ALONE,.. that means there is no running executable code unless you have a timer thread going to trigger something. Also, being able to store data is an issue in-program, because variables are usually confined to the locality of where they are created. This, of course, is not an issue, because you can use the Cells of the Excel program as non-volatile memory. An even bigger plus, if you store all your data in-house, in Excel Cells, once you [X] out your program, (saving changes of course), the data comes back once you re-open the project.
There is a very particular way to get your VB code to self-run upon opening up your Excel file, which I will document for you next issue, and there are also things in dealing with variables that must be explained.
Cells do not store random bits of data, they store information in what is called, "" Variant type data.
im HelloKitty as Variant HelloKitty = CVar("String stuffs")
Whenever you go to put data into a Cell in Excel, it is wisest to put it into a wrapper by converting whatever data type it is, into a variant type such as that.
You HAVE to declare every variable you use, and $ in strings is not allowed, although the $ in the command MID$ is allowed. All your strings and other data types are simply alphanumerics, no delimiters allowed.
When you are joining strings, you are wisest to use the & symbol, (joining), instead of the + symbol, especially if you have conflicting data types. Using the & will tell the interpreter to attempt to join string data, while the + operator will try to calculate a value from the expression.
To find all this wonderful VB stuff in Excel, press ALT-F11 on a blank Excel spreadsheet and you will find the editor. It uses forms and buttons, and other stuff like that, and must be explained a little further.
Oh, if you address a Cell, you have to put Sheet1.Cell(y,x)=....
It addresses the cells like LOCATE would, where Y is first.
Sheet1, is of course the name of the sheet you are using to store the data. If you do not put the name of the sheet in there separated by periods, you might end up having to later, because I used to code with just "" Cell(1,1)=..., but it gave me an error one day and the cure as to add the name of the Sheet to the Cell addressing. If you delete or rename a sheet, your VB code will come up with an Object Missing error, and you must rename another sheet to what the code reflects. This is sometimes difficult, just keep deleting sheets and adding and renaming until it lets you. It is difficult about doing that for some reason.
When you code the initial boot program it goes into a Module, and your programs go into Userforms. If you create an object, like a button, do not use reserved names. It will warn you if you try to. If you double click on the name of the userform, it will appear in the editor, and if you create a button and double click on that, it will generate a SUB for you with the name of the button with _ONCLICK added to the end. This is where you stick your code to react to the thread activation. Thinking on a thread only basis is a very big head spin, since getting my diary program in VB//Excel was a big learning curve for me at first.
I will document this further, and there is also very easy to use code that will let you do a file search and return the entire file path as well as the file, which is valuable for any real project.
There is code by one of the masters that lets you create and modify 24bit BMP's using GET and PUT commands, which you can use to edit graphics in your VB code, and there is also code to access a DOS shell within VB so you can trigger your edited image to view in an external program like PAINT, or whatever.
Alot of making thread based code work is to take a page out of Java scripts for web pages. You only activate based on your entries the code to parse your information by hitting a "" SUBMIT button. In my diary program, I can edit a diary entry, but I will lose my edit unless I hit SUBMIT to save the data into the Excel Cell for me.
Really, going from a constantly running coded program to a thread based response only kind of coding, will take a change in thinking, but it will prime you for other programming as well. Alot of modern code is done using thread only based methods, and this will give you a taste of how to orchestrate a program to run concurrently, with completely isolated pieces, working across a mutually accessable plane of data sharing, (the cells), and hopefully push you further into better programming.
Oh, when I name my buttons, I usually add the lil word Momo on the end, so whatever name I come up with does not accidentally be a reserved word. Momo -- "" Momentary Switch.
Good Sprite Animation
I have found an unwritten rule about sprite animation, that should help anybody that is learning to do animated pixel art, aka game sprites.
" Do not change the number of pixels in your sprites."
How do we do this? Well, the way you do that is write your own image editor, that lets you take and swap the pixels locations, two at a time, instead of drawing and erasing. Of course you need to get the base sprite done first with erasing, but once you go to take and add in fluid motion, your eye will notice the drop in pixels subconciously, and it will look "" off, to you. The proportion changes both actually, and your eyes subconciously pick up on it as well. Once you break the fluidity of having the same number of pixels on the screen, your animation looks broken and very odd, even maybe disturbing. Yes, there ARE cases where you Must add more pixels period, but doing the inbetween animations, take and wiggle the pixels around, don't hack and slash your way through doing those fine tuned animations. Your eyes will thank you and so will your fans.
A virtual 3rd button for your mouse.
An awesome trick I found using a shareware program called MVP, was the addition of a 3rd button, without actually mapping the middle button on the mouse. How?? You poll the right button, and once the button is pressed down, you poll to see if the user clicks the left button next while still holding the right one, or lets go of the right button.
This simple way of adding a third option to your programs is invaluable and saves a ton of overhead. Cause eliminating even one extra menu can cut down on a ton of extra lines of code. This will let you drop all that down into a simple polling loop to see what the user does with the other button while you watch the first one.
Printing listings on any printer in a readable format.
Open document in Notepad, copy paste to Word pad, SELECT ALL, set to "" Courrier New Font, and manually type in the font size as 5 .
When you go to print, one you will save a ton of ink, and two, if you can read that small, you will be able to see those long long long lines of code with very little line wrapping on the ends.
'Simple program to fix the Linux naming problem.
OPEN "MYPROG.BAS" FOR INPUT AS #1 OPEN "MYPROG2.BAS" FOR OUTPUT AS #2 WHILE NOT EOF(1) A$=INPUT$(1,1) PRINT #2,UCASE$(A$) WEND CLOSE #2 CLOSE #1
I saw that letter about coding in Linux and how files with uppercase and lowercase will not find each other, so I coded that short sweet answer to that problem.