Wednesday 21 February 2018

New GamePlay Modes, New Weapons, New Fonts, New Stuff

Whilst contemplating unlockables, the obvious ones being the powerups which have to be unlocked, I turned my attention to differing gameplay modes. These things are sometimes called modifiers or mutagens and change an aspect of how the gameplay works. I came up with five ideas which I considered to be a good balance. I thought I might name them along the lines of "Trial By Whatever", as each one is an additional form of  challenge. I also thought that it might be a good idea to add a bonus score modifier to each one in use, that way if the player unlocked and chose to enable all five challenges, their score would double - thus giving an added incentive for the player to actual use them. Cue bullet point list! Note, gameplay modifier names are works in progress.
  1. Trial By Fun: Everybody drops FunBalls on death. Previously only bosses and certain enemies would drop FunBalls, but with this modifier every deceased enemy does and the original enemies drop double the amount. Expect more dodging!
  2. Trial By Strength: All attacks, whether by the player or the enemy, do critical damage. This is basically a x3 modifier to damage which makes gameplay much faster and increases the player's own vulnerability.
  3. Trial By Chance: Swag parcels full of powerups no longer spawn, instead there is a small percentage chance (based on the actual game difficulty chosen by the player at the main menu) of an enemy dropping a powerup when they are directly attacked by the player. In the proposed multiplayer co-op mode, this could create a rather amusing situation when everyone suddenly dives in to try and grab the swag for themselves.
  4. Trial By Judgement. All enemies spawn as elites. This means that not only do they have a higher capacity to take damage (somewhat negated if Trial By Strength is also enabled) but also carry a special attack of some sort, which are: radiation attack, player seeking missiles, extra health and damage, speed bonus,  electical attack and slow player on touch attack.
  5. Trail By Ordeal. Every 9 minutes or so (not certain of the acutal timings yet) some sort of enemy champion or enemy horde teleport in to harrass the player.
As stated above, unlocking and then enabling each of these challenges adds 20% to the player's score. Enabling them also makes for a much faster and more hectic game as escaping the level becomes much more urgent.

 Collecting a swag powerup dropped by an enemy

Speaking of unlockables, characters came to mind. Characters will come with their own statistics and are auto-equipped with their own weapon and evasion ability. Currently I only have one character, running around as placeholder yellow cube with a pistol and fast but short sprint for their evasion ability. Their standard attack is a single light bullet (damage 10) which has a long range (20m+), and their heavy attack (which uses energy the same as their evasion does, so the player has to wait for the recharge before being able to use either again) is a burst of four heavy bullets (damage 20 x4). Whilst tidying the finite state machines which control weapon states up, I noticed an error which had been around since the time the dinosaurs ruled the earth. Heavy attacks use onAltFire as a function call, but I had them set to the standard stateFire rather than stateAlternateFire, which meant that they were inheriting data from the standard attack. This meant that heavy attack was using particles and audio set for light attack rather than their own. Now heavy attack has a deeper, bassier gunshot and a wider spray of gunbarrel particles. I should have noticed this error much sooner.

Creating a new character I decided on "shotgun" as the weapon. This has a standard attack of solid slug (damage 50) which is much slower than the pistol in firing as it has to be cocked with a nice pump-action sound and also has a shorter range (12m). To compensate the damage is much higher. The heavy attack is a close range (5m) scatter shot, which hits all targets within a 90 degree angle (damage 20). The special evade for Shotgun is what I have called a "Ghost Run" - the ability to run through enemies for a few seconds to escape.

"Ghost Run" took some doing, as I had never had cause to go hunting around the collision code which was spread through numerous files of the engine. So what I wanted was to find out where I could extract the collision object's type (eg: AI enemies are derived from Player Class so I only wanted playerObjects) and then make a test against the class on whether this object should be ignored.

Of course it was not that simple ...



A few days and according to Windows Event Viewer, 80 crashes later, I realized that the whole thing was a lot simpler than I had originally envisioned. I created a new customCollisionMask for the Player class which emitted PlayerObjects and then made the test under the Player class's own workingCollisionList. If "Ghost Run" was enabled via a bool flag, and the object was derived from Player class then it used the customCollisionMask to ignore new playerObjects. Another bool flag issued when the state of Ghost Run changed which then renewed the workingCollisionList to remove that playerObject if it had already been added to the list, or readd it to the list if it was the last collision ignored before Ghost Run was deactivated. I felt like a coding god, regardless of having spent the previous week looking in entirely the wrong files.

I should probably read this, but to be honest my style is to make it up as I go ...

So now I had a working second character. Apart from obvious difference such as attacks and abilities I decided that characters should also have a unique strength attribute when colliding with enemies (or other players). This would be useful for barging their way past opponents. Strength should be relative to their own suited range, thus long range based characters would have a low value whilst short ranged, melee based characters would be high.

Shotgun is a medium ranged character so can push similar sized enemies around by banging into them. Pistol is a long range based character so now finds it difficult to physcially move enemies and is much more vulnerable to get swarmed at close range. However Pistol has a sprint evasion which quadruples speed and triples the force of pushing enemies, though this only lasts for a couple of seconds as energy drains away.

Shotgun in action, with Gradius Style Option/Follower trailing behind 
 
I also started thinking more about the overall look of the player's screen and HUD, and how to display information best with text. Thus began the GREAT FONT HUNT! If there is one thing which can be equated to slogging through an parched wasteland of spikey rocks, it's trying to find fonts for your game. I have a preference for condensed fonts, I think they look elegant, but elegant and easily readable with a quick glance are not always the same thing.

This looked great until I added it the actual HUD ...

 There's thin and difficult to read and then there is this ...

 Yeah, but no but really no ...

Argh my eyes ...

 One of the great problems with staring at millions of fonts is that they all end up looking the same. Currently I have this below, but found that the numbers are a little too close together. Using a font editor I managed to give them a little bit more spacing. Cue the first image in this blog being reused.


Hello it's the first image in this blog again

So that's progress. Next up are to make more characters with various abilities and give them a thorough testing for balance. After that come up with a definitive list of enemies and environments for levels, and then hopefully finally start on some model designs to chip away at all these placeholder cubes. Also somewhere on the horizon is ditching DirectX 9.0c and updating to Physical Based Rendering ... whatever the hell that is ...