breaking down the train turret fight scene


First, a quick note. I underestimated this one. I thought that it will take me maybe six days. It's a bit more than two weeks right now and still a few minor things to do. This might be because I added lots of stuff: mesh processor (to split, deform, rearrange, etc.), custom AI manager to make it easy to spawn attackers in waves (which may come in handy later), controlling different entities. There were also a few days when I was a bit sick and/or had to take care of non-game related issues. This may mean that rather than create sets of completely custom stuff for future levels, I may prefer to reuse existing solutions. This does not refer to level layouts, enemies, weapons, EXM - these are going to be added. I am most likely not going to introduce multiple mechanics for each level.

Now let's get to the scene. I wanted to focus solely on technicalities here, but you might be interested in how it's all managed. Here we go then...


At one point, the player has to take control of a turret placed on the top of a huge train that goes at 110kmh (70mph). And there are some air fighters coming to attack us.

The whole section is driven by a script. It tells when you switch, introduces first enemies and shows what they're capable of. Then it switches to an automatic system that spawns enemies, makes them get closer to the player, attack and fly away. All these steps have predesigned points. The steps themselves may be mixed according to some simple rules (although for this bit, all may be mixed). When we destroy all attackers or the turret is destroyed by them, we switch back. This is again handled by a script. The waves happen at given intervals (that depend on the difficulty setting, "mean machine" makes waves come quicker).


Let's now focus on this screen. It shows the turret on a train, attacking air fighters that are deploying their arms to attack the turret. There are some buildings in the background, the huge tower far away and some ships flying high above.

Is the train really moving that fast? No.

It's the buildings that move. They move on a curve as in the game's world we should seem to get closer to the central tower on a spiral.

Although we actually don't move at all, the central tower rotates, so it seems that we're travelling around it. The ships that fly far away, fly in relation to that tower. 

How about air fighters then? Are they almost stationary? It's... a bit more complicated. Their code handles pursuit and attacking stationary targets. But as this level is all smokes&mirrors when it comes to movement, their logic takes that apparent movement into consideration. They "believe" that they're moving at great speed.


Now the particles. They have a mixed approach. They are stationary, all velocities are local. But they take into consideration the speed at which the room is moving and each frame they move back a bit. They don't move at full reverse speed though. It is blended, so it appears that the air slows them. This happens to the impact, smoke and explosions. They all have a little bit different setup.

All of that is to make the player believe that they're travelling on a train.

Why didn't I make the train go around the tower then? It would be actually a more complex problem. With floating point inaccuracy kicking in at the worst time. I would also have to deal with the relative speeds of projectiles and stuff. Fun fact: you can't shoot in the initial desert scene as you travel at the same speed as your projectiles. Making that relative speed actually doesn't help when travelling on elevators. But if I would be simulating this approach here, it would make aiming here much harder. From the physics point of view - all of that is inconsistent and doesn't make sense. From the player's perspective - it's actually predictable, therefore not frustrating.


Also - I wanted to make the train go forever like this. But you couldn't move at an angle in a circle. Although the lore with impossible spaces allows that to happen. It's just... I wanted to make the train seem closer to its destination depending on how far has the player gone through the level. Not on how much time has passed. And I wanted to have some control over where things are.

Right now, I have enough tools to make a few more fights that would be a bit different + a few scenes (air fighter's AI allows them to escort things too). I still need to create some stuff, but it's more actual content.

Let's make this train reach its destination and the player with it.

Get Tea For God

Comments

Log in with itch.io to leave a comment.

CANT WAIT! Hopefully this still incorporates the Outer Rim style gameplay along with the train scene, Im having a blast on my multiple Outer Rim runs but im craving new rooms and designs. So im excited to see whats next!!

With that being said, you could re-map/re-skin the Outer Rim 12 times and get us a little close to the tower each level, release that as a full game, and people would play it for AGES. So seeing the effort to expand the game, instead of just elongating it, is really awesome! When its done, you got my money for sure!

nice writeup thank you