Per-pixel map scroller for ATM-Turbo compatibles

Show us what you're working on, (preferably with screenshots).
Post Reply
Alone Coder
Manic Miner
Posts: 401
Joined: Fri Jan 03, 2020 10:00 am

Per-pixel map scroller for ATM-Turbo compatibles

Post by Alone Coder »

A tile-sprite engine for future games (maybe platformers?). Could fit in one frame at Pentagon 2.666LE, 25 fps at ZX Evo. Sprites are clipped for any needed window.

https://www.youtube.com/watch?v=L8ypWt5Rd5U

The engine is based on a big array of ld:push (one line of one layer = 256 bytes, so, 1024 bytes for 1024 pixel wide picture). You can load a picture in it, or you can update the edges from the map. Currently it is 256x64 map made of 16x16 metatiles. Each metatile consists of 4 8x8 tiles, that can be changed indepentently, but the "fonts" are linked to the given X&1, Y&1 (each 1/4 of a metatile has its own "font" of 256 tiles).

The sources are there: http://nedoos.ru/
Ralf
Rick Dangerous
Posts: 2283
Joined: Mon Nov 13, 2017 11:59 am
Location: Poland

Re: Per-pixel map scroller for ATM-Turbo compatibles

Post by Ralf »

Interesting stuff. These clones aren't much popular in the West, I suppose but if there is a really good game made for them, then people will
certainly want to play it.

Nice funky remake of Imperial March too ;)
Alone Coder
Manic Miner
Posts: 401
Joined: Fri Jan 03, 2020 10:00 am

Re: Per-pixel map scroller for ATM-Turbo compatibles

Post by Alone Coder »

I hope NedoOS will help in making good games, with its memory and file control.

I wrote there a number or simple games where anyone can copy-paste procedures. For example, this Untangle game for lines and cursor control:
https://www.youtube.com/watch?v=RBGllLW7yVc
Alone Coder
Manic Miner
Posts: 401
Joined: Fri Jan 03, 2020 10:00 am

Re: Per-pixel map scroller for ATM-Turbo compatibles

Post by Alone Coder »

I made a faster version of Untangle:
https://youtu.be/M6I0CeVlhMw
Now with music!
User avatar
djnzx48
Manic Miner
Posts: 730
Joined: Wed Dec 06, 2017 2:13 am
Location: New Zealand

Re: Per-pixel map scroller for ATM-Turbo compatibles

Post by djnzx48 »

This looks cool (the game and the scrolling engine). I have a character scrolling game that currently only targets 128K Spectrums, but it would be nice to have pixel scrolling on enhanced computers, if possible. (I don't yet know if it's feasible to try to support both NedoOS and the standard Spectrum in a single program.)

Does the demo depict the maximum number and size of sprites available, or can it handle more (or larger) sprites?
Alone Coder
Manic Miner
Posts: 401
Joined: Fri Jan 03, 2020 10:00 am

Re: Per-pixel map scroller for ATM-Turbo compatibles

Post by Alone Coder »

djnzx48 wrote: Fri Jun 26, 2020 3:54 pm This looks cool (the game and the scrolling engine). I have a character scrolling game that currently only targets 128K Spectrums, but it would be nice to have pixel scrolling on enhanced computers, if possible. (I don't yet know if it's feasible to try to support both NedoOS and the standard Spectrum in a single program.)

Does the demo depict the maximum number and size of sprites available, or can it handle more (or larger) sprites?
The number of sprites is unlimited. Supported sprite heights are 8,16,24,32 (more can be added in code, they looks mostly the same). Sprite width is not fixed (spmaxwid constant used for X coordinate correction at the left screen margin).
The game loop looks like this:
1. Draw background
2. Draw sprites and anything you want
3. Swap screen
4. Process input and game logic (preferably as many times as many frames passed)

Now I'm thinking out the idea how to make applications not to spoil each other's screen.
A) Call "I want to draw" in the beginning and "I ended drawing" in the end - is prone to programmer errors. And the call to system routines is slow.
B) Have 4 variables in the kernel that contain 4 pages of screens (2 for each). When you start drawing (either on the current screen or on the hidden screen), you get one or two of these pages in CPU memory. When you lose the focus, OS must change these pages in your CPU memory and these variables too. When you take the focus, OS returns true values in these variables.
Sadly there is no place for 4 bytes in the kernel if we want CP/M compatibility, only 2 bytes remained. Maybe CP/M compatibility is no more needed.

I prefer the B option.

BTW I made a video, how to play music in the web browser NedoBrowser in the background (E to edit url, L to load and play, Break to stop playing)
https://www.youtube.com/watch?v=0aEx8n-L5dQ
It seems mouse wheel spoils the idea somehow. Maybe I should limit its rotation.
User avatar
djnzx48
Manic Miner
Posts: 730
Joined: Wed Dec 06, 2017 2:13 am
Location: New Zealand

Re: Per-pixel map scroller for ATM-Turbo compatibles

Post by djnzx48 »

Thanks for the details. I looked at the source code more closely and it makes a bit more sense now.
Alone Coder wrote: Sat Jun 27, 2020 8:57 am Now I'm thinking out the idea how to make applications not to spoil each other's screen.
Maybe my assumptions are incorrect, but doesn't each application have access to the memory of all other running applications (or is there some form of memory protection)? Do you mean that the wrong application's screen may end up being paged in after a context switch?
Alone Coder
Manic Miner
Posts: 401
Joined: Fri Jan 03, 2020 10:00 am

Re: Per-pixel map scroller for ATM-Turbo compatibles

Post by Alone Coder »

djnzx48 wrote: Sun Jun 28, 2020 1:26 pm
Alone Coder wrote: Sat Jun 27, 2020 8:57 am Now I'm thinking out the idea how to make applications not to spoil each other's screen.
Maybe my assumptions are incorrect, but doesn't each application have access to the memory of all other running applications (or is there some form of memory protection)? Do you mean that the wrong application's screen may end up being paged in after a context switch?
ATM-Turbo only has 2 screen areas (as in 128K). So every application uses the same screen pages. We can have separate screen buffers for each application this way: only the focused application accesses true screen pages, and the rest access their own screen buffers. When focus lost, OS must copy the screen to the screen buffer of the task and set screen page numbers in that task accordingly. When focus is taken, OS must copy it back and set page numbers in that task to the actual screen pages.
So NedoPC guys told me :)
There's no memory protection. In theory, we can add some wiring to allow port access only in the kernel space, and allow switching to the kernel space only by RST n. RAM banking calls will be protected - but slow. So, not now :)

P.S.: the scroll when NedoBrowser lost focus was a bug, now fixed.
Alone Coder
Manic Miner
Posts: 401
Joined: Fri Jan 03, 2020 10:00 am

Re: Per-pixel map scroller for ATM-Turbo compatibles

Post by Alone Coder »

I found 4 free bytes in CP/M kernel, started to add the screen protection.
Wrote a faster line routine. So, level 13 is playable, maybe level 14 too:
https://www.youtube.com/watch?v=TFJtVqetKpk
My daughter liked the last music track :)
Alone Coder
Manic Miner
Posts: 401
Joined: Fri Jan 03, 2020 10:00 am

Re: Per-pixel map scroller for ATM-Turbo compatibles

Post by Alone Coder »

I added the screen protection without copying pages. So, programs just use the 4 variables with screen page numbers (that could contain kilable page), and every program must handle the "redraw" message from the OS (for Black Raven, this was the hardest, not all loops in the game do this).
Testing:
https://youtu.be/3hBncjNBCMM
Features AY remixes of music from "Unreal" game :)
Alone Coder
Manic Miner
Posts: 401
Joined: Fri Jan 03, 2020 10:00 am

Re: Per-pixel map scroller for ATM-Turbo compatibles

Post by Alone Coder »

Kernel page management bug fixed!
Testing:
https://www.youtube.com/watch?v=Erenfun4Y2c
(Music from variour AY music compos)
https://www.youtube.com/watch?v=nPXnWU0GUNs
(Music by Ironman)

I started a Twitch channel about NedoOS development (in Russian): https://www.twitch.tv/alone_coder
The first two broadcasts weren't saved (bug in Twitch Studio?). Here is the today's one:
https://www.youtube.com/watch?v=7YQ6013mtOA
User avatar
djnzx48
Manic Miner
Posts: 730
Joined: Wed Dec 06, 2017 2:13 am
Location: New Zealand

Re: Per-pixel map scroller for ATM-Turbo compatibles

Post by djnzx48 »

Interesting! Although the commentary is in Russian, the auto-translated captions are just about understandable. I got the impression from the development video that memory is fairly tight in the kernel.

I wondered how many levels there were altogether in Untangle, so I looked at the source. It seems like it's going to take quite a while to get through all of them.
Alone Coder
Manic Miner
Posts: 401
Joined: Fri Jan 03, 2020 10:00 am

Re: Per-pixel map scroller for ATM-Turbo compatibles

Post by Alone Coder »

In theory, Untangle has infinite number of levels, they are randomly generated :) In fact, all levels since level 21 will have 255 vertices in the mesh (all the previous levels have 6,10,15... "triangle numbers" of vertices).

In today's stream we made one more speedup in collision detection in Untangle, so I might pass level 21 in the future:
https://www.youtube.com/watch?v=dF17twNgxYo
Alone Coder
Manic Miner
Posts: 401
Joined: Fri Jan 03, 2020 10:00 am

Re: Per-pixel map scroller for ATM-Turbo compatibles

Post by Alone Coder »

Surprisingly, Lord Vader made one more speedup in collision detection. This matters a lot at higher levels, because the number of vertices grows as a square, and the number of checks grows as a square of number of vertices, i.e. like n^4.

Levels 17-18:
https://www.youtube.com/watch?v=_krTJrVr5QI
Today's stream (the viewers became active at last :)):
https://www.youtube.com/watch?v=J4cRHlSq9c0
Alone Coder
Manic Miner
Posts: 401
Joined: Fri Jan 03, 2020 10:00 am

Re: Per-pixel map scroller for ATM-Turbo compatibles

Post by Alone Coder »

In a series of streams, I added a windowing system for menus in Scratch (labels, buttons, flags, edits, radio buttons). DimkaM added possibility to upload and start programs remotely (they are also auto-closed if you upload the same program), as well as to play music and show pictures.
On task close, its files are closed and its music stopped.
OS_GETSCREENPAGES is finally removed.

https://www.youtube.com/watch?v=hyzn-T6oOfw
Alone Coder
Manic Miner
Posts: 401
Joined: Fri Jan 03, 2020 10:00 am

Re: Per-pixel map scroller for ATM-Turbo compatibles

Post by Alone Coder »

In another series of streams, I added pipes and primitive ANSI terminal, and commands like "dir >file" with stdout changed to file.
https://www.youtube.com/watch?v=-bTq76vHppA
Alone Coder
Manic Miner
Posts: 401
Joined: Fri Jan 03, 2020 10:00 am

Re: Per-pixel map scroller for ATM-Turbo compatibles

Post by Alone Coder »

NedoOS can now be remotely controlled over Telnet! (well, over raw TCP in fact :))
https://www.youtube.com/watch?v=SHceOFUhGoA
Alone Coder
Manic Miner
Posts: 401
Joined: Fri Jan 03, 2020 10:00 am

Re: Per-pixel map scroller for ATM-Turbo compatibles

Post by Alone Coder »

DimkaM solved level 18 of Untangle, and there were bugs in level 19 and on (now fixed).
Telnet server now works as indended.
Separate local terminals keep their screen and work well independently.
In the latest stream, I also showed several multicolors for 128K and how to convert gfx for them.
https://www.youtube.com/watch?v=UC40VV8_iXk
Alone Coder
Manic Miner
Posts: 401
Joined: Fri Jan 03, 2020 10:00 am

Re: Per-pixel map scroller for ATM-Turbo compatibles

Post by Alone Coder »

Started streaming the game engine development. I added a character which can run & jump, added a tracking camera:
https://www.youtube.com/watch?v=nXuWrjeK2oo
Alone Coder
Manic Miner
Posts: 401
Joined: Fri Jan 03, 2020 10:00 am

Re: Per-pixel map scroller for ATM-Turbo compatibles

Post by Alone Coder »

Taking objects, adding sounds.
In the end, Wolf 3D engine handling is described in detail:
https://www.youtube.com/watch?v=onBqBEJ ... e=youtu.be
BTW Telnet already works (tried PuTTY and Hyperterm). There is also scrolling ability in the terminal and mouse and simple copy-paste feature.
Alone Coder
Manic Miner
Posts: 401
Joined: Fri Jan 03, 2020 10:00 am

Re: Per-pixel map scroller for ATM-Turbo compatibles

Post by Alone Coder »

Bullets now decrease health and kill enemies, they drop through floor when dead:
https://www.youtube.com/watch?v=RRtt-ixuzng

NedoOS is rewritten for scrolling terminal, you can even copy and paste in it.
cmd now supports commands like dir > filename, dir | more.com, more.com < filename. Full documentation for API is being written.
https://www.youtube.com/watch?v=PtkQyAuSewA
Alone Coder
Manic Miner
Posts: 401
Joined: Fri Jan 03, 2020 10:00 am

Re: Per-pixel map scroller for ATM-Turbo compatibles

Post by Alone Coder »

In the recent streams I ported Turbo Pascal and BDS C Compiler into NedoOS.
Alone Coder
Manic Miner
Posts: 401
Joined: Fri Jan 03, 2020 10:00 am

Re: Per-pixel map scroller for ATM-Turbo compatibles

Post by Alone Coder »

Streams are moved to YouTube.

Added gfx library for BDS C.
Total speedup of term and stdio.
Long names included in cmd and Nedovigator:
https://www.youtube.com/watch?v=wmp-VW6nXqU
The game engine is abandoned because of no feedback.
Alone Coder
Manic Miner
Posts: 401
Joined: Fri Jan 03, 2020 10:00 am

Re: Per-pixel map scroller for ATM-Turbo compatibles

Post by Alone Coder »

I fixed q1 game (network shooter deathmatch, originally for AY-based LAN) for ZXNetUSB, so it can play over Internet.
https://youtu.be/xBMliQYi0O8
So, now we have two realtime net games in NedoOS.
Post Reply