Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Space Race
#1
July 16, 1973 saw the release of Atari's, Space Race. Designed by Ted Dabney and assisted by Nolan Bushnell and Allan Alcorn  on the heels of Pong, that released on November 29 of the previous year... 
https://en.wikipedia.org/wiki/Space_Race_(video_game)

This is my feeble attempt to recreated the game... It is not exact and is not complete. Complete in the sense that it is playable.

I have used colour... Sorry. The 'classics' were done in black and white. Like the dinosaurs, black and white, have had their day.

The code is not optimized and may contain 'random features'...

Controls are simple. Player 1 uses "A" and "Z". Player 2 uses "Up" and "Down". (Up and down movement "only").

The game: Both players have a limited amount of time to reach the top of the screen as many times as is possible. Colliding with "objects" will send the player back to the bottom of the screen.

The original game needed quarters to replay... My 7 year-old grand daughter would find the game "boring" but back in 1973... this was the next best thing to magic...

Ideas for improvements will of course be appreciated... but this was just a "fun" project and may not go any further. Mainly a "see if I can" type of game. There is no original source code as the game was purely electronic(?).

It was fun to make...


.n7   spacerace.n7 (Size: 7.6 KB / Downloads: 14)

ps: What were you doing in 1973?
Logic is the beginning of wisdom.
Reply
#2
(12-13-2023, 07:20 PM)johnno56 Wrote: July 16, 1973 saw the release of Atari's, Space Race. Designed by Ted Dabney and assisted by Nolan Bushnell and Allan Alcorn  on the heels of Pong, that released on November 29 of the previous year... 
https://en.wikipedia.org/wiki/Space_Race_(video_game)
..
It was fun to make...
ps: What were you doing in 1973?

Hi  johnno56,
I agree with you, using NaaLaa to recreate "old computer games" is very fun. Sometimes, I am amazed on how the programmers in 1970s developed such a game with limited resources ( no color monitor, limited computer memory, limited computer speed ) but certainly they had no limits in creativity  Smile

Thank you for sharing the source code of the Space Race. 
I am going to learn the logic of your source code. 
I am no longer young, and I think learn to code and to recreate old computer games is good as a therapy for my brain's health and to avoid dementia / alzheimer  Big Grin Big Grin Big Grin

Let's the fun begin  Big Grin
Reply
#3
There are several parts of the code that can be streamlined. I got it to work but it can be written better... lol

The difficulty that I faced was the lack of source code for the original game. Thankfully, the game itself is not too complicated, which made it easier to "throw it together"... lol

If you have any difficulties or questions just ask... If I do not know the answer I am sure that someone else on this site will know... lol

J

ps: In 1973 I was starting my second year of my apprenticeship... The seventies... when fashion took a 90 degree turn and the advent of glam-rock... A decade that is impossible to forget and a time that few will admit to surviving ... lol
Logic is the beginning of wisdom.
Reply
#4
Very nice Johnno.....it would be an interesting challenge to add some code to allow player 1 to play against the computer.
Reply
#5
Thank you.

... against the computer? Like a little bit of Artificial Intelligence? That would be nice... I have enough trouble handling what little intelligence that I can use... lol It would take someone with a lot more experience than I to do that... but it would be nice...
Logic is the beginning of wisdom.
Reply
#6
(12-14-2023, 06:45 AM)johnno56 Wrote: ps: In 1973 I was starting my second year of my apprenticeship... The seventies... when fashion took a 90 degree turn and the advent of glam-rock... A decade that is impossible to forget and a time that few will admit to surviving ... lol

Ah yes, the seventies, those were the days! I ... turned one year old in 1980 Smile

That's a nice game! As kevin wrote, it would be fun with a computer opponent. I might try to add some code for that.
Reply
#7
hmm... 1980... Married for two years; one daughter; no pets...

I am working on a concept... 2nd player (comp. controlled) will begin moving up the screen at the same rate as player 1. Using the circle-circle collision detection to calculate the distance between computer player and "objects". If player 2 gets within, for example, 32 pixels of the object and beneath the "y" axis of the object, player 2's velocity will reverse, until it is more that 32 pixels from the object, then player 2 will continue moving up the screen.

The prototype currently works with one lateral object... I am testing with multiple object but not having much luck... I may not be able to work on it until the day after tomorrow (Thursday) as my eldest grandson will be visiting tomorrow... 17 year olds love computers...
Logic is the beginning of wisdom.
Reply
#8
(12-14-2023, 06:45 AM)johnno56 Wrote: ...
If you have any difficulties or questions just ask... If I do not know the answer I am sure that someone else on this site will know... lol
...

Hi Johnno56,

Your source code of Space Race in Naalaa is very useful for me as a reference to study the logic of the game. 
Just for fun, I made some modifications  Cool

1. The program structure is grouped into 3 categories :    
    - INITIALIZATION   : set up windows, variables    
    - MAIN PROGRAM   : do ... loop
    - FUNCTIONS     
          InitObjects()
          GameIntro()
          MoveRocks()
          DisplayPlayers()
          PlayersMovement()
          CalculateScore()

2. Using Dot notation
Code:
function InitObjects()

  'computer player
  player.x = 60;   
  player.y = 300; 
  player.w = 15; 
  player.h = 16
   
  'human player
  player2.x = 165;
  player2.y = 300;
  player2.w = 15;
  player2.h = 16
  ...
endfunc

3. It is a simplified version
     i.e.Rocks only move from left to right  Big Grin
     i.e.Human Player vs Computer Player (only move forward, most of the time it hits the rocks  Big Grin )
Code:
function PlayersMovement()

    'Computer Player (Auto movement)   
    player.y = player.y - (0.1*rnd(10))
    if player.y <= -15
        score1 = score1 + 1; player.y = 300
    endif

    'Human Player
    if keydown(KEY_UP)
        player2.y = player2.y - 1
        if player2.y <= -15
            score2 = score2 + 1; player2.y = 300
        endif
    endif
    if keydown(KEY_DOWN)
        player2.y = player2.y + 1
        if player2.y > 300
            player2.y = 300
        endif
    endif
endfunc

Once again, thanks to Johnno56 for having shared the source code of Space Race in Naalaa  Big Grin


Attached Files
.n7   spacerace_simplified.n7 (Size: 6.2 KB / Downloads: 2)
Reply
#9
Well... for starters... on the surface, the games runs as it should, which is cool...

I am however impressed by how you "simplified" the code. Brilliant! Your understanding of how Naalaa implements arrays/tables is obviously much better than mine... Very nicely done! You realize that I am going to go over your code to see "what makes it tick"? lol I still have a LOT to learn...

You were right when you said the computer runs in to rocks most of the time... I am currently prototyping a "little something" that may (or may not) give the human a bit of a challenge. A kind of "early warning" or simple "avoidance" routine for the computer... more later... assuming I can get it to work... lol

Anyway... Very impressed by what you have accomplished! Well done!

J

Ok... Prototype seems to work... Tested the routine and it seems to be working...

How the routine works:

I used a simple circle/circle collision detection function to calculate the distance between the computer's ship and the rocks. If the ship is within 24 pixels of the rock, then reverse the computers thrust (making it move backwards), then continue moving forward. Because the computer automatically avoids the rocks, it is somewhat slowed down, it would be fair to reduce the human's overall speed to make it more of a challenge.


.n7   spacerace_avoidance.n7 (Size: 6.76 KB / Downloads: 7)

There still needs to be more tests but the initial few runs went without error... Feel free to modify or remove (will not be offended... But, if you do remove it, you will be struck from my Xmas list... Nah. Kidding. I do not have a Xmas list... lol)
Logic is the beginning of wisdom.
Reply
#10
(12-20-2023, 07:38 AM)johnno56 Wrote: ...
[ File : spacerace_avoidance.n7 ]

.. But, if you do remove it, you will be struck from my Xmas list... 

PERFECT !!! now the computer spaceship always wins  Dodgy Dodgy and the human player hardly hardly hardly wins  Sad 
It's very suspicious, you are using super AI (Artificial Intelligence) to make it  Big Grin Big Grin  

By the way, the logic whether I am in your Xmas list or not is determined by this piece of code below ...
And fortunately, the result of the code says that " I am included in Johnno's Xmas list "  Big Grin Big Grin 

Merry Snowflakes and Starfleet Christmas Johnno  Smile
Code:
#win32
set window "Xmas List",320,320

if 2023*2/2-2023 then
    wln "Remove from Johnno's Xmas list"
else
    wln "I am included in Johnno's Xmas list"
endif
   
do
  wait 1
until keydown(KEY_ESCAPE)
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)