Today I spent way too much time on my character movement controller. It turns out, this part is more complicated than I expected. But it’s so important to get it right, that I took the time, and spent a bunch of days working on it.
At first, I was a little bit disappointed that something so basic was not included in the game engine. So I browsed the asset store and tried a few assets with no success.
The problem, kin of “as usual” is that I want something very specific with a certain feel to it, and even if most of the assets were configurable I never found the right combination. I decided to give it a try myself.
I’m a little torn, in a way it was not so hard to do, but on the other, I had to deal with so many cases. As you may know from my article on my technological choices I decided to handle most of the physics myself. So that was some work to get the character to collide with stuff and bounce when projected.
But it’s done.
I implemented left / right move
Jump (and double jump) in player physics controller
Handled pretty much all collision cases, including when hitting multiple walls at the same time (or when falling, jumping)
Implemented distance limits (because in Artillery Royale, a character can move a certain distance regarding his class. Not sure that mechanic will make it up to the final version).
These days I’m lucky enough to spend time with a great artist: Jean-Baptiste Dessaux (Jb for short). He is going to work on the graphic side of Artillery Royale.
I’m very happy that this part of the project is moving forward! We are going to try to answer some critical gameplay questions; for example the proportion of the character versus the map or the style of the game.
Size IS IMPORTANT
In classic artillery games, players often move military tanks (or in the particular case of the Worms series: worms). These characters are slow, which gives artillery all its meaning.
In Artillery Royale, the characters are not intended to move slowly, they are humanoids. This could be a gameplay problem. Indeed if the player can quickly move his characters close to those of the other player, why would he use artillery rather than nearby weapons?
That’s partly why we have another gameplay mechanism: distance limits per character. For example, the bishop can move a certain distance, the knight a bit more, etc (it’s because the game has some chess board game roots). But even for me, it seems a little bit odd.
We will see how it goes!
By working with Jb I came to realize that doing a map generator is probably too early for the game. I’ll go for a pre-built map so the gameplay can be tested in advance. It’s always sad to remove features from the codebase but that’s how programs/projects dev work.
This article will be updated as I add parts to the game. Last update was on the 30th of October 2020
In this blog post, I will talk about the technological choices I made and go deeper in some technical details about the game.
The game is based on the Unity engine which allows you to export on all platforms, from PC/Mac to consoles via mobile platforms. I made that choice because I know Unity quite well and I like coding in C#. But to be honest, everything is not perfect in the Unity world.
Love / hate relationship
I love Unity because it’s very easy to get started with, there are plenty of online tutorials and examples, and the assets store has some good gems. All this gets you to pass the prototype phase pretty quickly.
I hate Unity because they have different ways to do the same thing (usually they buy some popular asset, integrate it in the software and that’s it, they do not remove the part it replaces). They also sometimes remove features without giving anything in replacement (last example with the networking part).
When I started the game, I thought “it’s going to be easy because Unity has all the needed tools including a good 2D physics engine”. But after a while playing with it, I found a bunch of blocking limitations.
First, it’s very hard to customize, you can play with physics materials and change the mass, friction, and all those variables, even the gravity scale itself. But still, in the end, it’s a bunch of variables that you’ve changed here and there. You get easily confused and it’s not even practical to test.
Second, and that was the blocker, the Physics engine is non-deterministic. It means that given a set of inputs (i.e.: force, mass, and start position) if you play it two times, you will probably not have the same output. Unfortunately, this is not compatible with Artillery Royale Gameplay. If a player at some point has a good aim, now the right force and play the same move again, they should get their bullet at the very same spot.
You will see that the deterministic part is even more important because of network implementation.
So I took some time to re-implement basic physic equations but kept some of Unity existing pieces like colliders and collision resolutions.
About the destructible map
I found a great asset on the store that allows you to take any Sprite and make it destructible. I bought it without even thinking and at first, I was in love.
But after some prototyping, I found out that because the asset was working on pixels and not shapes it would never render the way I wanted.
So I made my own destructible map which is based on Sprite Mask and custom polygon colliders, all of this is easily done with Unity and a bit of shape math.
I made some new prototype with a new solution of my own, tailored for that particular game. Indeed, being a turn-based game, I will go for a “turn replay” mechanism: the idea is to record the turn of the player (with a specific optimized stream format) and broadcast it to the other player in near real time. This will also allow keeping a record of any game for later replays.
You can now see how important it is to have deterministic physics, so I don’t need to record every movement in the replay stream.
With some tweaks and the right amount of smoothing I think it gave some good result.
But when you have to move your character on these maps it’s quite challenging, and I was wondering how I can have something better on that side and keep some of the interesting shapes?
Second attempt: Combinatory
I experimented with something I call a “combinatory” map. It’s a name I made up, I did not see any reference online talking about this approach.
The idea behind it is to take some basic shapes, like rectangles, triangles, and circles in different sizes and positions, and merge them into a single block.
If you apply some smoothing, you get something really convincing (IMHO). And this time it’s easy to navigate. Too easy probably.
When working on an important part of a game, it’s always good to ask for external feedbacks. So it’s what I did when I started to work with Jean-Baptiste the designer.
We came to the conclusion that the solution will be to mix the combinatory approach and some pre-made elements like platforms or other static objects.
This is what it looks like
Building a good random map generator is very hard, on this blog post I’ve shown you only the good results, but you can be sure that one out of two tries leads to some weird and probably unplayable map.
I’m going to work harder on this topic, but it will not be included in the playable. On this demo, you will find a handcrafted static map, tested for playability and fun!
In this mode, the two players start on a randomly generated map, with a defined number of characters.
The player’s goal is to eliminate all of the opposing player’s characters. Either by killing them or by expelling them from the map.
There are 5 to 8 characters per player: the Queen, the Bishop(s), the Rook(s), the Knight(s), and the King (not present in Battle mode, see Capture the King mode below).
Each of these characters is controlled in turn by the player, he cannot choose which character he wants to control, the order is pre-defined.
The parallel with chess is done via character classes (Bishop, King, etc.) but also by the fact that each character’s movement is limited by its class. ie: the Bishop can only move within a certain radius, the Rook a smaller radius, and the Queen without limitation.
Capture the King mode
In this mode, the rules are similar. The characters and the map are generated and positioned symmetrically (face to face) and the King of each player is positioned at each end of the map.
The goal is then for a player to go “capture” the opposing king (touch him with one of their characters).
Let’s meet the Characters
Playing different characters in the same game is one of the keys differentiation from other artillery games. Each character is visually different and has different abilities (and special weapons see below).
The Rook, for example, moves slowly (because it will be quite big), the Knight on the contrary is more agile.
Here is the list of the different characters and their particular characteristics:
Rook: The rook is an imposing piece, moves slowly. Its special ability is to be able to make a protective force field.
Queen: The queen is not limited in travel distance. It’s her special ability.
Bishop: The bishop has a special weapon, his movement is limited, his speed normal.
King: King’s movements are very limited.
Knight: The knight’s special ability is speed and greater amplitude of jump.
Let’s discovers the Weapons
Each player starts with three unlimited basic weapons, bazooka; grenade; gun. Then randomly on the ground, boxes containing a weapon appear. The player can pick up those boxes.
Bazooka: Simple projectile, the trajectory is influenced by the wind, explodes when the projectile encounters an obstacle, projection force managed by the player.
Grenade: Simple projectile, not influenced by the wind, bounced when encountering an obstacle, explodes after 3-5 seconds, projection force managed by the player.
Pistol: Straight shot, not influenced by the wind, instantaneous (no movement of the projectile), no force of projection.
Mortar: Simple projectile, the trajectory is NOT influenced by the wind, explodes when the projectile encounters an obstacle, no projection force.
Bomb: Simple projectile, not influenced by the wind, heavy, rebounded very little when encountering an obstacle, explodes 2 seconds after touching the first obstacle, projection force managed by the player.
Bonuses/penalties boxes appear randomly on the map. A player can pick them up and their ability applies to the current turn.
Double damage: Doubles the size of the explosions as well as the number of damage.
Double distance: Allow the current character to move further.
Everyone goes down: The ground sinks a unit in the lava.
Who is Jrmgx?
My real name is Jerome, I’m from France. In my everyday life, I’m a web/mobile/game developer. I had some success recently with Glitch Clip.
Today I want to level up and work on a bigger project! I’m really motivated, and ready to dedicate time and money to make it a success!
What are the Ambitions?
The goal is to make a PC / console game and then think about the mobile version. It’s a paying game, not a free to play. The game is intended for two players and is played either via the Internet or on the same machine.