 |

 A simple example
Starting with DizzyAGE v2.3 you can create scrolling games.
To see what I'm talking about, download "Dizzy and The Mushroom Pie",
enable developer mode (dev=1) and log messages (log=1) in dizzy.ini and start the game.
Open the console (press [`] and then [insert]) and write this line of code:
GameSet(G_VIEWPORTMODE,1);
It's as simple as that. To make it work in your game enable this game property when the game starts
and make sure you have the following code in the AfterUpdate handler (it was added in v2.3 template).
 How does it work?
In a scrolling game the idea is to keep the player still and to move the background.
Or at least this is what you see.
The scrolling system in DizzyAGE keeps everything working as before but it displays a viewport
no longer aligned with the current room's coordinates. In a normal game, the viewport shows only the current room,
but here you can see a part of the next room too. In fact you can see parts from up to 4 rooms at once
(like when you are close to the room corner).
Considering that the engine does some special things when a room is entered, the scrolling handles 9 rooms at once.
That is a matrix of 3x3 rooms, with the current room in the middle, all possible to be visible while the player
moves inside the current room.
So this large area of 3x3 rooms is displayed with the proper offsets (set in G_VIERWPORTX and G_VIEWPORTY) to
give the impression of a scrolling backround. Optimizations are performed to avoid drawing brushes outside of the
viewport.
 Dynamic objects
When a room is entered all objects (the dynamic brushes) from these 3x3 rooms are gathered and considered present.
That's more than in a normal game and it's important to update all of them, because the player can see them even
if he doesn't leave the current room.
Since the player can see AI objects from the neighbour rooms, some of them might need to be updated, even if not in
the current room. Like a bat or a platform that would otherwise be frozen until player enters their room.
As I said, the engine gathers and presents objects from all neighbour rooms too so animations will work by default.
But you'll have to find a way to call eventual script updates too. Usually these are local situations and you can easily
update them from their neighbour rooms too.
 Material map
Another issue may be when some AI must read from the material map. For example a character that follows you, or the
drops of some rain effect.
By default the material map has valid information only about the current room (with a small border around it).
So when you're seeing such an AI in the next room, it will not have valid material map information there.
Not unless you enable the G_FULLMATERIALMAP property, set to 1. This makes the engine write the full material map,
covering the whole 3x3 rooms area.
Since scrolling games must handle 3x3 rooms at once, it would be wise to do a few optimizations when you build the map.
For example don't make the static brushes write in the material map if they don't really need to. Especially if you use
the full material map option.
 Mirror, mirror...
Another new feature in DizzyAGE v2.3 is the native support for inverting the viewport. Both vertically and horizontally.
Both for normal and scrolling games. Just set the G_VIEWPORTFLIP game property to 0=normal, 1=x, 2=y, 3=xy and that's it.
No special changes to the map, no other hacks.
Again, everything works as before, you just see it flipped. So when you flip horizontally and press right, the player
looks like walking to the left, but it's x position is incremented as before (to the right). If you don't want this effect, you can
switch the key values in the Update handler.
 Scrolling tips
Both the G_VIEWPORTENMODE and G_FULLMATERIALMAP properties can be changed at runtime, usually when entering scrolling or static rooms.
This allows games with both static and scrolling areas. For example you can scroll when outdoors and use a static rooms for indoors.
You can also apply the scrolling effect only horizontally, or you can start scrolling only when you are close to the room's edges.
Depending on how your game looks, you may experience flickering on LCD monitors, due to pixel patterns.
Scrolling with a different step could fix it.
As for designing the map and puzzles, a scrolling game may have some advantages, but it also have disadvantages.
For example you'll loose the element of surprise - you can't run into Zaks' secret room, you'll just see it piece by piece.
So make sure your game really needs this feature.
Now go and start doing some shmup games! :)
|
 |
|