A word of caution: this post is about some of the concepts that went into the design of the level editor - abstract stuff that I'm not even sure how to explain. It's a long post and it might not always make sense. Revisions are plausible, but I'll mark them down. If there's a Master Demon that haunts our Backfire dreams, that must be the Demon of Content Syncing. He's also known as the Demon of Adding and Syncing Content on Layers that have Different Speeds and Lengths. That's a mouthful, I know. Ever since we started working on Backfire seven years ago we knew that one day we'll have to face The Demon. How will we ever manage to make everything sync nicely? Before I reveal the answer, a bit of context. Watching a ship moving through space can be extremely boring in real life. Stars are so far apart from each other that to a ship moving through space, even at very high speeds, they will be no more than static dots of light. Space would look even more boring if the ship was traveling at the speed of light, as some (1) boffins claim. That's why game, cartoon and even movie makers exaggerate the speed of background stars, so as to create a sense of movement and ultimately make things more interesting. Backfire uses a top-down perspective, meaning that the stuff on the screen - ships, stars, bullets, everything - is viewed from above. We simulate forward movement by scrolling stars and other objects downwards, while keeping the player's ship static. We simulate depth by scrolling stuff downwards at various rates. In our scenario, the objects that are furthest away from the screen scroll slower than those that are closer to it. We thought of defining 3 levels of depth under the player's ship and 3 levels of depth above it. We called these levels of depth layers, because they were sitting on top of each other. It's even easier if you imagine that each of these layers house various entities that share one common attribute: their speed. In other words, all the entities from a layer scroll down at the same rate, along with that layer. The bottom layer is the slowest, the top one is the fastest. The main issue is figuring a way to edit (i.e. put content on) all these layers which - due to their different speeds - have different lengths. Time out! Imagine you have a sammich, much like the one I drew for you here. Everybody knows how to eat a sammich, right? You shove the sammich in the mouth and take a bite, then repeat the process until there's no sammich left. I mean this is how most people eat it. Now imagine you have a weird sammich, made by someone who knows close to nothing about sammiches. The only thing normal about this weird sammich is the lettuce. The lettuce is fine, just a regular sized lettuce, but the bacon below it is too short and the cheese below the bacon is even shorter. Guess what? The bottom slice of bread is down right ridiculous, that's how short it is! Wait, there's more. (I know, it's a very weird sammich!) The cheese above the lettuce is too long, if you can imagine, and the bacon on top of it is even longer. The slice of bread at the very top is so long that you probably can't even see it end to end. Now try eating it in several bites, say 10, with each bite going through all the layers at once. Yes, this means that all the layers at the front of the sammich should be in line when you take the first bite. It also means that all the layers at the back of the sammich should, too, be in line when you take the last bite. Do you see how weird this is? The same goes with our in-game content, which lives on all those independent layers. Our layers must start and end at the same time, even though they have different speeds/lengths. This, when talking about empty layers, is not even that hard to do. No, but placing entities on the layers and synchronizing them to fit a certain scenario, is. Do you remember those corny karate movies in which a master tells his student that in order to get to the highest level of skill he (the student) must forget everything he learned until that point? Well, let's do the same and forget everything about layers. You see, all these layers I kept raving about since the beginning of this post don't even exist. They're completely abstract. They just help us visualize and organize the content better, but there are no build-in layers into our engine or levels. We knew this right from the start (2), but we focused so much on these damned layers that we kind of intoxicated ourselves into taking them literally. Luckily, in one of our recent brainstorming sessions Ben had a revelation. The solution was right there in front of us, more or less, but nobody found it. Until now. The idea is simple: edit everything on one layer, then assign to each entity a scrolling speed. Some entities will share their speed with others. Take a look at the mock-up "screenshot" in the column on the right: you can see a galaxy (yes, the one that looks like a turd, hehehe), some stars, some ships at the top, the player's ship at the bottom and a satellite of some sort in the top-left corner (that also partly masks a ship that's below it). All that stuff scrolls down, except the ship at the bottom (the player's). The galaxy is the slowest in terms of scrolling and the satellite is the fastest. Just to make things clear: the player and all the active entities (e.g. enemies) are in between the satellite and the galaxy, OK? Using this simple approach of assigning speeds to entities instead of entities to layers solved nicely an otherwise ugly problem. Now we're ready to learn about layers, again. Kidding... partially. While they're still abstract, we simply can't banish the layers for eternity. We still need order in our galactic chaos. Consider this: a) entities at the top (of the screen) must obscure the ones below them; b) entities at the top are faster than those below them. You see where this is going? If you have no idea, don't worry, I'm gonna tell you. It's going to Layerville. You can always group similar stuff together to make it easier to manage. We can call these groups, if no objections are made, layers. | A normal sammich. The complex layer system; note how the length of a layer is directly proportional to its speed. The position of the layers during a level. The dotted line shows where the player would be at that particular stage in the level. Mock-up screenshot. This is the top-down view of the game. All the stuff on the screen scrolls top-to-bottom, except the layer's ship, which is static. This creates the illusion that the ship moves forward through space. The entities on screen scroll down with different speeds; those that are farther away scroll slower than those that are closer to the screen. |
(1). Some scientists argue that when traveling at the speed of light one would see a bright blob of light in the distance. No star trails, no special effects, just a boring orb of light.
(2). I guessed that layers were abstract, but wasn't completely sure until I asked Ben about it.
(2). I guessed that layers were abstract, but wasn't completely sure until I asked Ben about it.