QB Express

Issue #21  ~  July 16, 2006

"A magazine by the QB community, for the QB community!"

In This Issue



From The Editor's Desk

Written by Pete

This past month, there has been a lot of speculation and a lot of conspiracy theories that QB Express is "dead" or "dying," that I don't care about the magazine anymore, and that nobody is submitting articles. Well, to quote the great Mark Twain, when his obituary was erroneously published:

"The reports of my death have been greatly exaggerated."

QB Express is not going anywhere. Sure, things have slowed down the last few months, and the issues have started coming out on a bimonthly basis -- but I am still dedicated to publishing QB Express as often as possible, and always doing the best job that I can. Ideally, I'd like to pump an issue out right on schedule on the fifteenth of every month, but sometimes life gets in the way...and the issues always end up taking far more time to write/compile than I ever expect them to take. But rest assured: As long as you, the readers, continue to submit content, QB Express WILL come out, sooner or later (preferably sooner), and it WILL continue to maintain the same high quality that it has always had. That is my promise to you. And I take this very seriously.

I'd like to rebuke some of the jabs people have made at QB Express lately, particularly in this thread. In that post, the moderators of ASCII-World (MystikShadows, lurah and mennonite) announced the creation of a new QB magazine, entitled "PCOPY." When I heard about PCOPY, I was happy, and wished them well...I believe that there's room for many more QB magazines in the community, and the way I see it, the more activity, the better. But some QB Express fans started questioning the new magazine, saying it would hurt QB Express and that there was no need for a second BASIC magazine. Hearing the criticism, mennonite went on a tirade against QB Express. Here are some of his claims -- and my responses:

1. QBE is becoming something most members of the qmunity (my qmunity) have no reason to post to. it is becoming too specialized, and although pete says he will publish anything about qbasic/freebasic (indeed, thanks to his server he can publish just a little more than pcopy can) the fact is that most things will not FIT there. what? i mean contextually. qbe is becoming a magazine for the highly skilled, mostly. that can change- it should!

I disagree completely -- QB Express is a magazine for EVERYBODY in the Qmunity, of all skill levels. Very few people who read QB Express are "elite" coders. I myself certainly am not a good QB/FB programmer... Besides, a lot of the tutorials in QB Express are *very* basic. I mean, we've had a half dozen tutorials that introduce people to the PRINT command!

There have always been tutorials covering a wide array of topics, for both beginners and advanced coders. And that's the way it should be. Why should I pander to one specific group when I can deliver content that will appeal to everyone, whether they're a beginner or an expert? If you aren't skilled enough to understand a tutorial, skip it. Passing on one article doesn't ruin the experience of reading the entire magazine. My hope is that there is something in QB Express for everyone, and I think we've succeeded so far.

2. the main reason no one is sending stuff in to qbe is because (i think, and at least two others have suggested something like it) is that there is an unconscious feeling it won't be published anyway. i mean pete's been busy...the damage is done- three months is a long time to see qbe get irregular!

First off, QB Express still gets plenty of submissions. The submissions were a little bit slow this month, and we have had bigger issues in the past, but this issue is still huge. I mean, there are NINE tutorials this month, FIVE comics, one of the biggest news briefs sections ever, and a ton of other articles! Before QB Express, it was unheard of for a QB magazine to have more than four or five tutorials a month...I just think that QB Express' huge success has made people have hugely inflated opinions of how much content a magazine needs. Honestly, I don't know what you're complaining about.

Second, becoming a bimonthly magazine for a few months instead of a monthly isn't going to kill QB Express. I'll be the first to admit that the magazine's lost a little bit of momentum, but it's not like QB Express is down for the count. I hope to get back to the monthly schedule if I can find the time. (That's the hard part...keep in mind that Pete's QB Site is one of a dozen other websites that I run; that I work 60+ hours a week for Actual Reality Pictures; I produce a cartoon called Unicorn Boy and I'm planning a new reality show that I will produce in the fall; I'm writing a feature-length screenplay and spec scripts for TV shows; I do work for my parents' company, Thunderbird Atlatl; I live in Los Angeles, where I spend at least an hour stuck in traffic a day; I've got many other hobbies that I pursue...and I also have friends, family and a social life.)

3. something needs to change anyway. i've tried changing pete's course before, it doesn't work. pete's gonna do his thing, (and if you were in pete's shoes, wouldn't you?) i don't think the way pete is doing things now is gonna work, and i want there to BE a qbe 22, 23, 24... and this might make him see he needs to change something fast, sooner. this is the best kick in the ass i can think of, and i swear, it's at the right time. this has been planned for a while.

Considering that QB Express is the longest running and largest QB magazine ever, I think I'm doing something right. Look at the archive. We've published more articles in QB Express than almost every other QB magazine combined. What needs to change? My system has worked better than any has in the past, and QB Express is by far the single most productive website in the QB / FB community. I challenge you to name any other site that has more content posted to it on a regular basis.

Maybe I haven't been running QB Express perfectly, but you can't say I haven't done a decent job.

And so, those are my retorts. If you, the readers, are worried that QB Express is done for, go ahead and jump ship. Now that there are other magazines for you to submit content to, you've got choices. I know some of you aren't happy with what I've been able to scrape together every month and a half or so, but I ask that you cut me some slack. QB Express is a shitload of work, and it's work that I don't HAVE to be doing. It's a hobby; it's something that I do for "fun" (even though it's not really all that fun, especially with all these people ripping on me). And I don't make a cent for the dozens of hours of work that I put in. Just put yourself in my shoes. That's all that I ask.

Enjoy the issue.


Submit To QB Express

You all know the drill. This magazine can't exist without people SUBMITTING articles, editorials, tutorials, reviews, news and feedback. This is not just a solo effort by me... it's a group effort by people throughout the QB community. If you have anything to submit, or have time to write something, DO IT!

If you want to write about something, but can't think of a topic, or need inspiration, check out the "Official QB Express Article Requests" thread! There have been quite a few articles requested -- and even if none of them strikes your fancy, we can help you come up with something that you would like to write about. If you're interested in getting your own monthly column or just want to write an article or two, by all means, do it! Anything that is submitted will be included!

I also want feedback and letters to the editor regarding this magazine. I want suggestions and critiques. What do you like? What don't you like? What could be done better? Let me know!

All submissions and feedback can be sent to pberg1@gmail.com. You can also PM me on the Pete's QB Site or QBasic News message forums. If QB Express is going to continue to be so good, YOU need to contribute!

-Pete



Letters

Letter From MystikShadows

Hi Pete,

I had to make my coffee first to read this edition ;-). WOW is just about the only word that comes to mind reading that ;-). You know, there's something to be said about the day QB Express is finally made available. I, for some reason, picture the community suddenly quieting down, sitting down at their PCs and starting to read. Almost like sunday church ;-).

Maybe I'm the only one that thinks that though I don't know. But you know the feeling I'm trying to explain? hehe. what I do know is that I like to plan my reading ;-). I don't try to read it on a day where it just won't work. I'll look at the table of contents, see what's on the menu so to speak and then know what i'll be reading next when that time comes. So I'm a motivator huh? I can live with that ;-) hehe...Although it's not just a bout motivating per se, but if it's one of the side effects, I can open up a MystikShadow Cult or something hehe.

I'd like to talk about Lachie's (2 month worth) letter. well especially about the part that concerns me (as in me not doing my job). Well first off, for the last 2 issues (hence 3 1/2 to 4 months), he's right. I have to admit, I've been neglecting the newsbrief side a bit. But as he'll read in this issue #21 I am back on on the chain. And i'll be sure to make sure to be sure he never needs to say that ever again ;-). Also to help his problem, I would strongly recommend atleast 256 Megs of RAM to run Windows XP, 512 would be even better. XP is a resource hog with no precedence and no limit to what it can eat. so if he can upgrade his ram it would be great. if not, I would recommend reverting to Windows 98 with driver and Direct-X upgrades. Should make things run alot smoother.

A word about my MIDI series, I haven't been able to finish it for this issue. This month has been weird for me to say the least, always outside doing something, so my time got cut short. it's started but not completed (as most know, I've been busy with my FB Elite project (see the newsbriefs in this issue), The 4th installment of the MIDI series should be available in QB Express #22. I'm also looking for other subjects (midi and/or music) related to write about that I might not be thinking about at the moment (since the series seems to be good so far, let's push the bar and make it the single most complete MIDI reference work available anywhere. So if any of you readers have an idea, feel free to let me know. As a Part 5 I want to describe everything about the SoundFont format (getting popular today) and how to use it. After that I'll let the readers decide ;-) (and yes, digital audio is on the schedule with things like special effects and FFTs (Fast Fourrier Transforms). But I know there's so much more :-).

And now comes the letter itself. First off, your express poll, when I saw the list, I was amazed (and somewhat dissapointed at myself) at how many names I didn't know in there. makes me mad to not have been there back in those days. I'm glad I arrived when I did, in a way, in another, I wonder where I would be in gaming today, if I would have arrived a heck of a lot earlier in the QMunity than I did ;-). This is also why I emailed you all these questions and posted about it on your forum. Hopefully, someone will clue me in on everything I missed since the beginning of the QMunity. It's one thing to read about some of the stuff, it's another to have experienced it and tell me about it :-). Come on guys make me live these classic moments ;-).

Now, how about that news section huh? I know I didn't participate in it but like wow, there's a whole lot happening still today as I can see. There's really alot going on, seems not as many people are talking about it though or actually announcing it, some of the news happens on threads not destined to be announced as news. So you gotta look everywhere to be sure to get it all. But it's still awesome to see that so much is still happening. Things are alive and well as we can see from that news section. I bet you there's even more happening that we're not aware of.

I have to admit I was a bit biased in my suggestion for the awards. The reason I suggested Jace Masula's website was well I like the design of course, crisp, clean, easy to nanigate, professional looking, you name it. But I really like his ASCII Quest game creation system too. As for Piptol, well you named the reasons very well. He really does deserve a lifetime achievement award for all his contributions to the QMunity.

Cyber Chick, wow, so far it's shaping up to be one of the best 2D games I've seen (any language). I love the graphics, I love where the game seems to be going. Things look great on all the screenshots shown. I mean wow. I think more games like those should surface, I love them (yes, I don't just love text ;-) but this is a prime example of the type of 2D game I like. Great work on the part of the creator. I'm looking forward to hearing more about that project and eventually playing that game.

I enjoyed lurah's first ever game review. I'm still laughing when he said that playing that game was suicide in every possible way (lurah killing lurah as in the screenshot lol. Good ole lurah has a great way with words even if his english isn't as good as he wants it to be, he does a great job at expressing himself. And I think, for a first review, he did an awesome job at it too. Three cheers for lurah. I want more of those :-). More articles too, so far, I've found every article he's written to be very through provoquing and true. C'mon lurah, get busy hehe.

Pritchard's making a QB or FB site article, I thought, brought out some good tips as to what you should do before you make the website. I think it might even be the reason why alot of QB/FB website projects have failed in the past as well. It's one thing to do a QB/FB website that has everything, it's another to do a QB/FB website that has things no one else has. In that regard, I think Pritchard did an outstanding job at bringing out information to those that want to make a QB/FB website that just might make the difference whether their website succeeds or not. Great work and I enjoyed reading it a lot.

Nathan's article about Creatively Writing Game Story Lines, I think, was one of his best article, though short, it seemed to be enough to bring the reader to think alot before making their next story based games. looks like he covered alot of grounds with that small article which is, in effect, quite a feat of strength considering the subject matter. So I had to point that out here. I'm wondering how good nathan93 would be on a subject that requires a more detailed article, but I think that if he likes the subject enough, he might surprise us and maybe even himself. Great work there.

Moneo's "The Fallacy of Meaningful Codes" explains an age long issue in the professional software developement industry (specifically in IT (Information Technology). It's obvious Moneo has had plenty of experience in the subject, the article does nothing else but show all that experience. Now, when you think about it, making sure each record of a database can be uniquely retrieved can definitaly be applied to games (more complex games at that too). So if some of the game coders out there think that this doesn't apply to them, the best thing I can tell them is that wait till you have a couple 10s of thousands items to deal with in your game of which only a few can be worked with depending on where you are in your game's world, etc etc...and maybe you'll see the usefulness of having meaningful codes implemented. I think this article is worth it's weight in gold for the IT industry and for any industry that might need to deal with a large amount of data.

What's to say about Immortis' "What Not to Do as a Programmer" article. Can you imagine, in 3 rather short categories, he explained over 40 years of computing issues with the programmers in pretty much all it's gory (but true) details. Not being in one of those 3 categories is what makes a good programmer, end of discussion :-). I'd sure like to see Immortis tackle other great subjects like this one. I really liked his way of explaining things in a dead on target, in your face with diplomacy (I define diplomacy as sending someone to hell in such a way that they can't wait to make the trip hehe). But All true and those that fit in one of the categories will see that he's absolutely right. Awesome work.

Always glad to read ratt's comics, they are so consistant, and he's definitaly getting better at the humor behind the comics. I don't agree with Lachie on his comment about them at all. It's a nice break from the magazine, in the magazine (who sais QBE doesn't offer everything now huh HUH?) hehe. It's also great to see the other 2 comics. I mean come on, what's the new york times without it's sunday morning funnies? hehe. Myabe QVE should be released on sundays only to give these comics their due value? hehe. I liked them all.

Optimus' "Polar Plasma" explained to me something I've been wanting to know for a good long while now, for a few years, I've always seen plasma demos, but I never quite studied code or looked at anything in enough details to actually understand how they work per se. I'm glad Optimus explained it here. It's alot clearer in my mind now. So a big thank you to him for writing on the subject, I for one definitaly appreciated the effort and am tremendously glad to have read it.

Fuzzypig's "Making Good Sound Effects". What can I say, I love sound and music, digital audio or MIDI files (as some might have noticed by now hehe). Whenever I see a title with sound, music or sound effects in there, my eyes open wide and i'm ready to absorb all I can from the contents. It's clear to see fuzzypig's knowledge in the field, and I would like to thank him right here for taking the time to talk about it here on QB Express. One of the best readings I've had personally. I might email him with a good set of questions now that I know someone that know that much about digital audio and FX. A great read.

Well I was hoping lachie would do a follow through to his "How To Program A Game With FreeBASIC" and was pleasantly surprised to see that it was there. I gotta say, there's no denying lachie's knowledge in that field. he's one of the best and certain one with the abilities to share that knowledge clearly with the readers. So i'm glad he took it upon himself to share that knowledge with the readers. I'm learning alot from him and well I can't wait to read more about it. Keep on writing Lachie, I'm waiting hehe.

What can I say, the reason why I'm such a big (err motivator, yeah that's it ;-) ) is because there's so much to motivate about :-). Look at all the great contents it has and the great people contributing to it. I shouldn't be the only one with the pom poms here hehe.

MystikShadows
Stephane Richard

Haha, looky here! Another fantastic letter to the editor, as we've all come to expect by now. :)

I love reading your take on *every* single article in each month's issue -- you're always so positive, and so motivating, and I guarantee you that the writers really appreciate the kind words. Maybe I should buy you some pom-poms, because you're one heck of a cheerleader. :)

You've mentioned many times that you wish you had been around to see the QB community in its infancy, back in the mid-to-late '90s -- back in the proverbial "golden age". I wish I were able to able to satiate your hunger on the topic, but I'll tell you, the reason why I'm still hanging around the Qmunity now is because I had so much fun in those early years. I'm sure I have a gilded memory of the Qmunity back then, considering I was an enthusiastic 12 or 13 year old, and we tend to remember fond childhood memories as even better than they actually were.

But still, I think the Qmunity as a whole was a whole was a lot more excited to be coding back then. We were younger, the World Wide Web was still new, and this concept of sharing your little game programs and talking to each other online and running your own website for the world to see was just new and exciting. Now, I think a lot of us take it for granted. The newbies that are joining the QB community have grown up with things like high-speed internet access and message forums, so this stuff doesn't seem revolutionary to them. For me, on the other hand, the QBasic community was the *first* online community I ever interacted with, the first message boards that I visited, and Pete's QBasic Site was my first website. I didn't have Internet access at home until I was 12, and that's also when I really got interested in computers and programming.

Anyway, how can you find out about the Qmunity back then? Don't expect the "veterans" that are still hanging around to be able to give you the full picture. I suggest you go back and read through the huge amounts of "historical documents" that are still online. The Zines Archive is a good place to start. And there are hundreds of old QBasic sites from the '90s still lurking on the Internet, waiting to be explored. It's a veritable treasure trove, and I'm sure you can find out more than you ever thought you'd find if you take the time to look. :)

-Pete


Letter From mennonite

hi pete, i have questions on my mind, and i thought i'd run them by you.

you might not like these questions, you might think i'm being a dick, i really can't anticipate your exact reaction.

all the same, i thought i'd get your opinions first, since for one, you're certainly involved, and also, because as you've said before, this isn't even about programming for you anymore- it's about the community. i think among a few others, you might be best fit to address these questions. and forgive me being longwinded... you probably noticed it's the only way i write, and it's never on purpose. i try to explain my questions to make sure it's not misunderstood what i'm asking.

anyway, here's a start: who rules the qmunity?

has v1ctor usurped him or does the qmunity rule v1ctor?

does the qmunity have a ruler? is it z!re? do people rise to power, as shadowwolf says, "there are a few people like Z!re with in the community that can pull of this type of thing... they got this type of power by winning flame wars and climbing the political ladder so to speak."

also, if there was a ruler of the qmunity, what would he be like?

personally, i think the qmunity is better off without a ruler... more like with leaders... who lead not just one, two, or three people around, bullying newbies, (which never happens, so forget i said it!) but someone who really creates what you used to truly be able to call a "community" that is... a community of *people*, vs. just a "community," of individual persons, as i suspect things are moving towards.

but all the same, lets look at some "person"-types, and decide who's best fit if we're all stuck with him (or her.)

is this person someone with an image to maintain, verses a real sort of "thing" about integrity, or is it someone who simply abuses everyone to maintain an "image" of superiority? (i don't think at the end of the day one person is actually superior to another, but our society is undoubtedly full of such false images.)

is this person someone who's so full of himself that he can't tell or even notice when other people are making substantial contributions to the qmunity?

or is this person more of a puppet... a mouthpiece for the real leaders of the qmunity, one that says one thing now, another later... as long as it's what the community expects to be said at a given time? someone who will bow to anything, the ridiculous, the profound, whatever strikes the mood of the masses? a lapdog leader- do any of us want or need one, or can we say for ourselves what is on our mind and render such a figure worthless?

do we want someone who is so completely busy with projects that he doesn't have time... similar to someone who is merely too full of himself... but not in terms of ego, merely someone who is too preoccupied? would this make a suitable leader, if we had one? or would a newbie with a new hobby (that is, programming) be better suited? admittedly, in *most* instances such a newbie would NOT be fit at all. still, i'm asking.

then again, most people simply (and without any reason to be ashamed of it) have something better to do. what's being the leader of a band of geeks (i use the term affectionately)... even a loosely defined sort we belong to now, compared to who knows what else?

again, i don't think a leader is needed, per se... but i think we might be stuck with people "rising to the top" as it were... and i'm not sure that alone is a problem. as long as an ideal is created where people trying to crush each other isn't the main goal of "belonging," and where the priority becomes... i dunno, helping each other in a real way, and not making newcomers sorry they asked... i think there won't be any consequence of a leader, other than the occasional (and welcome) extra topic or project being discussed.

in other words, a community that values people (as a whole) won't pay much attention to a leader anyway. too busy being a true community. and that's good enough!

i put this idea forward at a time when people are jumping out of line to disapprove of this or that... sometimes someone goes too, too far in attempting to destroy another person. actually, seph comes to mind, but there's no telling who i am referring to. you may think i am referring to pete, who felt compelled to trash seph personaly for whatever reason in qbe #20. i am of the impression (perhaps mistaken, to be sure!) that seph did nothing of any sort to pete... that pete only decided to trash seph as a bandwagon sort of thing- but perhaps seph, as i once did, managed to rub pete the wrong way in an email- i dont know.

i could also be talking about z!re, in her inability to wish seph and his new family the best, only to take yet another opportunity to say he's essentially unfit to exist. i could be talking about that.

or, as they often are to me, these could merely be part of another trend i see, and wonder about. it may seem very silly, even absurd to even ask these questions, or admit they've crossed my mind.

but as long as they have, i thought i might try to find out what others think. whether i truly and ultimately care, or whether i don't- i'm honestly curious.

is there a particular mission left, or common ideal left in this community? what ideal would that be, and who is best fit to help others see that goal to fruition?

and don't say v1ctor... because really, everytime someone asks him anything like this, he just sort of ducks away. and that's not bad- maybe we all should do just that, but as you must know, sometimes i can't help myself.

i had to ask.

Who rules the Qmunity?

That's an easy one: NOBODY

The Qmunity is an autonomous collective; nobody has any real control over anybody. That's not to say that some people don't rise to the top and influence how people behave. But it's not because they have any special rights or privileges; it's because they earn a little something called respect for what they contribute. The people that make the biggest contributions become our defacto "leaders" -- but they are leaders because other people value their works and their ideas, not because they have any real power.

I know why you wrote this letter. You're disgruntled because the so-called "leaders" of the Qmunity have different opinions than you...and you don't like where the Qmunity is headed. You wish you could call the shots. The thing is, nobody calls the shots. The way you "lead" the Qmunity is by making contributions and thus, earning respect! Then people might actually listen to you. But instead of actually contributing something, you complain and browbeat and personally attack our most productive and respected members. That's not a very good strategy if you actually want your opinions to be heard.

Let's review some of your posts this past month: You lambast V1ctor and the choices he made about *HIS* compiler (just look at your childish and exceedingly rude posts at FreeBasic.net); you personally berate MystikShadows (this post); you accuse me of "killing" QB Express, running an "elite" magazine, and marginializing certain members of the Qmunity; and now you attack me, Z!re and others for dismissing Seph's failed attempt to organize a community-wide mutiny when he was banned from a forum for being a jerk.

Personally, I'm sick and tired of it. In the past few months, my opinion of you has dropped through the floor... You're just trying to stir the pot and cause controversy, and you're making all of us very angry. You're convinced that everything is some grand conspiracy, and you take everything way too personally. And the way you go about expressing yourself makes you seem like a jackass. For someone who claims to hate flaming, it seems to be one of your favorite hobbies.

mennonite, there's a reason why you don't get any respect in this community. It's because you talk and complain a lot, but have hardly contributed anything. I think the opinion of the Qmunity is best summed up in Cha0s' response to one of your posts:

"Go

Code

Something

Useful"


I'm sure I've offended you (whether you like it or not), but I think you need some chewing out. I hope you take Cha0s' advice and roll with it. PCOPY is a great start, if you guys are able to get it off the ground. But we're not going to cut you any slack until we see some sort of concrete contributions...and a little bit less attitude. As I said last month, "I guess most people on QB/FB forums just want to....(gasp)... get along."

-Pete


Have a letter for the editor? Send all your rants, raves, ideas, comments and questions to pberg1@gmail.com.


Express Poll

Every issue, QB Express holds a poll to see what QBers are thinking. The poll is located on the front page of Pete's QBasic Site, so that's where you go to vote. Make sure your voice is heard!

What is the best QBasic game developer of all time?

With the help of Lachie Dazdarian, I've decided to run a tournament to find out who the community thinks is the greatest QB game programmer / programming group of all time.

The two of us have nominated the 50 top QB game developers, who we feel deserve special recognition for their contributions to the QB gaming scene. From these 50 choices, YOU are going to vote to select the greatest QB game programmer. The winner will receive a special award at the Qlympics 2006, which will take place in QB Express over the next few months.

I've randomly split up the nominees into five divisions. You will get to vote for the top developer in each division, and then we will have a final vote between the five finalists.

So, without further ado, here are the nominees. (Category winners are in bold.):

DIVISION 1
Aleksander Trojanowski (ATTE series)
Bulma Produktions (Suds Skins 1 & 2, Johnny Abbot's Sex Adventures 1&2)
CMC (DarkPhear)
Hamster Republic (Wandering Hamster, SpitWar, RPG, Cowbobs)
Hyper Anime (BAkuen SakuRu, Kunio Kun)
Pieslice Productions(MUX, TerraScape)
RelSoft & Adigun A. Polack (Frantic Journey)
Shattered Realm Productions (TWIGZ Engine, The Great Escape)
TopGun Software (Space Commando 1&2)
Typosoft(Ped xing's Quest, Sumo, SuperSumo 1&2)


DIVISION 2
Darkness Ethereal (Mattress Warrior, Secret Of Cooey series, In The Nocturne, Mysterious Song, Lianne in the Dark Crown, Legend of Lith II)
Eric Carr (SpinBall)
focus ZERO (Monkey Blast!)
J.B. (Sonic Xtreme)
Master Creating (Shadow Of Power, Diamond Fighter IV)
M \ K Productions (Pieces 1&2, Bob Saget Killer 2000, Fury)
Na_th_an (Jill The Goddess, Lala Prologue, Oytkator's Plans)
Pantera55 (Elysian Fields)
Pasco (Groov Buggies, France '98 World Cup Soccer)
Sasha Vukelich (Dynamic - The Colonization of Jupiter)


DIVISION 3
Piptol (Ghini Run, Squealer TNT, Kingdoms)
Future Software (BomberZone, Zelda Clone, Cobra, Space Invaders)
Jocke The Beast (Dark Woods 1&2, Mirkwood)
Lachie Dazdarian (Detective Academy, Ball Blazing Fantasy, Rocket Fuel Mayhem, Dark Quest, Another World Memory, Run 'Em Over, Pong Worz)
Mark Hall (ARC Legacy)
Oren Bartal (Super Stack, Ultimate Super Stack)
syn9 (ZeroG)
Stefan Hendriks (Arrakis)
Terry Cavanagh (The Hunt, Black Hole)
WisdomDude (Hack-Man 2&3, Cyber Chick)


DIVISION 4
BINARYmagic (Alien Terror, Anaconda)
BjM Software (DreamScape)
Danny Gump (Mystical Journey, Super Mario World Clone)
Jason Gould / The_Brain (Puz, Peanut Patrol 2)
JAWS V Soft (Mini RPG series)
Mike Snyder (Lunatix, Lexter 1&2)
Nekrophidius (Wrath Of Sona, Two Lords)
PHAT Kids(Kids of Karendow Chapter 1, PHAT Professional Burglar)
SV Reanimator (PromZone, Cyclone)
TMB (Percussor, Around The World, The Little Pixie 2, The Adventures)


DIVISION 5
Angelo Mottola (WetSpot 1&2)
Delta Code(Larry The Dinosaur 1&2, Unofficial Tournament)
Jace Masula (CODELINK, StarQuest)
Kevin Reems (Stick Fighters Brawl 1&2)
Michael Hoopman (Dark Ages)
Milo Sedlacek (MonoSpace)
Nick London / NutzBoy (Peanut Patrol)
SonicBlue Productions (SB's Bricks)
StarsDev (The Terror)
Tsugumo (Untitled, TheGame)

In order to vote, visit the front page of Pete's QB Site. (The poll can be found in the left column.)

Good luck to all the nominees -- and may the best developer win!


Results of Division 2

The top two developers move on to the final round of the competition!

DeveloperVotesPercentGraph
Piptol1121%
Future Software48%
Jocke The Beast815%
Lachie Dazdarian1019%
Mark Hall36%
Oren Bartal00%
Syn9917%
Stefan Hendriks36%
Terry Cavanagh24%
WisdomDude36%
53 Total Votes

Finally some competition! While the winners of the first two divisions were pretty overwhelming, this third division was a squeaker. Four developers stood out in this poll -- Piptol, Jocke The Beast, Lachie Dazdarian and Syn9, and just a few more votes for any of them could have completely changed the results.

But despite the popularity of Jocke's "Dark Woods 2" and Syn9's "Zero G", the two developers that ended up getting the nod were Piptol and Lachie Dazdarian. What gave these two the edge is probably their sheer number of QB releases. While Jocke and Syn9 each had only one big QB game under their respective belts, Piptol and Lachie both released several.

Just look at this list: Detective Academy, Ball Blazing Fantasy, Rocket Fuel Mayhem, Dark Quest, Another World Memory, Run 'Em Over, Pong Worz, Ghini Run, Squealer TNT, Kingdoms. That's TEN games...and the list doesn't even include *all* of the QB games Lachie and Piptol put out. This is quite the accomplishment -- and it makes Piptol and Lachie Dazdarian worthy of advancing to the next round of the Greatest QB Game Developer tournament!



News Briefs

News from all around the QB community, about the latest games, site updates, program releases and more!

QB / FB Site News

QB Express Gets Some Competiton: PCOPY and FreeBasicNews.net

It's about time! QB Express has been the ONLY QB or FB mag to publish regularly in the past two years (and with the exception of one issue of QBXL in March 2005, the ONLY magazine)... This is a far cry from the "golden age" of the Qmunity in 1998-2000 when there were four or five magazines going at once.

But it looks like that's all going to change. In the past month, two new BASIC magazine projects have been announced: PCOPY, an joint effort by the staff of ASCII-World, MystikShadows, lurah and mennonite; and FreebasicNews.net by Pritchard and Mr. Match.

PCOPY will be a magazine dedicated to covering all dialects of BASIC, beyond just QB and FB, and it hopes to tailor toward programmers at all levels (including articles written by newbies, for newbies). FreebasicNews will be focused solely on FB programming, and will likely have a focus on the happenings of the Freebasic.net forums. Both magazines will be released irregularly (though there have been claims that there may be bimonthly releases). Since neither magazine has actually released an issue yet, we still don't know exactly what to expect. Currently, PCOPY has an issue in the works; FreebasicNews is still doing preliminary work on designing their website.

If you'd like to read up on the mission statements and debate surrounding both magazines, you can check out these forum threads: PCOPY thread and FreebasicNews thread. The PCOPY thread in particular elicited a heated debate over my handling of QB Express, and also whether another magazine was appopriate. I addressed this in my "From The Editor's Desk" article, so I won't go into it again, but you should know that I fully support both magazines -- and no matter how well these magazines turn out, QB Express is here to stay.

On behalf of QB Express, I warmly welcome our new competition! I hope that both magazines succeed. It would be nice to see someone give us a run for our money!

News Brief by Pete


Beginner's Guide to FreeBasic by Rick Clark

Rick Clark wants to teach all you newbies how to code in FB...the right way. Here's a news brief from the man himself:

I am working on a beginner's guide to FreeBasic. You can find the details here if you are interested:

http://www.freebasic.net/forum/viewtopic.php?t=3910

There is a preview in pdf format that I update as I finish content in the first post. This is a wip, of course, so the preview isn't really polished at all. :)

Rick Clark

http://rdc.ascii-world.com/

News Brief by Rick Clark


Mystery Solved: The October 1999 Pete's QB Site Shutdown!

In October of 1999, Pete's QBasic Site was shut down by my free hosting provider, Hypermart, for distributing illegal copies of QuickBasic 4.5...even though the files weren't hosted on my server, and I was merely linking to another QB site that was distributing the compiler.

According to Hypermart, somebody had filed a complaint that my site had breached its contract and broken U.S. copyright law. Hypermart suspended my account and shut down my website, without a single warning. Needless to say, I was pretty mad about the whole situation... and I thought I'd never find out who the "perp" was that filed the complaint. But a few weeks ago, I was startled to receive this email:

This is something that is probably long overdue. I was sitting here at work when someone mentioned soemthing about DOS and it brought up some old memories from my young Qbasic days. I went to Qbasic.com, then to qbtop50.com, and followed on to your site. I was curious of who still owned it and I started reading the history page. And then I came across this:

"Then at the end of October '99, it almost all came to an end. For the last couple of months, I had been offering free downloads of QuickBasic 4.5 in the "Compilers" section of my site. Hypermart somehow found out about it and terminated my account. Immediately, a witch hunt broke out, with everyone on the message board blaming each other for reporting my site."

I'm not proud of this at all, but I did it. I was 13 going on 14 years old at the time and I owned a competing (stupidly, that's how I saw it) website. You might recall someone owning Quickbasic.net, and then also buying QuickBasic.com. That was me. I called it the Quick Basic Network, or the QBN. This was how my nickname was formed on most of the message boards as theqbn .

It was entirely immature and heartless for me to have done that and I apologize. I never thought that emailing that complaint to the Hypermart abuse department would have led to deleting your entire site, but I was wrong.

I am now in my last year of college for my Networking and Security degree and I own a real estate brokerage firm in Eastern North Carolina. I gave up the domains several years back as I lost interest. I seemed to generate a lot of criticism in the QB community back then and I thought it was about time for me give up.

I just wanted to shed some light on this and I wish you the best of luck.

Thanks,

[NAME REMOVED]

Although this shut down almost led to the downfall of my site, I was able to sweet-talk Hypermart into restoring my account -- so in the end, nothing was really lost except for a few weeks of updates that I would have done if my site were online. I wrote the guy back and told him there were no hard feelings. Here's my response, if you're interested:

Don't worry about it, I'm not mad. It happened so long ago, and Hypermart restored my site, so it's all water under the bridge. Besides, if I recall correctly, I kind of enjoyed the month-long vacation from updating my site. :)

It seems like your early interest in internet security must have paid off, considering you're about to get your degree in "Networking and Security"!

Thanks for the email,

Pete

Mystery solved!

News Brief by Pete


Preview of Lachie's QBasic Games Directory!

Lachie Dazdarian never ceases to amaze me with his knowledge of and dedication to preserving and promoting QBasic/QuickBasic games. You're probably familiar with Lachie's reviews of QB games and his "Searching For The Unknown" series for QB Express, but those articles are nothing compared to his latest project. The QBasic Games Directory is a huge undertaking, and you absolutely have to check out the preview version Lachie's got up:

http://games.qbasic.com

Lachie's goal is to "collect, archive and offer to public" all "worthy" QBasic games that have ever been released publically. ("Worthy" games being quality titles, and preferably not engine demos unless they're really good.)

So far, he's really lived up to that goal. Lachie's got close to 500 games entered in the database, most of them with screenshots. He's also written up a description and rated every program, and everything is entirely searchable because the site is custom-built with PHP. To my knowledge, this is the best and most thorough archive of QBasic programs ever assembled. Some archives may be larger, but they're not of anywhere near the same quality...and they usually have a lot of "unworthy" games clogging up the collection. This directory is the real deal.

Unfortunately, the actual GAMES have not been uploaded yet, but that should be coming soon. Lachie asked me to give Mark Wilhelm, the owner of QBasic.com and hosting provider, a little bit of prodding: "The site is still not 100 % ready since it's taking EONS for Mark to set it up but maybe you can write a small line about it for the News Brief." Well, Mark, here's my "small line" of motivation: get to work!

With the games uploaded, and maybe a little bit of restructuring/redesigning, this could very well become the most important QBasic website on the Internet. Lachie, we thank you for your amazing work, and we can't wait to see the final product!

News Brief by Pete


Fuzzypig Launches New Website

Fuzzypig, a regular over at Freebasic.net, has launched a new website of his own: Fuzzypig's Domain. So far, it's just got a few of Fuzzypig's own programs, links, an empty forum, a new blog, and a design that hearkens back to 1997 GeoCities websites. It's not much to look at yet, but you should bookmark it and check back...who knows, it could become amazing. A lot of of great QB/FB sites started the same way.

News Brief by Pete


FreeBasic.tk Moves

FreeBasic.tk, formerly hosted at FBTK.net, has now moved back to its predecessor's domain, QBTK.net. Apparently, Sumo Jo let the domain name expire, and he doesn't want to pay a penalty fee to get it back. So now if you want your FBTK goodness, you'll have to visit: fbtk.qbtk.com. Or, I suppose you could use the domain name that the site is actually named after: freebasic.tk.

Anyway, head over there and post something! The once-active forum has been DEAD for the last few months.

News Brief by Pete


Project News

New Zero GTR Demo: Mindblowing

Prepare for your mind to be blown. Syn9 has released an engine demo of his upcoming "Anti Gravity Racing League" game, entitled Zero GTR, that is the single most professional piece of work I've ever seen come out of the FreeBasic scene. If you haven't checked it out yet, now is the time.


Although it's still just a one-track engine demo, Zero GTR looks and feels like a game you'd play on a modern console, not something that a hobbyist made in his spare time in...BASIC... Syn9's got a real gift for graphic design -- the world he creates is made up of simple geometric shapes, and has far fewer polygons than anything you'd see in a current racing game, yet its simple stylistic look is absolutely gorgeous. This demo is proof that it's not the complexity of the graphics that makes a game look "modern", but good design that really makes all the difference.


Syn9 has also registered a domain name for Zero GTR: http://www.zerogtr.com/ It's just a placeholder right now, but it looks like he's planning to do some major promotion of this game when it's finished. Since Zero GTR will feature online network play, zerogtr.com will most likely be the hub for players to communicate.

This is really exciting. I think that of any FB game so far, Zero GTR could be the one that attracts mainstream gamers to the FB community...and to FreeBasic. I can't wait to see the game get developed over the next few months, before its estimated Winter 2006 completion date.

Here are the links to try out the demo:

Download the demo: trackTest2.zip
Download the updated/improved program file: core.exe

News Brief by Pete


New "Seamless Tactical RPG" by Xerol

You've got to check out this awesome project:

I don't have a full name for this yet, but STRPG is just a description of the "genre": A seamless tactical RPG.

The main beef I've got with TRPGs (like FFTactics, Disgaea, etc.) is that 99% of the action takes place on limited battlefields. STRPG will remove this restriction, but bring in new features to compensate for the seamless nature of the world and still keep the tactical nature of the game.

It's still in its very early stages; so far we've just started working on our first battle demo (which doesn't explore the 'seamless' part of the game just yet) so all you're gonna get for now is these screenshots:




As you can see we're using temporary models for now because we don't have a character modeler. This is a paid position that is open to the first person who can demonstrate they have the abilities to meet the requirements of this job. The game will be published (under the Level Ground label) and sold online. Obviously at this early stage we can't give any estimates for when a final product will be available, but we expect to have a playable demo out within a week. (Already you can battle, but there are a ton of issues that need to be worked out, and the code is patchy at best.)

Anyone interested in the modeling position can email xerol3@yahoo.com or contact us on AIM:lggaming.

News Brief by Xerol


The Long-Awaited Official Release of FreeBASIC 0.16b

On June 12th, V1ctor announced the release of version 0.16b of the awesome FreeBASIC compiler. IF you read the changelog you can see that alot of corrections and additions have been made, once again which is great news. always good to see the FB team working so hard to bring us a highly efficient and usable programming language.

According to some users, some project that compiled with version 0.15b might not work as is with version 0.16b however, following the changelogs and making the appropriate changes in the code seems to be all that is needed to get them to compile properly.

Three cheers for the FB Team!

News Brief by MystikShadows


MystikShadow's FB Elite IDE project

On June 3rd, I announced a project I've been working on for a few weeks. It's called the FreeBASIC Elite I.D.E. It's an IDE with a more than familiar look and feel (see the screenshot for details). The object is to make an IDE reminescent of the QB family of compilers. Here is a list of the main features planned for the project:

  • Split view editing (like the QB IDEs have).
  • Syntax Highlighting (colored FB code like all of today's IDEs).
  • Syntax Checking while editing option (just like in QB)
  • FreeBASIC Consultant (to play the role of the QB Advisor)
  • Ability to load more than one file at a time (.mak file support).
  • Immediate mode code interpreting (again like all QB environments).

Here's a screenshot of the editor showing the FreeBASIC Consultant with the help for the PRINT statement just to give you a taste of what's ahead.



I'm currently working on the file open/save dialogs and other standard editing dialogs like search, replace and the likes. After that I start on some of the bigger engines like debugging options, interpreter and the likes.

Here are links to some of the comments I've gotten so far on the project: My post on the freebasic.net forum and My post on the QBasicNews forum.

News Brief by MystikShadows


Rattrapmax6's ASCII_Drop_Player Announced

On June 6th of 2006, Rattrapmax6 made this this announcement about his newly created MP3 player. It is designed to be very simple to use, just drop an MP3 file on the icon and it will start playing.

As he states in his post, the player currently can only be used by dropping an MP3 file on it, there's no playlist (but perhaps it would be a good thing to add.)

News Brief by MystikShadows


Vector X FB Port, Courtesy of Lachie D.!

Here's the latest game release from the ever-newsworthy Lachie Dazdarian: Vector X 2006.

It is, as Lachie describes it, it's "a port of a rather unknown 3D QBasic game" originally released by Dan McFadyen in 2001. The game uses wire-frame graphics, and you control a space ship flying down a narrow passage, trying to avoid or destroy enemies, mines and landscape features along the way. There are five levels, and at the end of each level, you must destroy a specific structure to advance.

Check out some screenshots:






"Of course," Lachie explains, "my port is not just a simple port but more, what is to be expected from me." Compared to the original QB version of the game, Lachie completely overhauled this version, adding music / sound effects, improving the graphics substantially, adding backgrounds, new menus, improving the control and a whole lot more. Lachie says this release falls somewhere between being a port and a complete remake.

I gave Vector X 2006 a spin, and I was very impressed. It feels quite polished -- the menus, the presentation, the music, etc. -- which is something we've all come to expect from Lachie's work. The game was pretty fun to play, once I got the hang of it. I managed to get to the third level, and I really liked the little touches, like the destructable terrain and the placement of the mines. It's a challenging game, but it is pretty well-balanced in terms of gameplay (I never felt like I was cheated by the enemies).

However, I found the wireframe graphics to be confusing -- While I liked the simplistic style of the graphics, I was never sure where in 3D space my ship was in relation to the ground and the enemies. (If the surfaces were opaque, this wouldn't be as much of a problem. Also, a shadow on the ground directly below the ship would be a huge improvement, in my opinion.) I also found the pop-in of new ground on the horizon to be distracting.

Overall, though, this is definitely one of the most "worthy" FB games I've had a chance to play, and I encourage you all to check it out. It's in my top ten favorite FB games so far, and that's saying something!

You can download the game below:

Download VectorX_2006.zip (2762 KB)
Download VectorX_2006Lite.zip (no sound version; 880 KB)

News Brief by Pete


Pritchard Releases Geometry Library

As announced in this freebasic.net forum thread Pritchard has created a geometry library for FreeBASIC. The library was created to offer some 2D/3D based geometry calculations (including 2D and 3D collision detection routines). Here are some of the highlights as expressed by Pritchard himself:

The Lib Supports the Following:

  • Tested on Version .16 Unstable, so no guarantees for you .15'ers
  • 1D, 2D, and 3D Trigonometric Functions with Single Digit Precision
  • Spherical Against Line Segment Collision Detection for All Dimensions Supported:
    Code: Collision_Detection_Dimension(Boundary Type, Boundary Start, Boundary End, Object Position, Radius)
  • Boundary Type is the value of which normal to use.
  • Spherical Against Spherical Collision
  • A ton of other stuff, really (function list below) :P

From what people are saying, this is a very fast and efficient library and I have to agree to it after I've tried it on my PC.

News Brief by MystikShadows


Finally! True DOS Networking Routines For QuickBasic

Mike Chambers has created a method to do TCP/IP networking in QB...something that people have been working on for years with only marginal success. Here's the news from Mike:

Anybody who has ever wanted to use TCP/IP networking in QuickBASIC under true DOS can now do it using Mike Chambers' TCP routines. All you need is an ethernet packet driver. You can download the routines with documentation here: http://rubbermallet.org/qb/index.html

It is also on Pete's QB site under the misc downloads section.

If you find a packet driver that wraps to winsock.dll you could also use this under Windows.

News Brief by Mike Chambers


Wetspot II Ported to Windows

Randall Glass has followed up Adigun A. Polack's "Wetspost 10th Anniversary Remix" and given the same treatment to Angelo Mottola's classic WetSpot II. Here's the news:

For all you Wetspot II game players; Wetspot II has been converted to Windows !

Have you ever tried to run the Dos version of Wetpot II but could not get it to run because of ems problems on you modern computer.

Well fear no move. Wetspot II has been converted to Windows using FreeBasic.

It is an improved Wetspot game in play ability and and improved documentation.

And new cheat codes !

You can download the game at this Simtel.net page, and relive the memories from what is widely considered to be the best QB game ever made!

News Brief by Randall L Glass


Deleter's FreeBasic Bitmap Font Library

Deleter has released a useful library that could save you some time the next time you're, say, coding a game in 24 hours: routines to incorporate your own bitmap fonts! Here's some more info.



Description:
A small static lib in freebasic that does some pretty simple printing routines. While not particularly ingenious, it nevertheless makes it really easy to use custom bitmap fonts and saves time for the fun stuff when coding a game. It works with any bit mode so whether you need a fast fix for custom fonts on that retro arcade 8-bit classic, or if you are making a slick, high-tech app, this lib has what you need. All the code for the lib is available, so if you want to peek at or even modify the internals, go right ahead. There is a small test program available for both 8bit and 32bit mode that explains all the functions.

You can download the library and fonts at Deleter's website.

News Brief by Pete


Mind Maker QBasic Version 1.1

I got an email from Corey Yeates (who asked me to refer to him as "Corey Yeates ==> evil_chicken"), asking me to include one of his simple programs in this issue of QB Express. The program, entitled "Mind Maker", is a compilation of several very simple programs. While I didn't have a chance to actually check out the program, I did scroll through the source code, and I saw a series of ASCII art drawings of a sailboat getting destroyed by a giant wave, as well as text like "You Lose A Man From The Impact Of The Wave." This could be interesting!

http://geocities.com/coreyyeates/PROGRAM_EDITION.txt

You can also visit Corey Yeates / evil_chicken's homepage at this link.

News Brief by Pete


Wallace Releases Visual Editor, Continues Work On Inspiration

Wallace Software has continued working, quietly, on his upcoming FB first person shooter, Inspiration. If you check the Wallace Software homepage, you'll see the latest updates on Inspiration -- which come every few days.

Some noteworthy quotes from the last month:

"All of the bugs in the weapon editor have been figured out and its looks fantastic, so far I've created a double barrel shotgun and a sword."

"I'm still hoping that a cross FreeBasic will go cross platform so that I can test it on my main computer, but the Acer is very fast. I'm making my Virtual PC on my iMac the standard for speed since it is fairly slow going there. I think on my Acer Inspiration will blister around 250 FPS so I'll have a LOT of room for advanced effects."

"Map Editor chugging along. I've decided because of the complexity of the sprite portion of the maps that I will be splitting the map editor into two programs. One will edit the static parts of the map like the walls and floors and stuff, while I will have another editor for the sprite map. I have also decided that the main map, light map, and sprite map will be three different files, that way I can use the same wall set for multiple levels of the game and change the lighting arrangements of them without making whole new maps. I will soon start working on the engine."

Wallace also released the Wallace Visual Editor 1.2 back in June, which is being used to create assets for Inspiration. Groovy!

News Brief by Pete


Lynn's Legacy Undergoes Beta Testing; Final Release Imminent!

Josiah Tobin and Cha0s' action RPG, Lynn's Legacy, is coming along very well, and in the past month and a half, a private demo has been circulated to a group of beta testers. (You can read all about it in this thread). Already one of the most promising games in development for FB, it sounds like it's really starting to come together:

On May 29th, Cha0s wrote: "We currently are about half a day's work away from finishing the first chapter of the game. That's 3 dungeons and various sidequests. There's about one hour worth of game play."

But the real big news came this morning (June 16th), when Cha0s announced:

We will be releasing a final version of Lynn's Legacy to beta testers this week, and plan a full public release next Friday.

Just thought you might like to know. ;)

This is fantastic news. Lynn's Legacy is one of the most-awaited projects of the year, and the entire Qmunity is frothing at the mouth to get their hands on the final version. Friday (five days from now) can't come soon enough!

News Brief by Pete


RelSoft Updates Genso's Junkyard

RelSoft, the king of the FB graphics demo, has just posted SEVEN new demos on his website, Genso's Junkyard...and they are all stunning:




I think the gfx demos speak for themselves...check them out!

News Brief by Pete


"They came... We shot them down!" by Lithium (and others)

Last month, Lithium released an awesome shooting game entitled "They came... We shot them down!" that is one of the most fun FB games I've played. Take a look:


You control the jeep in the picture, and it's your job to protect the little green people walking the streets below from the constant alien bombardment that falls from the sky. It's similar to "Missile Command", except your jeep is mobile, and the alien attackers have some new weapons and tricks up their sleeves. This game is mouse-based and handles really well. With a little more polish, it could become something really great.

You can find a 75% complete demo of "They came... We shot them down!" at Lithium's page (which, by the way, has recently gotten a really cool redesign).

News Brief by Pete


"King's Land 2" by Jace Masula

Jace Masula has released a second version of his QB strategy game, King's Land, and it looks really great. Check out the animated screenshot and description below:

King's Land is a simple turn based strategy game similar to warcraft and age of empires. The game takes place during the middle ages and has 3 levels of difficulty. each campaign focus different aspects of strategy. Its a cross between chess, stratego... and warcraft i guess.

I'm in the process of writing a game manual... but it is fairly self explainitory and anyone can figure out how to play in 15 minutes. anyway, it worth a look if you enjoy old school cheesy strategy games. please report any bugs or constuctive suggestions right here.

For a pure-QB game, this is very impressive (and it's also one of very few new QB games that has come out in the past year). Definitely worth your time! You can download King's Land and find out more info at Jace Masula's QBasic Lab.

News Brief by Pete


Eclipzer Previews New Voxel Viewer

Eclipzer has posted a screenshot of a new Voxel Viewer that he's working on. In case you're unfamiliar with voxels, they are essentially 3D pixels (the term itself stands for "Volumetric Pixels"). Voxels are a less common method of creating 3D graphics, but it leads to some really cool effects.


According to Eclipzer, "Eventually this will be a full blown editor, once more of the core programming is completed."

I spoke with Eclipzer regarding what he plans to do with the voxel editor / viewer once it's completed, and he mentioned that he was interested in possibly remaking Alias' QB game Attack of the Blobeteers. (In fact, the model that you see in the Voxel Viewer screenshot above is from AotB.) Unfortunately, Eclipzer has been unable to find the original sourcecode of the game. If you have a copy of Attack of the Blobeteers, or know where to get it, please get in touch with Eclipzer!

News Brief by Pete


News Brief by Pete


Some Other Cool Projects / Posts

Here are some other neat programs that are worth a look. I'd write up full news briefs for them, but I'm exhausted and just want to get this dang magazine published!

  • shockwave has released some cool demos this month: a 6 Hour blobs Demo and a Realtime Fire Demo. Nice!

  • phycowelder made a simple maze game called Hedge Row Maze.

  • speedlemon released a game called Gem Hunt with the following notice -- "Warning: This game barely has any food in it." Watch out!

  • Rick Clark created a simple graphics editor called Glyph32 Maker, which outputs your graphics in the form of DATA statements.

  • thesanman made a Flight Simulator program, and is also working on a 3D first person shooter entitled Realms of Darkness.

  • mennonite posted some Qmunity stats that he collected and charted, regarding the number of forum views versus replies. Check out this thread to see the graph and his analysis.

  • Rattrapmax6 moved his website, x.t.r. GRAPHICS to a new server and off of AOL. He also did a nice redesign of his website, and has kept up with regular updates.

  • Clyde made a graphics demo called Gravity - Electro. Yum.

  • TheAdventMaster created some TextBox and Font Routines, which could be very useful if your FB program uses text or text boxes (and it probably does)...

  • Adigun A. Polack posted the results of the 2nd FreeBASIC Ultimate Demo Compo. The winner? A cool music player by Clyde and DBF: Camouflage Music Disk. The Music Disk has a really nice interface, and I would recommend taking a look. Also, while you're at it, visit the DBF-GVY Demo Code Forum, a fairly active forum about graphics demo programming with a FreeBasic section.

  • Ryan (rmann05) is working on a program called Test Master that will help students study for tests. You can find it at his website.

  • Rick Clark has started giving out something called FreeBasic Outstanding Contributor award. The June award went to cha0s: "Cha0s is always willing to help those who need guidance with excellent explanations and helpful code examples. Thanks cha0s." Congratulations!

News Brief by Pete


Other News

Lachie Updates His FB Game Programming Tutorials

In the last two issues of QB Express (#19 and #20), we have featured excellent and extensive FreeBasic programming tutorials by Lachie Dazdarian. However, being the perfectionist that he is, Lachie wasn't completely happy with how they turned out. As a result, he's released corrected / updated versions of both of them:

If you are wondering about mistakes the biggest one was in the first lesson where I incorrectly gave instructions about using 24 bit graphics in GFXlib. I said you can't get transparency with sprites saved in 24 bit mode in a GFXlib program that uses 24 or 32 bit screen color depth. I realized later that this was caused by my incorrect way of converting 8 bit graphics to 24 bit color depth mode. In the second it was only one word but kinda important(I refered to a variable with an incorrect name). And several nitpicks(of course).

These were already AMAZING tutorials, and now they're even better!

News Brief by Pete


Got news to report? Send it to: pberg1@gmail.com!


Gallery

Written by Pete

Every issue QB Express features a preview and exciting new screenshots from an upcoming QB game. If you would like your game featured, send in some screenshots!

This month, we feature THREE previews: LONG: Legend of Noname General by Lachie Dazdarian, a Super Smash Bros. Clone posted at FreeBasic.tk by "someusername," and FieldView by Z!re and company.


LONG: Legend of Noname General


In development in QB since 2002, Lachie Dazdarian's point-and-click adventure LONG is living up to its name, having quite a long development cycle. But this summer, Lachie plans to port it to FreeBasic and finish off the game once and for all. LONG will also receive a huge graphical upgrade from the QB version, which you will be able to see in the following before/after screenshots that follow.

But first, here's a little more info on the game's premise, straight from Lachie's website, Kentauri:

The Legacy Of Noname General is a point and click adventure programmed in QuickBasic [and soon, FreeBasic]. Since i don't want to create just another point and click adventure I'll try to create a unique graphical design and interesting story.Story will be mixture of D.Lynch Lost Highway and R.Zelazny "pocket world" motif.

The graphics are indeed pretty stylistic. Check out some of the old QB screenshots that really showcase LONG's graphical stylings. But in the FB version, the graphics will look even nicer, according to Lachie:

I decided to make LONG a 24 bit graphics game. The reasons are not really relevant but it's important to say this should(I can't promise) advance the look of the game. This is still in testing phase but "the tests" I did so far are very promising. I've sent you 5 scene images and if you want to make news of this PLEASE PUBLISH ONLY THE FIRST THREE IMAGES(long_new1, long_new2 and long_new3)! Others appear really later in the game and I don't want for all the community to see them before the game is out.

Here are some before/after shots. I wish I could show you the other two screens Lachie sent me (they are much more impressive than the three below), but he was very clear that they were for my eyes only.

BEFORE
AFTER

Lachie also sent me a mock-up of what the new FB version's user interface will look like:


"The 6th image represents some of my ideas on how the new game screen might look like. It's all still testing, the very screen is not operable. In this screenshot I also show how 24 bit graphics will allow me to enable some really cool translucency scene transitions. Fell free to show this image to community too."

So when will LONG be released? I'm guessing this fall, or perhaps at the end of this summer. Lachie just recently graduated from college, and he has informed me that he will be without internet access for the rest of the summer...and that he will also have plenty of free time to work on various projects. He hopes to complete the FB version of LONG during that time. After that though, who knows what will become of the Lachie that we know and love:

So LONG at least should be ported during this period. It will be the last summer of Lachie Dazdarian, as I call in my head. Huge changes must and will happen in my life after I finish college and even if I keep making games like I did so far I will be living a different life. I hate being a grownup. :P

Don't worry. My feelings are that we will keep seeing Lachie around for years to come. Someone as dedicated to game programming as Lachie will find a way to be part of the Qmunity. Like they say, "Once a QBer, always a QBer!"



Super Smash Bros. Clone

AKA "Super Smash Brothers 7: Kirby Gets Frisky"


Okay, I really don't know anything about this game, but I think it looks really cool. Being a HUGE fan of Super Smash Brothers, I thought I'd share everything I know about it, hook, line and sinker. I have not spoken to its creator, (a guest at FBTK calling him/herself "someusername"), and aside from a few posts in this thread, I haven't seen anything else posted about this game. When someone asked someusername about his identity, he replied: "Who am I? Well, I've been programming in Basic/QB/FB during +10 years now, and I've always lurking in all QB/FB communities so far, never posting. I think this is (probably) my first post ever!"

As for the game, here's what someusername has said the following:

Sounds (and looks) like it will be a very fun game! I hope the demo does indeed come out soon, because I'd love to give it a go.

But anyway, enough talk... time for a flood of screenshots! (I apologize that I'm doing a rather half-assed Gallery here, but I never bothered to do any research on this game. Therefore, this article will live up to the "gallery" name and feature a lot of pictures...and not much else.)










That's all, folks! Visit the original thread for more info.


FieldView


Z!re and her team of developers are busy at work on the massive online open RPG in the works, entitled FieldView. This uber-ambitious project aims to be by far the biggest and most intricate FB game ever created (though most of the features outlined so far have not been developed yet, and are thus "vaporware").

This month, Z!re sent me a work-in-progress version of the FieldView manual to share with you all. Although this "gallery" article does not include any screenshots, I figured that this would be the best place to include this document.

But first, here's some info from Z!re:

FieldView / Plantasy Studios Official Site

The latest release is always here: http://fieldview.mine.nu/download.php?id=1

In most cases the auto-patcher will handle the updating just fine though. People can see for themselves whats going on and whats added.

As always, questions or bugreports are to be sent to muhdev@gmail.com

We're especially looking for gameplay/ingame questions such as the ones described in the manual.

-Z!re

And now for the FieldView WIP manual:

--General Info--

FieldView is a Massive Multiplayer Online Role Playing Game, or MMORPG for short.
It is set in a medieval fantasy world where players are allowed to live out their lives folowing whatever path they choose.
Various pieces of history regarding the lands found within FieldView is available ingame in the form of books.

--The Goal--

FieldView aims to allow players as much freedom as possible, within 'reality' rules. For example players will be able to construct buildings, chop down trees, become smiths, merchants, bakers. Or simply wander off into the wild looking for some game to hunt.

--Starting Up--

When starting for the first time players have to create an account, details on this can be found by following the onscreen instructions.
After an account has been created you can create or load a character, once again onscreen instructions explain how to do this.
If you start a new character a tutorial mode will start that explains the basics of the game.

--The Gameplay--

There is no difference between a player and a NPC.
FieldView offer no "mobs" or "creeps".
There is no automatic respawning, nor pre-defined spawnpoints.

In FieldView players can perform various tasks ranging from, as previously mentioned, baking bread to fighting savage hordes of beasts.
Players are also able to gather enough fame that other players, or NPCs, join them in a common cause, creating a clan, pack, army or empire if you will.
Such leaders are able to issue abstract orders to his followers, much in the sense of many Real Time Strategy games.
As previously mentioned players can gain followers, this is not limited to non-animal followers.
This means that a player can gain the trust of a dog, which will then follow the player around.

FieldView is a class-less game, meaning that you do not pick a class and thats what you get. Instead players are able to excel at the skills of their choosing.
Skills are learned as they are performed, or learned from experienced players, much like a master trains a novice.
There is no levelup system for your character as a whole, instead you train your skills.
In addition, items such as swords do not have an innate damage, the damage you do with your sword depends on your swordsmanship skill and what type of sword it is. In addition, your strenght plays in telling how hard you hit.
Attributes such as strenght are dynamicaly shifted towards the one you use the most. If you carry a large stone, your strenght will go up, lowering your other attributes.
All players have the same amount of health, if you want to fight, wear armor.

--What Happens if You Die--

If you die in FieldView you will become a lootable corpse. Your spirit will be transported either to the celestial or abyssal planes.
Your corpse remains lootable until your spirit has performed the tasks given to them.
Spirits that do not perform their tasks and return to the body will be hunted by spirithunters.
Death on Elite difficulty will make you loose 50% of your skills.
Elite difficulty gains 100% skill increase, Normal difficulty gain only 50%
It is possible to change to Elite at any time, but not possible to change back.
Normal players suffer no penalty from death other than the possibility of having their items looted by other players/NPCs.
Spirits can ressurect with their body either by possessing their corpse, or by going to the temple of their most favored god.


--List of Playable Races--

Players will be able to play any one of 14 races in FieldView, the races with their pros and cons are listed below (Some races not listed as their abilities are not yet decided):

Dragons
Pros: Magic resistant, Tough skin
Cons: Few magic skills, Unable to wear armor, Unable to perform certain jobs
Special: Flight, Fire breath

Dwarves
Pros: Strong, High morale
Cons: Low stamina and dexterity, weak magic skills
Special: Forge, Imbue, Runebind

Goblins
Pros: Small, Fast, Stealthy
Cons: Physically weak, Low morale
Special: Construct, Repair, Enhance

Humans
Pros: Can learn almost all skills, Survivalists, Widespread, Good spellcasters, Learns skills faster
Cons: Unable to excel in most skills, Dissliked by most other races
Special: None

Minotaurs
Pros: Strong, Horns and claws
Cons: Low intelligence cap, Unable to learn many magic skills, Low agility cap
Special: Can one-hand weild many two-hand weapons, Can wear heavy armors without penalty

Ogres
Pros: Big, Strong
Cons: Slow, Stupid
Special: Inspire fear, Ranged melee, Critical strike



--The policy--

As FieldView aims to allow as much freedom as possible to players there are few restrictions to play. The most significant are:
No bot usage
No cheating
No selling of any FieldView related material for money or other services outside of the FieldView game.
FieldView admins are Gods, obey them.
Registering an account to play FieldView can be done either ingame or from the official website.

And so, there you have it! Make sure you visit the FieldView / Plantasy Studios Official Site for the latest news and information on FieldView!



Have a game that you'd like previewed in the Gallery? Email some screenshots and information to: pberg1@gmail.com!


Qlympics 2006:
The Nominations Round

Written by Pete


The Qlympics 2006

It's taken a few months, but the Qlympics 2006 is finally here!

Based on the suggestions of the Qmunity, I have compiled a huge list of nominees for all of the categories in the 2006 Qlympics. Now, it is up to you to help narrow down that huge list of nominees into three to five nominees per category.

You do this by filling out...

THE QLYMPICS 2006 NOMINATIONS BALLOT

Fill out this form, and let's get this party started!

In issue #22, I will release the FINAL VOTING BALLOT, where you will vote to decide the winners! The final voting round will begin with the release of QB Express #22, in August, 2006.

The Rules

Additional categories

In case you're wondering, there are a few other awards categories that will not be subject to this nominations round:

Time to Vote!

What are you waiting for? Go vote for your favorites!



How to Design and Program a Game in 24 Hours

Written by SJ Zero

If you've been around the Qmunity for the past two years, you're no doubt familiar with SJ Zero's 24 hour FreeBasic minigame coding competitions. The rules are simple: you have only 24 hours to complete the best possible game that you can. When the time is up, everyone uploads their games, and people vote to decide a winner. It's a simple concept, but it results in some pretty awesome games (SJ Zero's awesome "Rambo Vs. Kitty Cat" is a testament to this).

And if you go way back to the days of QB RPGs and Darkness Ethereal, you'll find scads of partially-completed RPG demos from DarkDread's many 24-hour RPG coding competitions. The QB classic "The Secret of Cooey" was the fruit of one of these awesome contests. It's amazing how much can be accomplished with a little experience, a little inspiration, and 24 hours.

But before you start, it's a good idea to think over the process a bit. That's why SJ Zero wrote this article. Coding a game in 24 hours is a completely different animal from a conventional game development cycle (which, can take up to NINE YEARS, as Duke Nukem Forever has shown us). The extreme time constraint forces programmers to think very creatively, work efficiently, and run on pure adrenaline (and caffeine) for a whole day...but if you decide to partake in one of these stressful marathon coding sessions, you'll accomplish something that most coders in this community only dream about: actually finishing a game.

-Pete

1. Design and assessment

Fundamentally, this journey of 1000 lines of code begins before you've even turned on your computer. More than any other type of game, the 24 hour game absolutely requires planning.

In other arenas up to now, people have suggested planning every single equation beforehand. You don't have time for that now. If you spend 8 hours planning, you've suddenly only got 16 hours left to actually code and accumulate. Do NOT make the mistake of planning into minute coding detail. Instead, ask yourself the following:

By answering such questions, you will begin to get a fairly solid idea of what will be involved in making the game you've decided to make.

This may sound trivial, but by answering the questions in the first hour, you can concentrate on programming, and gathering or creating art, music, and sounds.


2. Data Structures

The first thing to get started with when you've made your decisions is to start designing and coding up data types for every object in the game. By creating the data structures first, you end up inadvertently designing a large portion of the game.

The nice thing about this step is that almost every game starts almost every object with the same fundamental attributes: X, Y, X acceleration, and Y acceleration. From there, you'll often want to give it some designation for an object subtype so you can, for example, have multiple enemies using a single data type.

Always try to keep in mind exactly how you're going to use these variables. Remember, that fundamentally, you need to know where every object is, what every object looks like, what every object does, how every object is going to move over the next set time period, and what the status of the object is. By correctly setting up the data structures, you ensure that your program will more or less design itself.

Having created the data structures, just create arrays for the different object types.


3. Graphics

Before we start programming the graphics engine, get your art assets together. Ideally, you'd create them from scratch, but you've got 24 hours – there's no shame in taking a few from elsewhere. The ideal is to use public domain images, however. There's no reason to infringe anyone's copyrights.

Now, you might be asking why on earth we'd set up graphics at this time. The answer is very simple: By having graphics set up, loaded and running, you've got a visual debugger for the physics engine and player controls. Therefore, make sure that the fundamentals of the graphics, that is to say, the position and sprites for all the objects on the screen, are functioning. It may be a good idea to use some false data in the data structures you've created so you can tell if everything is working.


4. Physics

Physics is the most involved part of the process, but it's much easier now that you have graphics in place. With this phase comes a large portion of independent design I can't get into here, but some of the most important questions you have to ask yourself are related to how objects act and why. For example, most arcade games function the way they do because they are hard-coded to do so. Most modern video games, conversely, tend to have universal physics models which treat everything the same and force objects to move according to a universal model.

No matter which philosophy you choose for your physics model, ensure that everything is taken care of in this little block: Enemy stuff, player stuff, movement stuff. Keeping it centralized has the added distinction of allowing you to move to a TCP/IP networking model later, or allowing you to make changes to the fundamental gameplay without altering anything but the physics engine.


5. Player Controls

In the past, player controls would be difficult because it had to do everything. Because of the way I've recommended you tackle your physics, it is the most simple: Simply alter the physics values so your player character is compelled to act in the way you want it to move. Want to move left? Increase the X velocity. Want to move right? Increase the Y acceleration. Want to jump? Set the Y acceleration to a relatively large negative value. By handling player controls in this way, multiplayer is easy to implement, and the physics engine can cover everything important. The centralization has so many benefits I couldn't possibly list them all here.


6. Level asset creation

If you are creating a game that requires manual level asset creation, God help you. You've chosen a path that will require the majority of your time to be focused on creating level assets. However, if you get the first 5 steps out of the way quickly, you can still end up with a large, playable game.

One lovely thing is, because of the way you've implemented everything in an encapsulated manner, you can just pull the physics and player controls out of the engine and use the same base as a level editor.

For Rambo vs. Kitty Cat, I didn't even do that – I simply made the mouse into a level editing control device and kept the keyboard as the game playing control device.

After completing these 6 steps, you'll have a complete, playable game! From here, you can expand it however you'd like, polish it up for a true release, or move onto another game.

Whatever you choose to do, congratulations! I hope to see you at the next QBXL Competition!

- SJ Zero


Download a copy of this article: 24hours.html


The Next (R)evolution in Computing

Written by Rick Clark

Modern computing has come a long way from the days of Babbage's Difference and Analytical Engines, which are thought by many to the true ancestors to the modern computer, even though neither machine was actually built as a full-scale working model. The first production computers were mechanical devices, in many ways similar to Babbage's Analytical Engine. These mechanical computers evolved into electro-mechanical devices, a hybrid of electrical relays and mechanical parts, which in turn became electronic analog devices, then electronic digital devices, which finally gave way to the semiconductor-based digital computers we have today.

Even though the guts of the computer have changed over the years, the main function of the computer hasn't. Babbage created his Difference Engine to calculate logarithmic tables and Eniac was created to calculate artillery trajectories. Modern computers can do all sorts of things besides calculating tables of logarithms-but at their core, they are still overgrown calculators.

The principles of computing, which were beginning to be developed as early as the 1930's and became practical on a large scale in the 1950's are still being used today. The new frontiers of computing technology, quantum-based CPU's and holographic memory may increase the speed and capacity of computers, but will not change the fundamental nature of computers; they will still be large (or small) calculators.

The problem with computers is that, for all of the gigabytes of memory and fancy HD displays, they are hardware-centric, engineering devices, designed to solve engineering problems. Sure, the attempt has been made to make computers more user friendly by layering operating systems and programs on top of the hardware, but the user is still at the mercy of the computer engineer and software designer to develop the tools that are needed to use the computer. And even though it is much easier to use a computer now than it has been in the past, the available software is still hardware-centric, making the user conform to the rules of the machine, rather than making the machine conform to the rules of the user.

Making computers faster, or increasing their capacity won't change the fundamental paradigm of machine centered computing. The next evolutionary step in computing, the next revolution in computers will be the shift from hardware-centric computing to human-centric computing. Instead of using a computer to solve a problem, we will interact with a computer to solve the problem together. What is needed to make this paradigm shift possible? Computers will need to understand human languages.

This can be shown by using an example familiar to all of us programmers: writing a program. To write a program, you start with a programming language of your choice. Once you write the source code, it is fed into a compiler or interpreter to convert the source code into machine code that is then executed by the computer. Notice the process: we write a human-readable document that must be converted to a machine-readable document before the computer can understand what we want accomplished.

Source code is a strictly human construct. A computer has no idea what Dim a as As Integer means from a language perspective. In order to make the computer understand what we want done, the code must be translated to machine language. The machine forces this step-wise process because we must conform to the rules of the machine. To make matters worse, we as programmers must conform to the rules of the language designer, even though the rules of the language may not be what we really need in the first place.

It makes more sense, from a human perspective, that to solve a problem, we simply tell the computer the problem, and together, build a solution. If the computer understood our language, we could explain to it what needed to be done. If what we are asking is ambiguous or not understood, language provides the mechanisms necessary to clarify concepts and ideas, and arrive at a common understanding. Human-centric computing means making the machine conform to human rules; that is, changing computing from calculation-based to language recognition.

Consider the following:

  1. Understanding language implies interaction. If a computer understood human language, it would have the facility to be an interactive partner in problem solving, because language is the basis for human interaction.

  2. Understanding language implies learning. The only way to develop language skills is to learn the language. In order for a computer to understand language is has to learn the language, and must have the capacity to learn the language of the user.

  3. Understanding language implies intelligence. Language is, because it is a human construct, filled with subtleties. If a computer were able to understand language, it would also have the necessary intelligence to understand these subtleties.

  4. Understanding language frees the computer and user from the constraints of the engineer and software designer. If a computer can understand that I need to build a database of names, it will also have the capability to build and manage that list of names.

  5. Understanding language implies a universal machine. If language is the medium of computer interaction, then the concept of a specific operating system, even specific programs, is no longer necessary. Language enabled computers would be universal, able to interact, not only with humans, but with other computers as well, in a humanistic fashion.

  6. Understanding language implies evolutionary change. Languages change over time, and the evolutionary progress of man can be measured by the changes in human language. If a computer understood language, it too would evolve right along with humans.

While all of this may sound nearly impossible, the shift from calculation computing to language computing does not mean a new set of computing principles. Rather it is the reformulation of those principles, the change of perspective that needs to come about in order for the paradigm shift to occur. Calculation oriented computing has undeniably changed the world. Language oriented computing, the next (r)evolutionary step in computing, may have an even bigger impact.


Download a copy of this article: The_Next.txt


Polemic For the Future of FB

Written by SJ Zero

This is a call to arms; a call to war. Too long have we done nothing with our great freedom. Too long have we wasted our time and bickered amongst ourselves and tried our very best to ignore the fact that we were achieving nothing. I've watched the greatest programmers of our generation lured away or drawn into nothingness. I've watched an entire community scream in anger about nothing, and be answered in kind.

Quit wasting my time.

Today, more than at any other point in our history, we need a direction. We need some fight to be fought, some direction to pit one against another not in the airy realm of useless semi-philosophical thoughts, but hard code hammered into something great and useful.

There is only one way to do this.

Pick up a project, right now. It doesn't matter if it's good. It doesn't matter if it's stupid. It doesn't matter what you think of it at all. Just pick up a project and RUN with it. This issue, we've got all the information you'll need to get a demo up and running in 24 short hours. Think about how insignificant a slice of time that is. In a single day, you could have something. And if everyone reading this message runs out and spends 24 little hours on something, and looks at everyone else's product of 24 little hours, then really interesting things start happening: People start to go "Gee, I like how that little 24 hours turned out. I think I'll try to spend 24 little hours trying to make something better.", and they do. From there, the little bits of 24 little hours accumulate and we'll have a community to put any other on the Internet to shame.

We have the technology. All we need now is the will.


For more articles by SJ Zero, visit QBXL.net. But really, you should take SJ's advice and go code something.


Digg it!
The Year's Best Programming Articles From Digg.com

Written by Pete

If you haven't heard of the social tech news site Digg.com yet, you've been missing out on the single best source of news and interesting bookmarks on the entire web....if you're a geek, that is.

In the past few months, Digg has passed the former king of online geek news, Slashdot, and it keeps growing. In fact, on Monday, June 26th (tomorrow when I'm writing this), Digg is launching version 3 of their website, which will add a ton of new features and will expand the site beyond just tech/geek news to everything from movies and music to world news to art.

But one topic that Digg has always covered extremely well is perhaps the geekiest subject of them all: Programming. You'll find some of the most interesting and informative articles about computer programming listed at Digg -- covering everything from how to create high-tech new Ruby On Rails web apps, to old-school DOS programming, to general programming theory.

Since I'm sure a lot of QB Express readers have missed out on many of the good programming articles posted at Digg, I've gone through the last year's worth of top programming articles and filtered out the ones that would appeal to QB / FB programmers: the ones on general programming know-how, and some of the stuff on old-school BASIC / DOS coding. (I've left out all the articles on specific languages and web programming... but if you're interested in learning PHP, AJAX, CSS, Python, Java, C++, or web programming, you'll find literally hundreds of fantastic articles in the Digg programming archives.)

If you're not already a member of Digg, I encourage you to sign up and pay the site some visits. If you ever need to kill time, or want to keep yourself informed about the latest in technology, science and entertainment, Digg.com is *the* place to visit online. You never know what you're going to find. Plus, you can submit articles of your own and direct mega traffic to your site (if enough people actually digg your article). Also, you should check out the weekly Audio / Video podcast Diggnation with Kevin Rose (Digg.com founder) and Alex Albrecht. It's the most entertaining podcast I've found anywhere.

As you've guessed, I'm a Digg addict... I visit the site every time I sign online, and can't get enough. If you're interested in seeing the stories that I've been Digging throughout the week, visit my user profile -- and if you're a member, add me as a friend! None of my real-life friends use Digg, so I don't have many Digg friends yet...but if all you QBers befriend me, then I won't be such a digg dork. :)

Enjoy the articles!

-Pete


How to Design Programs: An Introduction to Computing and Programming

submitted by dirtyfratboy 1 day 23 hours ago (via http://www.htdp.org/2003-09-26...)

Programming a computer requires patience and concentration. Only rigorous planning and adherence to the plan will prevent serious logical mistakes in our designs. But when we finally master the design of programs, we will have learned skills that are useful far beyond the realm of programming.

 

Ultimate Game Programming Guide

submitted by shirini 3 days ago (via http://www-cs-students.stanfor...)

This is one of the best resources for game programmers out there.

 

All the programming algorithms you might ever need

submitted by bonlebon 4 days ago (via http://www.cse.ucsd.edu/~dasgu...)

This is a pure gold link for CS pros, techs and hobbyists.

 

Functional Programming For The Rest of Us

submitted by dirtyfratboy 5 days ago (via http://www.defmacro.org/rambli...)

"So what is FP? How did it come about? Is it edible? If it's as useful as its advocates claim, why isn't it being used more often in the industry? Why is it that only people with PhDs tend to use it? Most importantly, why is it so damn hard to learn?"

 

10 tips on writing reusable code

submitted by depi 6 days ago (via http://hoskinator.blogspot.com...)

Really good tips how to write reusable code.

 

15 Exercises to Know A Programming Language: Part 1

submitted by rlamarch 8 days ago (via http://www.knowing.net/PermaLi...)

The fastest way to learn a new language is to write some code. Here are 15 exercises from veteran programmer Larry O'Brian to kick start your studies.

 

15 Exercises for Learning a new Programming Language

submitted by sickaltima 13 days ago (via http://www.jobsnake.com/seek/a...)

Prashant N Mhatre has a working knowledge of several programming languages but job demands to learn a new language frequently in a short time. Prashant shares 15 exercises to master languages quickly.

 

How The Current State Of Case Law Forces Software Patenting

submitted by dirtyfratboy 19 days ago (via http://www.emailbattles.com/ar...)

Programmers have slowly come to realize that, if they don't patent their code, they may find themselves unable to legally use it after someone else patents it much later. Out of necessity, a new patent-oriented ethos has taken over.

 

Complete MS-Debug Tutorial

submitted by gwjc 21 days ago (via http://thestarman.dan123.com/a...)

If you started on MS-DOS PC's back in the 80's you probably still have fond memories of writing .coms in debug. Even if you never used it, Microsoft still gives you a copy of it with Windows, so you can fire it up and flashback to the days before the GUI.

 

They Laughed When I Sat Down At The Keyboard

submitted by tastypastry 35 days ago (via http://www.old-computers.com/f...)

Atari/Microsoft ad from the early 80's for Microsoft Basic II.

 

Good List of "Programming Fonts"

submitted by mbuchetics 55 days ago (via http://keithdevens.com/wiki/Pr...)

Programmers have very particular font needs. A font for programming must be mono spaced, extremely readable, and must sharply distinguish between similar characters, such as capital O and zero and the number 1, capital I, and lowercase L. In addition, good programming fonts allow you to view more lines of code on screen at once.

 

Massive List Of 5000 Programming / Computer / Internet Books - For Free!

submitted by lonelycanuck 57 days ago (via http://2020ok.com/5.htm)

Who needs to pirate books / steal from the library with a list of free resources like these?

 

5 Truths About Code Optimization

submitted by palindrome 66 days ago (via http://jroller.com/page/rolsen...)

"See if you can speed this code up." It's usually code I've never seen. It's probably important, otherwise they wouldn't be worried about how it is performing. And speed it up to what? Still, there are some basics you can fall back on when someone asks you to optimize some code.

 

Interested in Computer Science?

submitted by dbxz 71 days ago (via http://photoncubetutorials.blo...)

If your planning on going to University for it here is an article that will give you a small taste of what Computer Science is like.

 

Ethics for Programmers: Primum non Nocere

submitted by bonlebon 84 days ago (via http://glyf.livejournal.com/46...)

I've been mulling over these ideas for quite a while, and I think I may still have more thinking to do, but recent events have gotten me thinking again about the increasing urgency of the need for a professional code of conduct for computer programmers.

 

Computer and programming books

submitted by lacop 93 days ago (via http://www.computer-books.us/)

High quality computer books for available for free download.

 

The Three Great Virtues Of A Programmer

submitted by mudgen 100 days ago (via http://c2.com/cgi/wiki?Lazines...)

"We will encourage you to develop the three great virtues of a programmer: laziness, impatience, and hubris" -- Larry Wall.

 

Math For Programmers: It Isn't As Hard As You Think

submitted by dirtyfratboy 100 days ago (via http://steve-yegge.blogspot.co...)

"They teach math all wrong in school. Way, WAY wrong. If you teach yourself math the right way, you'll learn faster, remember it longer, and it'll be much more valuable to you as a programmer."

 

Poster of History of Programming Languages

submitted by rsanchezg 104 days ago (via http://www.oreilly.com/news/gr...)

Poster of history of programming languages of 1954-2004.

 

What Programming Languages You Should Actually Care to Learn

submitted by geezusfreeek 105 days ago (via http://www.cabochon.com/~steve...)

This is probably my favorite tour of the popular languages we all hear debates about and which ones are actually worth their steam. It includes C, C++, Lisp, Java, Perl, Ruby, and Python. This is sure to spark at least a little controversy in the comments.

 

Natural Selection Yields a Sorting Algorithm Better than Quicksort

submitted by dirtyfratboy 113 days ago (via http://critticall.com/)

This is the home page of Critticall. A programming tool, which enables you to apply the Darwinian force to algorithms! To those fundamental, and to those quite common. Evolution isn't just a theory. It's a nature's technology to make complicated things.

 

The real power of programming in assembly

submitted by deathray 114 days ago (via http://www.scene.org/awards.ph...)

Check out these 64k intros, less than 64kb in size and yet more than 2 minutes of graphics and music. Programming at its best.

 

Top Ten List of Programming Advice to NOT Follow

submitted by slf67 132 days ago (via http://www.chrylers.com/weblog...)

Addresses some of the most common things people are being told about programming with which the author disagrees.

 

Programmers get their own search engine

submitted by jsmiley17 138 days ago (via http://www.linux-watch.com/new...)

A tool, known as Krugle, is designed to deliver easy access to source code and other highly relevant technical information in a single, clean, easy-to-use interface for programmers. Krugle works by crawling, parsing, and indexing code found in open source repositories and code that exists in archives, mailing lists, blogs, and Web pages.

 

Seven Secrets of Successful Programmers

submitted by netmancer 143 days ago (via http://www.irishdev.com/NewsAr...)

Nice quick list of seven good programming practices.

 

List of Algorithms

submitted by vagabond0101 144 days ago (via http://en.wikipedia.org/wiki/L...)

This single wikipedia webpage shows you a list of algorithms neatly classified into categories. Pick the ones you are interested in !

 

Do Programmers think like mathematicians?

submitted by summer2005 145 days ago (via http://epsilondelta.wordpress....)

This is the start of a new series, “Programming Like A Mathematician”. The author will explain how a mathematician thinks about a particular problem, with hopes that programmers will be able to see things from a different perspective.

 

The A to Z of Programmer Predilictions

submitted by Carlsb3rg 151 days ago (via http://www.hacknot.info/hackno...)

Hilarious caricatures of 26 different types of programmers

 

FREE ebook: Programming from the ground up

submitted by bonlebon 153 days ago (via http://download.savannah.gnu.o...)

All you wanted to know about programming and never dared to ask. ALERT: PDF ahead.

 

I'm A Programmer, Not A Computer Guy

submitted by FilteringCraig 160 days ago (via http://blogcritics.org/archive...)

This is a funny article showing that just because someone can program a computer doesn't mean that that makes them a "computer guy." This is to programmers what printers and copiers are to computer guys.

 

What I Learned at MIT

submitted by LewsTherin 168 days ago (via http://www.technicat.com/writi...)

Some lessons learned by Philip Chu from being a student at MIT, especially ones not taught by teachers. My favorite is "Work Alone".

 

Seven Habits of Highly Effective Programmers

submitted by crapiolio 183 days ago (via http://www.technicat.com/writi...)

Must read if you are a new or pro programmer.

 

Best Practices for Software Development

submitted by equanimous 196 days ago (via http://all-technology.com.nyud...)

Here is a voteable list of best practices in software development. I am using the coral cache because the server is a little old, so if you would like to vote or post please remove .nyud.net:8090 from the url.

 

How to be a Programmer: A Short, Comprehensive, and Personal Summary

submitted by jak119 220 days ago (via http://samizdat.mines.edu/howt...)

just what the title says

 

Developer's Top 10 replies when code doesn't work...

submitted by seven5 237 days ago (via http://www.cenriqueortiz.com/w...)

I've said them all...

 

C'mon Kids, Let's Play Programmer

submitted by Albertpacino 278 days ago (via http://www.wired.com/news/tech...)

The creator of a board game says computer programming can be fun. A few rolls of the die later you, too, could become a programmer.

 

The most popular programming languages

submitted by jtam 290 days ago (via http://www.tiobe.com/tpci.htm)

The TIOBE Programming Community index gives an indication of the popularity of programming languages. The index is updated once a month. The ratings are based on the world-wide availability of skilled engineers, courses and third party vendors.

 

I can count to 31 on one hand

submitted by futoranime 293 days ago (via http://www.glassgiant.com/misc...)

Learn the art of binary counting with your hand. Just dont stay on 4 or 20 while in public. If this is a dupe, then 4 you!!

 

Why Good Programmers are Lazy and Dumb

submitted by mdipi 301 days ago (via http://blog.outer-court.com/ar...)

Lazy programmers write simple code, and dumb programmers always want to learn more. Great read.

 

Program in BASIC...online

submitted by armand_wall 306 days ago (via http://www.pachesoft.com/rocke...)

Yes, online. Enter a few lines of Basic code, hit "Run" and actually see the results in a web page. Even the "Input" keyword works! The site includes a complete reference and has some example code. I think this is useful for programming apprentices. And if you already know how to program, this is fun to fiddle with. Take a look.

 


Check out my Digg user profile to see what else I've been digging -- and add me as a friend. :)


Monthly Awards

Written by Pete

Every month, QB Express hands out two awards to recognize QB or FB coders and websites that have done exceptional work in the last month. They are not awarded for work done in the past, only for work that has been released since the last issue of the magazine. We will bring you these awards on a monthly basis to help give credit where credit is due.


Site of the Month

Genso's Junkyard
http://rel.betterwebber.com/

Webmaster: Relsoft


There isn't much to Relsoft's personal projects page, Genso's Junkyard, but everything you'll find there is absolutely fantastic work by one of the Qmunity's best coders. You'll find (most) of Rel's games, graphics demos, libraries, projects, tutorials, downloads and screenshots on this site -- everything on it was made by Relsoft, and and all of them of the high quality that we've come to know and expect of RelSoft's work. The site itself has a nice style to it, with a sleek blue color scheme and an anime logo featuring one of Rel's favorite anime characters.

This past month, Relsoft posted a huge update, where he added SEVEN new FB graphics demos that he's written in the past few months, complete with screenshots and descriptions. All of these demos are very impressive on their own, but all seven of them together will knock your socks off!

While Genso's Junkyard doesn't have the most frequent updates, and a lot of the content is a bit outdated, it still stands out as one of the best personal pages in the Qmunity. And for that reason, plus the latest update, I hereby award Relsoft the QB Express Site of the Month award!



Programmer of the Month

Xerol
http://www.lggaming.com



Xerol is someone who's been a frontrunner for programmer of the month for just about every month since I started giving out the award. He's a talented coder, and is extremely active in the FB scene. Just about every month he's released something new, whether it's a new minigame he's written to win a programming contest (this happens a lot), posted a preview of one of his upcoming games (so does this), or announces a new project or library that leaves us all drooling (check).

Let's take a look at some of the things Xerol's done lately:

That's a lot of great stuff... and that's just the stuff that's gotten featured in QB Express!

This past month, Xerol released a lot of information and screenshots on a new game he's working on: a "Seamless Tactical RPG" that looks like it will be awesome. (Check it out in the News Briefs above.)

Also, a little bird told me that Xerol's 21st birthday is coming up on July 24th (just over a week away), so what better time to receive an award? The cool thing is that Xerol and I are almost exactly the same age -- my own 21st birthday is just two days later, on July 26th! Hopefully our new status as "adults who can legally drink" won't take away from our involvement with the Qmunity. :-)

For his countless program releases and always phenomenal work, Xerol is the QB Express Programmer of the Month.


Have a suggestion for Programmer / Site of the Month? Email me!


Comics

By Rattrapmax6, Redcrab and tunginobi

Three different comic series this month! Rattrapmax6 is back this month with another QBasic Horse Humor comic, Redcrab returns with another "0 1" comic, and tunginobi is here with three more Stickblob comics.





QBasic Horse Humor

























Single-Dimension Dynamic Arrays in Types

Written by Richard D. Clark

This is the first part of a two-part series on creating dynamic arrays within type definitions.

A Dynamic array in a type definition is a very useful feature, but FreeBasic doesn't support it. Or rather, it doesn't support it directly. However, you can create dynamic arrays by using pointers and the associated memory functions.

An array is simply a contiguous block of memory that holds a certain data type. Arrays in FreeBasic use an array descriptor to describe the data contained within the array, and you can use this same technique to build a dynamic array within a type. The two elements you need within your type-def are a pointer to a particular data type, and a size indicator.

You can then use the ptr field to allocate a block of memory to the needed size, and save that size in the size indicator field. The size field is used to tell you how many elements are currently in the array. Once the array has been initialized, you can then use pointer indexing to access each element in the array.

The following program illustrates the steps in creating, initializing and resizing a dynamic type-def array.



Option Explicit

'Define type:
'size is current size of array
'darray will contain array data
Type DType
    size As Integer
    darray As Integer Ptr
End Type

'Create an instance of type
Dim myType As DType
Dim As Integer i, tmp

'Create enough space for elements
myType.darray = Callocate(5, Sizeof(Integer))
'Set the length of the array
'in the array size indicator
myType.size = 5

'Load data into array
For i = 0 To myType.Size - 1 
    myType.darray[i] = i
Next

'Print data
For i = 0 To myType.Size - 1
    Print "darray[";i;" ]:";myType.darray[i]
Next
Print "Press any key..."
Sleep
Print

'Save the current array size
tmp = myType.size
'Now resize the array
myType.darray = Reallocate(myType.darray, 10)
'Set the length indicator
myType.size = 10

'Load in data into new allocation
For i = tmp - 1 To myType.Size - 1
    myType.darray[i] = i
Next

'Print out contents
For i = 0 To myType.Size - 1
    Print "darray[";i;" ]:";myType.darray[i]
Next
Print "Press any key..."
Sleep

'Free allocated space
Deallocate myType.darray

End

The first step is, of course, to define the type-def:

Type DType
    size As Integer
    darray As Integer Ptr
End Type

Since this is just an example there are only two elements within the type, a size indicator and the array pointer. Notice that the array pointer is defined as an Integer ptr. When you define a pointer to a particular type, you are creating a "typed" pointer. The compiler can use this type information to check to make sure the values being placed into the array are valid, and will also use this information for pointer arithmetic.

The next step is to define the working variables.

Dim myType As DType
Dim As Integer i, tmp

Here an instance of the type is created, as well as some working variables that are used in the following code. WARNING: You must initialize the array pointer before you can use it; using an uninitialized ptr can cause program crashes, system lockups and all sorts of BAD things.

myType.darray = Callocate(5, Sizeof(Integer))
myType.size = 5

These two lines of code initialize the array pointer to hold 5 integers. Callocate is used to allocate the memory segment, since Callocate will initialize the segment to zeros.

The size field stores the current length of the array. Now, of course, you could calculate the size of the array by simply dividing the number of bytes in the allocation by the size of an integer, but using a size indicator within the type is much cleaner and saves you a calculation in your program.

For i = 0 To myType.Size - 1 
    myType.darray[i] = i
Next

This section of code loads the array with some values. You can see why saving the size of the array simplifies the coding process. Since the array is a typed pointer, you can access the array using the pointer indexing method, which is almost like accessing a predefined array.

For i = 0 To myType.Size - 1
    Print "darray[";i;" ]:";myType.darray[i]
Next

This section simply prints out the values using the same method that was used to load the array.

Of course, this should be a dynamic array, so you should be able to resize the array, and this is exactly what the next section of code will do.

tmp = myType.size
myType.darray = Reallocate(myType.darray, 10)
myType.size = 10

The first line of code saves the current size of the array so that the new memory segment can be initialized while not overwriting any existing data. You will see this in a moment.

The second line uses the Reallocate function to resize the memory segment, that is, resize the array. In this case, the array is being made larger; you could of course make the array smaller. If you were to make the array smaller, any data not in the new segment would be lost, as you would expect.

The last line of code above saves the new array size in the size indicator.

For i = tmp - 1 To myType.Size - 1
    myType.darray[i] = i
Next

Here, you can see why the old array size was saved. In the For statement, the initialization procedure starts from the old index and iterates through the newly added indexes, storing data within the memory segment. This is like using the Redim Preserve statement on a normal array.

For i = 0 To myType.Size - 1
    Print "darray[";i;" ]:";myType.darray[i]
Next

This code section simply prints out the new values.

Deallocate myType.darray

This is vitally important. You should always deallocate any allocated memory that you have created in your program to prevent memory leaks.

When you run the program you should see the following output:

darray[ 0 ]: 0
darray[ 1 ]: 1
darray[ 2 ]: 2
darray[ 3 ]: 3
darray[ 4 ]: 4
Press any key...

darray[ 0 ]: 0
darray[ 1 ]: 1
darray[ 2 ]: 2
darray[ 3 ]: 3
darray[ 4 ]: 4
darray[ 5 ]: 5
darray[ 6 ]: 6
darray[ 7 ]: 7
darray[ 8 ]: 8
darray[ 9 ]: 9
Press any key...

The first print out shows the original array. The second print out shows the newly resized array.

There you have it, a single-dimension dynamic array in a type. In the next tutorial, you will see how to add a two-dimensional array to a type-def using the same techniques.


Download a copy of this tutorial: SDArray.txt


Text User Interface Development Series
Part One - T.U.I. Basics

Written by Stéphane Richard (Mystikshadows)

INTRODUCTION:

Welcome to this series on Text User Interface Development. Of course, T.U.I. development is not a new subject today. However, it is always an interesting one. If you want to program a text game of any kind, a tool or utility or a full fledged application, in many of those cases, having a good and intelligently designed text user interface can make a difference on how much your program will be loved and used by it's potential users. Alot of us have seen many examples of text user interfaces from a simple text editor, to other programs that use a text user interface to present the user with it's functionality. We'll be using many of them as examples in this series.

The layout of the series will be pretty straightfoward. This first part of the series that you are reading right now will basically present the basics of T.U.I. What are the components, what role would/could they play in a complete design, what they are typically used for and the likes. Some basic TUI concepts will also be explained in this first part so that they are clearly understood before they are used further in this series. Let's begin right now.

WHAT A TEXT USER INTERFACE IS:

When you make a program, it's great to give it a good set of complete features and functionality that help your project accomplish it's designated role (game, application, tool and utility, you name it). The only way that the program becomes useful to a user is in the way that all that functionality is presented to them. To present these, in an intelligent way, to the user is the art of creating a user interface and a text user interface is a text only way of interacting with the user. In the course of computer history, there were basically four types of user interfaces that have arised. Here they are here with a brief explaination of what they entail.

Now, for the sake of this series, we will be concentrating on the S.A.A. / C.U.A. User interface design since it is, by far the most widespread of them all. As such, we'll be describing exactly what entails the C.U.A. standard. Everything it means, along with every single visual aspect of this standard as far as visual components, operation standards and the likes. Once this is done, and in future issues of this series we'll be building our codebase to create and operate a standard C.U.A. compliant and functional text based user interface framework that you can customize and use in all of your other projects if you wish.

STANDARD APPLICATION ARCHITECTURE / COMMON USER ACCESS DEFINITION:

In a nutshell, the C.U.A. standard is based on the fact that you have a file, database or document of some sort and are about to perform somekind of work on that document. You can have more than one type of document you might be working on, and you can have tools that might come in handy while you are working on that document. Think of a C.U.A. application as a desktop metaphore (much like Windows, OS/2, Gnome opr KDE in linux). Where the programs are different windows and tools (like a calculator, a calendar and the likes) are typical things that you might find on your desk. The menu system, of course, reflects the functionality available based on which type of file you are currently working on. I will be using existing text/DOS applications to explain the many components that make up a complete typical C.U.A. application. The system we'll be creating will be very similar to those however, since I believe some of the funcionality (visual and non visual) can be better, I will make them better in this series. Let's start by taking a look at three screenshots.

Now, the main reason I showed these 3 screenshots is so you get good visual examples of everything that make up a Text user Interface. As you can see from these three screenshots, there are many parts that make up a C.U.A. application. After this series is done, we'll have everything we need to build complete C.U.A. compliant applications. So then, let's start this by decribing what makes up a complete C.U.A. user interface, each component and each type of dialog and so on. and that will conclude this first part of the series. So let's get right to it shall we?

COMMON USER ACCESS STANDARD T.U.I. COMPONENTS:

Now that we defined all these, it's time to get a glimpse at why these control exist, how they can be used in every day application development projects. The best way to do that is to define some standard dialogs. you can define a standard dialog as being a dialog that anything can use at will when needed. If doing a business application, chances are any business module might need to open either a document or a database from the hard drive (or the network depending). For those, you can create one dialog that will be available to all business modules (maybe even all other related applications as well, if it works in one place it will work in all places too). This minimizes the coding effort and once that one form is stabilized, it's good for every other module that might need to make use of it. So there's definitaly alot of advantages to taking the time to create standard dialogs and test them quite well. Here there are right here so we know what we'll be creating.

COMMON USER ACCESS STANDARD DIALOGS:

Standard dialogs are windows that offer common functionality that you are likely to find in all types of application no matter whether it's a game, a tool, a full fledged application you name it. Typically and especially when you are building more than one application, it's highly recommended that you offer a standard way to do certain things like opening files and the likes. This will greatly minimize the learning curve of all your applications and hence make your programming projects more interesting to your potential users. Here are these standard dialogs

Now that we have our standard dialogs defined, It's time to talk about standardization. I won't mention too much here because the rest of the series will detail our standardization in complete details. Here one thing I can say is that it's time to start thinking about keyboard and mouse access. it's time to start thinking about what Alt + F2 will do throughout your whole application or even complete range of applications. IT's important to define these right up front, before any coding is done so that you are prepared for it. It's also time to jot down what visual interaction you'll want your T.U.I. to allow the user to do. For example, will you want the user to be able to drag controls arounds, move them around the screen with the mouse (or keyboard of course), wil lAlt, or F10 be the key to activate the mouse. What part of the color configuration will the user be allowed to change (will he be able to select specific colors and/or specific themes of colors) and all these details. In the next part of the series we'll start covering all these details so that again, we know right up front, waht kind of coding project we're up against and be better prepared to start the coding phase.

IN CONCLUSION:

And there you have it. I believe that with this first part, we'll now have a complete "to do list" in order to get started on implementing our T.U.I. framework. We've covered all the controls that we'll be implementing as well as our standard dialogs. I'm sure you started visualizing a bit how your whole T.U.I. framework will be, how things will be called. Maybe you even dared to start writing down some keyboard shortcuts and such to start preparing for our next installment. That's great. You're of course free to do whatever you want. But me, in the next installment is when I'll be defining all these things, maybe when you read that, you'll get ideas and insight on your own standards that might make you change a few things.

I'm always open to emails with criticism, suggestions, comments and compliments (of course) as well as exchange of ideas. So if by reading this, a whole bunch if things appeared in your head and you want to talk about it, feel free to email me (click my nick name below to email me) and we can have a good detailed discussion about all this. I answer, of course, any and all questions and critiques, the object of these series is that all of us become better at what we do best. That certainly can include me as well. Until our next installement, happy reading and coding.

MystikShadows
Stéphane Richard

Download a copy of this article: TUISeries1.zip, or view it on its own here: tuiseriespart1.htm


i-TECH Tutorial:
Using Circles as Objects in Games

Written by Kristopher Windsor

The object of this tutorial is to move a circle with the arrow keys, and have the circle interact with some other objects on the screen. The program uses CONST, CIRCLE, DO WHILE, INKEY$, SELECT CASE, SQR, and multidimensional arrays, which should be understood before using this tutorial. To start, here is the game code format:


'i-TECH Tutorial: Using Circles as Objects in Games
'(C) 2006 i-TECH and Kristopher Windsor

'Declare and initialize variables

'Initialize the display

'Loop until the program ends

'Respond to user input

'Move the circle

'Initialize and move the other objects

'Accept user input

Step 1: Make the circle move

The variables X, Y, and SIZE will be used for the main circle. DIST controls how far your circle will move when you press a key. The game will run in SCREEN 12 (640*480*16) until the user presses escape.


'i-TECH Tutorial: Using Circles as Objects in Games
'(C) 2006 i-TECH and Kristopher Windsor

'Declare and initialize variables
dist = 8
key$ = ""
size = 32
x = 320
y = 240

'Initialize the display
SCREEN 12: WIDTH 80, 60: CLS

'Loop until the program ends
DO

'Respond to user input

'Move the circle

'Initialize and move the other objects

'Accept user input
key$ = INKEY$

LOOP UNTIL key$ = CHR$(27)

The game will use SELECT CASE to process user input from the arrow keys. CHR$(0) + CHR$(72) is the up arrow key, and CASE CHR$(0) + CHR$(80) is the down arrow key. The IF statements stop the circle from leaving the screen.


'i-TECH Tutorial: Using Circles as Objects in Games
'(C) 2006 i-TECH and Kristopher Windsor

'Declare and initialize variables
dist = 8
key$ = ""
size = 32
x = 320
y = 240

'Initialize the display
SCREEN 12: WIDTH 80, 60: CLS

'Loop until the program ends
DO

'Respond to user input
SELECT CASE key$
CASE CHR$(0) + CHR$(72): IF y > 0 THEN y = y - dist
CASE CHR$(0) + CHR$(75): IF x > 0 THEN x = x - dist
CASE CHR$(0) + CHR$(77): IF x < 639 THEN x = x + dist
CASE CHR$(0) + CHR$(80): IF y < 479 THEN y = y + dist
END SELECT

'Move the circle

'Initialize and move the other objects

'Accept user input
key$ = INKEY$

LOOP UNTIL key$ = CHR$(27)

Now the game needs to display the circle. This displays the circle, but leaves a trail when it is moved. (The trail makes a very nice effect.)


'i-TECH Tutorial: Using Circles as Objects in Games
'(C) 2006 i-TECH and Kristopher Windsor

'Declare and initialize variables
dist = 8
key$ = ""
size = 32
x = 320
y = 240

'Initialize the display
SCREEN 12: WIDTH 80, 60: CLS

'Loop until the program ends
DO

'Respond to user input
SELECT CASE key$
CASE CHR$(0) + CHR$(72): IF y > 0 THEN y = y - dist
CASE CHR$(0) + CHR$(75): IF x > 0 THEN x = x - dist
CASE CHR$(0) + CHR$(77): IF x < 639 THEN x = x + dist
CASE CHR$(0) + CHR$(80): IF y < 479 THEN y = y + dist
END SELECT

'Move the circle
CIRCLE (x, y), size

'Initialize and move the other objects

'Accept user input
key$ = INKEY$

LOOP UNTIL key$ = CHR$(27)

When the circle moves, it has to be erased from its previous location, to avoid leaving a trail. After the circle is drawn at (X, Y), the variables X and Y are stored to the variables PX and PY. Then, after the program has looped, a black circle is drawn at (PX, PY) to erase the white one, and the white circle is redrawn at (X, Y), which lets it move as neccessary.


'i-TECH Tutorial: Using Circles as Objects in Games
'(C) 2006 i-TECH and Kristopher Windsor

'Declare and initialize variables
dist = 8
key$ = ""
size = 32
x = 320
y = 240

'Initialize the display
SCREEN 12: WIDTH 80, 60: CLS

'Loop until the program ends
DO

'Respond to user input
SELECT CASE key$
CASE CHR$(0) + CHR$(72): IF y > 0 THEN y = y - dist
CASE CHR$(0) + CHR$(75): IF x > 0 THEN x = x - dist
CASE CHR$(0) + CHR$(77): IF x < 639 THEN x = x + dist
CASE CHR$(0) + CHR$(80): IF y < 479 THEN y = y + dist
END SELECT

'Move the circle
CIRCLE (px, py), size, 0
CIRCLE (x, y), size
px = x: py = y

'Initialize and move the other objects

'Accept user input
key$ = INKEY$

LOOP UNTIL key$ = CHR$(27)

The erasing makes the circle flicker, so the game should only erase the circle if it is going to be moved. Also, the variable C is added so the user can change the color of the circle by pressing [Space]. This program works well, and is the end of step one.


'i-TECH Tutorial: Using Circles as Objects in Games
'(C) 2006 i-TECH and Kristopher Windsor

'Declare and initialize variables
c = 15
dist = 8
key$ = ""
size = 32
x = 320
y = 240

'Initialize the display
SCREEN 12: WIDTH 80, 60: CLS

'Loop until the program ends
DO

'Respond to user input
SELECT CASE key$
CASE CHR$(0) + CHR$(72): IF y > 0 THEN y = y - dist
CASE CHR$(0) + CHR$(75): IF x > 0 THEN x = x - dist
CASE CHR$(0) + CHR$(77): IF x < 639 THEN x = x + dist
CASE CHR$(0) + CHR$(80): IF y < 479 THEN y = y + dist
CASE " ": c = INT(RND * 7) + 9
END SELECT

'Move the circle
IF x <> px OR y <> py THEN CIRCLE (px, py), size, 0
CIRCLE (x, y), size, c
px = x: py = y

'Initialize and move the other objects

'Accept user input
key$ = INKEY$

LOOP UNTIL key$ = CHR$(27)


Step 2: Add other objects and make them interact with the circle


You might wonder how fast QBasic is re-reading the DO WHILE loop. This adds "1" to the variable framecount each time it loops, and then displays that variable:


'i-TECH Tutorial: Using Circles as Objects in Games
'(C) 2006 i-TECH and Kristopher Windsor

'Declare and initialize variables
c = 15
dist = 8
framecount = 0
key$ = ""
size = 32
x = 320
y = 240

'Initialize the display
SCREEN 12: WIDTH 80, 60: CLS

'Loop until the program ends
DO

'Respond to user input
SELECT CASE key$
CASE CHR$(0) + CHR$(72): IF y > 0 THEN y = y - dist
CASE CHR$(0) + CHR$(75): IF x > 0 THEN x = x - dist
CASE CHR$(0) + CHR$(77): IF x < 639 THEN x = x + dist
CASE CHR$(0) + CHR$(80): IF y < 479 THEN y = y + dist
CASE " ": c = INT(RND * 7) + 9
END SELECT

'Move the circle
IF x <> px OR y <> py THEN CIRCLE (px, py), size, 0
CIRCLE (x, y), size, c
px = x: py = y

'Initialize and move the other objects

'Accept user input
key$ = INKEY$

framecount = framecount + 1: LOCATE 3, 5: PRINT "Frames: "; framecount
LOOP UNTIL key$ = CHR$(27)

The program is easily running at over 1,000 frames per second, which is approximately fifty times faster than necessary. Next, the program will use some other objects. They will be smaller circles. These other objects will use the two-dimensional array of integers o([the number of objects in the game],[however many numbers are needed for each object]). Each object will use an x-coordinate, a y-coordinate, and a color. The objects do not need to be defined before the game starts, because they will be positioned as the game runs. Note the array and the ocount constant variable (oxy-moronically named).


'i-TECH Tutorial: Using Circles as Objects in Games
'(C) 2006 i-TECH and Kristopher Windsor

'Declare and initialize variables
c = 15
dist = 8
framecount = 0
key$ = ""
CONST ocount = 64
size = 32
x = 320
y = 240
DIM o(1 TO ocount, 3) 'The three is for coordinates and colors

'Initialize the display
SCREEN 12: WIDTH 80, 60: CLS

'Loop until the program ends
DO

'Respond to user input
SELECT CASE key$
CASE CHR$(0) + CHR$(72): IF y > 0 THEN y = y - dist
CASE CHR$(0) + CHR$(75): IF x > 0 THEN x = x - dist
CASE CHR$(0) + CHR$(77): IF x < 639 THEN x = x + dist
CASE CHR$(0) + CHR$(80): IF y < 479 THEN y = y + dist
CASE " ": c = INT(RND * 7) + 9
END SELECT

'Move the circle
IF x <> px OR y <> py THEN CIRCLE (px, py), size, 0
CIRCLE (x, y), size, c
px = x: py = y

'Initialize and move the other objects

'Accept user input
key$ = INKEY$

framecount = framecount + 1: LOCATE 3, 5: PRINT "Frames: "; framecount
LOOP UNTIL key$ = CHR$(27)

The objects will not exist on the screen the whole time, so the game needs to know whether the objects exist or not. So, if the color is black (that is color zero), the game will not think the object is there. Every time the game loops, it should attempt to make a new object exist if it does not already. This game will pick a random object each time it loops, and if that object is not being displayed, then the game gives random coordinates to that object and gives it a random color. This will display the object since its color is no longer black (except the object display is not yet written).


'i-TECH Tutorial: Using Circles as Objects in Games
'(C) 2006 i-TECH and Kristopher Windsor

'Declare and initialize variables
c = 15
dist = 8
framecount = 0
key$ = ""
CONST ocount = 64
size = 32
x = 320
y = 240
DIM o(1 TO ocount, 3) 'The three is for coordinates and colors

'Initialize the display
SCREEN 12: WIDTH 80, 60: CLS

'Loop until the program ends
DO

'Respond to user input
SELECT CASE key$
CASE CHR$(0) + CHR$(72): IF y > 0 THEN y = y - dist
CASE CHR$(0) + CHR$(75): IF x > 0 THEN x = x - dist
CASE CHR$(0) + CHR$(77): IF x < 639 THEN x = x + dist
CASE CHR$(0) + CHR$(80): IF y < 479 THEN y = y + dist
CASE " ": c = INT(RND * 7) + 9
END SELECT

'Move the circle
IF x <> px OR y <> py THEN CIRCLE (px, py), size, 0
CIRCLE (x, y), size, c
px = x: py = y

'Initialize and move the other objects
a = INT(RND * ocount) + 1 'Tries to initialize this object
IF o(a, 3) = 0 THEN o(a, 1) = INT(RND * 640): o(a, 2) = INT(RND * 480): o(a, 3) = INT(RND * 15) + 1

'Accept user input
key$ = INKEY$

framecount = framecount + 1: LOCATE 3, 5: PRINT "Frames: "; framecount
LOOP UNTIL key$ = CHR$(27)

The objects won't be moving, so displaying them is a bit easier, although the game needs the variable OSIZE to size these objects. This game has sixty-four objects, so the game now runs at about 100 frames per second. Speed will not be a problem for this game, but it is more limiting for these types of games than memory is.


'i-TECH Tutorial: Using Circles as Objects in Games
'(C) 2006 i-TECH and Kristopher Windsor

'Declare and initialize variables
c = 15
dist = 8
framecount = 0
key$ = ""
CONST ocount = 64
CONST osize = 12
size = 32
x = 320
y = 240
DIM o(1 TO ocount, 3) 'The three is for coordinates and colors

'Initialize the display
SCREEN 12: WIDTH 80, 60: CLS

'Loop until the program ends
DO

'Respond to user input
SELECT CASE key$
CASE CHR$(0) + CHR$(72): IF y > 0 THEN y = y - dist
CASE CHR$(0) + CHR$(75): IF x > 0 THEN x = x - dist
CASE CHR$(0) + CHR$(77): IF x < 639 THEN x = x + dist
CASE CHR$(0) + CHR$(80): IF y < 479 THEN y = y + dist
CASE " ": c = INT(RND * 7) + 9
END SELECT

'Move the circle
IF x <> px OR y <> py THEN CIRCLE (px, py), size, 0
CIRCLE (x, y), size, c
px = x: py = y

'Initialize and move the other objects
a = INT(RND * ocount) + 1 'Tries to initialize this object
IF o(a, 3) = 0 THEN o(a, 1) = INT(RND * 640): o(a, 2) = INT(RND * 480): o(a, 3) = INT(RND * 15) + 1

FOR a = 1 TO ocount 'Loops for each object to display
IF o(a, 3) > 0 THEN CIRCLE (o(a, 1), o(a, 2)), osize, o(a, 3)
NEXT a

'Accept user input
key$ = INKEY$

framecount = framecount + 1: LOCATE 3, 5: PRINT "Frames: "; framecount
LOOP UNTIL key$ = CHR$(27)

Now the game needs interaction. The game needs to know when the main circle touches one of the objects, and that is calculated through the pythagorean theorem. The distance between the main circle and object A is SQR((x - o(a, 1)) * (x - o(a, 1)) + (y - o(a, 2)) * (y - o(a, 2))). If that value is smaller than the size of the main circle plue the size of the object, then the two are overlapping. When the circle and object collide with each other, the main circle will change color, and the smaller circle (object) will disappear. To make an object disappear, it has to be erased from the display, and its color has to be set to zero. Once the object has disappeared, it is soon re-created.


'i-TECH Tutorial: Using Circles as Objects in Games
'(C) 2006 i-TECH and Kristopher Windsor

'Declare and initialize variables
c = 15
dist = 8
framecount = 0
key$ = ""
CONST ocount = 64
CONST osize = 12
size = 32
x = 320
y = 240
DIM o(1 TO ocount, 3) 'The three is for coordinates and colors

'Initialize the display
SCREEN 12: WIDTH 80, 60: CLS

'Loop until the program ends
DO

'Respond to user input
SELECT CASE key$
CASE CHR$(0) + CHR$(72): IF y > 0 THEN y = y - dist
CASE CHR$(0) + CHR$(75): IF x > 0 THEN x = x - dist
CASE CHR$(0) + CHR$(77): IF x < 639 THEN x = x + dist
CASE CHR$(0) + CHR$(80): IF y < 479 THEN y = y + dist
CASE " ": c = INT(RND * 7) + 9
END SELECT

'Move the circle
IF x <> px OR y <> py THEN CIRCLE (px, py), size, 0
CIRCLE (x, y), size, c
px = x: py = y

'Initialize and move the other objects
a = INT(RND * ocount) + 1 'Tries to initialize this object
IF o(a, 3) = 0 THEN o(a, 1) = INT(RND * 640): o(a, 2) = INT(RND * 480): o(a, 3) = INT(RND * 15) + 1

FOR a = 1 TO ocount 'Loops for each object to display
IF SQR((x - o(a, 1)) * (x - o(a, 1)) + (y - o(a, 2)) * (y - o(a, 2))) < size + osize AND o(a, 3) > 0 THEN
c = INT(RND * 7) + 9 'Changes circle color
CIRCLE (o(a, 1), o(a, 2)), osize, 0 'Erases the object
o(a, 3) = 0 'Sets the object color to black so it no longer exists
END IF

IF o(a, 3) > 0 THEN CIRCLE (o(a, 1), o(a, 2)), osize, o(a, 3)
NEXT a

'Accept user input
key$ = INKEY$

framecount = framecount + 1: LOCATE 3, 5: PRINT "Frames: "; framecount
LOOP UNTIL key$ = CHR$(27)

Instead of showing how many frames have been run in the program, the game will loop for 5,000 frames (CONST FRAMESTOTAL), and show the user how many frames are left. So the DO LOOP must be changed to stop when FRAMECOUNT equals FRAMESTOTAL. Now the program needs a scoring feature. The variable SCORE will increase by one every time the circle overlaps an object. The PRINT statement also must be changed to show the time (frames) left and the score.


'i-TECH Tutorial: Using Circles as Objects in Games
'(C) 2006 i-TECH and Kristopher Windsor

'Declare and initialize variables
c = 15
dist = 8
framecount = 0
CONST framestotal = 5000
key$ = ""
CONST ocount = 64
CONST osize = 12
score = 0
size = 32
x = 320
y = 240
DIM o(1 TO ocount, 3) 'The three is for coordinates and colors

'Initialize the display
SCREEN 12: WIDTH 80, 60: CLS

'Loop until the program ends
DO

'Respond to user input
SELECT CASE key$
CASE CHR$(0) + CHR$(72): IF y > 0 THEN y = y - dist
CASE CHR$(0) + CHR$(75): IF x > 0 THEN x = x - dist
CASE CHR$(0) + CHR$(77): IF x < 639 THEN x = x + dist
CASE CHR$(0) + CHR$(80): IF y < 479 THEN y = y + dist
CASE " ": c = INT(RND * 7) + 9
END SELECT

'Move the circle
IF x <> px OR y <> py THEN CIRCLE (px, py), size, 0
CIRCLE (x, y), size, c
px = x: py = y

'Initialize and move the other objects
a = INT(RND * ocount) + 1 'Tries to initialize this object
IF o(a, 3) = 0 THEN o(a, 1) = INT(RND * 640): o(a, 2) = INT(RND * 480): o(a, 3) = INT(RND * 15) + 1

FOR a = 1 TO ocount 'Loops for each object to display
IF SQR((x - o(a, 1)) * (x - o(a, 1)) + (y - o(a, 2)) * (y - o(a, 2))) < size + osize AND o(a, 3) > 0 THEN
c = INT(RND * 7) + 9 'Changes circle color
CIRCLE (o(a, 1), o(a, 2)), osize, 0 'Erases the object
o(a, 3) = 0 'Sets the object color to black so it no longer exists
score = score + 1
END IF

IF o(a, 3) > 0 THEN CIRCLE (o(a, 1), o(a, 2)), osize
NEXT a

'Accept user input
key$ = INKEY$

framecount = framecount + 1: LOCATE 3, 5: PRINT "Score: "; score; " | Time left: "; framestotal - framecount
LOOP UNTIL key$ = CHR$(27) OR framecount = framestotal

I got 275 points! {:-D) The program is now finished, but it has no name. Give it one! The program is currently fifty-eight lines long, but it can be shrunk by using colons to fit more on a single line. Now it is under thirty lines long (only twenty if the comments are removed)!


'i-TECH Tutorial: Using Circles as Objects in Games
'(C) 2006 i-TECH and Kristopher Windsor
'Declare and initialize variables
c = 15: dist = 8: framecount = 0: CONST framestotal = 5000: key$ = "": CONST ocount = 64: CONST osize = 12: score = 0: size = 32: x = 320: y = 240: DIM o(1 TO ocount, 3)
'Initialize the display
SCREEN 12: WIDTH 80, 60: CLS
'Loop until the program ends
DO
'Respond to user input
SELECT CASE key$
CASE CHR$(0) + CHR$(72): IF y > 0 THEN y = y - dist
CASE CHR$(0) + CHR$(75): IF x > 0 THEN x = x - dist
CASE CHR$(0) + CHR$(77): IF x < 639 THEN x = x + dist
CASE CHR$(0) + CHR$(80): IF y < 479 THEN y = y + dist
CASE " ": c = INT(RND * 7) + 9
END SELECT
'Move the circle
IF x <> px OR y <> py THEN CIRCLE (px, py), size, 0
CIRCLE (x, y), size, c: px = x: py = y
'Initialize and move the other objects
a = INT(RND * ocount) + 1: IF o(a, 3) = 0 THEN o(a, 1) = INT(RND * 640): o(a, 2) = INT(RND * 480): o(a, 3) = INT(RND * 15) + 1
FOR a = 1 TO ocount 'Loops for each object to display
IF SQR((x - o(a, 1)) * (x - o(a, 1)) + (y - o(a, 2)) * (y - o(a, 2))) < size + osize AND o(a, 3) > 0 THEN c = INT(RND * 7) + 9: CIRCLE (o(a, 1), o(a, 2)), osize, 0: o(a, 3) = 0: score = score + 1
IF o(a, 3) > 0 THEN CIRCLE (o(a, 1), o(a, 2)), osize
NEXT a
'Accept user input
key$ = INKEY$
framecount = framecount + 1: LOCATE 3, 5: PRINT "Score: "; score; " | Time left: "; framestotal - framecount
LOOP UNTIL key$ = CHR$(27) OR framecount = framestotal

The End! Support and Feedback at kristopherwindsor@yahoo.com. This tutorial was written by Kristopher Windsor in June 2006.



Download a copy of this tutorial: circles_as_objects.html


Computer Controller Design

Written by SJ Zero

Computer Controller Design

Controllers are sort of a black art among most engineers, believe it or not. Many controllers used are simple on-off affairs, or gain + bias controllers for continuous control. Computer Scientists can sometimes be even worse, coding strange hacks to regulate variables rather than trying to control them. Today, we'll be looking at some general control theory, five controllers, the theory behind them, and how to implement them in FreeBASIC. Finally, we'll look at a few minor tricks you can use to make controllers extremely useful for controlling things in your software.


General Control Theory

A controller takes a variable of what's going on, called a "Process Variable" or PV, and tries to change another variable, called the "Manipulated Variable" or M, to drive the Process Variable towards the desired value, called "Set Point", or SP. The manipulated value M goes to whatever is controlling the process, and that device is called the "Control Element".

To illustrate this, let's consider a controller which controls the amount of time a computer spends sleeping to correctly get the desired frame rate. The frame rate itself is the Process Variable in this case. The time the computer spends sleeping is the manipulated variable. The desired frame rate is the Set Point. The pause itself is the control element.

The difference between a controller and a regulator can basically be summed up in terms of software by the presence or absence of a set point as part of the fundamental design. In real-life process control, a control loop is a much more complicated and elabourate device than a regulator. For the above example of controlling frame rate, an effective method to regulate the frame rate is to simply set the frame wait to 1/3 of a second. If the PC is fast enough, the rate will regulate to its optimum value. If the PC is too slow, the regulation will not correct properly.

One often-overlooked concept in controllers is the concept of "Fail to safe". In terms of computers, this isn't relevant for safety reasons, because the controller and the control element will never fail independently of each other (In real life, lines can be cut or pneumatics can be blown out). Where this IS important is the fact that not every control element will act in the same direction! In the example above, increasing the frame period will decrease the frame rate. What if, instead, you were increasing the frequency of the frame wait? In that case, the increase in frequency would increase the frame rate. For this reason, we have "DIR" and "REV" outputs. The thing to remember is that DIR outputs will increase with an increase in error(More on this later), and REV outputs will decrease with an increase in error. In practice, you must ALWAYS ask yourself: "If my PV changes, which direction of change in M will bring PV back to SP?"


Controller 1: The knife-edge on-off

The knife-edge controller functions basically by comparing the process variable to set point, and setting M to 100% or 0%, depending on the DIR/REV setting, when PV drops below SP, and hammering M to the opposite value when the PV rises above SP. This results in a fairly tightly controlled PV, oscillating at the natural frequency of the process.

The knife-edge controller is the easiest to write in FB – basically, it's just an IF statement!

IF DIRREV = DIR then
       IF PV < SP then M = 100 else M = 0
ELSE
       IF PV < SP then M = 0 else M = 100
ENDIF

Note that the reason this is called "knife edge" is that there is a single sharply defined point where on becomes off. This effect can also be created by setting the proportional gain on a P+B controller (Covered later) to a massive value, thus sending M to max or min depending on the PV and SP.


Controller 2: The Hysteresis on-off

The Hysteresis, or "Band gap" on-off controller is virtually the same as above, with one important difference: Unlike the knife-edge controller, which will turn a process on and off right around a single point, the on and off values are different. This is used mostly in places where hammering a control element off and on so quickly will have a detrimental effect.

IF DIRREV = DIR then
       if M = 100 then IF PV < SP + X then M = 100 else M = 0
       if M = 0 then IF PV < SP - X then M = 100 else M = 0
ELSE
       if M = 100 then IF PV < SP + X then M = 0 else M  = 100
       if M = 0 then IF PV < SP - X then M = 0 else M = 100
ENDIF

Notice that this controller just changes the point around a bit depending on the direction M is in. Controllers like these are used in industrial operations when the simplicity of an on-off controller is ideal, but the high oscillation of a control element using a knife-edge controller will cause excess mechanical wear.


Controller 3: The P+B

The P+B controller is where things get interesting, because we're getting into continuous control. P+B means "Proportional + Bias". To understand what this means, you must first understand that error is either SP-PV or PV-SP, depending on the DIR/REV setting. Therefore, all the remainder of the controllers actually know is exactly how different PV is from SP.

Proportional control uses this information, E, by simply multiplying it by some factor Gp. The effect is any error in the process variable signal vs. set point will drive M to oppose the error proportionally. To understand this, consider you have your two hands pushing against each other. Now, when one starts pushing harder, the other starts pushing harder. When one lets up, the other lets up. In the end, nothing moves. This is exactly how this controller functions. It also has a bias function, however. The purpose of this is to eliminate the offset caused by the Proportional signal. There is an offset because the proportional signal REQUIRES error to act. Thus, if there is no error, the output won't change. If the output won't change, your PV drifts from SP. If your PV drifts from SP, you get an error, and the controller can correct that error!

M = B + Gp*E

if DIR then E = PV – SP else E = SP – PV
M = B + Gp*E

Controller 4: The P

We covered mathematical integrals in a previous article. This controller supposedly take the integral of error over time, multiplies the integral by a constant Gi, and adds that to the proportional gain covered in the previous controller. The result is that the controller 'seeks' zero error by integrating the error over time, and acting in the direction required to push error towards 0. This would be tough if we were actually planning on taking the integral mathematically, but you can sum the error using a much better method: just keep adding the error to a value, scaled with time!

One problem with this form of controller is they can "wind up" the integral and take a long time to "unwind" on some processes. This can happen if your SP is set very high or very low, and is then set very low or very high. There is no bias in this controller, because the Integral action actually functions as an 'auto-bias' mechanism.

M = Gp * E + GI * E

if DIR then E = PV – SP else E = SP – PV
IntegralE += E
M = B + Gp*E + Gi*IntegralE

Controller 5: The PID

The PID controller takes the previous PI controller, and adds one more element. A problem with many processes, such as temperature control loops, is that the strange time constants will make a PI control loop oscillate. This happens because a PI control loop can have no clue when the process starts approaching the appropriate value. The PID controller adds a derivative unit, which opposes the rate of change of the process variable, multiplied by a constant Gd. By limiting the rate of change, the PID controller can achieve what almost appears to be prescient control with some processes, such as temperature. An important thing to remember though, is processes with Gaussian noise(that is, noise that more or less stays around the measurement signal) will act WORSE with a pid controller.

M = GP * E + GI * integral(E) + GD * dE/dt

if DIR then E = PV – SP else E = SP – PV
IntegralE += E
DerivativeE = oldE - E
oldE = E
M = B + Gp * E + Gi * IntegralE + Gd * DerivativeE

Note that the so-called Derivative is nothing more than the difference between the old error and the new. Again, calculus concepts so difficult with equations are much simpler when you exist in the time domain.


Integrating a control loop into a software process

To integrate the controller into a loop, simply plug the sensed variable into PV, and the controlled variable into SP. You may need to scale both, but that's more or less self-explanitory.


Tuning your control loop

There are a large variety of ways to tune a control loop, including the Process Reaction Curve and Zeigler Nichols. Instead of trying to explain those complex techniques, I'll just tell you to do the easy thing: Increase proportional gain until the loop starts to oscillate, then pull back a bit. Then, increase integral gain until the loop starts to oscillate, then pull back a bit. Finally, do the same for derivative. It's not pretty, but it will provide a relatively good reaction, possibly better than quarter amplitude damping.


Download a copy of this tutorial: Computer_Controller_Design.txt


Generating Random Integers

Written by Edward F. Moneo

More and more of us are requiring random integers in our QB programs. Some of us can write the statement for generating a random integer by heart. However, I'm going to lay down the rules for those of you that don't know them by heart.


RANDOMIZE TIMER


Without the RANDOMIZE TIMER, the RND statement(s) of the program will always generate the exact same set of random numbers. This could be handy for debugging the program.


The following DIM statements are for proper definition of the variables:

DIM LOWER   AS INTEGER   'The FROM or LOWER value of the required random range.
DIM UPPER   AS INTEGER   'The TO or UPPER value of the required random range.
DIM RANDINT AS INTEGER   'The generated random integer within the range.

The following is the statement for generating a random integer:

RANDINT = INT ((UPPER - LOWER + 1)*RND + LOWER)

Depending on your QB manual, you may also see the following statement:

RANDINT = INT(RND * (UPPER - LOWER + 1)) + LOWER

Either statement works equally well.


CONSIDERATIONS:

1) Abbreviated statements.

Some programmers will often abbreviate the RND statement as follows.

Example #1: Get random integers from 1 to 10.

RANDINT = INT(RND * (10 - 1 + 1)) + 1

They often abbreviate this to:

RANDINT = INT(RND * 10) + 1

Example #2: Get random integers from 0 to 9.

RANDINT = INT(RND * (9 - 0 + 1)) + 0

They often abbreviate this to:

RANDINT = INT(RND * 10)

These shortcuts can lead to problems, especially when you need to modify the upper or lower values of the range. The best approach is to place the complete RND statement, with the LOWER and UPPER parameters, into a subroutine, SUB or FUNCTION, and always pass both the lower and upper values of the range.


2) Unique random integers.

Random integers can and will repeat like the throws of the dice.

Some applications need the random integers to always be unique.

Here's a sample bit of code to eliminate duplicate random integers.

RANDOMIZE TIMER
DIM LOWER   AS INTEGER
DIM UPPER   AS INTEGER
DIM RANDINT AS INTEGER

LOWER =  1
UPPER = 52

DIM DUP (LOWER TO UPPER)   'Setup an array covering all the possibilities.

FOR X = LOWER TO UPPER
    DO
      RANDINT = INT(RND * (UPPER - LOWER + 1)) + LOWER
    WHILE DUP(RANDINT) = 1
    DUP(RANDINT) = 1
    PRINT RANDINT
NEXT X

The above FOR loop will generate 52 unique random integers.

Within the above DO loop, we get a random integer. We check the DUP array to see if that value is flagged with a 1, indicating that we had it before.

If we had it before, it's a duplicate, so ignore it and get another random integer. If it's unique, continue and flag it in the DUP array to indicate that we just had it, and now process it (in this example, print it).


Hope this all works for you, or at least gives you some ideas.

Regards,
Moneo


Download a copy of this tutorial: random_integers.txt


Ecliptorial: Volume I
Floor Mapping Tutorial

Written by Eclipzer (Quinton Roberts)

The following tutorial has been reconstructed, by the author, from the original. Though some content has been modified for clarity, the original format has been retained for authenticity.

Item #???
SubjectFloor Mapping
AuthorQuinton Roberts
Completed06/23/00
Updated07/08/06

Copyright (c) Quinton Roberts 2000-2006.

Introduction

One effect that was used quite a bit on the Super Nintendo was an effect called floor mapping. This essentially took an image and tilted it into the distance to simulate depth. A prime example of floor mapping can be seen in Nintendo's classic game Super Mario Kart.


Floor Mapping with an Infinite Tile

Before we cover the more advanced methods of floor mapping we need to cover the basics. The easiest way to understand floor mapping is to use a single tile and map it indefinitely across our floor. First we must create a tile to map. In our case we will use a 128x128 image.

floor map tile

This tile is then projected onto the floor indefinitely.

floor map tile projected indefinitely

Projection Model

Our first step is to construct a diagram that models our desired projection. The floor will be a plane which extends outward indefinitely. Perpendicular to the floor will be the screen. The eye will be located a distance 'd' behind the screen and a height 'h' above the floor. Conceptually, the eye generates a ray which passes through the screen and intersects with the floor. The point at which the ray intersects the screen (x,y) is where we will color the pixel. The point at which the ray intersects the floor (u,v) gives us the color of the pixel we will draw to the screen. The following is a diagram to represent this:

conceptual diagram for floor mapping

Now, the idea is that given the distance of the eye from the screen and its height from the floor, we should be able to find any floor coordinate (u,v) given any screen coordinate (x,y). By seperating the above diagram into individual parts, we should be able to derive the relationship between floor coordinates (u,v) and screen coordinates (x,y).


Solving for 'v'

Removing triangle DEP from the original diagram we get the following diagram:

diagram solving for floor coordinate 'v'

It should be immediately obvious that we have similar triangles here, the most important of which has been formed with the dotted line. Since similar triangles are proportional to each other, we can set up a ratio and solve for 'v', the vertical component of the floor coordinate we wish to find.

1. Construct a ratio:

     v/h = d/(h-y)

2. Solve for 'v'

       v = h*d/(h-y)

Solving for 'u'

Removing triangle MDP from the original diagram brings us to the following diagram:

diagram solving for floor coordinate 'u'

Again it should be immediately obvious that we have similar triangles. We'll once again set up a ratio and solve for 'u', the horizontal component of the floor coordinate we wish to find.

3. Construct a ratio

     u/v = x/d

4. Solve for 'u'

       u = v*x/d

Though we now have the (u,v) coordinates, the 'u' coordinate is dependent on the 'v' coordinate as seen in step 3. To retain as much accuracy as possible it's best to have the coordinates dependent only on what's given (x,y,d,h). Therefore we will simply substitute equation 2. for 'v' and simplify.

5. Substitute for 'v' using equation 2.

     v = d*h/(h-y)        'equation 2.
     u = v*x/d            'equation 4.
     u = [d*h/(h-y)]*x/d  'substitute for 'v'

6. Simplify

     u = x*d*h / d(h-y)   'multiply (top by x, bottom by d)
     u = x*h/(h-y)        'd's cancel

7. Final Equations

     u = x*h/(h-y)
     v = d*h/(h-y)

So we now have the equations necessary to transform any screen coordinate (x,y) into its respective floor coordinate (u,v). There are, however, some important things to note about our newly found projection transform equations. The first is that both the 'u' and 'v' coordinates are scaled by the same value, h/(h-y). This little fact can be used to increase the speed of calculations. The second is that the denominator of both equations, (h-y), tells us that the height of the eye must never equal the height of any pixel on the screen, as this would produce a zero in the denominator (dividsion by zero is bad). Therefore, it is very important to remember that the eye must always be either above or below the screen.

--Eclipzer


Download a copy of this tutorial: floormap.zip / floormap.html


An Improved Delay Routine

Written by Roger Greenlaw

Hello, Pete,

I tested the tutorial programs for QuickBasic that are located on your website for tutorials, and have made a change to one of the example programs. [EDITOR'S NOTE: Referring to Andre Van Wyk's Basic Course In Game Design, originally published in 1996.]

I discovered that the programmer who wrote the tutorial used a very simple loop to control program timing. Modern programs are compiled (QB45 or FreeBasic) and most compilers provide some optimization.

Roger Greenlaw


An example of this process looks like this:

Timed loop #1:

FOR counter = 1 TO 10000

NEXT counter

This process works well on interpreted programs but the following problems can be observed

1,. Shortening the code by combining the two lines

FOR counter = 1 TO 10000: NEXT counter

will cause the loop to run in a much shorter time. This time the loop will be completed faster, and therefore the end of the range (10000) would need to be much higher to achieve the same time delay.

If each of these loops are compiled using QB45 or FreeBasic the loops will each execute in the same amount of time. The programmer would need to test the loop and adjust the ending value repeatedly until the desired delay is achieved. Once compiled, the loop will execute at different speeds on different machines. The faster the processor, the quicker the loop will execute. To make a delay loop that is more effective I wrote a subroutine that can be included in any QuickBASIC or FreeBASIC program which provides more reliable timing delays.

DECLARE SUB SNOOZE(delay)

 

SUB SNOOZE(delay)

 

  StartTime = TIMER

  WHILE StartTime + delay < TIMER

  WEND

 

END SUB

This loop will sleep for a specific amount of time with the following statement

REM Sleep for ¼ second

Delay = .25

CALL SNOOZE(delay)

To allow for keyboard interruption of the delay loop the following can be used

DECLARE SUB SNOOZE(delay, keypress$)

 

SUB SNOOZE(delay, keypress$)

 

  StartTime = TIMER

  WHILE StartTime + delay < TIMER

  Keypress$ = INKEY$

  IF keypress$ <> “” THEN END SUB

  WEND

 

END SUB

This routine will function the same as the first example with the following differences:

Delay = .1

Keypress$ = “”

CALL SNOOZE(delay, keypress$)

When the loop completes, and program control returns to the main program from the subroutine keypress$ will contain the key that was pressed to exit the loop, or will be empty if no key was pressed before the delay time expired.

This technique can make it easier to program delays in programs.

If anyone would like to contact me about these routines please email rgreenlaw@adelphia.net

Roger Greenlaw


Download a copy of this tutorial: delay.txt


An Introduction To Network Programming Using Winsock

Written by Stéphane Richard (MystikShadows)

INTRODUCTION:

Welcome to this introductory tutorial on network programming using winsock. The subject has been talked about and asked for both on the Official QB Express Article request thread and in a few emails I've received and although there is an example it seems that some of the things could be explained in a bit more details. As such I've decided to create this tutorial that will guide you through using winsock in order to connect to a specific website URL and retrieve information from the server. Since all you can do with winsock is far beyond the scope of an introductory tutorial, I will be providing you with links to all the information you'll need so that you'll be equipped to take on just about any network/internet related tasks.

When it comes to this tutorial, the example program supplied should also work in linux (with perhaps some minimal changes) since linux sockets work pretty much the same way as Windows sockets. Since I don't have linux installed at the moment I can't give you these changes directly or know the discrepencies of Windows and Linux when it comes to sockets programming. If someone has played with sockets programming in linux with freebasic and knows these discrepencies (if any) please let me know via email and i'll be glad to add these to this tutorial. And now, let's get right into the core of winsock programming.

FREEBASIC WINSOCK PROGRAMMING BASICS:

In most cases, when programming with winsock, there is a very simple order of things to follow. Since winsock typically talks to a server, no matter what type of interchange you'll be making with that server, you will be basically following the following order:

It doesn't matter the job to be done via winsock, there's no command that automatically opens or closes things for you so it will be a simple question of remember to open, perform the request or task and close. Just be warned that if you don't close your connections after a while of opening new connections, you (or you with other people) could overflow the server and hence freeze on your side and slow down the server dramatically for other users so just pay a little attention and show a little consideration when doing internet related network programming.

MAKING SENSE OF THE PROTOCOLS AND COMMANDS:

The commands in question, as I mentionned, differ depending on the protocol used. Each type of connection allows different sets of commands and as such, I will enumerate here the four most used protocols with links to list of commands so you get an idea of what can be done under these different protocols. The protocols are:

Of course, there are other protocols, but in all honesty, the other protocols are either used less and less or practically dissapeared from the map. When you think about it, there's not much more you'd be doing on the internet (except chatting or group gaming which is done with TCP/IP anyways) aside viewing websites, sending and receiving emails and uploading or downloading files.

FreeBASIC comes with a special library for winsock and sockets programming. In the next section we'll talk about it however, we'll limit ourselves to just what we need for this tutorial or the next section would be way passed the scope of this tutorial. So then, let's get right to it.

THE DREADED WINSOCK.BI INCLUDE FILE:

I'm not sure if any of you have looked at the "winsock.bi" file but you might notice that it's 17kb in size, has a lot of defines, user defined types, constants and sub and function declaration. There is also the winsock2.bi file which stands at a whopping 48kb, has alot more defines, constants, user defined types and subs and functions declarations. In otherwords, it has alot more definitions and declarations that we need for a first program. winsock.bi and winsock2.bi are located in your freebasic installation folder under the inc\win\ folder. If you want, you can take a look at them to get their full scope of definitions. However, for the purpose of this tutorial and your convenience, I've extracted the definitions and declarations that that we will be needing only.

Since these are extractions, I have not documented them per se, the most important thing to know here is that all these definitions are in winsock.bi and winsock2.bi. if you want a good complete reference on winsock programming, take a look at the Sockets.com which features everything you ever wanted to know about the subject and complete references to standards, protocols, function and sub references for winsock and reference lists and references for all RFC standards. sockets.com is by far the best website to use for anything winsock related, take a look and see for yourself how complete it is.

The Constant Definitions and Define Statements:

As you can see below, we don't need alot of constants here. we only have four defined here (note that winsock.bi has alot more because of the different types of internet protocols and connections that can be made) and for this tutorial it's really all we'll need. We defined a macro called MAKEWORD that essentially assures that the value return is of a valid USHORT type (0 to 65535 in range).

OPTION EXPLICIT ' -------------------- ' Library Inclusions ' -------------------- '#Include "winsock.bi" <- Commented out for tutorial purposes, ' should be used instead in projects #INCLIB "wsock32" ' ------------------------------------------------------------------ ' Constants and defines extracted from winsock.bi for this example ' ------------------------------------------------------------------ CONST AF_Inet = 2 CONST Sock_Stream = 1 CONST IPProto_TCP = 6 CONST NewLine = CHR$(13)+CHR$(10) #DEFINE MAKEWORD(a,b) ((a) shl 8 or ((b) and &h000000FF)) #DEFINE WSADESCRIPTION_LEN 256 #DEFINE WSASYS_STATUS_LEN 128

The User Defined Types:

The user defined types shown here (seven of them) are shown here because they are used either in other structures (some structures have fields that are of other structure types) or as final structures to be used by the winsock related functions. Some of the names here are quite ambiguous and in my opinion could have been given much better and clearer names than those used here.

' --------------------------------------------------------------- ' User Defined Types extracted from winsock.bi for this example ' --------------------------------------------------------------- TYPE WSAData wVersion AS SHORT wHighVersion AS SHORT szDescription AS STRING * WSADESCRIPTION_LEN+1-1 szSystemStatus AS STRING * WSASYS_STATUS_LEN+1-1 wMaxSockets AS USHORT wMaxUDPDG AS USHORT dwVendorInfo AS BYTE PTR END TYPE TYPE HostEnt H_Name AS BYTE PTR H_Aliases AS BYTE PTR PTR H_AddrType AS SHORT H_Length AS SHORT H_Addr_List AS UINTEGER PTR PTR END TYPE TYPE S_Un_B_ S_B1 AS UBYTE S_B2 AS UBYTE S_B3 AS UBYTE S_B4 AS UBYTE END TYPE TYPE S_Un_W_ S_W1 AS USHORT S_W2 AS USHORT END TYPE UNION In_Addr S_Un_B AS S_Un_B_ S_Un_W AS S_Un_W_ S_Addr AS UINTEGER END UNION Type SockAddr_In Sin_Family AS SHORT Sin_Port AS USHORT Sin_Addr As In_Addr Sin_Zero(0 TO 7) AS BYTE End Type Type SockAddr SA_Family AS SHORT SA_Zero(0 TO 13) AS BYTE END TYPE

The A.P.I. Function Declarations:

Again, winsock.bi and winsock2.bi have a whole lot more API function declarations than those shown here. However, for the sake of this tutorial, once again, I merely included the functions that we will need. the WS prefix you can see in most of these functions are to indentify that the functions are WinSock related.

' ---------------------------------------------------------------------- ' API Function Declarations extracted from winsock.bi for this example ' ---------------------------------------------------------------------- DECLARE FUNCTION WSAStartup _ LIB "WSock32" _ ALIAS "WSAStartup" (BYVAL wVersionRequired AS SHORT, _ BYVAL lpWSAData AS WSAData PTR) AS LONG DECLARE FUNCTION WSAGetLastError _ LIB "WSock32" _ ALIAS "WSAGetLastError" () AS LONG DECLARE FUNCTION WSACleanup _ LIB "WSock32" _ ALIAS "WSACleanup" () AS LONG DECLARE FUNCTION Socket _ LIB "WSock32" _ ALIAS "socket" (BYVAL AF AS LONG, _ BYVAL S_Type AS LONG, _ BYVAL Protocol AS LONG) AS LONG DECLARE FUNCTION CloseSocket _ LIB "WSock32" _ ALIAS "closesocket" (BYVAL S AS LONG) AS LONG DECLARE FUNCTION Connect _ LIB "WSock32" _ ALIAS "connect" (BYVAL AS LONG, _ BYVAL AS SockAddr PTR, _ BYVAL AS LONG) AS LONG DECLARE FUNCTION HTons _ LIB "WSock32" _ ALIAS "htons" (BYVAL HostShort AS USHORT) AS USHORT DECLARE FUNCTION GetHostByName _ LIB "WSock32" _ ALIAS "gethostbyname" (BYVAL szHost AS STRING) AS HostEnt PTR DECLARE FUNCTION Send _ LIB "WSock32" _ ALIAS "send" (BYVAL SocketID AS LONG, _ BYVAL BufferPtr AS LONG, _ BYVAL BufLen AS LONG, _ BYVAL Flags AS LONG) AS LONG DECLARE FUNCTION Recv _ LIB "WSock32" _ ALIAS "recv" (BYVAL SocketID AS LONG, _ BYVAL BufferPtr AS LONG, _ BYVAL BufLen AS LONG, _ BYVAL Flags AS LONG) AS LONG

Now, take a look at the following 2 functions. You'll notice they are quite empty (1 line each) and well I thought I'd explain why I didn't just use the WS related functions themselves. Usually, a winsock "session" needs to have an initialization/creation section prior to the work to be done, and a closing section after, one never knows what might be needed when creating or closing an internet connection. Therefore, I've created these two functions as a skeleton app. In your projects, you might need to create variables, assign some values, to different things before you execute your task and keeping this initialization material in one function is a great way to keep the code organized and clear. Same goes for closing or terminating a winsock session. So think of these two functions as a template to follow. But again, my style is my style and you're more than welcome to use it, or not, depends on what you need initialized and prepared before you perform your work as well as what needs to be closed and released from resources when the work is done.

'==================================================== ' StartSockets gets a WSAData structure ready to be ' used in the rest of the program. '==================================================== FUNCTION StartSockets() AS LONG DIM WSAInfo AS WSAData WSAStartup(MakeWord(1,1), @WSAInfo) END FUNCTION ' ==================================================== ' EndSockets clears resources used by StartSockets ' ==================================================== FUNCTION EndSockets() As Long WSACleanup() END FUNCTION

Next on the list, take a look at the ConnectToURL function below. This is where "the work" actually happens. I have commented the code here so you see what each part does but the basic idea is to perform the following (once the socket is opened):

   1. Retrieve the URL's host
   2. Create the URL's socket
   3. Connect to the URL
   4. Prepare HTTP GET request and send it to throught the socket
   5. Retrieve the contents
   6. Display the retrieved contents on the screen

' ==================================================== ' NAME: ConnectToURL() ' PARAMETERS: BYVAL URL AS STRING ' RETURN VALUE: A LONG typed value ' ASSUMES: URL to be a valid website URL ' ---------------------------------------------------- ' DESCRIPTION: This function performs the actual ' work of this demonstration. it will ' connect to the URL passed as its ' parameter and retrieve and display ' some information about the URL. ' ==================================================== FUNCTION ConnectToURL(BYVAL URL AS STRING) AS LONG ' ---------------- ' Work Variables ' ---------------- DIM URLHost AS HostEnt PTR DIM URLSocket AS SockAddr_In DIM URLSocketID AS UINTEGER DIM Connection AS LONG DIM Message AS STRING DIM Buffer AS STRING DIM BufferReceive AS ZSTRING *1001 DIM BytesReceived AS LONG ' --------------------- ' Retreive URL's host ' --------------------- URLHost = GetHostByName(URL) ' --------------------- ' Create URL's Socket ' --------------------- WITH URLSocket .Sin_Family = AF_Inet .Sin_Port = HTons(80) .Sin_Addr.S_Addr = **URLHost->H_Addr_List END WITH ' ------------------- ' Create The Socket ' ------------------- URLSocketID = Socket(AF_Inet, Sock_Stream, IPProto_TCP) ' -------------------- ' Connect To The URL ' -------------------- Connection = Connect(URLSocketID, @URLSocket, LEN(URLSocket)) ConnectURL = URLSocketID ' ------------------------------------------------------------- ' Prepare HTTP GET request and send it to throught the socket ' ------------------------------------------------------------- Message = "GET / HTTP/1.0" + NewLine _ + "Host: " + URL + NewLine _ + "User-Agent: MystikShadows/1.0" + NewLine + NewLine Send(URLSocketID, STRPTR(Message), LEN(Message), 0) ' --------------- ' Retrieve File ' --------------- BytesReceived = Recv(URLSocketID, STRPTR(BufferReceive), 1000, 0) WHILE BytesReceived > 0 Buffer = Buffer + LEFT$(BufferReceive, BytesReceived) BytesReceived = Recv(URLSocketID, STRPTR(BufferReceive), 1000, 0) WEND ' -------------------------------------------- ' Display received file and info to the user ' -------------------------------------------- PRINT Buffer END FUNCTION

With all of these created, it makes the main part of the program quite short. All it does now is declare a variable called Connection of type LONG, calls the StartSockets() function (with whatever initialization code you may need), calls the ConnectToURL() function which performs the actual task and finally calls the EndSockets() function to close what's been opened (and release resources as needed by your projects).

'========================== ' MAIN PART OF THE PROGRAM '========================== DIM Connection AS LONG StartSockets() Connection = ConnectToURL("www.ascii-world.com") EndSockets() SLEEP

And that just about covers it really. This program will perform the intended work which is to connect to http://www.ascii-world.com and display information and contents about the URL. Note that you can change the call to ConnectToURL to supply other URL addresses to see what they will show you. Don't worry, you don't have to type (or cut and paste) all that in, here's a link to the sockets.bas so you can just download the file and compile it for yourself. Here is what the program produced with the ascii-world URL.


AND TO CONCLUDE THIS TUTORIAL:

There you have it, we are at the end of this winsock programming tutorial in FreeBASIC. I think that as an introduction, it covered alot of grounds and gave you a good start on your own winsock projects. As far as winsock itself is concerned, the functions needed are all present in winsock.bi and winsock2.bi. Don't forget to consult the links I provide in this tutorial to learn everything that you can do with winsock and how to do them as well. The references to the protocols will tell you which you should use on a given wonsick project and also have valid protocol commands for you so you can learn HTTP, FTP, SMTP programming in all it's details. Winsock programming is by no means a simple subject. When looking at the example shown here we can see that it still takes quite a few steps to perform a very basic winsock related task. However, there's no denying the necessity of winsock programming whetehr you are creating an online game, or an application that can really benefit from a connection to some online resource. So I believe this should be enough to get you curious to see just what else can be done with winsock.

Remember, as always, that i'm always opened to comments, suggestions, ideas, constructive criticism and questions from you, just email me with anything you want to share with me about winsock programming. I'll be happy to answer questions, and bring suggestions and help to your winsock projects as well. If you'd like me to write on other winsock related subjects just let me know either by emailing me (see the email address below) or on the Official QB Express Article request thread and I'll see what I can do. Until next time, happy reading, and coding.

MystikShadows
Stéphane Richard
mystikshadows@gmail.com


Download a copy of this tutorial: FBWinsockIntro.zip, or view it on its own: winsockprogramming.html


We are the Normal and the Bounce Equation

Written by Relsoft

Hello, it's been a while since I last wrote something for Pete.  The last time I wrote for QBE was an intro into OpenGL.  For those who are expecting another 3d tute, sorry, this is 2d. But be sure to understand the concepts here for the algos and equations presented here could he used in a 3d engine.

"How do I bounce?". I've always seen this question being asked on all the forums I have been to. Since I've always have something to say on the topic, I decided to make this tute. This tute has a long time coming. I envisioned it before I went AWOL from the community after my good friend, DR_D, showed me an awesome 2d demo of a ball colliding and "sticking" to lines that it collided to (see appendix). I thought this demo could be extended to make a pinball like engine. So I "searched" the net for the bounce-to-an-arbiraty-line-algorithm but lo and behold, I never thought there isn't a single tutorial covering it, at least in 2d, but most likely, I suck at using google. :*)

So I sat on a table one day and with a pen and a paper drew some vectors and the vectors I want to get. After about 15 minutes(maybe less, but I draw slow) of work, I figured the damn thing out. I was sure of the equations I came to but when I translated it to code, something went wrong. There are some issues/errors with the direction and after 2 days of trying to figure it out, I gave up and posted my problems here: vector secret.... It took like 3 seconds for DJ Peters to figure out what was wrong. I was using integers instead of singles! The equations were fine, the code was fine, but the coder(me) wasn't. Then for a double whammy, after I made the equations and the code, figured out the vector math, etc., Blitz and Shadowolf, or was it ShiftLynx?, pointed me to the standard equation o get the reflection vector (see appendix). It felt good knowing that I did the vector math myself without resorting to any ready made equation though. Enough rant. Let's start.

Before actually being able to bounce, we need to have:

  1. A point to line collision system


  2. A way to calculate a 2d normal of a line segment


  3. A firm knowledge of vector arithmetic (not really needed that much) Namely the dot product and vector addition

I. The Normal

Number 3 is easy, all you have to do is read this: <vector tutorial>. With all the vector brouhaha out of the way, we could now code our 2d normal algo. A normal to a line is a vector perpendicular to the given line. It means that the normal has a union of 90 degrees to the said line. Ie. Their intersection has a 90 degree angle in it. read the vector tute if you're still getting blanks. :*) Now for every line, their are always 2 normals and what you use depends on where you want to bounce.

Here's the figure:


The black line is our line segment and the blue line or the red line are 2 normals to the line. Here's the code to calculate the normal:

private sub get_2dnormal (seg as segment_type, s as integer)

    if s then
        seg.normal.x = -(seg.y2-seg.y1) 'negate to get the other normal
        seg.normal.y = (seg.x2-seg.x1)  'erase negation here if you want the other
                                        'normal
    else
        seg.normal.x = (seg.y2-seg.y1)  'negate to get the other normal
        seg.normal.y = -(seg.x2-seg.x1) 'erase negation here if you want the other
                                        'normal
    end if
    normalize (seg.normal)
end sub

"s" as a parameter is a "switch" to give you the option of what normal to use. "seg" is the line segment.



II. Closest point on line

To be able to collide a ball to a line segment, we need to have a closest point to a line function and check whether the ball's radius intersects the line. To get the closest point...


Say we have a point P and a line segment defined by AB.  We need to find a way to find out the distance of P from the line defined by AB.  AS some of you have already known (from Geometry) that the closest point on a line is located on a line perpendicular to it.  Now the problem is we know where P is, we know where A and B are be we don't know the perpendicular vector/line that intersects AB which also intersects P.  The answer? The dot product.  The dot product returns the Cosine of the angle between 2 vectors but it also gives us the "projection" or the "length of projection" of one vector onto another. Now to get the dot product we need to define a vector from A to P and from A to B.  To define a vector from A to P you only have to subtract A from P.

ie.


v1.x = P.x - A.x
v1.y = P.y - A.y

Doing the same with A and B...

v2.x = B.x - A.x
v2.y = B.y - A.y

Now we need to get the projection by using the dot product...


We normalize v2 because we need to project v1 onto it using the dot product.  Projecting v1 onto v2 gives us the component if v1 that is parallel to v2. Check the vector tute for reference. The dot product essentially "drops" a perpendicular from P to a point in AB. What you get as a result is the length of projection.

Just dropping a perpendicular does not necessarily results in P being in the in between the line AB.  There are 3 cases.



Case 1


This is the first case where the angle is greater than 90 but less than 270 where out dot is negative. How can I be sure that its sign is negative?

Proof:

Let: R = Radius(length of A to P)

cos(angle) = dot(v2,v1)/|v1||v2|

cos(angle) = A/H or X/R

sign of X is negative when 90<angle<270 since point P would be in Quadrants II or III.

cos(angle) = -/+ = (-) :*)

For this case we return A since P does not have a projection within the line. How do we check for this case? Easy check if the dot is less than 0. :*)

Proof(clue):

cos(90) = 0; figure it out yet. :*)

If dot<=0 Then Return a



Case 2


In this case the projection of P is still outside the boundaries of A and B but it's also located on the right of B so we return B. How do we check?  We check if the length of projection  is greater than the distance from A to B. :*)

If dot>=distance(a,b) Then Return b

The distance formula is just the magnitude of the vector from A to B (v2)

private function get_magnitude ( v as vector2d ) as single

    return sqr( ( v.x * v.x ) + ( v.y * v.y ) )

end function

Now for the generic case...



Case 3


In this case the projection is within the lines boundary so we return an arbitrary vector that is also the same vector as v2 but scaled according to the projection length. :*)

vreturn.x = a.x + (v2.x * t)
vreturn.y = a.y + (v2.y * t)
return vreturn

The whole function is in the sources called

function closest_point_on_line(a as vector2d, b as vector2d, p as vector2d) as vector2d

:

:
end function


III. The bounce equation


Given a ball with a direction vector a colliding on a plane with a normal b, how do we get vector c? (the bounce vector is c) Answer: basic vector arithmetic.  All the vectors I'll be discussing here are called "free" vectors. Free vectors are vectors that could be placed anywhere you want. :*)


The above picture is the same as the first one but with another vector d. vector d is the negative of vector a. Hence it points in the direction opposite vector a. Magnitude of d is also equal to a.

Important!!! In the following figure, our d vector above becomes the b vector below and not the normal b.


Since we substituted the letter b instead of d, b is the negative of a in this case.

Now I subtract a from b [b + (-a)] to get a vector pointing opposite a but twice the length since mag(a) = mag(b). We'll call it impact vector . I drop a perpendicular from impact to the normal to get the length of the projection which is:

leng = (impact dot normal) / Magnitude(normal)

We multiply this length to our original normal to get the new vector we'll call it impulse.


Now that we have the impulse vector, all we need to do is to add it to our original vector a to get c.

See it's sooo easy!




Here's the demo of this tutorial. :*)




Special thanks to:


Dr. D

DJ Peters

Blitz

Shadowwolf or Shiftlynx




Richard Eric M. Lope BSN RN

Relsoft 2006

http://rel.betterwebber.com


Appendix

a. Dr. D's Line Collision Demo




b. The general equation for the reflection vector is:

-2*(V dot N)*N + V

Here's a demo showing gravity and simplified bouncing using the general reflection vector equation. By Dr. D and Relsoft.




c. As an exercise, why not make multiple balls bouncing on the screen?

Bouncing from ball to ball is almost the same as our equation. Here's a demo of it in QB that I wrote: Ball to ball collision and response. It is based on this tutorial by Hugo Elias.

Hah! I ported the ball to ball demo to FB.




d. Bouncing demonstration inside a rotating polygon

Demo of 2D bouncing inside rotating polygon, written by Relsoft. Use the mouse to point inside the rotating poly.



Download a copy of this tutorial (and all demo programs): bounce.zip


Final Word

Sure, it came out late again, but I think QB Express #21 turned out to be a pretty fantastic issue! I hope you enjoyed it. I know I sure did.

The deadline for the next issue is: August 15th, 2006

Please get all of your submissions in by then. I'm hoping that QB Express will be back on track and out of this slump we've had as of late...we'll see what my schedule is like a month from now. I'll continue working for Actual Reality Pictures and living in Los Angeles for the first three weeks of August. I will be driving back across the country starting August 18th, and my senior year at Ithaca College begins on August 30th, so it's going to be a busy month. But I am determined to get QB Express #22 published before August is over -- and preferably BEFORE the 18th!

As always, you can send them to: pberg1@gmail.com.

But more importantly, make sure that you nominate your choices for the Qlympics 2006! It is up to YOU, the members of the QB/FB community, to decide which programs and people will get recognized for being the best of the best, and every vote matters!

Until next time...END.

-Pete


Copyright © Pete Berg and contributors, 2006. All rights reserverd.
This design is based loosely on St.ndard Bea.er by Altherac.

QB Top 50 - The best QBasic and QuickBasic Sites