Free Camera & Lock-On


In this post, we'll talk about the foundation of the game's camera. Of course, camera control remains a notoriously particular element of game design. The camera scripts in Future Battle Legend entered the project early and I'll likely tweak them long into development. Since we're now working on the battle environment, central to the game, we're focusing on the camera in battle, where the player will mainly manage two camera states. I'll call them Free and Lock-On camera states.

The Free camera was adapted from the previous third-person A.V. Knights game, Giant's Chalice. Like in that game, the Free Camera looks at and follows the player. Moving the mouse (the controller's secondary analog stick) rotates the camera around the player. Each frame, the player's input moves a "target position" Vector3, and the camera moves smoothly towards that Vector3. We can also use Vector3.LookAt. With this kind of setup, it can be tricky to hone in on high-speed movement that isn't jumpy. Moving forward, playtesting will determine how and when the camera will zoom in and out.

The second camera state, Lock-On, provides the crucial option for the camera to look at a target other than the player—namely, the enemy mech. This aids the player as they aim at and move in relation to their target. While the challenge of attacking the enemy without Lock-On has some gameplay merit in itself, I needed to add Lock-On for two reasons. First, I knew it was logical that a mech's systems would allow some scanning and targeting assistance. Second, I wanted to enable a standoff between fighters where two opponents could circle around each other. It was a dramatic image I was struck by (in my imagination). Programatically, Lock-On was a little more complex than updating the old Free Camera code; vector math isn't my strong suit. My technique was to parent the camera to the player during Lock-On, so I wouldn't have to code the swath of camera movement enforcing the player's perspective. Instead, the Lock-On code primarily uses Vector3.LookAt.

You can read about a mech's basic stats in a previous post. Remember the Tech stat? A mech's total Tech (summed up from every Part in the build) determines the maximum range at which it can lock onto a target. If you are having trouble locking onto your opponents, you probably need to get some more Tech points into your build. At this stage in development, when the player presses the Lock-On button, the Tech range of the mech displays momentarily, and Lock-On begins if the target is within range. Currently, the transition between Free and Lock-On camera states isn't smoothed, but this is a big item on the development to-do list.

That covers the basic camera functions in place a few weeks into Future Battle Legend's development. Next, we'll move into damage programming. When mech Parts take damage, they may break down entirely, stripping the mech of the stats provided by those destroyed Parts. For example, a viable strategy in battle might be to attack Parts that are giving your opponent an advantage, such as destroying Tech-related Parts to limit their Tech range. Thanks for reading! For more updates on this game's development follow @avknights_dev on Twitter.

Leave a comment

Log in with itch.io to leave a comment.