On the subject of horizontal software scrolling games

Discuss all aspects of programming here. From 8-bit through to modern architectures.
User avatar
tricky
Posts: 1823
Joined: Tue Jun 21, 2011 8:25 am
Contact:

On the subject of horizontal software scrolling games

Postby tricky » Sat Nov 19, 2016 9:15 pm

At this point, this should probably be on RetroSoftware in a software development thread!
Carrying on from "Super Mario on the BBC?" viewtopic.php?f=1&t=12020&start=90 I thought I would take another look at Scramble. I do like a blast every now and then, but the beeb versions while good, either scroll too fast or scroll at an uncomfortable frame rate.
I had a quick look around for a map to see how big it was and how much memory it would require and to see if it would even be feasible. The only map I could find was not the arcade original, so I got sidetracked creating one!
I discovered that the game should scroll one mode 1 or mode 4 pixel per frame, not two as I had though, so mode 5 is probably out, leaving mono probably.
I got a video of it being played in mame, then used VirtualDub to resize and trim it so that it exported the right hand 4 pixels of each frame as thousands of TGAs. I was hoping to just grab the right pixel and stitch them together, but the video wasn't completely stable.
map6607.png
The dashes are where a non scrolling star appears, the streaks are the flying saucers and the little blobs the fireballs.
Attached is the code that I used to make the attached map - nothing to run on the beeb yet, but hopefully someone will find it interesting.
I also fixed the broken Tga::compare function (it was OK before it got optimised to memcmp!). tga2equb is the stitcher (remember I said I usually start with that code and repurpose it).

How the stitcher works.
The stitcher works by looking up from the bottom right pixel of the map so far, the bottom of the magenta at the start of the map and then scans up until it finds another colour. I then copy a 4x8 pixel block with the colour change in the middle on the right. From the same height on the four pixel wide strip that I am trying to append, I copy the same 4x8 section. To deal with the points where the palette changes, I replace the colour below the line with red, the ground line green and everything else blue (or some order!).
Using the same method I colour the copy of the new bit of strip and then try to match them up, first trying 1 new pixel, then none, and finally 2.
Once I find the overlap, I was just copying the new bit, but that means on the next check the bits under the line and the lines will not match each other in the map, so I changed to copying the whole new strip.
My plan for the next section of map it to search for the brick floor and later ceiling and use those to fit the new strip.
Attachments
Scramble.zip
(7.47 KiB) Downloaded 25 times

User avatar
oss003
Posts: 2518
Joined: Tue Jul 14, 2009 11:57 am
Location: Netherlands
Contact:

Re: On the subject of horizontal software scrolling games

Postby oss003 » Sat Nov 19, 2016 9:48 pm

Scramble was also one of my favourites in the 80's :D

Looks like the background is build with just a few blocks, these are the graphics of the game:

scramble1.png
scramble2.png

I also found a site with a lot of ZX Spectrum maps: http://www.zx-spectrum.cz/maps-direct.php

Greetings
Kees

User avatar
tricky
Posts: 1823
Joined: Tue Jun 21, 2011 8:25 am
Contact:

Re: On the subject of horizontal software scrolling games

Postby tricky » Sun Nov 20, 2016 8:07 am

Thanks.
I wonder why mame thinks the vertical resolution (with the monitor turned portrait) is 768, I've seen it a few times, but usually all the graphics have their pixels elongated.
I've seen some of those maps before, but never found the index page. The spectrum version would be a good start for a memory saving version as someone else has already shrink everything to fit the reduced horizontal (compared to some home micros) and vertical resolutions.

User avatar
tricky
Posts: 1823
Joined: Tue Jun 21, 2011 8:25 am
Contact:

Re: On the subject of horizontal software scrolling games

Postby tricky » Sun Nov 20, 2016 9:40 am

Added some code to tga2equb to spot the colours used in bricks and got to the end of the video, need a better video or to get to the end myself!
I don't think I had noticed that you can see starts through the gaps between the bricks.

Scramble.zip: No beeb software. tga2equb was copied from hscroll, which must have been an old version as BLACK was actually transparent white! Added write region. Warning Tga::operator = is bitwise!

EDIT: I thought it would be easier to fit the bottom instead of finding the bricks, but 4 pixels isn't enough for this, so fixed the few issues manually!
map_brick.png
Map updated.
Attachments
Scramble.zip
(4.71 KiB) Downloaded 27 times

User avatar
Rich Talbot-Watkins
Posts: 1090
Joined: Thu Jan 13, 2005 5:20 pm
Location: Palma, Mallorca

Re: On the subject of horizontal software scrolling games

Postby Rich Talbot-Watkins » Sun Nov 20, 2016 6:06 pm

How do you imagine this working on the Beeb then? Mode 1, and just plotting changed edges of the landscape? Haven't done the calculations but my instinct is that wouldn't work quickly enough, along with all the sprites which would need continually updating...

User avatar
tricky
Posts: 1823
Joined: Tue Jun 21, 2011 8:25 am
Contact:

Re: On the subject of horizontal software scrolling games

Postby tricky » Sun Nov 20, 2016 7:53 pm

I'm not sure if it would work, but probably mode 4 :(
At 16x8 tiles, there are 117 including sprites in the parts of the map that I have converted so far without the extra combinations of what is next to them.
The bricks would have to be changed to solid colour, the sprites could be part of the landscape and then maybe patched as blank or BIT when moving or destroyed.
After doing the mario level, I'm pretty sure it could be drawn, but the sprites are definitely a worry and mode1, would need to be done more like I did the ground in the mario demo as well as going to 224x208 (play area is 224x200) unless the score and status were vertical :shock:.
For mode 1, some of the micro detail in the landscape tiles would probably have to go (maybe an industrial theme).
e.g. There are several types of each diagonal, which give nearly the same outline.
I mainly though that it was interesting to post as there was no proper scramble map and the way of mapping it seemed novel :D

User avatar
tricky
Posts: 1823
Joined: Tue Jun 21, 2011 8:25 am
Contact:

Re: On the subject of horizontal software scrolling games

Postby tricky » Mon Nov 21, 2016 8:22 pm

In mode 4, it requires about twice as many tile pairs, so double the tile memory.
Mode 1, it is about the same number of pairs as mode 4, but as there are only four copies, it is about the same memory as the SMB level.
I have included the rockets, fuel and whatever the other things are, so it would draw as the attached image, but with 4 colours.
map.png
The worst case frame is less than half the worst case mario frame, so mode 1 seems feasible.
The two pages wide do add a twist, but I like the idea of not having to handle the wrapping when drawing sprites.
Because there would be twice as many lda/sta sets (columns) in mode 1, either the map would need decoding differently or the improved way of handling things scrolling on and off would need implementing.
As I think there is only ever one target per column, it should be possible to swap which character is being scrolled in place.
The map is at least 3 times longer, so SWR would probably be required.
What do people think? Still no promises :roll:

User avatar
Pernod
Posts: 943
Joined: Fri Jun 08, 2012 10:01 pm
Location: Croydon, UK

Re: On the subject of horizontal software scrolling games

Postby Pernod » Mon Nov 21, 2016 8:51 pm

You're map ends at the point I used to die :lol: How did Rocket Raid and Moon Raider do it, or were their maps shorter?
- Nigel

BBC Model B, ATPL Sidewise, Acorn Speech, 2xWatford Floppy Drives, AMX Mouse, Viglen case, etc.

User avatar
tricky
Posts: 1823
Joined: Tue Jun 21, 2011 8:25 am
Contact:

Re: On the subject of horizontal software scrolling games

Postby tricky » Mon Nov 21, 2016 9:30 pm

I'm not sure how accurate their maps were, but one scrolled too fast and the other only scrolled every few frames.

User avatar
tricky
Posts: 1823
Joined: Tue Jun 21, 2011 8:25 am
Contact:

Re: On the subject of horizontal software scrolling games

Postby tricky » Tue Nov 22, 2016 8:55 pm

Four colour map of attached level would be 9K, so probably 10K by the time the rest is mapped, 5K more for the tiles and 12K + status area for the screen.
map4c.png
Since the game force scrolls, a bit more data could be embed in the map to reduce the work of repacking the draw code, which would probably push into SWR, but that would leave plenty of room.

EDIT: Using a map more like RichTW was suggesting on the SMB thread, you could probably half the 9K.

User avatar
oss003
Posts: 2518
Joined: Tue Jul 14, 2009 11:57 am
Location: Netherlands
Contact:

Re: On the subject of horizontal software scrolling games

Postby oss003 » Wed Nov 23, 2016 5:47 pm

Hi Tricky,

just had a look at the F14-Tomcat map. I have converted this game to the Atom and 1 level is 'only' $800 bytes.
The background even has parallax scrolling. I know it's a vertical scroller but the size of a level isn't that big.

Tomcat.png

https://youtu.be/KDU-Wqjm0ak

Greetings
Kees

User avatar
tricky
Posts: 1823
Joined: Tue Jun 21, 2011 8:25 am
Contact:

Re: On the subject of horizontal software scrolling games

Postby tricky » Thu Nov 24, 2016 7:39 am

Nice one Kees that looks like it would go nicely in the virtical shooter framework I am doing over at RS. At 2k per section and 4 sections totaling less than the scramble map, it is about the same screen lines per byte, but does have rather more detail ;)
I think the scramble map could probably be reduced down to about 3k, but it needs to be stored to make assembling the draw code quick enough to be done in the spare time from two 50fps frames.
I might try to code something up tonight.
Kees, did you have a go at the stars? I must check the Atom screen memory layout, as I think it might even be easier on the Atom.

User avatar
oss003
Posts: 2518
Joined: Tue Jul 14, 2009 11:57 am
Location: Netherlands
Contact:

Re: On the subject of horizontal software scrolling games

Postby oss003 » Fri Nov 25, 2016 5:32 pm

I'll have a look at the stars program.

The Atom screen memory map is much easier to use than the BBC screen memory map.

8000 - 8001 - 8002 ........ 801F
8020 - 8021 - 8022 ........ 803F
....
97E0 - 97E1 - 97E2 ........ 97FF

So 32 bytes per line and 192 lines per screen.

Time for an Atom demo ......... ;)

Greetings
Kees

User avatar
tricky
Posts: 1823
Joined: Tue Jun 21, 2011 8:25 am
Contact:

Re: On the subject of horizontal software scrolling games

Postby tricky » Fri Nov 25, 2016 6:32 pm

That's great, only beaten in my mind by having all the bytes in vertical columns 256 bytes deep.
You won't even need half the stars code then, which won't save many CPU cycles, but will save some space.

User avatar
oss003
Posts: 2518
Joined: Tue Jul 14, 2009 11:57 am
Location: Netherlands
Contact:

Re: On the subject of horizontal software scrolling games

Postby oss003 » Fri Nov 25, 2016 9:57 pm

Yep, stars is working ....... :)

https://youtu.be/FwW7AlomENI

Greetings
Kees

User avatar
tricky
Posts: 1823
Joined: Tue Jun 21, 2011 8:25 am
Contact:

Re: On the subject of horizontal software scrolling games

Postby tricky » Sat Nov 26, 2016 8:38 am

It's a bit hard to tell from that video ;)
If you make it 1280x720p50/60, YouTube will keep the 50/60 Hz. It doesn't need to fill the area, so you can still keep the steam acceptable.

User avatar
oss003
Posts: 2518
Joined: Tue Jul 14, 2009 11:57 am
Location: Netherlands
Contact:

Re: On the subject of horizontal software scrolling games

Postby oss003 » Sat Nov 26, 2016 9:01 am

Which program are you using to record the video because I use CAM Studio but the recorded framerate is only 12 frames/sec at a resolution of 518 x 433??

User avatar
tricky
Posts: 1823
Joined: Tue Jun 21, 2011 8:25 am
Contact:

Re: On the subject of horizontal software scrolling games

Postby tricky » Sat Nov 26, 2016 10:08 am

I usually use the video feature in beebem, but also use virtual dub on windows to capture an area of the screen, having set the desktop rate to 50hz for b-em.
I would have thought that any emulator could be persuaded to write out a stream of PNGs out similar, which can then be converted to a video- soundtrack separate.

User avatar
oss003
Posts: 2518
Joined: Tue Jul 14, 2009 11:57 am
Location: Netherlands
Contact:

Re: On the subject of horizontal software scrolling games

Postby oss003 » Sat Nov 26, 2016 10:56 am

Wouter Ras his DOS emulator had this option but Atomulator not.
IIRC David Boddie added this feature to Elkulator so maybe it can easily be added into Atomulator, I'll have a look.

@David, did you finish this project?

http://www.boddie.org.uk/david/www-repo ... 01-23.html

Greetings
Kees

User avatar
davidb
Posts: 1832
Joined: Sun Nov 11, 2007 10:11 pm
Contact:

Re: On the subject of horizontal software scrolling games

Postby davidb » Sat Nov 26, 2016 12:07 pm

I couldn't figure out the palettes to use with B-Em and Arculator. :( It may be a lot simpler with Atomulator if it is like Elkulator. :)

User avatar
oss003
Posts: 2518
Joined: Tue Jul 14, 2009 11:57 am
Location: Netherlands
Contact:

Re: On the subject of horizontal software scrolling games

Postby oss003 » Sat Nov 26, 2016 12:09 pm

Hi David,

The Atom has a static palette and Atomulator looks like elkulator.
Are the sources available?

Greetings
Kees

User avatar
davidb
Posts: 1832
Joined: Sun Nov 11, 2007 10:11 pm
Contact:

Re: On the subject of horizontal software scrolling games

Postby davidb » Sat Nov 26, 2016 1:15 pm

All my commits can be found in a Mercurial repository. I would guess that you would make changes to the video.c file in Atomulator that I made to the ula.c file in Elkulator. I dump raw video and audio data to files that I process afterwards because I found that compressing individual frames was quite processor-intensive.

User avatar
tricky
Posts: 1823
Joined: Tue Jun 21, 2011 8:25 am
Contact:

Re: On the subject of horizontal software scrolling games

Postby tricky » Mon Dec 12, 2016 9:42 pm

Just a little audio test ;)
Attachments
scrambl.zip
just the intro then silence
(1.89 KiB) Downloaded 35 times

User avatar
oss003
Posts: 2518
Joined: Tue Jul 14, 2009 11:57 am
Location: Netherlands
Contact:

Re: On the subject of horizontal software scrolling games

Postby oss003 » Wed Dec 14, 2016 9:52 pm

Sounds good tricky, is it a sample?

Greetings
Kees

User avatar
tricky
Posts: 1823
Joined: Tue Jun 21, 2011 8:25 am
Contact:

Re: On the subject of horizontal software scrolling games

Postby tricky » Wed Dec 14, 2016 11:13 pm

No, the same "music" player as in the last few demos and Frogger.
Only uses first two tone channels:

Code: Select all

ALIGN &100
.VOL_MACROs : .track2 : .track3 : EQUB 0
.VOL_MACRO0 : EQUB &19, 0
.VOL_MACRO3 : EQUB &19, &28, &17, &19, &28, &17
.VOL_MACRO4 : EQUB &19, &28, &27, &26, &15, 0
.VOL_MACRO2 : EQUB &19, &28, &17, &19, &28, &17
.VOL_MACRO1 : EQUB &19, &28, &27, &26, &25, &24, &23, &22, &11, 0
.track0 EQUB SET_SND_LEN + 24 * SND_LEN_DIV, SET_VOL_ENV + (VOL_MACRO1 - VOL_MACROs) * VOL_ENV_DIV, 3, SET_SND_LEN + 16 * SND_LEN_DIV, SET_VOL_ENV + (VOL_MACRO2 - VOL_MACROs) * VOL_ENV_DIV, 3, 0, SET_VOL_ENV + (VOL_MACRO3 - VOL_MACROs) * VOL_ENV_DIV, 3, SET_SND_LEN + 8 * SND_LEN_DIV, SET_VOL_ENV + (VOL_MACRO4 - VOL_MACROs) * VOL_ENV_DIV, 2, 3, 1, 3, 2, 3, 2, 3, 1, 3, 2, 3, 2, 3, 1, 3, 2, SET_VOL_ENV + (VOL_MACRO1 - VOL_MACROs) * VOL_ENV_DIV, 1, 0, END_TRACK ;; 31 31 bytes
.track1 EQUB SET_SND_LEN + 24 * SND_LEN_DIV, SET_VOL_ENV + (VOL_MACRO1 - VOL_MACROs) * VOL_ENV_DIV, 2, SET_SND_LEN + 16 * SND_LEN_DIV, SET_VOL_ENV + (VOL_MACRO2 - VOL_MACROs) * VOL_ENV_DIV, 2, 0, SET_VOL_ENV + (VOL_MACRO3 - VOL_MACROs) * VOL_ENV_DIV, 2, SET_SND_LEN + 8 * SND_LEN_DIV, SET_VOL_ENV + (VOL_MACRO4 - VOL_MACROs) * VOL_ENV_DIV, 4, 2, 3, 2, 4, 2, 4, 2, 3, 2, 4, 2, 4, 2, 3, 2, 4, SET_VOL_ENV + (VOL_MACRO1 - VOL_MACROs) * VOL_ENV_DIV, 3, 0, END_TRACK ;; 31 31 bytes
.snd_reglo EQUB 0, &01, &0A, &02, &04
.snd_reghi EQUB 0, &15, &1F, &19, &2A
The volume macros could really do with a tweak - auto converted mostly from an AY-3-8910 .VGM
It's about 100 bytes, but could be tweaked some more.
Attachments
DemoTunes.zip
four tunes - auto converted - still needs work
(9.57 KiB) Downloaded 37 times

User avatar
tricky
Posts: 1823
Joined: Tue Jun 21, 2011 8:25 am
Contact:

Re: On the subject of horizontal software scrolling games

Postby tricky » Fri Dec 16, 2016 7:35 am

Last batch of auto converted tunes for now.
I need to add splitting them into sections as the current system has a limit of 255 bytes per channel.
Attachments
MoreDemoTunes.zip
(8.82 KiB) Downloaded 31 times


Return to “programming”

Who is online

Users browsing this forum: No registered users and 1 guest