Because some times, I just don't have anything better to do

RetroChallenge

RetroChallenge #3, part 4, The Aliens are done.

OK! This was fun!.
Then, yeah, I made it so that only one alien will move in each loop. This, of course speed up the game.
And then I realized that there was a lot of speed being wasted somewhere else.
You see, the aliens and the player are 8×8 sprites. And every time an alien moves, the H and V positions change by 8

350 IF Y*8V(A) AND PPOINT(H(A)+4,V(A)+12)=1 THEN V(A)=V(A)+8
370 IF X*8H(A) AND PPOINT(H(A)+12,V(A)+4)=1 THEN H(A)=H(A)+8

But, for whatever reason, the player’s X and Y change by one, and then the sprite is PUT in X*8, Y*8

140 IF PEEK(341)255 AND Y>0 THEN IF PPOINT(X*8+2,Y*8-6)=1 THEN Y=Y-1
150 IF PEEK(342)255 AND Y0 THEN IF PPOINT(X*8-6,Y*8+2)=1 THEN X=X-1
170 IF PEEK(344)255 AND X<31 THEN IF PPOINT(X*8+10,Y*8+2)=1 THEN X=X+1
….
260 PUT(X*8,Y*8)-(X*8+7,Y*8+7),J,PSET

This means that every time I PUT, and check for collision, slow multiplication has to be used.
By changing it to work as the aliens already did, everything is again a bit faster.
One of the changes I made caused the aliens not to be drawn until they move. It actually seemed kind of cool, so I left it like that.
And I think that the final change is that the difficulty level now influences how far away from the start is the victim going to be.
Wanting to see how much faster or slower the game was, I used the TIMER variable, which “tics” 60 times in a second. By setting it to 0 at the start of the loop, and printing it at the end, I could get a fairly decent idea of the game’s “framerate”.
The original took from 13 to 20 tics, while the new one took… between 8 and 20!
Success! Not only the game looks and plays a bit better, but it is also faster!
Let’s take a look at the remixed “Aliens”



I hope you like it, at least a bit.
And, in case you are curious, here is the source code for the Remix and for the Original versions.


RetroChallenge #2, part 2. Easier than it seemed.

Well, yesterday I spent a few hours coding the “Hippo Teeth” game, and I was surprised at how easy it all seemed to flow.
After saving the background image as a BIN file, that could be LOADM’d from the main program, I went ahead with creating and animating the “Sprites”.
The player’s controlled Doc can be in just 3 positions, one below each tooth. So I used a variable P to track those. As the graphic of the player is made up of 5 lines of 3 graphic characters each, I also use P$(5) to store the 5 strings. Then another array P(3,5) to store where each of the 5 strings should be printer for each of the 3 possible positions.
That is, when the player is in the 2nd position, I print P$(1) at P(2,1); P$(2) at P(2,2); P$(3) at P(2,3) and so on.
I did the same with the Worm and the Tongue, but for the Smoke, it was a bit more complicated, since it can be in located in a 3×4 grid.
Actually, my first problem was that the game was running too fast!
Each teeth has 40 “life points”, and I was subtracting one for every loop that the worm was under a specific tooth. I had to cut that down to 0.25 for each loop, which actually gives the teeth a life of 160 points.
I made a single change to the game play.
In the original, the tongue could move to “cover” the worm, and stood there, blocking your shoots, while the worm ate the tooth.
Now, if you shoot a “clean” tooth, the tongue may move to that position, leaving the worm open for a shoot.
So far, the game is taking 2570 bytes of memory, and I realized that I’m using some commands that are not in “standard” BASIC (STRING$, TIMER).
I will need to figure out if the game will target a 4 KB machine with tape, or a 16 KB one with Extended BASIC / Disk BASIC.
If I go for the 16 KB machine, I can make some extra animations, and with Extended BASIC, probably nicer sound.
Here is a video of the game after under 3 days of work, with sounds mostly as “placeholders”

And yes, I need to figure out why sometime the smoke cloud is not deleted…


RetroChallenge #3, part 3, Changes…


After going over the code of the old Aliens game, I started reorganizing it a bit.
For this, I set up an emulator to “Print to a text file”, and then listed the program to the “printer”.
After some Copy-Pasting (and line number changing), I moved the lines that create the graphics to the end of the code. This way, the main loop ended up between the 10th and 30th line, instead of around the 80th to 100th. This already makes it faster because of the way the infamous GOTO command works.
While doing this, I noticed that I was initializing some variables that are never used, and that there was provision for up to 50 aliens in one level!
I don’t think that fixing that gave me any extra speed, but at least there is no waste of memory as before.
Then, for the hardest part.
The lines in main loop had to be rearranged to have all the graphics drawn in the graphics page that is not being displayed. Then, copy that page to the one in the screen, do the math, delete the sprites that are going to move in the first page, and loop back to drawing the sprites.
I think I kind of sorted that out in a decent way, but there might still be room for improvement.
Then came code compacting.
Again, in Notepad++, I started looking at lines that could be crammed into a single one.
For example:

420 PR=1
430 COLOR 1
440 PMODE 4,1
450 LINE(Q*8,Z*8)-(Q*8+8,Z*8+8),PSET,BF
460 PMODE 4,5:SCREEN 1,0
470 PLAY”O4;L8;C;L16O3BL32AL8GL16FL8ED”
480 S=S+25
490 RETURN
Became
420 PR=1:COLOR1:PMODE 4,1:LINE(Q*8,Z*8)-(Q*8+8,Z*8+8),PSET,BF:PMODE 4,5:SCREEN 1,0:PLAY”O4;L8;C;L16O3BL32AL8GL16FL8ED”:S=S+25:RETURN

The risk here is that you may delete a line that is referenced in a GOTO or GOSUB, That is why I always keep a backup of “uncompacted” listing, in case I need to figure out where something used to be.
After all looks good, I take the file into a disk image using either IMGTOOL from MAME or with Toolsheed
With this, the program went from 132 lines to 100.
At this point, code was probably as neat and fast as I would get it without a major rewrite, and that was not the goal.
The flicker is, of course, gone. But sometimes, when more than 2 aliens move at the same time, you can tell that it is slowing down. Perhaps I should change it to have only one alien move in each cycle?
I’ll move on, make some minor changes to the look of the game, and then come back to that thought.


RetroChallenge #1, part 2


I got lucky!
Not only does the floppy drive in my … “gaming PC” works, but I also found an unopened box of disks at work! Which somehow ended up in my backpack and then at home.
img_20180904_234047064_ll
Now I have about 12 disks, that should be in good conditions.
I also found copies of Windows 3.1, DOS 6.22, and ARJ in my old backups, and have already downloaded Compushow and Quattro Pro.
But then, I realized that those programs are usually in disk images (.img files). I should have an old DOS program to read those files and create real disks… somewhere.
And… yes! The old TRS-80 Color Computer emulators for DOS! I still have them!.
Those are going straight to the Acer’s HD.


RetroChallenge #3, part 2


While I was at work, I managed to find some time to go over the code of the first game in my list, titled “Aliens II”.
By looking at the game, I found a few things that seemed easy to improve/fix.
There is a lot of flickering, and using page flipping should fix that.
The maze is not well designed, with lots of dead ends that tend to block the alien’s movement, and can force you to take very long paths to get to a particular place.
The time available to complete each level is just not enough in most cases, and finally, the text messages is horribly placed on the screen.
In the code, I found that the DATA for the graphics is on top of the code, instead of in a routine at the end.
Then, I realized that implementing page flipping to minimize flicker is not going to be that easy.
The game keeps the maze in one of the pages, copies it to the second, and draws the “sprites” there. In the next cycle, instead of erasing the sprites, the clean background is copied again from one page to the other.
This means that, in order to use the page flipping technique to eliminate the flicker, I will have to add the commands to delete the sprites from the old positions. This will make the game slower…
Moving on, I found this:

910 IF PEEK(344)255 THEN IF X<31 THENIF PPOINT(X*8+10,Y*8+2)=5 THEN X=X+1:GOSUB 1040:
And the line 1040 is just….
1040 RETURN
WTF????

OK, then, first task, speed up the game.
Rearrange the code to bring the main loop as close to the top as possible, declare all variables at the game start, giving priority to the most used ones, find some numbers that are used a lot and change them to variables.
Then, the game’s look.
I decided not to change the graphics. They are quite …. bad, let’s face it. But I guess is part of the game’s personality. The only real change will be to get rid of the white color and change it for green. Fits better with the game idea. And of course, the text must be aligned better, not just dropped anywhere in the screen!
And finally, game play.
The maze needs a redesign. Not a major one, but it should be easier to go from one place to the other, for both, the player and the aliens.
And like I said, the time available is not enough.

Here is a video of the original gameplay.


And the sound! What was I thinking? I believe that i just took a part of the music from some demos in the CoCo’s manual.
Should that stay or should that go?
Well, I guess we’ll see… tomorrow?


RetroChallenge #1, part 1

My First Challenge, as you may remember, is to fully load an AcerNote730i laptop, with software to match it’s manufacture date of 1995.

I guess I can divide it in three.
1) Choose the software,
2) Get the software, and
3) Load the software.

Even if the computer is from 1995, Windows 95 is clearly out of the question.
Windows 3.1 should not be a problem, perhaps with the computer booting to DOS, and loading Windows manually when needed.
X-Tree was one of my favorite programs back in the day, and it will find its way in there.
Norton Utilities, or at least Norton Disk Doctor should also be there.
Other programs that I used back in the day were Quattro Pro, Arj, Compushow…
Some games must also be there. Maniac Mansion, Master of Orion and Doom seem like a good way to start.

Getting the software should not be that hard. I still have copies of some of the one I was using back in the 90’s, and sites like “Vetusware” make it relatively easy to find almost anything from that time period.

The real challenge will be to get the software into the computer. As I mentioned before, it has no PCMCIA slot, nor network card. That leaves only the serial port and the floppy drive.
I do have a P-III with a floppy drive, and I could get the software to it from either a CD or a CF card reader. But I have not used the floppy drive in years…
And to use the serial port, I will fist need to get a terminal program into the laptop, so I would still need to use the floppy drive for that.

Well, I guess my next step will be to test that floppy drive, the few disks I still have around, and perhaps try to get a few more from somewhere. Let’s see how it goes.


RetroChallenge #3, part 1

And I had to do it. Start with my 3rd Challenge.

So I went over my old BASIC programs looking for something interesting that could be part of this challenge. I have 10 full disks, and after 5, it seemed to me that I had more than enough games to keep me busy for the month.
Let’s see what I found…

Alien II
Inspired by the movie “Aliens”, you are a space marine trying to rescue the alien’s victim in a maze of tunnels.
Aliens II

R Rusa
A Russian roulette simulation. Yeah, I guess I was kind of sick back then 🙂
Ruleta

Sup-Caza
You must try to catch the weird tentacled thing, avoiding the pac-man like chomper.

Sup-Caza

Lobo 1
Inspired by (I believe) a ZX Spectrum game inspired by the “Airwolf” TV show.
Airwolf

Tiro
A simple target shooting game.
Tiro

TOW-2
Keep the missile on target to blow the tank before it blows you.
TOW

Topgun2
You are alone against 2 enemy fighters. At least that is better than 5 vs 2 as in the movie!

TopGun

Super j
Shoot the enemy space fighter from your base’s turret before it fires on you.
Super J

You may have noticed that some of the names and text in the screenshots are in Spanish. Yes, that is my native language. I’m not really sure if I want to translate them.
What do you think?

Now is time to pick one, and start trying to figure out 30 year old code written by a 15 year old kid….


I finally made it to RetroChallenge!

OK, not that they were going to reject me or anything like that, but the last 2 times I tried to participate in the RetroChallenge, something got in the way. (The last time was a trip to the US that allowed me to go to my 2nd “CoCoFest”, so I can’t complaint about that one).
At least, this time I’m writing the first blog post, and that is much more that I managed before.
I decided to take 3 challenges, 2 of which have been in my mind for quite a while, and I will try to write individual posts for each.

The first one is related to an old laptop a friend gave me for free some 10 years ago. An AcerNote730i (486SX,4 MB RAM)

It was clearly designed from the start to be a limited machine, as it has almost no expansion options. Just a parallel port, serial port, VGA, PS port and a floppy drive. No PCMCIA slot or network card.
The hard drive was clean except for some leftover DOS files (From a Windows 95 boot disk).
Eventually, I got to install “Maniac Mansion“, but never gave it the attention it deserves.
Then, the First Challenge is to install a full DOS and software package, including some games, utilities and productivity software in it.

The second challenge came to mind after writing a couple of games for my Tandy Color Computer 3.
I realized that I was always using the high-res modes, full 128 KB memory, and requiring a floppy disk (real or emulated).
But I had nothing that would run in the old Color Computer 1 or 2.
So, my Second Challenge, is to write a game that will run in any CoCo, using the low-res graphics mode (64×32) and no more than 16 KB RAM.

The third challenge is somewhat related to the second.
Not long ago, loaded all the programs I wrote in BASIC from 1985-ish to around 1995 and created disk images with them, to play them in emulators or in my real CoCo using the SuperIDE card.

A few weeks ago, while optimizing one of my latest programs, I realized that I could probably improve some of my old ones, creating perhaps a “Director cut” or “Remix” version of them.
Therefore, my Third Challenge is to look through my old programs, find some that could use some cleanup, and try to update them.

Well, maybe I’ve overextended myself…. Time will tell. I have 30 days and counting.