Tuesday, 17 October 2017

RetroChallenge 2017/10: Binary Room

Binary Land is a puzzle video game developed by Hudson Soft in 1983 for the MSX, FM-7 and NEC PC-6001. In the game players have to unite two characters (male and female), who are in love. The MSX version features a human boy and a human girl. The player controls the two characters simultaneously, with a timer adding to the difficulty. These characters move in mirror images of each other. The game features many different puzzles stages that the characters must navigate, and there are enemies within the mazes that add extra challenges.
The MSX Version with boy and girl characters
I found out about this game when I stumbled across a Japanese website dedicated to people's computing projects using arduinos and raspberry pie devices. Some of these devices implement versions of Basic to allow for simple programming projects in the style of old 8-bit computers.
This one seemed to display a simple text like game.  The author explained that they had created a puzzle game inspired by the game Binary Land.  He called his game Binary Room. I suspect this was because it involved a simple rectangle with some randomly placed blocks in it, rather than complex set puzzles/mazes.  The movement system was the same though, with two "characters" A and B being maneuvered in a mirror like fashion.  The object of the game was to move them so that they straddle numbers in sequence.  Each stage has a set of numbers equal to the stage number randomly placed in the room, up to stage 9.  Here's the source code for the game as listed by Taisuke Fukuno, who I take to be the programmer, although he might just be the person responsible for the "Create Everyday" website.
1 'BINARY ROOM
10 S=1 15 CLS:LC4,0:?"STAGE:";S
20 FOR I=0 TO 15
30 LC8+I,2:?"#":LC8+I,17:?"#"
50 LC8,2+I:?"#":LC23,2+I:?"#"
70 NEXT
80 SRNDS:FOR I=1 TO S*3
90 X=RND(12)+10:Y=RND(12)+4:IF SCR(X,Y) CONT
100 LCX,Y:IF I%3 ?"#" ELSE ?I/3
110 NEXT
120 X=15:Y=16:V=16:W=16:C=1:CLT 125 K=INKEY()
130 A=-(K=28)+(K=29):B=-(K=30)+(K=31)
140 IF SCR(X+A,Y+B)=0 LCX,Y:?CHR$(0):X=X+A:Y=Y+B
150 IF SCR(V-A,W+B)=0 LCV,W:?CHR$(0):V=V-A:W=W+B
160 LCX,Y:?"A":LCV,W:?"B" 165 LC(X+V)/2,(Y+W)/2:IF SCR()-48=C IF Y=W AND ABS(X-V)=2 OR X=V AND ABS(Y-W)=2 ?CHR$(0);:C=C+1:IF C=S+1 LC4,20:?"CLEAR!":WAIT30:IF S=9 END ELSE S=S+1:GOTO 15
170 LC16,0:?"TIME:";TICK()/60:WAIT3:GOTO 125
The questions marks represent PRINT commands.  The LCx,y commands are equivalent to PRINT@ or LOCATE commands in MS Basics.  SCR(x,y) commands do the job of checking the character values stored at specific screen locations.  The rest are pretty much standard Basic.

I found that the logic for placing the numbers was completely random, so sometimes they could be placed in a way, depending on where other numbers and blocks were placed, that there was not room on either side or above and below, to maneuver the characters around it to straddle it.  This would make a stage impossible to complete.  I changed the logic so that after placement, each number is checked to see if there are spaces to the right and left or above and below.  If not, the number is moved somewhere else and re-checked. This vastly decreased the possibility of generating incompletable stages, but not entirely.  Very occasionally you might end up with something like this:

  #
#  #
#1# 

The check shows that the top and bottom spaces are clear, but not really because the top space is not really accessible but has been blocked off to access by the character.  The number of blocks placed per round is equivalent to the number of the round multiplied by two, so this possibility is very rare.  Even on level nine there will only be 18 random blocks placed on screen.  But to prevent frustration I added the ability of the player to press R to redraw any stage and allow play to continue.  So check your stage before setting out!  The object of the game is to complete the 9 stages before 1000 seconds run out.  The faster you complete, the higher your score.  High score is saved.  When you complete the puzzle Beethoven's 'Ode to Joy' is played.  I tried to translate the music from an updated version that Taisuke also posted.  It's not a very good job, but my son Charlie is away at university, and he's my musical expert.  Perhaps when he comes back at Christmas I get him to take a listen and try to improve on my poor job.

Here's a video that Taisuke posted showing his updated version with music:
Here is a video of my port.  I have made some changes since making this video.  Now the counter counts down to zero and a higher score is the score with the most seconds left on the clock when stage 9 is completed, which is a bit more intuitive.  I also added the R redraw function to the instruction screen.

Anyway, hi to the folks doing the RetroChallenge 2017/10! I've been peeking around a little but hope to have some more time soon to check out the other projects being done.  If you are not one of the participants please check out the RetroChallenge website.

No comments:

Post a Comment