Hello Ladies & Gents!
Andrew here! Today I’m here to share a few details of the combat system in
Legend of Nesslifia.
The combat system uses a third person camera set at a 3/4 view. Your characters are clickable models on the field and for controls, you interact by moving your camera around the battlefield and using your cursor to select units. Here’s a look into the prototype map we worked on.You can also see early versions of some GUI widgets on the right. The numbers at the top represent the number of player units (blue), and number of enemy units (red) within visible range of the player. You can also see a mini-map widget. The other widget is a time scale changer. During combat, if you need more time to think, you can turn down the timescale to give you a moment, however, if you think things are going great, you can turn the timescale up, to move through the battle quicker.
So there are some tricky requirements to this basic system that had to be worked out for example, the character selection. In the Gif above, you can see units being selected using the cursor. This can be tricky in a 3D space, as 3D games don’t have any kind of consistent screen space for the units. So we’ve used what is called Ray-casting. Ray-casting is a tool that Unity (our game engine) uses to calculate physics. What it does is it essentially casts a ray in space from a given position (in this case our camera), in a given direction (in this case the direction of the cursor on screen). Then it sees what object it collides with, and returns that. That might be hard to consider, so I will quote the usual example and tell you to think of it like a laser beam that we are firing from the camera’s position, towards the cursor. After that, we check what object the laser beam hits. If that object is a controllable unit, then we make that unit the current context to be controlled. Once we have a unit selected, we can do things such as tell the unit to move by clicking a space on the ground, which will then, again fire another laser beam at the cursor to see what the player has clicked on. This trick is used in a lot of games that use cursors in a 3D space.
Next, once a position on the map is chosen for a unit to move to, the path-finding A.I. kicks in to find a path. Path-finding is somewhat complicated, so I’ll spare everyone those details. haha The game also uses a mini-map however so to display this, in that similar style to retro games we simply display the navigational mesh.
That light blue stuff on the mini-map widget at the top right is the navemesh.
Navemesh is essentially a 3D model created to show valid space to be walked over. The path-finding system uses the Navemesh, and a very efficient path-finding algorithm (which is likely “A*” or a variation of it) to find the shortest path to it’s target location. I will talk more about path-finding some other time since it would require some in-depth explanation.
The next thing I wanted to talk about involves the various attacks, and abilities that units learn throughout the game. The attacks and abilities are like spells, and special techniques that classes and characters learn through acquired experience. Things like Heal, lighting bolt, cross-slash, and volley.
Here you can see a mock-up of game play. Attacks are selected using the L1 button, and Abilities with R1, in combination with one of the face buttons. On the programming side, this means that every class and character has their own list of attacks, and abilities based on their level. Keep in mind, some characters have much much more than the 4 shown in the example below. Each attack has to have a name, an image for the GUI, and a reference to the effect in it’s entirety. Which includes a target type (enemy unit, player unit, any unit, position on ground.) and a function that is called to execute on the target.
Well… there is much more to discuss about the combat system, but hopefully this gives you a basic idea of what’s going on.
Until next time, keep adventuring!