CraPONG! v1.1 Experimental software in BASIC compiled

People are still making stuff for the Sinclair related machines. Tell us about new games and other software that runs on the Spectrum, ZX80/ZX81, Pentagon and Next.
Post Reply
eurocamsuite
Drutt
Posts: 15
Joined: Sun Mar 17, 2019 3:51 am

CraPONG! v1.1 Experimental software in BASIC compiled

Post by eurocamsuite »

CraPONG! arises from an idea that occurred to me recently while I was in bed trying to sleep, or rather, thinking how I could animate the pixel a tennis paddle to mount a simple pong in the Spectrum BASIC with pixel by pixel shift, Knowingly, that all the original PONGs were developed in assembly code in its entirety, or even, in plates without a processor using electronic components and logic circuits in the first generation. Finally, on the night of May 26, I got to it and what I am presenting to you is the fruit of my digital lucubrations and also of my insomnia.

I must confess that with this simple development I have removed a thorn that I have always had nailed and also, a strong curiosity to know if something similar to a PONG could be done, probably the most relevant game in the history of the game, using only the BASIC of the ZX-Spectrum. Development still has a path of optimization because the code is primordial, but according to the result obtained it seems that it is possible, although the last word is yours.

Image

When I came up with the idea, I must admit that I had some doubts about BASIC's ability to achieve the goal but I was also convinced that this was the only possible way to move the palettes (blocks) pixel by pixel. Then, as far as the physics of the ball and the logic of the game are concerned, the native compiler MCODER3 and its succulent vitamin contribution did the rest.

The project is super basic, simple, spartan and probably very boring to play, but you will see that the purpose was not to create a video game itself but to experiment with a new technique and the code, still unpolished, does not allow for more. Not in vain, the version I am posting is compiled with our beloved MCODER3 and runs even in a 16K. The font occupies about 2KB and once compiled with the code added by the compiler its memory weight barely exceeds 7KB.

Web del proyecto #5 in ZXOPENSOURCE (SNA, TAP, Z80, source, manual, etc...) :
https://calentamientoglobalacelerado.ne ... rce/#prj05
User avatar
zxbruno
Manic Miner
Posts: 213
Joined: Sun Mar 04, 2018 6:13 am

Re: CraPONG! v1.1 Experimental software in BASIC compiled

Post by zxbruno »

This is very interesting, thank you!

There are a few Sinclair Basic demos on YouTube that show pixel scrolling but I've never seen the listings and don't know how it's done. I also remember seeing topics demonstrating horizontal text scrolling in Basic. I may have seen UDG pixel scrolling as well, and in all these cases the listing was never compiled. The only problem is that I can't find any of those topics right now. :| I read SCF and WOS forums but also follow the Spectrum Basic Facebook group. It's getting increasingly difficult to remember where something was posted.
User avatar
Joefish
Rick Dangerous
Posts: 2042
Joined: Tue Nov 14, 2017 10:26 am

Re: CraPONG! v1.1 Experimental software in BASIC compiled

Post by Joefish »

Is that done with UDGs or with pixel plotting?

Vertical pixel movement with UDGs is a fun one. I've seen something similar with a rotating counter effect.

For the counter, you define your UDGs as the numbers 0-9 and then 0 again. So when you print the first one you get a 0.
Then you POKE the UDGs system variable to one byte higher, and when you print it again it appears to have scrolled up 1 pixel. Keep going and it scrolls through the digits 0..9 and round to 0 again.

For small characters, you define the first, third, etc. as empty. Then you print character 'B', with 'C' underneath. Your image appears in the 'B' space and the 'C' under it is empty. Then you subtract one from the UDGs system variable and print them again. The image in 'B' will have moved down a pixel into the 'C' space. The top of 'B' is filled in with a blank line from the empty 'A' UDG. So you're printing 'B' and 'C', but after 8 steps 'A' and 'B' has slid down into the 'B' and 'C' position.

It means POKEing the system variable every time you want to print a character, but you can make it easy on yourself by moving it to a 256-byte boundary so you only have to adjust the lower byte of the address.

To pixel scroll left/right you need multiple copies of the graphic, pre-shifted left to right in 1 or 2-pixel steps, just as you would in machine code. You can combine this with the previous trick to get anywhere-pixel-positioning, but it wastes a lot of memory on all those empty spaces.
eurocamsuite
Drutt
Posts: 15
Joined: Sun Mar 17, 2019 3:51 am

Re: CraPONG! v1.1 Experimental software in BASIC compiled

Post by eurocamsuite »

This technique is totally innovative, at least it is certain that I have not seen it before. It occurred to me a few days ago.
This technique does not use GDUs to achieve vertical movement of the rackets or free movement of the ball, so the size of the BASIC source code does not exceed 2 KBytes. I only use high resolution BASIC native commands and you can download the program without compiling from my zxopensource website.

Soon I will publish a document to explain in detail this simple technique, although at the moment it will be in Spanish only, but you can always use an automatic translator;)

regards 😃
User avatar
ZXDunny
Manic Miner
Posts: 498
Joined: Tue Nov 14, 2017 3:45 pm

Re: CraPONG! v1.1 Experimental software in BASIC compiled

Post by ZXDunny »

It's pixel plotting (or rather, DRAW using INVERSE to un-draw the top/bottom lines as the paddles move vertically) and using CIRCLE (with INVERSE again to remove the ball as it moves) it's compiled so it does move smoothly though.

The small m/c stub at the end appears to modify the font.

Image
d2010
Dizzy
Posts: 79
Joined: Tue Mar 26, 2019 9:19 am

Re: CraPONG! v1.1 Experimental software in BASIC compiled

Post by d2010 »

eurocamsuite wrote: Tue May 28, 2019 7:44 pm CraPONG! arises from an idea that occurred to me recently while I was in bed trying to sleep, or rather, thinking how I could animate the pixel a tennis paddle to mount a simple pong in the Spectrum BASIC with pixel by pixel shift,
The main problem , is speed-of-Ball to high w/ith speed-of-racket. How to speed-up the speed of Racket?
:P
User avatar
ZXDunny
Manic Miner
Posts: 498
Joined: Tue Nov 14, 2017 3:45 pm

Re: CraPONG! v1.1 Experimental software in BASIC compiled

Post by ZXDunny »

Change the LET y=y+1 and LET y=y-1 statements in lines 10 and 20 respectively to add/subtract larger values, but you might find that you get stray lines of pixels above/below the paddles.
User avatar
djnzx48
Manic Miner
Posts: 729
Joined: Wed Dec 06, 2017 2:13 am
Location: New Zealand

Re: CraPONG! v1.1 Experimental software in BASIC compiled

Post by djnzx48 »

You could also try putting something like FOR n = 1 TO 2: NEXT n surrounding the paddle up/down routines so they execute twice or more in succession. That would avoid problems with the line drawing.
d2010
Dizzy
Posts: 79
Joined: Tue Mar 26, 2019 9:19 am

Re: CraPONG! v1.1 Experimental software in BASIC compiled

Post by d2010 »

djnzx48 wrote: Tue Jul 02, 2019 10:06 am You could also try putting something like FOR n = 1 TO 2: NEXT n surrounding the paddle up/down routines so they execute twice or more in succession. That would avoid problems with the line drawing.
You see here..Your game is very-good.Do you like this sinous-hide?
Thanks for Mr. Beeper sound-Like.
https://youtu.be/fc4W1vBWNqA?t=147
hikoki
Manic Miner
Posts: 576
Joined: Thu Nov 16, 2017 10:54 am

Re: CraPONG! v1.1 Experimental software in BASIC compiled

Post by hikoki »

Not a bad idea at all, Mr-Pixel! A Pong based on geometrical theory of gravity and flipping between different non-Euclidean geometries, a sort of Pinball Pong where the player can morph the spacetime maze. Each player could transform just his end or the opponent's one.
User avatar
ZXDunny
Manic Miner
Posts: 498
Joined: Tue Nov 14, 2017 3:45 pm

Re: CraPONG! v1.1 Experimental software in BASIC compiled

Post by ZXDunny »

Ralf
Rick Dangerous
Posts: 2279
Joined: Mon Nov 13, 2017 11:59 am
Location: Poland

Re: CraPONG! v1.1 Experimental software in BASIC compiled

Post by Ralf »

Interesting stuff. It flickers a little but seems smooth anyway.

One comment - PONG isn't first computer game in history. At least Spacewar! (https://en.wikipedia.org/wiki/Spacewar! ) is older and there are probably more.
User avatar
ZXDunny
Manic Miner
Posts: 498
Joined: Tue Nov 14, 2017 3:45 pm

Re: CraPONG! v1.1 Experimental software in BASIC compiled

Post by ZXDunny »

The first video game came out before there were any computers.
hikoki
Manic Miner
Posts: 576
Joined: Thu Nov 16, 2017 10:54 am

Re: CraPONG! v1.1 Experimental software in BASIC compiled

Post by hikoki »

Nice! Let the player change his racket colour and associate each colour to one of these trajectories
Image
Image
In addition, let these trajectories remain on the screen for a while so the ball gets deflected with ATTR. In practice, a sort of plasmapong-like shooting.
Players could also throw planets to the field, any number up to spending a mass of about seventy suns. Just like this ha!
Spoiler
eurocamsuite
Drutt
Posts: 15
Joined: Sun Mar 17, 2019 3:51 am

Re: CraPONG! v1.1 Experimental software in BASIC compiled

Post by eurocamsuite »

The truth is that I've been trying to accelerate the blades by increasing the displacement to 2 pixels, but then a disadvantage of playability arises, the artificial intelligence of the CPU becomes invincible.

Given this situation, I added some elements (defenses and forwards dribblers!!) in each field to get some more uncertainty in the game.
It seems that I have achieved it, but I will continue experimenting soon.

Thanks to everyone for the interest and for your interesting comments!

Image

This project is hosted in:
https://calentamientoglobalacelerado.net/ZXopensource/
eurocamsuite
Drutt
Posts: 15
Joined: Sun Mar 17, 2019 3:51 am

Re: CraPONG! v1.1 Experimental software in BASIC compiled

Post by eurocamsuite »

Experimenting with the possibilities of vectorial animation in BASIC-ZX I have managed to move a filled circle to the pixel with relative fuidez.

Image

In fact, this softness is achieved thanks to the combination of the power of the compiler MCODER3 with the technique used in CraPONG that allows to redraw and erase only the contours of the objects that we want to move.

I will document on my website https://calentamientoglobalacelerado.net/ZXopensource/, although it is quite simple.


regards!!
eurocamsuite
Drutt
Posts: 15
Joined: Sun Mar 17, 2019 3:51 am

Re: CraPONG! v1.1 Experimental software in BASIC compiled

Post by eurocamsuite »

New experimental software derivative from CraPONG!...

https://youtu.be/TYJFSJHM7UY

[media]https://youtu.be/TYJFSJHM7UY[/media]
llewelyn
Manic Miner
Posts: 205
Joined: Thu Feb 22, 2018 3:27 pm
Location: virginias eastern shore
Contact:

Re: CraPONG! v1.1 Experimental software in BASIC compiled

Post by llewelyn »

ZXDunny wrote: Tue Jul 02, 2019 3:39 pm The first video game came out before there were any computers.
What about 'Hunt the Hurkle'? I know that was on the mainframe at the London College of Printing in the late 60's if memory serves? I definitely remember the name but I'm not entirely sure about the date. It was on the Middlesex Polytechnic mainframe in 1980 I do know.
User avatar
ZXDunny
Manic Miner
Posts: 498
Joined: Tue Nov 14, 2017 3:45 pm

Re: CraPONG! v1.1 Experimental software in BASIC compiled

Post by ZXDunny »

llewelyn wrote: Thu Aug 08, 2019 9:40 pm
ZXDunny wrote: Tue Jul 02, 2019 3:39 pm The first video game came out before there were any computers.
What about 'Hunt the Hurkle'? I know that was on the mainframe at the London College of Printing in the late 60's if memory serves? I definitely remember the name but I'm not entirely sure about the date. It was on the Middlesex Polytechnic mainframe in 1980 I do know.
The earliest video game (because it used a screen to display the action rather than output to blinking lights to indicate a status) was "Tennis for two" and was created in 1958 - and was played on an oscilloscope.

https://www.bnl.gov/about/history/firstvideo.php
Post Reply