Space Race - Printable Version +- NaaLaa (https://www.naalaa.com/forum) +-- Forum: NaaLaa (https://www.naalaa.com/forum/forum-1.html) +--- Forum: NaaLaa 7 Code (https://www.naalaa.com/forum/forum-4.html) +--- Thread: Space Race (/thread-20.html) Pages:
1
2
|
Space Race - johnno56 - 12-13-2023 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... spacerace.n7 (Size: 7.6 KB / Downloads: 14) ps: What were you doing in 1973? RE: Space Race - 1micha.elok - 12-14-2023 (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... 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 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 Let's the fun begin RE: Space Race - johnno56 - 12-14-2023 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 RE: Space Race - kevin - 12-15-2023 Very nice Johnno.....it would be an interesting challenge to add some code to allow player 1 to play against the computer. RE: Space Race - johnno56 - 12-15-2023 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... RE: Space Race - Marcus - 12-19-2023 (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 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. RE: Space Race - johnno56 - 12-19-2023 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... RE: Space Race - 1micha.elok - 12-20-2023 (12-14-2023, 06:45 AM)johnno56 Wrote: ... 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 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() 3. It is a simplified version i.e.Rocks only move from left to right i.e.Human Player vs Computer Player (only move forward, most of the time it hits the rocks ) Code: function PlayersMovement() Once again, thanks to Johnno56 for having shared the source code of Space Race in Naalaa RE: Space Race - johnno56 - 12-20-2023 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. 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) RE: Space Race - 1micha.elok - 12-22-2023 (12-20-2023, 07:38 AM)johnno56 Wrote: ... PERFECT !!! now the computer spaceship always wins and the human player hardly hardly hardly wins It's very suspicious, you are using super AI (Artificial Intelligence) to make it 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 " Merry Snowflakes and Starfleet Christmas Johnno Code: #win32 |