Fursan al-Aqsa Dev Blog #13 - Fixing the Aiming System
In this technical article I explain step by step how I was able to fix the most significant bug of my game, which could, for some players, break the gameplay.
I know my game is not perfect, but I can assure it has less bugs than #CyberBug 2077 :) :) :)
Yesterday, after an entire night asleep and with the help of Allah (God), I was able to solve the most significant bug of my game. This bug was there since the first demo, and I tried to solve it many times without success. Then, as any other dev, I put it on my TODO LIST.
However, I was talking with a friend of mine, who recently downloaded and tested the last demo (Infiltration), and he told me although he liked my game, but the aiming bug spoiled his enjoyment with my game. This made me think too much on the matter. So I decided: It's time to put my dirty hands to solve this shit :)
The bug in question, is that sometimes, if the player is too much close to some wall, or any level geometry object, the projectile simply is not launched from the weapon, which results in too much frustration for the player, because he is aiming towards the enemy and the bullets don't hit the target.
The advantage of UDK Engine, in my case, is that it comes with the entire source code (unreal scripts) of Unreal Tournament 3, making it the perfect engine for making a shooter game (you can create ANY kind of game with UDKEngine, but you have a shooter template outside the box).
I did read the entire UTWeapon.uc script, which controls all the functions of a weapon in Unreal Engine 3 (in case UT3). So I came to the origin of this bug:
The function is:
simulated function vector GetPhysicalFireStartLoc(optional vector AimDir)
And the line of code is:
FireStartLoc = Instigator.GetPawnViewLocation() + (FireDir * FireOffset.X);
Even if you don't understand UnrealScript, but is very simple to have an idea of what's happenning.
The FireStartLoc is the initial position of the projectile (in case the weapon bullet), and it's calculated taking into consideration the Player Camera (PawnViewLocation). I asked myself, why the fuck EPIC Games did this way? It`s because Unreal Tournament 3 is a First Person Shooter, so it makes sense to use the player point of view for calculating the projectile start point.
But as I changed the camera for my game (Third Person), so whenever the player is pressed behind a wall, the camera changes to avoid colliding with the wall, so it kinda loses the PawnViewLocation, resulting on the bullet not being ejected from the weapon.
So after a lot of trial and errors, and trying to use other calculations and formulas on this same class (UTWeapon.uc), I replaced that line of code by this:
//FireStartLoc = Instigator.GetPawnViewLocation() + (FireDir * FireOffset.X); FireStartLoc = Instigator.Location - FireDir*FiredProjectileClass.default.CylinderComponent.Translation.X; FireStartLoc.Z = FireStartLoc.Z + FMin(Instigator.EyeHeight, Instigator.CylinderComponent.CollisionHeight - FiredProjectileClass.default.CylinderComponent.CollisionHeight - 1.0);
Voila!!! The projectile now is fired from the weapon regardless the player position!!! Problem solved? Not yet.
These new formulas solved the problem in 95%, then I just needed to make a small adjustment on the crosshair screen position, to make the projectile hit the center of the crosshair. But I needed to make 2 adjustments, one for First Person View, and another for Third Person View.
The function is:
DrawWeaponCrosshair( Hud HUD )
if( Instigator != none ) { PC = UTPlayerController(Instigator.Controller); //this will check if is FPS view if (PC.bBehindView == false) { //ScreenX = X - (CrosshairSize.X * 0.5); ScreenX = X - (CrosshairSize.X * 0.5); } //this will check if is TPS view else { //ScreenX = X - (CrosshairSize.X * 0.5); ScreenX = X - (CrosshairSize.X * 0.5) - 10; } } ScreenY = Y - (CrosshairSize.Y * 0.5); Now I finally solved this bug which was torturing me from a long time.
And as a plus, now the bullet time effect has a more important function than just the cosmetics. Because I had to increase a bit all the guns projectile speed, to make the aiming system more accurate, so now the bullet time slow motion effect can trully help to deviate from the bullets.
Last, but not least, making headshots now is a breeze!
Cheers and until next update!
Get Fursan al-Aqsa: The Knights of the Al-Aqsa Mosque®
Fursan al-Aqsa: The Knights of the Al-Aqsa Mosque®
Third Person Shooter Game about Palestine Resistance against Israel Occupation
Status | In development |
Author | Nidal Nijm Games |
Genre | Shooter, Action |
Tags | FPS, intifada, israel, middle-east, palestine, ps3, resistance, Third-Person Shooter, xbox360 |
Languages | Arabic, English, Portuguese (Brazil), Chinese (Simplified) |
More posts
- Fursan al-Aqsa is at RISK + Operation al-Aqsa Flood Update31 days ago
- Vote for Fursan al-Aqsa in the DevGAMM Awards!68 days ago
- Fursan al-Aqsa Remake - Steam FPS Fest & Nablus UpdateApr 15, 2024
- Fursan al-Aqsa won the Best Hardcore Game Award!!!Mar 21, 2024
- Fursan al-Aqsa Diapers Update and Steam Winter SalesDec 20, 2023
- Vote for Fursan al-Aqsa IOTY 2023!Dec 03, 2023
- Fursan al-Aqsa Steam Autumn Sales, Steam Awards and Sniper Rifle GameplayNov 25, 2023
- Fursan al-Aqsa Remake - Nablus Preview - The Lions' DenOct 22, 2023
- Fursan al-Aqsa Classic Episode 2: Battle of al-Aqsa MosqueAug 13, 2023
- Call of JihadJul 06, 2023
Leave a comment
Log in with itch.io to leave a comment.