Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: Space Shooter in QBasic (github.com/strathausen)
79 points by Jean-Philipe on Feb 1, 2016 | hide | past | favorite | 26 comments

Looking at the demo without running it yet, that looks amazing. It reminds me a lot of the QBasic game Outer Space Wars that I wrote when I was 14, having taught myself QBasic from reading a book checked out from the local library. I too made a font editor using some crazy string manipulation to make up for not yet understanding the modulus operator at the time. I so need to try to find those disks and take a look back at some of the first code I ever wrote as a fledgling self-taught teenage programmer.

OP, thank you for bringing back the memories.

To younger programmers, Internet access was not quite a thing that I had access to then. Before my dad got AOL, I was only allowed to log into the county library BBS and not any public system. One actually used a modem to dial directly in at that time and no one else could use it simultaneously. Once my family had AOL, I later was able to participate in a programmer chat room on AOL, which was the entry into a whole new world.

To further enlighten our younger programmers, I only had BBS access for the first time on a summer job internship just before going to the university. No way my parents would pay for a modem on those days nor for the regional phone rates.

That BBS was the only one in a probably 80 KM radius and with a maximum of 4 connections.

So yeah, learning to code meant demoscene parties, magazine listenings, get programming books as gift or being able to find something at the local library (usually from the 70's and early 80's).

As for development software, we would either type the compiler/interpreter ourselves from those magazines and books, or use one of those bundled tapes/disks if lucky to find them.

Also during those days, the local street markets where a common source of software.

In my case, before the Internet there was "the programming & shareware magazines". They usually included a CD with lots of freeware, shareware and some open source too (that's how I got DJGPP or POV, for example).

And you needed friends, because it was impossible to buy all the interesting magazines every month, so CD-ROM trading was a thing back then.

Oh man, QBasic was the first programming language I ever encountered and started playing around--what great times!

At the time (I was probably 11 or so) I knew that it was important to learn to write serious stuff, and knew that an operating system was probably "serious stuff," and so I thought it might be a good learning experiment to write an operating system in QBasic. Needless to say I was missing a few links in how "serious stuff" was written back then, but it sure was a fun intro!

Same here. Even had an 8-note keyboard-driven music player built in, iirc. Although it lead to a life-long interest, I never really wrote anything 'serious' from scratch since then. Scripts and editing others' code was about my limit.

And this is despite trying at 12-13 to 'go pro' with Visual C++ ordered through a student discount and the C++ For Dummies book (I had no idea where to start) that never took off the ground. A wish there was a local group or mentor I knew about back then!

For someone who could never figure out how gorillas.bas was able to display anything to the screen (all of my basic code just wrote text to the screen), this is amazing.

Sounds a bit like me, except I could draw lines and circles. I made a small text based adventure game this way.

One of the first programming hobby projects I ever did was a level editor for a similar qbasic game called mono space. So fun!


I loved this game back in my qbasic days.

RIP Milo!

Wow, that looks awesome! Is the code on Github?

I dont think so. You can download a zip from

http://logiclrd.cx/milo/ http://logiclrd.cx/milo/downloads/monospac.zip

I was very fortunate to get an Amstrad 6128 when I was 12. A big expense in New Zealand 29 years ago 8-). It came with a huge manual with lots of example programs to type in. Amstrad basic was a cool language with commands like move 0,0; draw 320,200; rem a line from corner to corner; and even while/wend.

Looking at what you wrote at 15, I'm curious to know what you are doing nowdays?

I co-founded http://www.fitanalytics.com/ as the only technical guy, been working on that for the first four years (started with nodejs 0.4.x back then and CoffeeScript).

Now I have a small team in Berlin (5 devs), doing some mobile apps and a project for Wix: www.wixeducation.com (ES2015, Postgres)

We don't have a real website, because we're so busy :D but there's a logo online: www.code-pan.com

Line 67: ON ERROR GOTO errorhandler...line 205: errorhandler: RESUME NEXT... Obviously, this code has no errors ;-)

Does it work in http://www.qb64.net/ ?

I got it running with FreeBasic with a few changes: several arrays were not declared (does QB just guess the correct size? Resize them as they are indexed??), and I had to comment out the PLAY commands, which FB doesn't support.


Turns out it runs insanely fast, there's no speed control. It's also really hard to see in a tiny window.

If I remember correctly you always needed to do a DIM or REDIM at some point before really using them.

But it is so long time ago and I never really used QBasic, by the time it came out I was already into Turbo Pascal, leaving Turbo Basic behind.

I did however spend long evenings trying to understand it, as QBasic was one of the first languages I tried to implement a compiler for.

This code didn't DIM some of those arrays at all, and others were DIMed as integers instead of integer arrays! IIRC QB allows variables with different types to have exactly the same name, so I guess that's equivalent to not DIMing any of them.

I think I might remember something about a default size for undeclared arrays...


By the way: The PLAY command was acting as a pause hack, to limit the speed. It would just block the loop for a few milliseconds. Not sure there's an alternative, I think SLEEP was only for seconds...

I recently discovered this myself and was able to run the vast majority of my games I wrote as a kid except for the ones that used sound or machine code.

woah, this would've been much more fun to play than my qbasic space shooter: i did not know about timers, etc. and focused on making graphics out of draw primitives.

i wonder, what were others using for documentation? as i recall, i'd found a short introductory book on BASIC (not qbasic specifically, I don't think?) at the library.

It's really interesting how the sprites are implemented with PSETs

I actually wrote an editor just for that: https://github.com/strathausen/qed.bas

I've been setting each pixel by hand using that editor.

It's a really good-looking editor for a 15 year old kid to have coded back then.

Wow, just had a nostalgic moment. I remember QBasic. I remember my elementary school having a book about Basic and being able to do some of the example games and apps. And a few not working. BASIC/QBASIC differences?

But mostly I remember complaining to my dad. QBasic "compiled" to some intermediate that required QBasic to run... I remember never being happy with that.

I thought I had eventually found out... but QB64 only supports XP, and I know that I was doing QBasic on something much older than that... Maybe older versions of QB64 supported earlier versions of Windows.

anyway, a nice little 5 minute trip down memory lane.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact