Fast scrolling game howto, anyone?

Want to talks about games you like, would like to see developed on the Oric, it's here.
Post Reply
User avatar
Chema
Game master
Posts: 1975
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Fast scrolling game howto, anyone?

Post by Chema » Tue Feb 19, 2013 8:00 pm

Hi all.

Now that Twi is about to release a fantastic tool for designing tile-based games, I remembered I had something in my hard disk for months now. It is a quite disappointing test trying to find out a possible technique for fast scrolling games in the Oric.

I managed to produce masked sprites over a quite rich scrolling background even with some kind of paralax effect!, though my stars (those balls on the background which should be more spread) are just a first and not successful attempt, they are still on the background, while the rest of the world moves. Everything is done with double buffering and moves quite fast.

Of course still no animations for the ship, no other enemies (which would move as fast as your ship or lasers)...

Have a look at this video:
http://youtu.be/zS1SJmFYc20

You surely imagined it is using TEXT mode. This has many inconvenients I cannot figure out how to solve:
1. The scroll is bumpy. Yes, sub-character scrolling is not possible, so it is not smooth.
2. For the same reason it is not possible to scroll slowly (for the ships up and down moves it is indeed possible), so playability may suffer.
3. As there is no way to sync with the screen refresh, you sometimes "see" the drawing and the borders of the enemy "big ship" appear jagged as it scrolls. Anybody found a way to minimize this without the VSYNC cable hack?
4. TEXT mode means NO AIC mode, so very very little color. I am not sure I am ready to step back that much.
5. Tiles are used up very quickly, and there are not many of them. I am using currently 54+59 for the big ship, and several are needed for the sprites (the player's ship is 2x2, as well as the shadow, and 3x2 will be needed for sub-character up/down movement). Yes I am using both ALT and STD charsets. Ship animation does not take up extra tiles, however, as it is drawn from the image data in memory over the same tiles (this is mandatory anyway, as we want masked drawing).

The upper portion of the screen (in white) is HIRES mode, so a nice panel can be drawn there. The lower part is TEXT mode, so no use. But I don't see why I wouldn't extend the play area to the bottom of the screen. It shouldn't affect performance too much.

I am sure that some of you have explored this field. Any ideas?

Has anybody found an alternative way to do this? It takes ages to perform a scroll in HIRES!

Antiriad2097
Flying Officer
Posts: 148
Joined: Tue May 09, 2006 9:42 pm
Location: Aberdeen, UK
Contact:

Re: Fast scrolling game howto, anyone?

Post by Antiriad2097 » Tue Feb 19, 2013 8:35 pm

That's amazing work, really impressive! Can't wait to see a finished product derived from your work, even though that may be some time away. I didn't think the Oric could update that volume of data fast enough to do a decent full screen scroll.

User avatar
ibisum
Squad Leader
Posts: 850
Joined: Fri Apr 03, 2009 8:56 am

Re: Fast scrolling game howto, anyone?

Post by ibisum » Wed Feb 20, 2013 9:46 am

Nice work - text mode, eh? I'm guessing this is just how it has to be - buffer/manage the charsets and then mov TXT as rapidly as possible across the left and right boundaries ..

I wonder what technique Defence Force uses? It has always impressed me as a decent scroller, well .. within reason. I guess with such rich density of graphic detail as you seem to be aiming for, thats still not going to cut it.

Well I don't have much to add, but looks very interesting! Twilighte did a bit of an exploration of scrolling like this too, didn't he? I thought I recall seeing his use of AIC in a scroller, somehow.. maybe his thread on OType is of interest?

http://forum.defence-force.org/viewtopi ... 5&start=30

vrozos
Officer Cadet
Posts: 63
Joined: Mon Nov 21, 2011 12:36 pm
Location: Athens, Greece
Contact:

Re: Fast scrolling game howto, anyone?

Post by vrozos » Wed Feb 20, 2013 10:30 pm

Very nice! I used to play this game in CPC 6128 and it was not any better than this demo.

V.

User avatar
Dbug
Site Admin
Posts: 2325
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: Fast scrolling game howto, anyone?

Post by Dbug » Thu Feb 21, 2013 9:51 am

ibisum wrote:I wonder what technique Defence Force uses? It has always impressed me as a decent scroller, well .. within reason.
That's the thing: There's no scrolling in Defence Force except the few lines at the bottom that shows the ground.
All the scrolling perception comes from this small band plus the few stars and the moving enemies.

It's all in your head :)

User avatar
ibisum
Squad Leader
Posts: 850
Joined: Fri Apr 03, 2009 8:56 am

Re: Fast scrolling game howto, anyone?

Post by ibisum » Thu Feb 21, 2013 10:48 am

Heh heh .. it is indeed! Still, I think the O-Type exploration by Twilighte shows some other methods, too!

User avatar
Chema
Game master
Posts: 1975
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Re: Fast scrolling game howto, anyone?

Post by Chema » Thu Feb 21, 2013 11:36 am

Thanks to everybody for your comments.

I really think that this kind of technique has quite a big potential, but I am still worried about the points I made in my first post.

I imagine that with some intelligent designs (minimizing the usage of tiles in the background) and a good game design something fast and fun to play can be done. At this moment I am just trying to experiment with the possibilities. Well I should say I was, because as Dbug knows I did this months ago and forgot about it.

I don't see any other way of doing this kind of fast scrolling games. The best thing I could do in this area using HIRES mode was the scroll in Skool Daze, but stopping everything to perform a fixed-area scroll and then continue is far from what I'd like to achieve now. You could probably have a vertical smooth scroll fast enough if your play area is not too big and you don't need great speeds. But nothing with a fixed background or parallax effects which need full area double buffering...

However, I am not sure if using text mode is a way to go. Losing the possibility of AIC coloring is a pain. We are now used to them and a monochrome game will look outdated. And even so, the limitations of TEXT mode are too many.

And I know that sync with the vertical retrace by software has been discussed before. Even something about this topic was posted in the old Oric pages at Ensica. I recall something about letting the user calibrate the timings or something, but I have no idea of the details.

User avatar
ibisum
Squad Leader
Posts: 850
Joined: Fri Apr 03, 2009 8:56 am

Re: Fast scrolling game howto, anyone?

Post by ibisum » Thu Feb 21, 2013 1:57 pm

Is OType not the same sort of thing? Because I think the screenshots show AIC mode being used in a fast scrolling shooter - but I guess you mean horizontal scrolling is more difficult, perhaps?

So in HIRES mode, only updating a smaller rect wouldn't fulfill the goal either, I suppose?

User avatar
Chema
Game master
Posts: 1975
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Re: Fast scrolling game howto, anyone?

Post by Chema » Thu Feb 21, 2013 7:39 pm

I have been reviewing the forum you suggested and took a look at the sources. Well, they are evil :twisted: and very very fast. I can't wait to see OType finshed...

Indeed vertical scroll is easier. Horizontal scrolling would mean either 6pixel scrolls or slowly rotating bytes. And, well, yes. I wanted to see if something BIG using most of the screen and moving very quickly could be done.

But I am not really satisfied with the result...

Antiriad2097
Flying Officer
Posts: 148
Joined: Tue May 09, 2006 9:42 pm
Location: Aberdeen, UK
Contact:

Re: Fast scrolling game howto, anyone?

Post by Antiriad2097 » Thu Feb 21, 2013 9:09 pm

Chema wrote:Losing the possibility of AIC coloring is a pain. We are now used to them and a monochrome game will look outdated.
I don't agree with that. Monochrome/limited colour games can still be very effective if the design is right. I'm still more than happy to play many Spectrum games that are largely mono. Just because you can have colour doesn't mean you have to use it. In relative terms, I thought the demo looked amazing with such speed regardless of the colour scheme.
Chema wrote:Horizontal scrolling would mean either 6pixel scrolls or slowly rotating bytes.
Does it have to be a 6 pixel scroll? I know Cobra on the Speccy derived from an experiment with character shifting to achieve fast smooth scrolling. I'm sure the technique is covered on the World of Spectrum forum. In fact, a quick search there finds this little quote:
Cobra was massiveley optimised for speed. There's typically only one type of scenery block on each row of the screen and the screen is drawn from pre-shifted block data (for a blank, start, middle and end of each block). That's loaded into four registers and PUSHed to the screen in the right order so that it's redrawing the screen from a block map faster than a straight copy would do it. Then the sprites are added.
If you have repeating patterns for your scroll, you can have preshifted character data for each step. Shove that data into your on screen characters to redefine them instead of moving data onto screen, and with some thought put into where things are placed (and of course moving a few things around) you can fake a smooth scroll. (I'm thinking instead of byte shifting data left on the fly, have a string of characters that you redefine with different pre-shifted data set for each stage of the scroll to give finer detail. It would take careful planning of maps though).

This could of course be me theorising nonsense, since my programming skills are limited.

I find this interesting, there's another thread here:
http://www.worldofspectrum.org/forums/s ... hp?t=37484&
Not all these will be useful for Oric of course since the Z80 had different registers etc so some of the specialist tricks won't work the same, but some of the mapping/character shifting concepts are still useful.

User avatar
Dbug
Site Admin
Posts: 2325
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: Fast scrolling game howto, anyone?

Post by Dbug » Thu Feb 21, 2013 10:31 pm

The big problem on the Oric is that even if it has a text mode it is still limited to 96 characters per set. That's not a lot.
Using pre-shifting would work for a simple background, but then you need to add animated sprites on it, that becomes difficult.

I'm sure it would be possible to design a type of game made to take advantage of the two sets of 96 characters, but for converting generic shooters, that may prove impossible :)

User avatar
Chema
Game master
Posts: 1975
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Re: Fast scrolling game howto, anyone?

Post by Chema » Thu Feb 21, 2013 10:56 pm

This is getting interesting... :)

I took a look at Cobra, which I enjoyed a lot in the past btw, and you both are right. It does not have many different tiles and and are very intelligently used, so the result is quite varied, fast and smooth. It changes the set of tiles from screen to screen to increase variety.

For such maps, the 192 usable characters in the Oric may be enough and preshifting could work.

I think Dbug suggested me something similar, but I did not find the way to implement it with the current design I have, because of lack of tiles, but it may be worth a try.

Do you Think, then, that current 6 pixel scroll looks too bad?

Antiriad2097
Flying Officer
Posts: 148
Joined: Tue May 09, 2006 9:42 pm
Location: Aberdeen, UK
Contact:

Re: Fast scrolling game howto, anyone?

Post by Antiriad2097 » Thu Feb 21, 2013 11:44 pm

No, I don't think it looks bad, not at speed, but as you said in your op when things slow down it becomes much more noticeable that its character scrolling.

Perhaps using some of the psychological tricks of scrolling by having a small area (that can have a repeating pattern) smooth scroll while the rest is 6 pixel? That parallax effect is effective.

Though I'd be happy with a fast scroller.

User avatar
Chema
Game master
Posts: 1975
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Re: Fast scrolling game howto, anyone?

Post by Chema » Fri Feb 22, 2013 10:48 am

Let me write down all this and see if I am mistaken somewhere...

Using pre-shifted tiles
It is possible if the number of different tiles is low. Cobra, for example, does not have many different tiles at the same time in the screen. You need to be creative when creating the maps, so they don't look too repetitive. It is a matter of making them tile together forming different shapes (like the walls, columns, tubes or terrain in Cobra). Inversine mode for some of them may add color and variety.

You also have to take care when placing objects. Each time two objects are contiguous, you'll need extra tiles for their shifted versions. Leaving a black square between them would solve this, I guess.

If the thing uses a very low number of tiles, you can change from one tileset to another by simply changing between standard and alt charsets. But I am afraid that 96 tiles won't be enough if you also want a good number of sprites around.

The process would be something like:
1 Select alternatively one tileset (either not shifted or shifted by 3 pixels). That might mean setting the correct attribute in the backbuffer's first column if it is also dumped with the play area. Or preparing to set it after it is dumped.
2 Every two frames, do the scroll.
3 Clear backbuffer, draw background.
4 Paint sprites and dump to screen.

It should be possible to use (as I am doing now) both charsets in alternate rows. But then I guess that, as you need to dump the tileset graphics over the charsets and that will be instantly seen on screen, glitches will appear with the current sprites and the background they are drawn over. Extra code should handle that situation, possibly by updating the sprites in advance or something like that. Not sure if that would destroy the double buffering and what effects that would cause.

There are also other options, like using more tilesets with preshifts of 3 and 2 pixels and do some paralax on different parts of the screen. If it works, it may look quite good.

Some kind of Super Mario Bros game could be created this way :)

Sticking to character scroll

If the background is rich, such as in Uridium (the graphics of my little demo are from the speccy version of that game) I think it is hardly possible to use the above method.

So there must be some kind of minimum speed imposed so that the character scrolling is not apparent. Maybe other tricks could be used. I am thinking of using pre-shifted tiles for the stars, for instance, so they move on a sub-char scroll on the background. However it will be a bit difficult to control, so some changes should be done to the game or you'll end up colliding with the obstacles all the time. What about an option to make your ship jump?

I have to make more tests. Probably adding other ships and see if the general look is acceptable.

I would be wonderful if people jump in with ideas and tests and see if we can end up with something nice! I am sure that Twilighte has done some experiments with this kind of techniques (maybe Magnetix?), and has some nice ideas or interesting points of view.

Oh, and about the sync with the vertical retrace, has anybody done something in this area?

User avatar
Dbug
Site Admin
Posts: 2325
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: Fast scrolling game howto, anyone?

Post by Dbug » Fri Feb 22, 2013 6:44 pm

Chema wrote:Oh, and about the sync with the vertical retrace, has anybody done something in this area?
Yes, I believe I sent you my 'asteroids' prototype with alternated dithering to generate shades of grey :)

I think the speed is also a matter of perception of relative size.
- If you have a 6x8 sprite with a character scroll, it feels like it's going very fast and it's very twitchy to control
- If you have a 12x16 sprite with character scroll, it feels less fast

So basically if you have a large world where the basic unit of collision is made of says 3x3 or 4x4 characters, it gets a lot easier to negotiate.
This means that you have to build larger blocks from individual characters, and then use these composite blocks to make the map.
Chema wrote:Some kind of Super Mario Bros game could be created this way :)
Take one example:
Image
This picture has three levels of parallax:
- The mountains in the background (slow movement)
- The trees in front (a bit faster)
- The blocks in front (much faster)

I can count horizontally about 7 of these big blocks, so say 40 characters per line divided by 7, gives 5.7 characters per block.
Say these blocks are made of 5x5 individual characters, that's 25 characters used but most of the border ones can be reused for different blocks, and it's possible to use inverse video to get different color combinations on the various characters.

The trees can be made by being repeated over the holes behind the blocks on all over the screen by being redefined dynamically each time the main view scrolls. Say they move at half the speed compared to the main blocks, so they move by 2 or 3 pixels, this means you only need two or 3 different patterns.

Compared to the blocks apparently we have two trees for one block in width, and the trees are a bit taller than the blocks, so one tree is about 2 or three characters wide and about 6 characters tall. Here goes 2x6 or 3x6 more characters, say 18 characters.

At this point we have 43 characters used

Then the mountain, which is made basically of slopes like / and \, and these ones have to scroll very slowly and smoothly, so like per pixel. You need two characters to smoothly pixel scroll a "/", it's probably possible to do the whole mountain background with some pattern on it, moving per pixel in less than 20 characters.

We now have 63 characters used for a three level parallax level.

Remains 33 characters for the sprites, plus a full alternate character set of 96 characters.

Now if we want to be creative, we know that the mountain and the forest are not visible on the same lines, so technically we could define the mountain using the ALT charset and the forest using the STD charset. We can keep some common characters for blocks and sprites. Since it means that most ALT characters are not used anymore then we get some room for things like the clouds for example (assuming there's no blocks visible higher).

Just thinking out loud :)

Edit: AIC in text mode is also doable, just a matter of doing my HIRES/TEXT mode to change ink color. Only problem is that we lose some available characters.

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests