Strategies for 1 pixel vertical scrolling on 9918 VDP (MSX 1)

Page 1/6
| 2 | 3 | 4 | 5 | 6

By albs_br

Champion (473)

albs_br's picture

03-10-2020, 21:00

Hi guys, I'm working on Pacific 2, and one of the fundamental features I wish is a rich background with islands, beachs, rivers, mountains, etc with vertical scrolling, and the scroll must be fine, 1 pixel granularity.

My first take was: to have all the tiles needed pre loaded on patterns table, and search all names table incrementing each position, also doing tile scroll on all names table each 8 frames loading the next line on top screen and restarting the process. The cost of this approach is:
- 768 bytes read, at most 768 bytes write (each frame);
- plus 768 bytes write each 8 frames

BUT: after many days and everything working fine with very good speed (I will upload a video soon) I realized something that seems obvious now: there will be space for very few tiles this way, and so the background will be very poor.

Another approach then came to me: to have all the frames on ROM and copy them to patterns table, If I had, say, 64 different tiles, then will be 64 * 8 = 512 bytes each frame, plus the regular scroll on 768 bytes of names table each 8 frames.

It's bit frustrating send to trash a good part of the work done so far (I even done a set of utilities on C# to create the tiles), but it looks like I'm on a dead end and the first strategy has no future.

(I hope the explanation is clear enough to be understood)

Login or register to post comments

By albs_br

Champion (473)

albs_br's picture

03-10-2020, 21:10

Video of the first strategy (the only one implemented so far):

https://youtu.be/y00nyaNN0jM

By MsxKun

Paragon (1124)

MsxKun's picture

03-10-2020, 21:29

Hi

You're right. Strategy 1 gives you lack of patterns and 2 needs too many VRAM dumps to make it fast enough.
But maybe you can mix them. Maybe you can only dump from ROM to VRAM the water on your example (as there are a lot, tho... not so many if you plan to add detailed islands, beachs and so...), and have different patterns on name table for the rest. That gives you some more tiles. Maybe enough.

Do you really need 1 pixel per frame? If not.. maybe you can pass with 2 pixels and that reduces the number of tiles needed. So more different tiles free.
If the scroll is fast enough, difference between 1pix or 2pix is not too big.

The other option is to use MSX2 Wink Vertical scroll for free. And most of the people has some MSX2 or higher around.
If you don't, then it's not an option. Even if you can use emulator, it's not the same that play your game on your own MSX.

By MsxKun

Paragon (1124)

MsxKun's picture

03-10-2020, 21:34

albs_br wrote:

Another approach then came to me: to have all the frames on ROM and copy them to patterns table, If I had, say, 64 different tiles, then will be 64 * 8 = 512 bytes each frame, plus the regular scroll on 768 bytes of names table each 8 frames.

Forgot something about that. If you copy 64 tiles, * 8 bytes it is 512bytes indeed. But you need to copy 3 banks of tiles. That makes it triple waste Big smile

Also, remember you also need to dump your sprites' data. 4 bytes per sprite is not much, but when you have many... and your example has quite a lot of them.

By thegeps

Paragon (1189)

thegeps's picture

04-10-2020, 00:15

Well, in Freedom Fighter I update 30 tiles x 3 banks so 30x8x3=720 bytes. Then the same for colors (have you forgot about them?) so 720+720=1440 bytes+768 bytes (to update the nametable)=2208 bytes. Storing precalculated frames (even in a megarom) for such number of tiles means 30tiles x8 bytes (def) + 30x8 (colors)=480 bytes x8frames each=3840 bytes. And as you can see there still isn't a lot of variety (consider that you need different frames to have transictions between a tile and some different tiles: from grass to grass, from grass to tree, from grass type1 to grass type2 and often viceversa). I had to implememt a dual tileset (with some common tiles) to add variety and it still isn't enough... and my frames aren't precalculated, so they filled less room on megarom bank (16K ascii mapper). But consider that you have to add level map infos, attack pattern eventlist, bosses, musics, sprites (each level has its own on FF)... well, each 16K bank is nearly full on Freedom Fighter... I'll soon write about my scrolling tech if you are interested but it is expensive (but never say never, maybe you can improve it!)

By albs_br

Champion (473)

albs_br's picture

04-10-2020, 05:06

MsxKun wrote:

Do you really need 1 pixel per frame? If not.. maybe you can pass with 2 pixels and that reduces the number of tiles needed. So more different tiles free.
If the scroll is fast enough, difference between 1pix or 2pix is not too big.

Well, I really need 1px scrolling, as the bg speed is slow (you can see in the video). If you check 1942 for MSX 2 or arcade, the scroll is slow like this.

Quote:

The other option is to use MSX2 Wink Vertical scroll for free. And most of the people has some MSX2 or higher around.
If you don't, then it's not an option. Even if you can use emulator, it's not the same that play your game on your own MSX.

This is a frequent topic (why not go straight to MSX 2 and avoid all thjis "suffering"). I can point out some reasons:
- Nostalgia. I had only MSX 1 on my old days (MSX 2 wasn't sold in my country, expansion kits weren't an viable option at that time)
- I feel like I haven't used all the MSX 1 potential, maybe after I try something on MSX 2;
- The MSX 2 can be more powerful, BUT, the bar is set far higher too (remember Pointless Fighter and SMW for example). People now expect SNES level games and it's a huge task for an amateur dev working alone on few hours/week). The bigger the project, lower the chance of finishing it;
- MSX Dev accept only MSX1 (at least this year, next is an open question). Without a deadline, maybe I will never finish any project, as there is allways a new idea and make a POC is much more fun than the often tedios tasks needed to make a "complete" game.
- if I go to MSX 2, because is more powerful, why don't 2+, why don't Turbo R? Amiga? 486, Pentium II, III, IV??? When you see you are developing games on Unity for current PC's, what is the opposite of what I want at this moment. There is a trade off.

By albs_br

Champion (473)

albs_br's picture

04-10-2020, 05:08

MsxKun wrote:

Forgot something about that. If you copy 64 tiles, * 8 bytes it is 512bytes indeed. But you need to copy 3 banks of tiles. That makes it triple waste Big smile
.

OMG. You are right. That's why is always better to talk to somenoe else when you have an "eureka" moment. Often you are forgetting something...

By albs_br

Champion (473)

albs_br's picture

04-10-2020, 05:11

thegeps wrote:

Well, in Freedom Fighter I update 30 tiles x 3 banks so 30x8x3=720 bytes. Then the same for colors (have you forgot about them?)

Yep. I forgot the colors too...

I guess for now is better to stick with the first approach and try to draw a set of tiles that can be reused to make many shapes. Also get rid of less "valuable" tiles such as the A-Z chars to free space on patterns table.

I have to think well on this topic.

By sd_snatcher

Prophet (3659)

sd_snatcher's picture

04-10-2020, 06:06

Please don't get me as rude, but I had to state my POV about this specific argument.

Quote:

- if I go to MSX 2, because is more powerful, why don't 2+, why don't Turbo R? Amiga? 486, Pentium II, III, IV??? When you see you are developing games on Unity for current PC's, what is the opposite of what I want at this moment. There is a trade off.

I'm sure you didn't do this with an ill motive, but this is the well known slippery slope fallacy.

The MSX1, 2+ and TR are all classic MSX machines, and all of them are >=30 years old by now. The amount of time that separates "Unity for current PCs" from them is far greater than the amount of time that separates each MSX generation.

Amiga, 486s, Pentium, NES, PC-88, C64, FM-7 etc are all totally different platforms, regardless of whatever their architecture was made of. "Each to their own", as they say.
I'm sure PC users would find very awkward if anyone argued that only the IBM PC 5150 with CGA should be considered "a real PC", or only if the original OCS Amiga should be used, otherwise "why not use Unity for current PCs" instead? ;)

By MsxKun

Paragon (1124)

MsxKun's picture

04-10-2020, 10:08

Bit off-topic but... Why use Unity when you can use plain SDL2? ;P

By MsxKun

Paragon (1124)

MsxKun's picture

04-10-2020, 10:15

albs_br wrote:

Well, I really need 1px scrolling, as the bg speed is slow (you can see in the video). If you check 1942 for MSX 2 or arcade, the scroll is slow like this.

Well, you can just update scroll every 2 frames. Update sprites and stuff every frame as usual.

Page 1/6
| 2 | 3 | 4 | 5 | 6