Classic Computer Magazine Archive ANTIC VOL. 2, NO. 10 / JANUARY 1984

EDUCATION

ODD MAN AT PLAY

Transforming a concept into a game

by JOHN and MARY HARRISON

Last month we developed the custom character set that is the backbone of Odd Man Out, an educational program we designed to develop visual discrimination skills in preschoolers. This month, we will examine the subject of play action, the interaction between computer and user that transforms a concept into a game, as part of our study of how to write educational programs for preschool children.

THE BASICS OF PLAY ACTION

No matter how well conceived an idea seems to be, it is not effective unless it is used. Because of this, one of the most important facets to consider in designing educational software is play action. In developing Odd Man Out, we considered the following elements:

- varying background colors with difficulty level
- choice of graphics mode
- making the joystick responsive for young children
- adding an animated character to use in selecting proper response
- random selection of displayed objects
- immediate reward for correct response
- immediate indication of incorrect responses (without being critical)
- graphic reward based on performance

Some of these items are quite simple and require little or no explanation, but it is well worth the time it takes to examine the implementation of the more complex elements.

IT'S THE SIMPLE THINGS THAT COUNT

The pre-school audience lacks the sophistication of older and more computer-aware age groups. The three or four year old doesn't care if the animation is jerky or the graphics are simple -- if he can gain mastery over the computer and make it perform for him. While this should not be used as an excuse for shoddy work, it's true tha elaborate or highly-detailed graphics displays are rarely appreciated by the preschooler. Often it is the simple, subtle touches that make a program for youngsters easy to use and interesting to play.

By varying the background color with each difficulty level, we can immediately cue both parent and child to the level of difficulty being attempted. This is simply accomplished. In Odd Man Out, the variable CHOICE designates which of the seven levels has been chosen. Since the Atari is capable of displaying sixteen basic colors, we multiplied CHOICE by two and used the SETCOLOR command to change the background color. Color selection is arbitrary, but we preferred to use the even-numbered color choices.

To make the menu appealing, we used Graphics Mode 1 which contains large characters and thus makes the menu easy to read. An arrow points to the current selection. In addition to the seven difliculty levels, we added an eighth choice, EXIT, to provide for a clean termination of the program. The joystick is used to position the arrow; the fire button is pressed to make a selection.

The last of the relatively simple elements we included in Odd Man Out was a joystick routine designed for children's needs. The joystick is a switch that can sense eight distinct directions, but young children often lack the motor skills required to accurately position the joystick. As a result, when it checks for an up or down response, for example, our program checks for and allows any of the three joystick positions that can be considered to be pointing down, rather than allowing only one correct choice (see Figure 1). This minimizes a young child's anxiety by widening the window for acceptable resppnses.

CHARACTER ANIMATION

A more obvious technique we used to improve the Play Action of Odd Man Out is that of character animation. While animation is an extremely complex element of programming, and one that usually results in crude and jerky motion in BASIC, our implementation of animation in Odd Man Out is fairly simple and yields smooth motion.

Because this technique only works in Graphics Mode 0, we used the text window at the bottom of the Graphics Mode 2 display as the background for our animation. The Graphics-0 characters are small, so we designed an object three-characters-wide and two-characters-high. We wanted to be able to move the object both to the left and the right, and to keep its implementation simple. As a result, a two-headed animal seemed appropriate (our apologies to Dr. Doolittle). A child can position our "pushme-pullyou" beneath the object he or she wishes to choose without facing the distraction of seeing an animal that appears to walk backwards.

We started this process by attempting to visualize how such an animal would move. We decided that four "frames" would be required to describe the motion of the pushme-pullyou. In the first frame, the animal stands with its front and hind legs together, and with both heads level. In the second frame, it has its front and hind legs apart, and one head is higher than the other. The third frame is identical to the first. In the fourth and final frame, the animal's legs are apart and its other head is raised. Having identified these frames, we drew the figures on graph paper. Then the individual characters were extracted and read into the computer (as were the custom characters we discussed last month). Next, the complete sequence was stored in a string variable, PMPY$. This sequence is shown in lines 1380 and 1400 of Listing 1.

Odd Man Out allows for more than one correct choice of direction on the joystick.

These lines appear to be quite obscure, so let's look at them more closely. Remember it takes six characters to define the pushme-pullyou. The first three characters define the upper half of the animal. The down arrow and the three left arrows position the cursor so that the bottom half of the pushme pullyou is drawn beneath the upper half. This completes the first frame of the sequence. The rest of PMPY$ contains the remaining three frames of the animated sequence.

To prevent the danger of having bits and pieces of the pushme-pullyou strewn randomly about the screen, a mechanism is needed that erases those portions of the screen that are no longer occupied by the animal. This is accomplished by means of the variable ERASE$. Thus we print ERASE$, the frame, and then ERASE$ again. This allows the animal to move to either the left or the right without leaving a trail of abandoned parts behind.

RANDOM DISPLAYS

Nothing makes a game more boring than being able to foresee what sequence of problems or obstacles will be played. We have attempted to avoid this pitfall in Odd Man Out by using random-number feature of Atari BASIC. We use this random feature in three ways. First, we randomly select the object that will be displayed three times in a particular problem. Second, we randomly choose the object that will be displayed once (the odd man out). Third, we randomly select the position that will contain the the odd object. These steps ensure that there is no bias in our program regarding either the objects to be displayed or the location of the odd object in each set of objects.

EXPLANATIONS OF THIS MONTH'S PROGRAM SEGMENT

This month's program segment consists of the following maior sections:

(1) Lines 140-560: declare variables and read in characters for the pushme-pullyou
(2) Lines 880-1300: select difficulty level
(3)Lines 1320-1420: define frame sequence for character animation
(4) Lines 1500-1860: create level 1, 2, and 3 displays
(5) Lines 1880-2200: create level 4 and 5 displays
(6) Lines 2220-2480:create level 6 and 7 displays
(7) Lines 2500-2860: joystick input routines and pushme-pullyou move
(8)Lines 4180-4420: data that defines the pushme-pullyou

The first section requires little explanation. The variable FRAMES is the number of animation frames used (in this case four). FRAMSZE holds the length of a particular frame. In our case, ten characters are required per frame (six for the pushme-pullyou, along with four cursor-positioning characterp used to properly align the object).

The next section of the code is also fairly straightforward. Lines 880-1080 present the menu in Graphics Mode 1 and set CHOICE to one. We then reset the Attract Mode Flag (POKE AF,0). This keeps the computer from automatically beginning the attract mode, since the keyboard is not used. Next, the joystick position is read. POS is then used to determine if the UP or DOWN motion on the menu is desired. POS is set to two if DOWN is desired or three if UP is indicated. The remainder of this section adjusts CHOICE to the appropriate value, changes the background color, moves the pointer, and checks to see if the fire button has been pressed.

The third section of the code copies the custom characters for the pushme-pullyou into the character set, and sets up the character-animation strings PMPY$ and ERASE$. Lines 1500-1860 replace some of the lines used last month with the proper code for levels 1, 2, and 3. This code is more interesting and requires some explanation.

Since Odd Man Out consists of ten problems, a FOR/NEXT loop is used to control problem setup. SAME selects the one object (out of eight possibilities) that is to be displayed three times in a particular problem. DIFF selects one of the remaining seven objects to be the odd object. ODD chooses the location (0 to 3) of the object chosen by DIFF. P points to the first character in the object to be displayed. The screen is printed and control is passed to the joystick-input routine at line 2500. Lines 1880-2480 are similar, except that they allow the standard Atari characters to be displayed as objects. The only modified characters are the answer box and the pushme-pullyou.

One line that may be confusing is 1940. To reduce the amount of work required, this line copies the lower-case letters into the first half of the character set at the locations of the capital letters (a=>A), rather than copying the pushme-pullyou, answer box, and other miscellaneous characters into the second half of the standard character set.

Lines 2500-2860 are both the heart of Odd Man Out and a place where Play Action becomes a serious consideration. POKE 752,1 turns off the cursor. Locations 656 and 657 hold the row and column, respectively, of the cursor in the Graphics window. The pushme-pullyou is displayed on the left-hand edge of the screen, and the joystick is checked for input. If the value of JOY is greater than seven, the joystick could not have been moved to the right, so control is passed to line 2660. If JOY is greater than 11, this means that the joystick was not moved to the left, so control is passed to line 2800. If JOY < = 11 or < = 7, POS is updated and the character-animation sequence in lines 2700-2780 is activated.

The character-animation sequence displays the four frames required for the pushme-pullyou to take a step. By placing ERASE$ both before and after FRAME$, the left or right-hand edge of the pushme-pullyou that had been previously displayed will be erased. Lines 2740-2780 create the "clip-clop" sound effects of the walking character. The remainder of the section checks to see if the fire button has been pressed and if the pushme-pullyou is under one of the answer boxes. If it is, the next problem is displayed. Next month we'll add the right and wrong answer routines that need to be activated at this point.

PROGRAM ADDITIONS

It is now time to add this new section of code to the section presented in last month's column. Combining these two listings will provide you with the skeleton of Odd Man Out. However there is still no indication in the program of which responses are correct or incorrect, or of an overall evaluation of a child's performance. These topics will be examined next month.

To combine the two listings, first type in Listing 1 and LIST it to disk or cassette tape. Then load last month's listing, ENTER the new listing, and save the resulting program to cassette or disk for future use.

John and Mary Harrison are parents, teachers and Atari hobbyists. Mary teaches math and computer science at the high school Ievel. John holds an in M.S. in computer science and develops educational software. They coordinate the Education Department for ANTIC.

"Odd Man At Play" is the third installment of a series designed to teach basics of writing edtrcational software. The series is based on a program Odd Man Out. Part of the program listing appeared in the December issue; the listing and its explanation will be completed in February. As a result, portions of the program that appear in the December issue and that appear in this issue do not constitute a complete program. The system requirements of the completed program will be either 24K RAM (cassette) or 32K RAM (disk). -ANTIC ED

Download ODDMAN3.LST Download / View