• Please review our updated Terms and Rules here

Tektronix 4054A with Option 30 - Cylon Attack work in progress game!

nikola-wan

Veteran Member
Joined
Mar 7, 2018
Messages
1,304
Location
Texas, USA
I'm a big Battlestar Galactica original 1978 TV series fan - and since Battlestar Galactica featured Tektronix 4051 computers on the Galactica bridge and featured vector graphics for the battle scenes, I wanted to develop my first Battlestar Galactica game - Cylon Attack!

Here is a video of my Cylon Attack - work in progress game in Tektronix 4050 BASIC!

Cylon Attack!

Cylon attack.jpg
 
Last edited:
Neat (as usual from you of course).

The Cylon ships movement should be based on the physics of space flight - coupled with a random feature (for direction, velocity, acceleration and distance) to try and evade the human pursuer.

Use the joystick for a similar thing for the human pursuer.

The net effect would be the same as you currently have, with a fixed green 'target' and a floating yellow cyclon ship.

If you consider distance between the pursuer and the cylon ship this would affect the overall size of the yellow ship.

Depending upon where the laser blast hits the ship would define damage (which would limit movement) or a kill.

A clean kill for a larger distance would give more points.

You would need to add the points tally to the green image.

The higher the score, and the more direct kills that are made, would increase the difficulty.

How is that for a game specification?

Dave
 
Neat (as usual from you of course).

The Cylon ships movement should be based on the physics of space flight - coupled with a random feature (for direction, velocity, acceleration and distance) to try and evade the human pursuer.

Use the joystick for a similar thing for the human pursuer.

The net effect would be the same as you currently have, with a fixed green 'target' and a floating yellow cyclon ship.

If you consider distance between the pursuer and the cylon ship this would affect the overall size of the yellow ship.

Depending upon where the laser blast hits the ship would define damage (which would limit movement) or a kill.

A clean kill for a larger distance would give more points.

You would need to add the points tally to the green image.

The higher the score, and the more direct kills that are made, would increase the difficulty.

How is that for a game specification?

Dave
Great game specification - Dave!

I agree with adding distance - reducing the size of the Cylon ship with increasing distance from you, and adding left and right tilted Cylon ships as the Cylon ship turns away from you.

Yes, I wish I could use the Tektronix joystick that I have for this game - but the 4052R11 Character & Symbol ROM Pack CURSOR command that I'm using to move the Cylon only works with the joystick on 4052 computers - which don't have Option 30. :( That CURSOR command and the Tek 4050 BASIC POINTER command always use the 4054 keyboard cursor X&Y thumbwheels instead of the joystick when they detect the 4054 or 4054A. :(

That's why I think I need to design a game controller interface for the 4050 computers - so we can design much more interactive games than using the User Definable keys.

If we design a game controller that connects to the backpack serial interface - it will work on all the 4050 computers, not just the 4052/4054 with Multifunction ROM Packs. It will take a little longer to get the gamepad data as the 4051 is limited to 2400 baud, but it will work.

I would like to see RS-232 serial added to the latest 405x emulator from @WaveyDipole which includes all the 4051 ROM Packs like Fast Graphics. Then we could add the gamepad interface to the RS-232 serial where a PC USB gamepad with joystick and buttons could provide the data to the emulator.

71se60rnXTL._SL1500_.jpg
 
I did mean your game pad design as opposed to the Tek joystick.

The inputs to the physics model would be the thrust and the direction vector for both the Cyclon and fighter ships. Obviously The thrust then would dictate the acceleration and speed.

The output from the physics model would then be the distance between the two ships and the position of the Cylon ship relative to the fighter.

I will give the physics calculations some thought - or ask my son (a mechanical engineer)...

Dave
 
Yes, I wish I could use the Tektronix joystick that I have for this game - but the 4052R11 Character & Symbol ROM Pack CURSOR command that I'm using to move the Cylon only works with the joystick on 4052 computers - which don't have Option 30. :( That CURSOR command and the Tek 4050 BASIC POINTER command always use the 4054 keyboard cursor X&Y thumbwheels instead of the joystick when they detect the 4054 or 4054A. :(

You can get nonblocking cursor-free input from the joystick/thumbwheels and keyboard with the R12 "JGIN" call. Four arguments:

1: Delay time (specify 0 for nonblocking)
2: Variable receiving joystick/thumbwheel X coordinate
3: Variable receiving joystick/thumbwheel Y coordinate
4: String variable receiving keyboard buffer information

This may be easier than building a game controller?

PDF page 109 of http://www.dvq.com/tektronix/4052R12-opt.pdf

Then you can use other Option 30 commands to move the cylon sprite around.
 
You can get nonblocking cursor-free input from the joystick/thumbwheels and keyboard with the R12 "JGIN" call. Four arguments:

1: Delay time (specify 0 for nonblocking)
2: Variable receiving joystick/thumbwheel X coordinate
3: Variable receiving joystick/thumbwheel Y coordinate
4: String variable receiving keyboard buffer information

This may be easier than building a game controller?

PDF page 109 of http://www.dvq.com/tektronix/4052R12-opt.pdf

Then you can use other Option 30 commands to move the cylon sprite around.
Thanks Tom!

I was looking at the R12 joystick commands this morning.

I think the JMOVE is closer to what I was looking for - as it might drag the Option 30 object around like the CURSOR command I'm using from the R11 Character & Symbol ROM.

One issue with JMOVE is it will ALWAYS draw the R12 graphic - after the number of Counts has elapsed - which I don't want.

So I changed the example program slightly to create a new object with just an RMOVE to 0.001,0.001, and added another test IF K$="" then repeat the JMOVE.

I was hoping the R12 commands ONLY work with the joystick as the thumbwheels are never mentioned in the R12 manual - however my tests proved different.

I just tested with my modified JMOVE example program:
- 4054 thumbwheels work with the R12 "J" commands IF no joystick is attached
- joystick works on my 4054A IF the joystick is attached when the JMOVE command is executed

In addition - the manual indicates the ACROSS command will work without a joystick - so it would work on a 4052 for example.

I don't actually want the crosshairs to be visible in my Cylon game.

I did some experiments with my modified JMOVE example program (listed here):

Code:
100 REM JMOVE EXAMPLE
110 INIT
120 PAGE
130 REM GENERATE THE IMAGE OF A BOX
140 DIM B(24),B$(36),C$(36),D(2),D$(3)
150 DATA -50,-50,50,60,60,60,60,50,50,50,-50,-60,58.66,65,68.66,65
160 DATA 68.66,55,60,50,-60,-60,68.66,65,-1.0E-3,-1.0E-3
170 READ B,D
180 CALL "CHANGE",B,B$
185 CALL "CHANGE",D,D$
190 C$=B$
200 PRINT "MOVE JOYSTICK TO DESIRED SYMBOL LOCATION"
210 PRINT "TYPE A CHARACTER TO PLACE THE SYMBOL"
220 PRINT "TYPE E TO END PLACEMENT"
230 REM USE THE JOYSTICK TO PLACE THE BOX
240 B$=C$
250 CALL "JMOVE",D$,-1000,X,Y,K$
255 IF K$="" THEN 250
260 IF K$="e" OR K$="E" THEN 290
270 CALL "RDRAW",B$,1,0,0
280 GO TO 230
290 END

And now I remember that I don't like the Tektronix 4952 Joystick operation.
  1. Regardless of what the Tek 4952 joystick manual says - you must press the Select - which is a switch not a momentary button - or the joystick does not work
  2. The joystick is spring centered, but analog circuits inside the joystick sample and hold the last position before you let go of the stick (I believe to simulate a CAD digitizer puck instead of a PC joystick)
  3. The joystick position integrator logic is slow to follow the stick position
The last two bullets are blocker issues for using the Tek 4952 joystick for games.

I pulled out my rewired Kraft PC joystick that worked with my 4052 and 4054 years ago - and now it doesn't work. Likely broken solder joint on the cable.

What I hoped to do with a joystick was allow the player to try to follow the Cylon in order to get the Cylon centered in the targeting circles before firing.
Since the Cylon will be moving - that would require the joystick to be held in the direction of Cylon movement and letting go of the stick would stop the Viper maneuvering engines.

The Tek 4052 joystick would continue firing the Viper maneuvering engines if you released the stick. And if you tried to move the stick in the other direction - you wouldn't be able to find the X=0, Y=0 center.
The Tek 4052 joystick has a button to center the joystick analog output to 0,0.

Hmm - looking at the schematic, I may be able to pull joystick X,Y pins out of J172-2 and J173-2 and pull the DB-9 cable pins out of J171-1 and -5 and completely bypass the analog circuits. The power would still be supplied to the potentiometers on J170.

1691952946570.png
 
I have successfully modified my Tektronix 4952 joystick to eliminate the analog sample and hold circuitry!

Here is the photo of the joystick board and cables before the mod and after the mod:




My 4952 joystick before mod.jpeg after the mod: My 4952 joystick after mod-brite.jpeg

I pulled joystick X pin out of J172-2 and Y pin out of J173-2. I also pulled out the DB-9 cable pins J171-1 (brown wire) and J171-5 (blue wire).
I straightened the pins on a right angle three pin header and connected the joystick X pin to the blue DB-9 cable wire and connected joystick Y pin to the brown DB-9 cable wire and covered the bare pins with small heatshrink tubing (but did not have to heat the tubing - so these connections can be restored later if needed).

To remove the pin from one of these connectors - you need to carefully pull all the wires slightly away from the slotted side of the connector, then you can gently bend the "slots" away from the end of the pins and extract the pin or pins from the solid part of the connector. Then you can push the contacts that are going to stay in the connector back into the "slots".

This modification disconnects the slider from the X and Y pots and directly connects the slider to the DB-9 connector.

I plugged the modified joystick back into my 4054A computer and ran my modified JMOVE program in my previous post - to check the joystick operation and calibration.

Step 1 - I ran the JMOVE program and could immediately see the improvements in the joystick: rapid movement when moving the stick and return to the middle of the screen when letting go of the stick.
Step 2 - I changed line 270 in the JMOVE program to CALL "RDRAW",B$,1,15,0 which moved the R12 block back to the center of the screen when you press any key other than "E"
Step 3 - I pressed the space bar to draw the block with my hand off the joystick. Then I adjusted the joystick X and Y trims to align the crosshairs with the bottom left corner of the block
Step 4 - I then moved the joystick to one of the four extreme positions and pressed the "E" key to stop the program. Then I typed X with RETURN and Y with RETURN to get the X,Y coordinates from the last JMOVE.

The main limitation of this 4952 joystick mod is the max travel from the center of the screen (X=65, Y=50) is limited to about:
Xmin=47, Xmax=81 (26% of 0-130)
Ymin=35 ,Ymax=64 (29% of 0-100)

So since the unmodified 4952 joystick gets 1024 points of resolution from the 4050 joystick port and we are only getting about 1/4 of that with the modified 4952 joystick - we are likely limited to a resolution of about 256. I don't think that is a deal breaker - I think that is the analog joystick resolution of the Vectrex.
 
Bad news and Good News:

Bad News:
- JMOVE only works on R12 objects NOT Option 30 objects

Good News:
- with the Joystick mod - the R11 CURSOR command works on Option 30 objects if the Joystick is connected before the program is run!

Here is my screenshot of the Cylon Attack demo with the Cylon stored on the screen at the four maximum corners of my modified joystick travel (top left, top right, bottom left, bottom right).
The refresh Cylon is displayed in orange with the joystick lever released to center.

Joystick with POINTER.jpeg

I think this means the joystick lever released coordinates are NOT centered as the targeting circles are drawn centered on the screen.
This is probably why I had to add X=15 to the RDRAW command in the JMOVE example program to get the edge of the cube on the center line of the crosshairs.
 
"If the mountain will not come to Mohammed" ...

So I changed the Cylon ship Option 30 refresh mode object offset to match the joystick offset in my Cylon Attack work-in-progress.

Now I can move the Cylon with the modified joystick as shown - with the Cylon in the middle of the screenshot centered when the joystick lever is released.

I stamped (Option 30 FIX-ed) a Cylon at the corner limits of joystick travel and finally at the centered joystick position.
Then I printed the X and Y location of the joystick (with Cylon object 'attached') from the last POINTER command (based on default display coordinates of X=0-130, Y=0-100):

X=65.76
Y=49.44


Adjusted Cylon object location for joystick.jpeg

You can see that the Cylon ship in the middle is centered in the targeting circles! That's more like it!

Of course in my game - I want the Player to use the joystick to move the Viper ship towards the Cylon until the Cylon gets close to the center of the target - and then the Player can fire lasers by pressing a key.

I want the program to calculate hit or miss on the Cylon based upon the Cylon location on the screen - NOT the location of the joystick X/Y input.

Now I can continue with development of my Cylon Attack game!

You can get nonblocking cursor-free input from the joystick/thumbwheels and keyboard with the R12 "JGIN" call. Four arguments:

1: Delay time (specify 0 for nonblocking)
2: Variable receiving joystick/thumbwheel X coordinate
3: Variable receiving joystick/thumbwheel Y coordinate
4: String variable receiving keyboard buffer information

This may be easier than building a game controller?

PDF page 109 of http://www.dvq.com/tektronix/4052R12-opt.pdf

Then you can use other Option 30 commands to move the cylon sprite around.

Tom - I agree with you that the R12 "JGIN" call is likely a good one to use for the game. I don't want the call to draw a crosshair on the screen - so I will try to use the "NULL" vector R12 string (RMOVE,0.001,0.001) in that command with a timeout of zero to simply return the value of the joystick X/Y position in the main game loop. And if a key has been pressed - fire the lasers!
 
Hmm - I don't think JGIN is the CALL I need - JGIN causes the crosshair cursor to appear.
I guess the JMOVE that I used in my modified JMOVE example program is better - as I get to select and R12 object for the graphics cursor instead of default to crosshairs.

In my modified program I created an R12 "MOVE",0.001,0.001 object so the graphics cursor is invisible when running JMOVE. but an X,Y coordinate is returned with a key press.
 
I'm a little surprised --- I'm using it on a game that I worked on a while ago, and it didn't do that. Maybe I'm not setting up cursors in the same way you are? Are you specifying 0 as the first argument to JGIN?
 
I'm a little surprised --- I'm using it on a game that I worked on a while ago, and it didn't do that. Maybe I'm not setting up cursors in the same way you are? Are you specifying 0 as the first argument to JGIN?
Yes.

Prior to the JGIN, the Cylon was visible on the screen, when the JGIN is executed a crosshair graphics cursor appears.
 
I wonder if the behaviour is different with the joystick, since I only use the thumbwheels. If not that, then it may be the ways our two programs use the cursor, if you're still making use of cursor routines. I don't use them in my program. Beyond that, I can't really say, unfortunately!
 
My Tektronix 4050 BASIC Cylon Attack part 2 video is now uploaded: https://youtu.be/cBaplh57-2s


Cylon shot by Viper.png
I have modified my Tektronix 4952 joystick to bypass the sample and hold electronics in the joystick so it now operates like a PC joystick with fast X/Y response. In my game, the player will move the Viper to get the Cylon into the targeting crosshairs.

I have added Viper laser blasts with Tektronix 4052R12 Enhanced Graphics ROM Pack sounds for the laser and explosion sounds when the Cyclon is hit - like in the video thumbnail below.

In addition - I have added the 4052A/4054A enhanced BASIC command INSIDE that I have previously posted. This command will examine a closed polygon and return a 2 if the X,Y location is inside the polygon, or a 1 if the X,Y location is on the outline edge of the polygon, or a 0 if the location is outside the polygon.

This video demonstrates that collision logic and sound effects.
 
I just posted my Cylon Attack work-in-progress BASIC game part 4 video:

Cylon Attack - Part 4


Cylon Attack thumbnail.png
I root caused the Cylon flickering issue in my last video to the Tektronix Joystick I was using. Looking at the service manuals for my Tektronix 4054A vector graphics computer - the theory of operation section for the joystick and keyboard X/Y thumbwheels indicated both joystick and thumbwheels are connected to the display board. When the BASIC POINTER command is used to input the X and Y coordinates of the joystick or thumbwheels, the display board X and Y D/A converters are used with comparators and BASIC ROM code to perform successive approximation to determine the analog X and Y values.

This use of the display board blocks the Option 30 dynamic graphics coprocessor from accessing the video bus - which causes a moment of flicker every time the POINTER command is run in my tight loop of logic for the game.

So I spent last week designing a new joystick interface for my Tektronix computer - by leveraging six unused pins on the Arduino running my Micro SD Flash Drive which replaces the internal tape drive. I added a new function to the Flash Drive code to convert the X and Y analog joystick output of my Vectrex game controller and read the four buttons on the game controller when the Flash Drive received the BASIC program INPUT@5,31:X,Y,A,B,C,D command on the GPIB bus.

In this video I'm only currently using one of the buttons to fire at the Cylon. I have added random logic for Cylon position and velocity for this video.

The attached photo shows my prototype of the Vectex controller connected to an Arduino MEGA board.

Vectrex joystick connected to Arduino MEGA.jpeg

Next step is add player logic to use the joystick to move close enough to the Cylon to fire the lasers!
 
Here is a closeup photo of how I wired the Sega gamepad extension cable (from Amazon) to the Flash Drive. I used two zip ties to secure the end of the cable to the microSD adapter header pins.

Flash Drive with Vectrex gamepad cable.jpg


This photo shows the Tektronix 4952 joystick and 1982 Vectrex gamepad connected to my Flash Drive on top of my 4054A.

Vectrex gamepad with Flash Drive - vs Tektronix 4952 joystick.jpg
 
It was real easy to add player joystick code to Cylon Attack:

1590 REM use player joystick to move Cylon relative to target crosshair
1600 I0=I0-P/1000
1610 I1=I1-Q/1000

I0 = Cylon X position
I1 = Cylon Y position

With the /1000 scale factor - I can't catch most of the fast Cylons.
But I can catch the slow ones.

Next I'll try to have the fast ones escape instead of bouncing off the edge - and have another Cylon enter at a different location.

Then add scores for Cylons missed vs Cylons destroyed - heh heh heh.
 
I finished my Cylon Attack game today and posted the final video:

Battlestar Galactica - Cylon Attack game

The BASIC game program is 8K bytes and uses one 9K byte binary file containing the Cylon vector image and sound effects.
I adding HIT/MISS scoring and some of the Cylons are moving too fast to catch them using the Vectrex joystick connected to a gamepad interface I just added to my Flash Drive Arduino code.

May be an image of text that says 'MISS'
 
Neat (as usual from you of course).

The Cylon ships movement should be based on the physics of space flight - coupled with a random feature (for direction, velocity, acceleration and distance) to try and evade the human pursuer.

Use the joystick for a similar thing for the human pursuer.

The net effect would be the same as you currently have, with a fixed green 'target' and a floating yellow cyclon ship.

If you consider distance between the pursuer and the cylon ship this would affect the overall size of the yellow ship.

Depending upon where the laser blast hits the ship would define damage (which would limit movement) or a kill.

A clean kill for a larger distance would give more points.

You would need to add the points tally to the green image.

The higher the score, and the more direct kills that are made, would increase the difficulty.

How is that for a game specification?

Dave
Hi Dave,

I did add HIT and MISS scores to the game.

I scaled the joystick input slightly lower than the max velocity of the Cylon - so some of them cannot be targeted and will be missed when they leave the screen.
 
Back
Top