Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - CW

#121
Ah well, given the state of MY code, who am I to grouse about inelegant solutions?  :)
I'll just suck it up and require that the user pass the current font number so that everything can be left tidy when the function ends.

Thx all.
-CW
#122
Thanks Marmor. That gives me something to work with.

Spacefractal, I'm not sure I follow what you mean by " loading the font inside a function instead using that command directly".

I assume you mean avoiding the LOADFONT command? If so are you talking about loading the font using LOADANIM from within the function, using FRAMEWIDTH and FRAMEHEIGHT equal to the font-width and font-height, and writing a simple word-processor engine around it to displaying each animation cell where they need to be placed to create text? I suppose that would work, but it seems an awful long way to go to get around the problem of not corrupting the original font which was set by the calling program.

If this isn't what you had in mind, please give me a more detailed description on your method for handling it.

Thanks! 
-CW
#123
I am placing the finishing touches on a nifty function which may be useful with many different applications. I'd like to use both a custom directory and a custom font with the function, and than restore the original directory and font when the function exits. The directory is no problem, as we have the GETCURRENTDIR$() & SETCURRENTDIR() commands, but the font has me stumped.

If I use Fontkey% = GENFONT() in my function, is there a way to discover before I call it, from within the function, which font number is currently set so that I can restore it when I exit? Also, is there a way to UNLOAD(Fontkey) and free up the memory occupied by the custom font, which was set aside by the LOADFONT command using Fontkey = GENFONT?

Yes, I could require the programer to pass Fontkey to the function, but that seems so ugly and inelegant. It seems there should be a counterpart to GETCURRENTDIR$() for fonts.

Thanks!
-CW
#124
Fair enough, sf. I'll add it to my to-do list.  =D
-CW
#125
That is a very good question, Asmodean. I think I'd enjoy such a book too. I'm not sure any single book can cover it all.
AI, for example, is a rich field in its own right; and the books I've seen on it are linked to specific languages for their examples.

A personal favorite for me (and this will date me) was "Exploring Artificial Intelligence on Your Commodore 64", an entry-level book which covered all sorts of AI with easy to follow example code covering language parsing, weighted tree-searches, artificial learning and more. There used to be some wonderful programing magazines on the news racks which covered sound game layout and design. Maybe some of them are still being published. But even they will be tied to a specific language for their examples, I expect.

-CW   
#126
I normally write applications for my own study and amusement, but not many games. This is because, with very few exceptions, there is no game that I can write which can compete with the quality and brute man-hours which go into professional games. (Especially with 3-D) At one time the solo hobbyist could write engaging games to show off and share with his friends, and indeed, at one time I was in the habit of pulling all-nighters, just coding away. But those days ended around the time the C=128 came on the market. (There are, of course, even today, a few notable exceptions.)

No, these days I program as a way to explore subjects which grab my attention and about which I desire a deeper understanding; especially those applications for which suitable commercial software does not exist. I've written programs to explore probability, random walks, fractals, Conway's The Game of Life, Turing Machines, Mandelbrot sets, the Monty Hall problem, creating bar-codes (and several home applications for them), and more. Currently I'm discovering all sorts of deliciously mind-twisty things related to color wheels and the 16.58 million colors (255^3) we can display. I'll write up a report on that and share it in the near future. These are the sorts of things I do.

I'd like to share a couple of my more interesting examples. You have, no doubt, heard of the so-called "Bible Codes", by which a certain author popularized the notion that predictions of dramatic modern disasters, such as the space-shuttle blowing up, or 911, were "encoded" the Bible? It's all BS, of course. It boils down to playing Boggle with the text; a banal word-search using various skip rates by which a person can hunt for loaded terms in any text at all. And the ancient languages in which the bible was written are particularly suited to the game because there are no letters for vowels. This leaves the searcher free to sprinkle in vowels at will and dramatically increases the probability that some sort of "match" for loaded words can be found. I once wrote an application to hunt for these sorts of hidden "messages" in the text of other books which I downloaded for free from the Gutenberg Project.

I was once a member of a Bulletin Board (in the days before the internet) which was all but taken over by a passionate fellow who was convinced that George H. Bush was the Anti-Christ, and he wanted to warn the world using the Biblically  inspired mathematics by which George Bush's letters summed to the number of the beast, 666. Several of us tried to explain how the game was played, and that his numbers were no more than that, a game; but there was no talking to him. He couldn't imagine how anyone could come up with such a remarkable fit. So I wrote a little program which used brute-force to search for all combinations of numbers which summed to 666, using this fellow's name, John P Boatwright, based on the periodic table of the elements and a quote from the bible linking Satan to the earth. Well, that shut him up good. I even gave him all sorts of statistics about how vanishingly low the odds were that his name would sum to 666, purely by chance; so there was no denying the God's Divinely Revealed TRUTH that HE was the spawn of Satan. I even concentrated on elements with strong parallels to corruption, fire, or Satan. (Such as Nickle, which once had the nick-name 'Satan's Copper' for its heat resistance; or phosphorus, which was first isolated from urine and has a strong association with Sulfur, Fire and Brimstone.)  You can't buy an application to do that sort of thing!

So, 3D is nice and all; and I may one day dip my toes into the water out of pure curiosity, but 3D just isn't in my scope at this time, given the riches I still mine from pure 2D. GL-Basic is light-years ahead of the old Q-Basic, which is why I like it. I especially like the ability to control graphics on a pixel level -a thing I could never do when I programed in Visual-Basic. Basic is slow by its very nature, but it suits my needs and abilities well enough. Cheers!

-CW   
#127
Thanks Mr.Toad, that's just what I was looking for.
I was adding a lot of extra garbage which I didn't need.

Cheers!   :happy:
-CW
#128
Hey all, I need someone to help jog my memory.

I seem to remember reading somewhere that it is possible to declare optional arguments which can be passed to a function, but which can be omitted; in which case the function uses the default value. I can't find that text again, now that I need the ability. (Was it in GLbasic?)

It would look something like: (Just a quick and dirty example..)

FUNCTION Example: x%,y%, [color% = 0]    //where color% can either be passed, or not, by the calling program.
  SETPIXEL x,y,color
ENDFUNCTION

If memory serves, optional arguments are allowed provided they are placed at the end of the declaration.
I COULD create two or more variations on the same function, or create nesting wrappers around the functions, but why create two when one will do?

Can someone give me a hand?   :)

-CW
#129
Quote
What is wrong with the "I have an idea and need code+sound+gfx+etc"

There is nothing wrong with it. That's why KittyHello needs to get busy on the DOITALLFORME$( ) command.
You just describe what you want, and GLBasic does the rest.

-CW
#130
Off Topic / Re: Lost Code?
2013-Mar-19
Oh... OUCH Marmor. 5 YEARS of coding??  :O That sux.

Thx Softy. I'll check that out. It occurs to me that had I been using your utility I would only be out a couple of hours code, at most, and backing up to the cloud would have saved me a lot of running back and forth between the library and home. Good advice. I'll look into it.

Erico, that's a good philosophy. Try not to look at it as a loss, try to look at it as a chance to improve. lol  Thx. :)

-CW
#131
Off Topic / Lost Code?
2013-Mar-18
I'm a little ticked today. I arrived at the library this morning to do some coding, only to discover that I did not bring the latest version of my Color Wheel program with me.  :glare: Annoying, right? Yeah, but not too bad. So I walked back home, transferred the latest file to my thumb-drive, and then drove to the library again. There I discovered that the night before I had, somehow, overwritten my latest version with an earlier version! Gah! An entire day's programing lost :rant: It was late. That's what I get for not knowing when to stop and call it a night.  :bed:

I am now back home, where I have recovered the version previous to that; but now I'm not much in the mood for programing. Maybe I should crawl back into bed with the cat. =^..^=
It's just one of those days.

I'm glad I make regular backups. The loss wasn't too bad, just one day. But it is frustrating. My question to you is, what is the worst code-loss you have ever experienced, and how did it happen? Any stories you'd like to share?

I once lost a week's worth of coding, years ago (when I never bothered with backups) after one bad revision attempt in the spaghetti-code I used to write wound up trashing the program and got me hopelessly lost in the weeds, in a way that was beyond fixing. The more I tried to undo the damage, the more I screwed it up.  :giveup:
Ah well. Lesson learned. What about you?
-CW
#132
Can you do a mother ship that looks like a Mardi gras float? Or maybe a school bus? lol
J.K. They look really good.
-CW

PS, what should we call the game? "Space-Invaders" is taken.
How about "The Not-From-Earth-Interlopers"?
Hmm.. sort of rolls of the tongue.
#133
2D-snippets / Re: 8-Bit Rain
2013-Mar-18
Hey Erico, I like that! And nice choice of back-ground pick for the demo. The whole thing has a nice retro-feel to it.  :)
We could easily add things for rain-drops to splash off of, like phone-booth, news stands, awnings, etc.

This is perfect for an intro-scene. Can you imagine a "Dink Darkly, Private-Eye" logo in a seedy store-front window, with the rain falling down and a few lightning flashes? Some "mystery" music plays as an old-time car with grey windows pulls up, and parks. The head of a beautiful dame is momentarily visible over the top of the car as she steps into the door. A woman sobs. Lightning flashes. Game On!
-CW
#134
Very nice, SF.

Having recently struggled with the slow nature of plotting (drawing) circles in Basic, I am very well placed to admire how quickly your code can draw simple circles. (I especially like how you plot only those points which are actually on the screen.)

How do you think your code for creating simple disks would compare, speed wise, with plotting a disk to the screen, doing a GRABSPRITE of that disk, and then using STRETCHSPRITE to scale the disk up or down to the diameter needed? You could even draw the disk transparent and use the sprite as a mask to stamp colored disks out from a DRAWRECT.

If the speed is favorable, I also wonder if a speed gain could be made by plotting 25% of a disk, as you suggested, and then rotating the sprite around to create the rest of the disk from which the GRABSPRITE could be taken.

I like your more complex disks and  circles, with Alpha set and with the feathered edges, very much. Yeah, they take a little longer to render, but they are worth it. Very stylish.

-Cheers!
-CW