Bricksets

From Open Surge Engine Wiki
Revision as of 21:31, 31 December 2011 by Kzr (Talk | contribs) (The Brick)

Jump to: navigation, search
Stub
This article is a stub. This typically means the article is a placeholder for more content to come. Knowledgeable users are encouraged to help expand the article.

This page hasn't been written yet, but in the meanwhile you can take a look at the old bricks tutorial from opensonic.


ATTENTION Unfinished document. feel free to add content, but please do not review content without previously discussing that.


The Brick

In the Open Surge Engine, a brick the simplest element of level design. It is a tile sprite with a few parameters that define how the physics will make the players and objects interact with it. There is no maximum size for a brick, so you can make either a grain of sand or a huge walkway. In fact, if it suits your interest, you can make a level out of one huge brick.

The Brickset

A brickset is composed by two elements:

1) The image

No brickset would ever exist without the image where the bricks are contained. This image can be organized in any way you like. Some like their bricks to be spaced, others like to glue them all together to save space (not actual disk space, image space). Both these techniques have positive effects and drawbacks. If you do it "old-school" and create bricksets manually, spacing the bricks makes the definition process more human-friendly. On the other hand, gluing all the bricks together and making them stick to a 16*16 grid makes them ready to be defined in RBE.

2) The definition script

So you got all the bricks you want, now how do they get into the game? The engine searches the .brk file for references on bricks, gets their parameters, and the physics take care of the rest once you're done placing bricks in your levels. This script contains references to the image(s) source(s), how big the bricks are, what part of the image to use as its "face", the angle (for physics processing), the animation sequence (if any), and the most important parameter: the property


Images for bricksets

Making your own brickset from scratch can be tedious and frustrating, especially for a beginner. So why don't you take a look at SilverstepP's awesome templates:

-insert image here-

As you can see, it has lots of different slopes and angles, bricks for solid stuff, and for decorative stuff. Ready to be filled with textures or colors. It is also ready for 16*16 divisions, although, as you'll see later, that is not the size of every brick.

Making your brickset compliant with the 16 pixel grid will make it easier to use it in RBE for a nearly automated brickset generation, although this is not completely necessary. You should find your own way to deal with bricksets after you are done learning how to create and use them.


Brickset and Group scripts

now that you got an image to start, there are two things you can do:

1) Edit an existing .brk and try to define the bricks manually. You may want to do this if you use very few bricks, if you need to add or remove bricks from an existing set, or even if you want to define bricks that RBE can't easily do.

2) Load your image in RBE, and start clicking your way, marking bricks, setting angles and properties, and once you're done furiously clicking every little square with graphics underneath, it exports the scripts for both the brickset and brick groups.

Brick groups, just like the name says, are groups of bricks that form larger sections. You can group anything together and make your own prefabs, from rooms, to walkways, walls, ceilings, slope sequences...

TIP

If you build something with your bricks in an empty level and save it,
you can then open the level in a text editor, and copy your construction to a group script.
It works best if you build starting at x0 y0.


Brick parameters

A brick is defined like this:

brick 0
{
   type                OBSTACLE
   behavior            DEFAULT
   angle               0

   sprite
   {
       source_file     images/desert1.png
       source_rect     70 10 128 128
       frame_size      128 128

       animation
       {
           repeat      TRUE
           fps         8
           data        0
       }
   }
}

Every brick starts with brick followed by its number. Following a sequence is highly advisable, but you can number solids from 1 to 1000 and scenery from 9000 to 9999, for example.

The type will tell the physics core how to handle collisions with this brick. Obstacle means solid, Passable means you can pass through it, Cloud means you can go to the top of it from below (but not the opposite).

The behavior specifies the kind of movement the brick will do, if any other than default is specified.

-need more depth on movement types-

The angle tells the engine whether this is a ground, wall, ceiling, or slope. 0º is usually flat ground, 90º a right wall, 180º a ceiling and 270º a right wall. anything in between this values is a slope.