Skip to content

6. Scenery (Advanced)

reassembler edited this page Dec 23, 2021 · 15 revisions

Let's take a look at the advanced scenery editing features. If you're happy using the existing scenery patterns then consider this section optional.

We'll work from an existing OutRun level. Start a new project (File -> New Project) and import the Coconut Beach level (File -> Import -> OutRun Level).

Import Menu

Place the camera at position 1800 in the level. The quickest way to do this is to simply type the value into the Level Position.

Scenery Image

Now, let's select the scenery control point that's just before where we placed the camera. By hovering over it, we can see it's attached to the Boat Houses & Palms pattern.

Scenery Image

Let's click the Edit Pattern button in the bottom right to study this scenery pattern in detail.

The Pattern Editor

Clicking Edit Pattern will open the scenery pattern in the pattern editor. You should see something like this:

Pattern Edit

In the left column you can see the current pattern (196: Boat Houses & Palms), along with the various objects that make up the pattern (37: Building - Hut, 16: Tree - Palm etc.) In the left hand list, click on one of the objects in the pattern.

Pattern Edit

Here we've clicked on one of the huts. Let's see how this list of pattern objects corresponds to what can be seen on screen. To do this, check the Highlight Scenery option as shown below.

Highlight Scenery

With this option checked, click on the pattern objects one-by-one, i.e. click through the list on the left hand side (37: Building - Hut, 16: Tree - Palm etc.) Once you click an object that is currently visible on screen, you'll see a bright rectangle appear over the object. Now it's clear how this list and your selection corresponds to the game world.

Each object in the pattern has a unique set of properties. These can be seen in Sprite Properties list.

The properties are as follows:

  • Sprite X Position
  • Sprite Y Position
  • Sprite Palette. (Many sprites support multiple palettes. For example, try cycling the hut palette through 68, 196, 197 and 198.)
  • Draw Routine. This selects the internal OutRun game code to handle the sprite. I'd advise leaving this alone and accepting the default. The scope of this is beyond this documentation.
  • Mirror. Horizontally flips the sprite.
  • Shadow. Adds a shadow to the sprite.

Try changing the Sprite X Position and watch the selected object move across the screen.

Now let's change one of the objects in this pattern completely. Select an object that is currently visible on screen from the list on the left with the help of the Highlight Scenery option. Now select an object from the list on the right hand side to change that object. So to recap: click the left list first, then replace the object by clicking on the right list.

Highlight Scenery

Here I've been a bit silly and replaced one of the huts with a windsurfer, and changed the x position to place her in the middle of the road. Pick an object you can see on screen and attempt something similar.

Pattern Frequency

We have seen that the objects in a pattern have x and y co-ordinates. But OutRun is a pseudo-3D game, so we also need to think about the z co-ordinate. We have our list of objects, but what if we want to adjust the spacing between them as they hurtle past us?

This is where pattern frequency is used. It controls the z distribution of the object list within the pattern. The best way to understand how this works is to experiment in the editor. Let's go back to a simple level with a straight road and no existing scenery patterns. Use the New button to create a new pattern from scratch.

Create Pattern

Let's setup two objects within this pattern. Click on the New Object item that has been created and choose an object to assign from the list on the right hand side.

With this object selected on the left, click the New button again. This time round, another New Object is created in the pattern list. Note that clicking New when within a pattern creates a new object whereas clicking new with a section heading highlighted creates a new section.

Create Pattern

In the above screenshot, I've selected two objects and also set the Level Position so we can see what we're editing in the 3D view. You can see the rock and statue stretching into the horizon. The distribution into the horizon is controlled by the pattern frequency setting.

Pattern Frequency

The OutRun engine can draw two objects per line (or z position). The above frequency table, which should be read from the bottom upwards, essentially means:

  • Line 1 (0 & 1): Draw the rock & statue
  • Line 2 (2 & 3): Don't draw anything
  • Line 3 (4 & 5): Draw the rock & statue
  • Line 4 (6 & 7): Don't draw anything
  • ..................
  • Line 8 (E & F): Don't draw anything

I've annotated the screenshot below to demonstrate this more clearly. The red lines correspond to the lines/positions in the frequency table.

Create Pattern

This is a powerful system, because you can create a wide variety of layouts with a few simple changes. Here's an alternate layout example. The only thing that's changed here is the pattern frequency.

Pattern Frequency

We've essentially grouped the objects into triples here. Visually, this looks as follows:

Create Pattern

Remember that the pattern frequency should be read from the bottom upwards, which represents the placement of objects going into the screen. In a similar way, the list of objects in the pattern is selected from the bottom up.

The pattern continues until another pattern replaces it, or the Scenery Pattern Length value attached to the control point expires.

My Head Hurts!

If this is making your head hurt, the best way to understand the system is to play with existing OutRun levels. Edit the existing scenery patterns and build some simple test cases. You'll get to grips with things before long.

Engine Limitations

Sprite Limitations
There is a limitation on the number of sprites that can be rendered on-screen. If you exceed this value, the OutRun engine fails in a particularly nasty way and writes over important areas of memory crashing the game. CannonBall fails more gracefully although you could see key sprites, like the player's Ferrari, failing to display.

It might seem trivial to simply add a warning in the editor when this occurs, but in fact the problem is more complex. As such, I've added a notification when creating patterns. If the pattern is too dense, the following warning will show:

Pattern Density

If a pattern becomes too dense you can solve it as follows:

  • Remove the shadows from some of the objects (they require an additional sprite)
  • Lower the frequency so fewer boxes are checked.

A warning doesn't necessarily mean your pattern will cause a problem. The issue is also affected by surrounding patterns and the length attached to the control point. But I would avoid tripping the warning to play it safe. If you look at the existing OutRun patterns, they play it safe with the number of sprites.

Pattern Limitations
There are some instances where the OutRun engine isn't particularly flexible. For example, using some of the crowd patterns intended for the game's end sequences mid-level can cause the Ferrari to instantly crash.

Tips

  • You can double click a scenery pattern entry to rename it to something more memorable.
  • You can even rename the list of sprites in the right hand side, so when you next assign a sprite it has a different name.
  • You can create a maximum of 255 scenery patterns.
  • If you import OutRun's existing scenery patterns you'll find some interesting unused entries.