Archives

All posts for the month October, 2021

PureBasic is one of the most underrated languages on the planet. It’s especially good for beginners (but can be good for experts too). It’s a shame that they teach young programmers to use Python as their first language. Most people make the assumption that BASIC is dead and so stuff like PureBasic is automatically ignored by them. It’s not that BASIC (as a language) is dead; it’s that the old dialects of it are dead (including Visual Basic). Also, the name BASIC comes with the assumption that it’s more “basic” than Python and therefore undesirable, but that’s not true. BASIC is not that basic today.
Python has become way too popular for its own good. Teaching a noob to use Python can allow them to get away with bad code practice. On top of that, Python is incredibly slow and it doesn’t come with all the amazing features that PB does. In college, they started me out with Python and turtle graphics 😛 Nobody uses turtle graphics professionally and it’s not like it’s any easier than traditional graphics. It’s actually a hell of a lot more annoying than simply drawing something at a specific X, Y position.
It’s like giving a kid a utility van as their first car. Yes, it can get stuff done, slowly, but is it a car you would want as your first? No. Most kids would want a sports car. Not a super expensive sports car like a Porsche, but instead like a Mustang or Delorean. That’s PureBasic.
Python isn’t even a real programming language. It’s like the top slowest language out there. A lot of Python Devs will lie and say it is a real programming language, but it’s not – it’s a scripting language. Learning to become a good programmer using a scripting language with no proper variable types or real code blocks is idiotic. Python also doesn’t have all the built in libraries to make programming fun. The reason I got into programming was because I randomly discovered QBASIC in the system folder. It had a lot of stuff built in (for back in the day) and it was just a blank slate where you could make anything. When I was forced to use Python in college, it didn’t have that same fun to it – it was just a chore. I wrote some of the assignments in PureBasic and it did above and beyond what the teacher requested, but she wouldn’t give me credit. I had to rewrite it in Python – no other choice.
Beginner devs often want to make games to test their skill and Python is the worst possible choice you could make for that because of its lack of speed and good libraries for this purpose. On the other hand, you could just use PB and have all that stuff at your fingertips and have it compile to real native code and run as fast as C. It’s the obvious choice.
There is the problem of lower popularity though. Like if you really want to become a programmer professionally, then it’s probably best to go with JavaScript or C#. Each having their different strong-suits. JS if you want to make web apps or games in-browser and C# if you want to either make serious business stuff, or 3D games with Unity.

Python code eventually looks like:
.self .self .self .self .self

NOTE: When running on Windows 10, make sure you set the DPI scaling to 100% (normal size). If you have the DPI over 100, it will lock the mouse cursor in the corner of the window.

I just made a video game called Aspirin. This is my first post regarding this game.
It is a video game that only exists (as far as I know) on the TI graphing calculators. This version I made is for PC. There are many enhancements to the game. You can run it at whatever resolution you want and there are monsters (pacman) (unlike the original). The graphics are very basic, but it’s still fun. The arrows are super simplistic for a reason. If they were too fat (using an actual graphic instead of a line), it would make the game much harder.

It is an action/arcade type of game. The object of this game is to move your character (the yellow smiley face) around the screen to collect the balls. There are two balls appearing at a time. When you get one of them, you gain 1 point, and a horizontal arrow appears and keeps shooting in the same direction over and over. When you get the other ball, it’s a vertical arrow. You will die if you are hit by the arrows. Occasionally, a pacman will come from the side of the screen and try to steal the balls from you. If he does, you lose 1 point. The pacmen do not kill you – they only steal the balls. It’s hard to describe. Just play it.

Please give me feedback if you try it. It’s super easy. You don’t need to download anything other than 1 EXE file and it’s less than 1 MB.

All files are for Windows 64-bit version 7 through 10.

Aspirin V1.7: https://drive.google.com/uc?export=download&id=17Iq5ZfbY3ttfgPh0YPP6qpNIqLyR0KqK

Aspirin V1.5 400KB: https://drive.google.com/uc?export=download&id=1LnDbNCWmr4G8DqF5Vif-J_oixhDgE-4L

Aspirin V1.4 389KB: https://drive.google.com/uc?export=download&id=15V_PrnDvf0tg3zem93ioaT57XfPxCr-o

Original V1.0 with no monsters: https://drive.google.com/uc?export=download&id=13QkIR4kkNxuDHFki7tl3LJMR75wkA2iR

100% native. No runtime engine, no installation. In the next version I will reduce the monster frequency, add bonus points, and music.

So in order to make DOS games in 2021, there are several options. None of them are perfect, but after studying all the options, I’ve discovered the two options I believe to be the best. There are more options if you specifically want to make adventure games. For that you can use either, an old version of AGS, AGI, SCI Studio, or SCI Companion. However, this article will assume you want an open ended system that will allow you to make any type of game. You will need to know C to continue.

I narrowed it down to FreeBASIC and OpenWatcom C. This article will specifically focus on OpenWatcom with the Allegro game engine. I found this to be the best choice for multiple reasons including speed, flexibility, and development on Windows (instead of inside DOS). OpenWatcom was also the compiler used to make DOOM and it’s very fast compared to the primitive Turbo C and the GNU DJGPP. The fact you can build your games in Windows helps a lot too because you can read the code on an HD screen and not be limited to the low resolution of DOS.

So to start out, you should probably download the PCX plug-in for Paint.NET. This will allow you to produce an old compressed image format that can be loaded by your game. The other option is just using bitmaps and that will use more space. And no, there’s no JPG, PNG, or GIF here 🙂 PCX is basically an old fashioned PNG file.

1. Now you can download OpenWatcom V1.9 from their main website. Version 2.0 might also work, but I didn’t try it. Now install Watcom with all the DOS options enabled.
2. Goto this link and download the alleg.lib: http://matejhorvat.si/en/dos/allegwat/allegow.zip
3. Download the allegro source and extract: http://cdn.allegro.cc/file/library/allegro-4.2.3/all423.zip
4. In the directory you extracted, run fix.bat watcom.
5. Copy the lib you downloaded to .\WATCOM\lib386\dos
6. Copy the fixed include files from the thing you extracted into .\WATCOM\h
7. Comment out line 36 in .\WATCOM\h\ALLEGRO\PLATFORM\ALWATCOM.H
8. Open Watcom (LITERALLY – Open Open Watcom) and make a new project – choose 32-bit DOS using DOS/32A LE.
9. Goto Linker Switches #2 and put alleg.lib under Libraries (NOT Library Files).
10. Goto C Compiler switches #5 and disable stack depth check.
11. Goto C Compiler switches #10 and select 80386 stack-based calling -3s.
12. Now you can just add the exhello.c (hello world example) to your project and do a makeall.

It should now be working and have made an EXE file about 757KB.
(Make sure you are adhering to the C89 standard. So basically declare all variables only at the beginning of code blocks and make sure all functions/methods are written above what’s calling them.)

When you create the watcom project, I recommend using DOS/32A LE. This way it’s smaller and there is no need for an external DOS extender like DOS4GW. Initially my EXE was 757KB which is really big just to draw a sprite, so I ended up following the guide here:
https://liballeg.org/stabledocs/en/alleg043.html

…which made my EXE down to 500KB with no sound enabled (I’m going to use PC speaker). It’s still bigger than I expected, but I couldn’t figure out how to further optimize. I tried the space optimization in watcom and it only saved like 5KB. So I downloaded UPX for DOS and applied -9 compression and got 200KB. And that’s with the DOS extender linked in, so that’s good enough for me.