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.
eurocamsuite
Berk
Posts: 15
Joined: Sun Mar 17, 2019 3:51 am

CraPONG! v1.1 Experimental software in BASIC compiled

Post by eurocamsuite » Tue May 28, 2019 6: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, 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
5 x

zxbruno
Dizzy
Posts: 78
Joined: Sun Mar 04, 2018 6:13 am

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

Post by zxbruno » Wed May 29, 2019 12:33 pm

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.
0 x

Joefish
Manic Miner
Posts: 657
Joined: Tue Nov 14, 2017 10:26 am

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

Post by Joefish » Wed May 29, 2019 2:43 pm

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.
0 x

eurocamsuite
Berk
Posts: 15
Joined: Sun Mar 17, 2019 3:51 am

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

Post by eurocamsuite » Wed May 29, 2019 7:52 pm

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 😃
0 x

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

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

Post by ZXDunny » Wed May 29, 2019 11:43 pm

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
0 x

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

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

Post by d2010 » Tue Jul 02, 2019 5:28 am

eurocamsuite wrote:
Tue May 28, 2019 6: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
0 x

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

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

Post by ZXDunny » Tue Jul 02, 2019 9:00 am

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.
0 x

User avatar
djnzx48
Manic Miner
Posts: 583
Joined: Wed Dec 06, 2017 2:13 am
Location: New Zealand

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

Post by djnzx48 » Tue Jul 02, 2019 9: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.
0 x

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

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

Post by d2010 » Tue Jul 02, 2019 9:30 am

djnzx48 wrote:
Tue Jul 02, 2019 9: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.
0 x

hikoki
Manic Miner
Posts: 405
Joined: Thu Nov 16, 2017 10:54 am

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

Post by hikoki » Tue Jul 02, 2019 10:29 am

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.
0 x

Post Reply