[Project] Third Person Shooter

wingdnosring

New Member
Reaction score
16
Glad you like it.

How can I edit the grammar field to make it a clickable interface?

You have more than one area that has the grenade algorithm, you forgot to remove the one that isn't functional?

Actually, it's in three places. Two are used for actually firing grenades. The second one you are referring to is for the Aiming action while grenades are out. Try holding down the right mouse button with grenades selected.

[Edit]: I'd like to focus on the bullet height issue. If you jump into my sample map and try shooting at enemies with a rapid fire weapon (Plasma Turret is best for this test), you'll see that some bullets have a trail coming down to the bullet start point from midair. Also, when aiming downwards on ramps or upwards anywhere, you'll see bullets seem to start well above/below the player's unit. It's quite weird. Here's the applicable section of the trigger as it is so far in version 7:

Code:
                                                                Variable - Set Bullet_Temp_Creation_Point_Play = (Shooter Positions[BulletCreationLoopPlay] offset by 0.14 towards ((Facing of Controlled Shooter[BulletCreationLoopPlay]) - 135.0) degrees)
                                Sound - Play WeaponSound[CurrentWeapon[BulletCreationLoopPlay]] for (All players) on Controlled Shooter[BulletCreationLoopPlay] with Z offset 0.6 (at 100.0% volume, skip the first 0.0 seconds)
                                Variable - Set BulletHeightTempPlay = (Ground height at Bullet_Temp_Creation_Point_Play)
                                Variable - Set BulletAngleTempPlay[1] = (WeaponBulletSpeed[CurrentWeapon[BulletCreationLoopPlay]] * 50.0)
                                Variable - Set BulletAngleTempPlay[2] = ((Distance between Shooter Positions[BulletCreationLoopPlay] and (Current camera target of player BulletCreationLoopPlay)) + 0.0)
                                Variable - Set BulletAngleTempPlay[3] = (Square root(((Power(BulletAngleTempPlay[2], 2.0)) + ((Power(BulletAngleTempPlay[1], 2.0)) - ((BulletAngleTempPlay[2] * 2.0) * (BulletAngleTempPlay[1] * (Cos(90.0))))))))
                                Variable - Set BulletAngleTempPlay[4] = (((Sin(90.0)) * BulletAngleTempPlay[1]) / BulletAngleTempPlay[3])
                                Unit - Create Burst Amount[CurrentWeapon[BulletCreationLoopPlay]] WeaponBulletType[CurrentWeapon[BulletCreationLoopPlay]] for player BulletCreationLoopPlay at Bullet_Temp_Creation_Point_Play facing ((Camera Yaw of Player(BulletCreationLoopPlay)) - BulletAngleTempPlay[4]) degrees (Ignore Placement)
                                Variable - Set BurstGroupPlay = ((Unit type of (Last created unit)) units in (Entire map) owned by player BulletCreationLoopPlay matching Required: Missile, with at most Any Amount)
                                General - For each integer BurstLoopPlay from 1 to (Number of Any units in BurstGroupPlay) with increment 1, do (Actions)
                                    Actions
                                        General - If (Conditions) then do (Actions) else do (Actions)
                                            If
                                                ((Unit BurstLoopPlay from BurstGroupPlay) is in BulletGroups[BulletCreationLoopPlay]) == false
                                            Then
                                                Unit - Change (Unit BurstLoopPlay from BurstGroupPlay) height to (0.6 + (Ground height at Shooter Positions[BulletCreationLoopPlay])) over 0.0 seconds
                                            Else
                                General - Wait 0.001 Game Time seconds
                                General - For each integer BurstLoopPlay from 1 to (Number of Any units in BurstGroupPlay) with increment 1, do (Actions)
                                    Actions
                                        General - If (Conditions) then do (Actions) else do (Actions)
                                            If
                                                ((Unit BurstLoopPlay from BurstGroupPlay) is in BulletGroups[BulletCreationLoopPlay]) == false
                                            Then
                                                ------- Aiming vs Hipfire
                                                General - If (Conditions) then do (Actions) else do (Actions)
                                                    If
                                                        RightClickDown[BulletCreationLoopPlay] == true
                                                    Then
                                                        ------- Aiming
                                                        Unit - Make (Unit BurstLoopPlay from BurstGroupPlay) face (((Camera Yaw of Player(BulletCreationLoopPlay)) - BulletAngleTempPlay[4]) + (Random real between (0.0 - (Weapon Variation[CurrentWeapon[BulletCreationLoopPlay]] * 0.4)) and (Weapon Variation[CurrentWeapon[BulletCreationLoopPlay]] * 0.4))) over 0.0 seconds
                                                        Variable - Set BulletHeightTempPlay = (Random real between (0.0 - (Weapon Variation[CurrentWeapon[BulletCreationLoopPlay]] * 0.4)) and (Weapon Variation[CurrentWeapon[BulletCreationLoopPlay]] * 0.4))
                                                    Else
                                                        ------- Hipfire
                                                        General - If (Conditions) then do (Actions) else do (Actions)
                                                            If
                                                                WeaponFiringStyle[CurrentWeapon[BulletCreationLoopPlay]] == 1
                                                            Then
                                                                ------- Bolt-Action
                                                                Unit - Make (Unit BurstLoopPlay from BurstGroupPlay) face (((Camera Yaw of Player(BulletCreationLoopPlay)) - BulletAngleTempPlay[4]) + (Random real between (0.0 - (Weapon Variation[CurrentWeapon[BulletCreationLoopPlay]] * 10.0)) and (Weapon Variation[CurrentWeapon[BulletCreationLoopPlay]] * 10.0))) over 0.0 seconds
                                                                Variable - Set BulletHeightTempPlay = (Random real between (0.0 - (Weapon Variation[CurrentWeapon[BulletCreationLoopPlay]] * 10.0)) and (Weapon Variation[CurrentWeapon[BulletCreationLoopPlay]] * 10.0))
                                                            Else
                                                                ------- Other Firing Styles
                                                                Unit - Make (Unit BurstLoopPlay from BurstGroupPlay) face (((Camera Yaw of Player(BulletCreationLoopPlay)) - BulletAngleTempPlay[4]) + (Random real between (0.0 - Weapon Variation[CurrentWeapon[BulletCreationLoopPlay]]) and Weapon Variation[CurrentWeapon[BulletCreationLoopPlay]])) over 0.0 seconds
                                                                Variable - Set BulletHeightTempPlay = (Random real between (0.0 - Weapon Variation[CurrentWeapon[BulletCreationLoopPlay]]) and Weapon Variation[CurrentWeapon[BulletCreationLoopPlay]])
                                                Unit - Change (Unit BurstLoopPlay from BurstGroupPlay) height to (((Ground height at Bullet_Temp_Creation_Point_Play) + (0.6 + BulletHeightTempPlay)) + (((WeaponBulletSpeed[CurrentWeapon[BulletCreationLoopPlay]] * 83.3) * (0.0 - (Sin((Camera Pitch of Player(BulletCreationLoopPlay)))))) / (Sin((91.0 - (Camera Pitch of P over 5.0 seconds
                                                Player - Modify player BulletCreationLoopPlay Minerals: Set To (ClipSize[CurrentWeapon[BulletCreationLoopPlay]] - Shots_Fired[BulletCreationLoopPlay])
                                                Unit Group - Add (Unit BurstLoopPlay from BurstGroupPlay) to BulletGroups[BulletCreationLoopPlay]
                                            Else

I placed the wait in there as an experiment, but I really dislike having it in there. This loops through 14 players, so theoretically, the 14 player (assuming there are that many users) is going to be off by the wait * 14.

I've tried just about everything now. Points with Z offsets. Changing whether a unit ignores terrain height or not after creation, sending actor messages, and adding in Waits. I even tried creating a second bulletgroup that purely adjusted heights to reasonable levels before sending them off towards their targets. None of it seems to make a difference....

It seems to get worse if you're firing at a faster rate. If I use the WC-13 for instance, the effect is very rare, unless I aim incredibly high or low.

Is it possible that the problem is based off of this line?:

Code:
Variable - Set Bullet_Temp_Creation_Point_Play = (Shooter Positions[BulletCreationLoopPlay] offset by 0.14 towards ((Facing of Controlled Shooter[BulletCreationLoopPlay]) - 135.0) degrees)

I'm wondering if the facing of Controlled Shooter is changing returning a z angle as well as the x,y. When he turns, he's forced to face a dummy unit that is in the air, so it's possible that it thinks his facing is upwards...maybe? I'm really grasping at straws at this point.

[Edit 2]: Nope, it's not...just tested for that. In fact, the game seems to think these bullets are always the same height, when they clearly aren't...

I don't even know how they're getting so high into the air...I mean, they start at height 0, so how can they suddenly be jumping to height 10? It couldn't be lateral acceleration or something, could it?
 

onisagi

New Member
Reaction score
6
pay attention to see if its jumping to a different height at specific areas, like height change.
 

wingdnosring

New Member
Reaction score
16
Well, for some reason, some (not all) of the bullets fired seem to be getting created at about 10 height. Also, when aiming almost straight up with the plasma turret, there's a bizarre effect where certain bullets come UP from the ground at roughly the distance the bullets disappear at. It's almost as if some inactive bullets come up to reach the target height.

I used an error message to check and make sure the burst group was only altering the right number of units and it was consistently 3 (which it should be, since I was using the Plasma Turret for testing). What's bizarre to me is how it's so inconsistent.

I suppose it could be dependent upon how close they are to a 0.03 second interval of game time when they're created. Since they're moved every 0.03 seconds, that's the only time interval that could change from one bullet to another. It is clear that the height they get created at is based on the pitch of my camera. I don't know why that would be when their height is clearly set to 0 in the data editor, but that's what is happening. They are then being told to move to the point the user is aiming at before they get a chance to reach 0.6 bove ground level. So we have two issues here. One is the timing between the height changes. The other is their creation. I can't understand why their initial height is changing upon creation.
 

onisagi

New Member
Reaction score
6
So i see that when you aim higher than a certain pitch bullets from some of your guns look like they're being created at a higher point and travels in a curved slope towards the aiming angle. Is that your problem? How come it only happens to guns that have lingering effects? it it because other bullets have no fade/glow animation to display the travel trajectory? I remember you told me before, that you create your bullets at a certain height before setting its height to the correct height and then moving it forward. That's the problem there, that you can probably fix by hiding the units until they are ready to be seen. So you create the bullet at your shooting point, hide it, then change its height to the firing height, then unhide it-> repeat for each moving step, or only the first bullet creation step in case this interferes with the aesthetics of the bullet's glow effect.

btw, if you flag ignore terrain for the grenade unit, it should stop doing the weird jumping wen it goes over jumpy terrain. I forgot what other changes i made to make it work perfectly on any terrain height, but it was pretty small. I think i made the grenade explode when it's flying height is less than or equal to the height of ground terrain. In your case you wanna do a similar condition for the loop but start your grenade timer.

I'll probably add 0.01 to the ground terrain in the conditions, because i wanna make sure my explosion is above ground, for the effect model's sake.

Funny thing is, i've realized the grenade algorithm i've been working on can be tweaked to be a bullet firing mechanism that reacts to gravity... xD it works just like a traceline function...esp compared to rrowland's traceline function that he release its just missing collision detection with units, but it has physics and projectile movement, if i add in collision with units and bouncing physics, it'll be a complete projectile system. Inadvertently made something that i planned to do later... starting from a completely different direction.

Also ive found that shooting over cover is pretty difficult, i almost can't hit anything shooting downhill and behind cover, it was either hitting the edge of the terrain or missing the enemy. It's probably because i have no angle to shoot from the positions behind the cover, maybe make it thinner? so people can get a better angle behind it.
 

wingdnosring

New Member
Reaction score
16
So i see that when you aim higher than a certain pitch bullets from some of your guns look like they're being created at a higher point and travels in a curved slope towards the aiming angle. Is that your problem? How come it only happens to guns that have lingering effects? it it because other bullets have no fade/glow animation to display the travel trajectory? I remember you told me before, that you create your bullets at a certain height before setting its height to the correct height and then moving it forward. That's the problem there, that you can probably fix by hiding the units until they are ready to be seen. So you create the bullet at your shooting point, hide it, then change its height to the firing height, then unhide it-> repeat for each moving step, or only the first bullet creation step in case this interferes with the aesthetics of the bullet's glow effect.

It actually happens with all weapons, it's just more difficult to see on the ones that leave less of a trail. I've tried hiding the bullet suntil they start to move, but unhiding them makes all particles associated with the unit reappear, even the ones that show what I'm trying to hide. I tried the Kill All Particles action too, but it didn't work out.

I don't know why it's creating bullets so far above/below the player's marine. It's really, really frustrating though. I suspect its because I change the bullet's height to the pitch of the player's camera angle so soon after telling it to change the height to 0.6 above ground level. The two actions are too close together. The real question is this: Why are the bullets being created that high in the air in the first place? I have them set to height 0 upon creation....
 

onisagi

New Member
Reaction score
6
why don't you do all that in one step... the more steps you have the worst the particles are gonna get
 

wingdnosring

New Member
Reaction score
16
Is it possible to set a unit's height upon creation? I tried using z offsets on points, but it didn't seem to have any effect. If there's no satisfactory way to do that, it will always be 2 lines or more.
 

SerraAvenger

Cuz I can
Reaction score
234
Is it possible to set a unit's height upon creation? I tried using z offsets on points, but it didn't seem to have any effect. If there's no satisfactory way to do that, it will always be 2 lines or more.

Externalise similar code into a single action?
 

wingdnosring

New Member
Reaction score
16
Hmm..I just put a significant wait in the middle of the trigger to see what effect it would have. Basically, it made no difference, so I was wrong about the two actions being too close together.

I also noticed something else though. When aiming between (roughly) 200 and 340 degrees, the bullets fly straight. You don't get the strange trail effect at all. Why would the facing angle of the unit be a factor? None of this makes any sense... I put in an error message that told me the last created bullet's height, just to see what height it was starting at when I was aiming really high up. It displayed the same height as when I aim straight.

This seems like a problem with Blizzard's engine rather than my code. There's no way the game should think those bullets are the same height when they're clearly a good 5-10 height above the shooter's head.

I'd appreciate it if somebody else could take a really good look a this issue by delving into my library (V6's trigger is the same). I'm beyond frustrated with this little issue at the moment and its really taking away from my enjoyment of creating this system. The bullet creation triggers are located in the "Shooting Folder". I recommend messing with "Bullet Creation Player" and leaving the computer one for the time being.

As you can probably tell by the state of this post, I really need to get to sleep :S.
 

onisagi

New Member
Reaction score
6
comment yur stuff... looking at triggers is hard enough. It all looks like the same action at first glance...

And you need to compartmentalize if you can... sections that repeat... make it call an action or another trigger to do the work.

masses of triggers that look exactly the same are hard to debug. only the creator would know where everything is. I dun wanna see 2 sections of code that contain the same grenade code! D: If you're set on working with only triggers, set global variables, then call a trigger containing the code, then use local variables to grab the values from the global variables, and immediately you can call the trigger again without worry about mixing values up between trigger calls.

I still haven't found the meat of your shooting mechanism... but from the looks of it you're propagating the bullets in a single periodic trigger, meaning one trigger updates bullets that are out on the field? I'm just wondering... how yu manage to keep track of each unit's position and trajectory and use the periodic trigger to step it forward. I thought you said you stopped using custom values?

time for me to sleep too x.x
 

wingdnosring

New Member
Reaction score
16
Yeah the Bullet Travel trigger updates all bullets. Their height is set in Bullet Creation Player (or the Computer version for non-player controlled units) and they're told to adjust to that height over five seconds. The Bullet Travel trigger doesn't alter height at all.

Every 0.03 seconds Bullet Travel moves all bullets x distance towards the direction they're facing and checks for collision. That's it.

As for Bullet Creation Players:

Code:
Bullet Creation Players
    Events
        Timer - Every 0.05 seconds of Game Time
    Local Variables
        BlastPistolLoopPlay = 0 <Integer>
        BurstLoopPlay = 0 <Integer>
        BurstGroupPlay = (Empty unit group) <Unit Group>
        Bullet_Temp_Creation_Point_Play = No Point <Point>
        BulletHeightTempPlay = 0.0 <Real>
        BulletAngleTempPlay = 0.0 <Real[4]>
        BulletCreationLoopPlay = 0 <Integer>
    Conditions
    Actions
        General - For each integer BulletCreationLoopPlay from 1 to 14 with increment 1, do (Actions)
            Actions
[COLOR="Red"]                General - If (Conditions) then do (Actions) else do (Actions)
                    If
                        Grenades On[BulletCreationLoopPlay] == false
                        WeaponCoolingBool[BulletCreationLoopPlay] == false
                    Then
                        ------- Empty Clip
                        General - If (Conditions) then do (Actions) else do (Actions)
                            If
                                Remaining_Ammo[BulletCreationLoopPlay] <= 0
                                (Player BulletCreationLoopPlay Minerals) <= 0
                                Left Click Down[BulletCreationLoopPlay] == true
                                Or
                                    Conditions
                                        ForwardOn[BulletCreationLoopPlay] == false
                                        RightClickDown[BulletCreationLoopPlay] == false
                            Then
                                ------- Blast Pistol Damage If Empty
                                General - If (Conditions) then do (Actions) else do (Actions)
                                    If
                                        CurrentWeapon[BulletCreationLoopPlay] == 6
                                    Then
                                        General - If (Conditions) then do (Actions) else do (Actions)
                                            If
                                                (Number of Living units in (Units in (Entire map) having alliance Enemy with player BulletCreationLoopPlay matching Excluded: Missile, Dead, Hidden, with at most Any Amount)) >= 1
                                            Then
                                                Sound - Play Reaper_D8ChargeVO for (Player group((Owner of Controlled Shooter[BulletCreationLoopPlay]))) on Controlled Shooter[BulletCreationLoopPlay] with Z offset 0.8 (at 100.0% volume, skip the first 0.0 seconds)
                                            Else
                                        Unit Group - Pick each unit in (Units in (Entire map) having alliance Enemy with player BulletCreationLoopPlay matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
                                            Actions
                                                General - If (Conditions) then do (Actions) else do (Actions)
                                                    If
                                                        ((Picked unit) has Blast Pistol Target) == true
                                                    Then
                                                        General - For each integer BlastPistolLoopPlay from 1 to (Stack count of Blast Pistol Target on (Picked unit)) with increment 1, do (Actions)
                                                            Actions
                                                                Environment - Create Blast Pistol (Damage) on (Picked unit) from player BulletCreationLoopPlay
                                                        Unit - Remove (Stack count of Blast Pistol Target on (Picked unit)) Blast Pistol Target from (Picked unit)
                                                        Environment - Create a Large Terran explosion at (Position of (Picked unit))
                                                    Else
                                    Else
                                Sound - Play UI_UnitRaceTab for (All players) on Controlled Shooter[BulletCreationLoopPlay] with Z offset 0.6 (at 100.0% volume, skip the first 0.0 seconds)
                            Else[/COLOR]
                        ------- Regular Fire
                        [COLOR="DeepSkyBlue"]General - If (Conditions) then do (Actions) else do (Actions)
                            If
                                Left Click Down[BulletCreationLoopPlay] == true
                                (Player BulletCreationLoopPlay Minerals) > 0
                                Or
                                    Conditions
                                        ForwardOn[BulletCreationLoopPlay] == false
                                        RightClickDown[BulletCreationLoopPlay] == false
                            Then
                                General - If (Conditions) then do (Actions) else do (Actions)
                                    If
                                        CoverOn[BulletCreationLoopPlay] == true
                                        Or
                                            Conditions
                                                RightClickDown[BulletCreationLoopPlay] == false
                                                And
                                                    Conditions
                                                        (Abs(((Camera Yaw of Player(BulletCreationLoopPlay)) - (Facing of Controlled Shooter[BulletCreationLoopPlay])))) > 90.0
                                                        (Abs(((Camera Yaw of Player(BulletCreationLoopPlay)) - (Facing of Controlled Shooter[BulletCreationLoopPlay])))) < 270.0
                                    Then
                                        General - Skip remaining actions
                                    Else
                               Variable - Set WeaponCoolingBool[BulletCreationLoopPlay] = true
                                General - If (Conditions) then do (Actions) else do (Actions)
                                    If
                                        WeaponFiringStyle[CurrentWeapon[BulletCreationLoopPlay]] != 3
                                    Then
                                        Animation - Play Attack animation for (Actor for Controlled Shooter[BulletCreationLoopPlay]) as Default, using No Options options and Default Time blend time
                                        Variable - Set Left Click Down[BulletCreationLoopPlay] = false
                                    Else
                                General - If (Conditions) then do (Actions) else do (Actions)
                                    If
                                        WeaponFiringStyle[CurrentWeapon[BulletCreationLoopPlay]] != 2
                                    Then
                                        Variable - Set Shots_Fired[BulletCreationLoopPlay] = (Shots_Fired[BulletCreationLoopPlay] + Burst Amount[CurrentWeapon[BulletCreationLoopPlay]])
                                    Else
                                        Variable - Set Shots_Fired[BulletCreationLoopPlay] = (Shots_Fired[BulletCreationLoopPlay] + 1)[/COLOR] 
                                Variable - Set Bullet_Temp_Creation_Point_Play = (Shooter Positions[BulletCreationLoopPlay] offset by 0.04 towards ((Angle from Shooter Positions[BulletCreationLoopPlay] to (Point((X of (Position of InvisibleTargetDummy[BulletCreationLoopPlay])), (Y of (Position of InvisibleTargetDummy[BulletCreationLoo  [COLOR="SeaGreen"]The point a bullet is created at[/COLOR]
                                Sound - Play WeaponSound[CurrentWeapon[BulletCreationLoopPlay]] for (All players) on Controlled Shooter[BulletCreationLoopPlay] with Z offset 0.6 (at 100.0% volume, skip the first 0.0 seconds)
                                Variable - Set BulletHeightTempPlay = (Ground height at Bullet_Temp_Creation_Point_Play)
                                Variable - Set BulletAngleTempPlay[1] = (WeaponBulletSpeed[CurrentWeapon[BulletCreationLoopPlay]] * 50.0)   [COLOR="seagreen"]These four angles are actually rather unnecessary, they're a remnant from old code that I could probably remove.  As it is, they hep set the bullet's initial facing angle[/COLOR]
                                Variable - Set BulletAngleTempPlay[2] = ((Distance between Shooter Positions[BulletCreationLoopPlay] and (Current camera target of player BulletCreationLoopPlay)) + 0.0)
                                Variable - Set BulletAngleTempPlay[3] = (Square root(((Power(BulletAngleTempPlay[2], 2.0)) + ((Power(BulletAngleTempPlay[1], 2.0)) - ((BulletAngleTempPlay[2] * 2.0) * (BulletAngleTempPlay[1] * (Cos(90.0))))))))
                                Variable - Set BulletAngleTempPlay[4] = (((Sin(90.0)) * BulletAngleTempPlay[1]) / BulletAngleTempPlay[3])
                                Unit - Create Burst Amount[CurrentWeapon[BulletCreationLoopPlay]] WeaponBulletType[CurrentWeapon[BulletCreationLoopPlay]] for player BulletCreationLoopPlay at Shooter Positions[BulletCreationLoopPlay] facing ((Camera Yaw of Player(BulletCreationLoopPlay)) - BulletAngleTempPlay[4]) degrees (Ignore Placement)  [COLOR="seagreen"]Creates the bullets[/COLOR]
                                Variable - Set BurstGroupPlay = ((Unit type of (Last created unit)) units in (Entire map) owned by player BulletCreationLoopPlay matching Required: Missile, with at most Any Amount) [COLOR="seagreen"]Groups together all bullets of one type belonging to the shooter's owner[/COLOR]
                                General - For each integer BurstLoopPlay from 1 to (Number of Any units in BurstGroupPlay) with increment 1, do (Actions)  [COLOR="seagreen"]All actions given to the bullets regarding height are within this loop[/COLOR]
                                    Actions
                                        General - If (Conditions) then do (Actions) else do (Actions)
                                            If
                                                ((Unit BurstLoopPlay from BurstGroupPlay) is in BulletGroups[BulletCreationLoopPlay]) == false  [COLOR="seagreen"]Checks to ensure I'm not giving orders to bullets that are already flying out in the field[/COLOR]
                                            Then
                                                Unit - Change (Unit BurstLoopPlay from BurstGroupPlay) height to (0.6 + (Ground height at Bullet_Temp_Creation_Point_Play)) over 0.0 seconds  [COLOR="seagreen"]Changes the bullet's height to 0.6 above the marine's feet[/COLOR]
                                                ------- Aiming vs Hipfire  [COLOR="seagreen"]The if statement below changes the variation of the bullet.  If the right mouse button is held down the variation is lessened by 60%[/COLOR]
                                                General - If (Conditions) then do (Actions) else do (Actions)
                                                    If
                                                        RightClickDown[BulletCreationLoopPlay] == true
                                                    Then
                                                        ------- Aiming
                                                        Unit - Make (Unit BurstLoopPlay from BurstGroupPlay) face (((Camera Yaw of Player(BulletCreationLoopPlay)) - BulletAngleTempPlay[4]) + (Random real between (0.0 - (Weapon Variation[CurrentWeapon[BulletCreationLoopPlay]] * 0.4)) and (Weapon Variation[CurrentWeapon[BulletCreationLoopPlay]] * 0.4))) over 0.0 seconds
                                                        Variable - Set BulletHeightTempPlay = (Random real between (0.0 - (Weapon Variation[CurrentWeapon[BulletCreationLoopPlay]] * 0.4)) and (Weapon Variation[CurrentWeapon[BulletCreationLoopPlay]] * 0.4))
                                                    Else
                                                        ------- Hipfire
                                                        General - If (Conditions) then do (Actions) else do (Actions)
                                                            If
                                                                WeaponFiringStyle[CurrentWeapon[BulletCreationLoopPlay]] == 1
                                                            Then
                                                                ------- Bolt-Action  [COLOR="seagreen"]This secondary if statement does the same as the one above, but it only affects bolt-action weapons[/COLOR]
                                                                Unit - Make (Unit BurstLoopPlay from BurstGroupPlay) face (((Camera Yaw of Player(BulletCreationLoopPlay)) - BulletAngleTempPlay[4]) + (Random real between (0.0 - (Weapon Variation[CurrentWeapon[BulletCreationLoopPlay]] * 10.0)) and (Weapon Variation[CurrentWeapon[BulletCreationLoopPlay]] * 10.0))) over 0.0 seconds
                                                                Variable - Set BulletHeightTempPlay = (Random real between (0.0 - (Weapon Variation[CurrentWeapon[BulletCreationLoopPlay]] * 10.0)) and (Weapon Variation[CurrentWeapon[BulletCreationLoopPlay]] * 10.0))
                                                            Else
                                                                ------- Other Firing Styles
                                                                Unit - Make (Unit BurstLoopPlay from BurstGroupPlay) face (((Camera Yaw of Player(BulletCreationLoopPlay)) - BulletAngleTempPlay[4]) + (Random real between (0.0 - Weapon Variation[CurrentWeapon[BulletCreationLoopPlay]]) and Weapon Variation[CurrentWeapon[BulletCreationLoopPlay]])) over 0.0 seconds
                                                                Variable - Set BulletHeightTempPlay = (Random real between (0.0 - Weapon Variation[CurrentWeapon[BulletCreationLoopPlay]]) and Weapon Variation[CurrentWeapon[BulletCreationLoopPlay]])
                                                Unit - Change (Unit BurstLoopPlay from BurstGroupPlay) height to (((Ground height at Shooter Positions[BulletCreationLoopPlay]) + (0.6 + BulletHeightTempPlay)) + (((WeaponBulletSpeed[CurrentWeapon[BulletCreationLoopPlay]] * 83.3) * (0.0 - (Sin((Camera Pitch of Player(BulletCreationLoopPlay)))))) / (Sin((91.0 - (Camera  over 5.0 seconds  [COLOR="seagreen"]Changes the bullet's height over five seconds to match the angle of the player's camera[/COLOR]
                                                Unit Group - Add (Unit BurstLoopPlay from BurstGroupPlay) to BulletGroups[BulletCreationLoopPlay]  [COLOR="seagreen"]Allows Bullet Travle to move the bullet[/COLOR]
                                                Player - Modify player BulletCreationLoopPlay Minerals: Set To (ClipSize[CurrentWeapon[BulletCreationLoopPlay]] - Shots_Fired[BulletCreationLoopPlay])  [COLOR="seagreen"]Ignore this...it's a back up for checking weapon ammunition[/COLOR]
                                            Else
                                Timer - Start WeaponCoolingTimers[BulletCreationLoopPlay] as a One Shot timer that will expire in WeaponCooldownSpeed[CurrentWeapon[BulletCreationLoopPlay]] Game Time seconds
                                General - If (Conditions) then do (Actions) else do (Actions)
                                    If
                                        RightClickDown[BulletCreationLoopPlay] == true
                                    Then
                                        Camera - Apply camera object Angle Of Attack ((Camera Pitch of Player(BulletCreationLoopPlay)) - (WeaponRecoil[CurrentWeapon[BulletCreationLoopPlay]] * (Real(Burst Amount[CurrentWeapon[BulletCreationLoopPlay]])))) for player BulletCreationLoopPlay over 0.1 seconds with Existing Velocity% initial velocity and 10% deceleration
                                    Else
                                        Camera - Apply camera object Angle Of Attack ((Camera Pitch of Player(BulletCreationLoopPlay)) - ((WeaponRecoil[CurrentWeapon[BulletCreationLoopPlay]] * (Real(Burst Amount[CurrentWeapon[BulletCreationLoopPlay]]))) * 2.0)) for player BulletCreationLoopPlay over 0.1 seconds with Existing Velocity% initial velocity and 10% deceleration
                            Else
[COLOR="red"]                                ------- Reloading
                                General - If (Conditions) then do (Actions) else do (Actions)
                                    If
                                        ClipSize[CurrentWeapon[BulletCreationLoopPlay]] <= Shots_Fired[BulletCreationLoopPlay]
                                    Then
                                        General - If (Conditions) then do (Actions) else do (Actions)
                                            If
                                                Remaining_Ammo[BulletCreationLoopPlay] <= 0
                                            Then
                                            Else
                                                Variable - Set ReloadingBool[BulletCreationLoopPlay] = true
                                                Animation - Set the "Attack+Superior" animation time scale for (Actor for Controlled Shooter[BulletCreationLoopPlay]) to 2.0
                                                Animation - Play Attack Superior animation for (Actor for Controlled Shooter[BulletCreationLoopPlay]) as Default, using Play Forever options and Default Time blend time
                                                General - Wait 0.8 Game Time seconds
                                                ------- Blast Pistol Damage
                                                General - If (Conditions) then do (Actions) else do (Actions)
                                                    If
                                                        CurrentWeapon[BulletCreationLoopPlay] == 6
                                                    Then
                                                        General - If (Conditions) then do (Actions) else do (Actions)
                                                            If
                                                                (Number of Living units in (Units in (Entire map) having alliance Enemy with player BulletCreationLoopPlay matching Excluded: Missile, Dead, Hidden, with at most Any Amount)) >= 1
                                                            Then
                                                                Sound - Play Reaper_D8ChargeVO for (Player group((Owner of Controlled Shooter[BulletCreationLoopPlay]))) on Controlled Shooter[BulletCreationLoopPlay] with Z offset 0.8 (at 100.0% volume, skip the first 0.0 seconds)
                                                            Else
                                                        Unit Group - Pick each unit in (Units in (Entire map) having alliance Enemy with player BulletCreationLoopPlay matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
                                                            Actions
                                                                General - If (Conditions) then do (Actions) else do (Actions)
                                                                    If
                                                                        ((Picked unit) has Blast Pistol Target) == true
                                                                    Then
                                                                        General - For each integer BlastPistolLoopPlay from 1 to (Stack count of Blast Pistol Target on (Picked unit)) with increment 1, do (Actions)
                                                                            Actions
                                                                                Environment - Create Blast Pistol (Damage) on (Picked unit) from player BulletCreationLoopPlay
                                                                        Unit - Remove (Stack count of Blast Pistol Target on (Picked unit)) Blast Pistol Target from (Picked unit)
                                                                        Environment - Create a Large Terran explosion at (Position of (Picked unit))
                                                                    Else
                                                    Else
                                                General - If (Conditions) then do (Actions) else do (Actions)
                                                    If
                                                        (Remaining_Ammo[BulletCreationLoopPlay] + (ClipSize[CurrentWeapon[BulletCreationLoopPlay]] - Shots_Fired[BulletCreationLoopPlay])) < ClipSize[CurrentWeapon[BulletCreationLoopPlay]]
                                                    Then
                                                        Player - Modify player BulletCreationLoopPlay Minerals: Add Remaining_Ammo[BulletCreationLoopPlay]
                                                        Variable - Set Remaining_Ammo[BulletCreationLoopPlay] = 0
                                                    Else
                                                        Player - Modify player BulletCreationLoopPlay Minerals: Set To ClipSize[CurrentWeapon[BulletCreationLoopPlay]]
                                                        Variable - Set Remaining_Ammo[BulletCreationLoopPlay] = (Remaining_Ammo[BulletCreationLoopPlay] - Shots_Fired[BulletCreationLoopPlay])
                                                Variable - Set Shots_Fired[BulletCreationLoopPlay] = 0
                                                Player - Modify player BulletCreationLoopPlay Vespene: Set To Remaining_Ammo[BulletCreationLoopPlay]
                                                General - Wait 0.2 Game Time seconds
                                                Animation - Clear the Default animation for (Actor for Controlled Shooter[BulletCreationLoopPlay])
                                                Variable - Set ReloadingBool[BulletCreationLoopPlay] = false
                                                General - If (Conditions) then do (Actions) else do (Actions)
                                                    If
                                                        Left Click Down[BulletCreationLoopPlay] == true
                                                    Then
                                                        Animation - Play Attack animation for (Actor for Controlled Shooter[BulletCreationLoopPlay]) as Default, using Play Forever options and Default Time blend time
                                                    Else
                                                General - If (Conditions) then do (Actions) else do (Actions)
                                                    If
                                                        Or
                                                            Conditions
                                                                LeftOn[BulletCreationLoopPlay] == true
                                                                RightOn[BulletCreationLoopPlay] == true
                                                                ForwardOn[BulletCreationLoopPlay] == true
                                                                BackOn[BulletCreationLoopPlay] == true
                                                    Then
                                                        Animation - Play Walk Slow animation for (Actor for Controlled Shooter[BulletCreationLoopPlay]) as Default, using Play Forever options and Default Time blend time
                                                    Else
                                                General - If (Conditions) then do (Actions) else do (Actions)
                                                    If
                                                        ForwardOn[BulletCreationLoopPlay] == true
                                                        RightClickDown[BulletCreationLoopPlay] == true
                                                    Then
                                                        Animation - Play Walk animation for (Actor for Controlled Shooter[BulletCreationLoopPlay]) as Default, using Play Forever options and Default Time blend time
                                                    Else
                                    Else[/COLOR]
                    Else

Ignore the red, the upper portion is for detecting Blast Pistol shots and playing a sound when a player's out of ammo. The lower portion is for reloading.

The blue can also be ignored. It detects whether the player is actually able to fire. If running, or behind cover while facing a certain angle and not aiming, the trigger skips the remaining actions. The final blue if statement simply detects what style of shooting the user is using and whether or not the marine needs to play his attack anim again.

The straight black part is the actual bullet creation.

The green sections are little comments to help you sort through it. Some of the lines are cut off because they're too long, but it should help you understand the trigger layout.
 

xxxtrickyxxx

(o Y o)
Reaction score
64
for bullet detection why not use angles if you haven't yet? its much easier, simpler, and requires much less to be generated in the code to detect whats being hit. also much more accurate and is instant, and can easily be altered to have a drop factor or arc'd on a curv.
 

xxxtrickyxxx

(o Y o)
Reaction score
64
oh, well i honestly have trouble deciphering much from all your GUI code so i wasnt sure exactly what you used... XD

i just assumed you might have taken that dreaded loop 219048129 times every 3.2 distance or something. so you compare the actual angle your shooting with any potential targets' angles and distances and form sort of a hitbox using the angle of the triangle as the difference from the angle to the target and the actual shooting angle. and then the distance as the Adjacent side. then you find the Opposite using both the angle and the Adjacent side and if Opposite is within unit size parameters its a horizontal hit. and then move on to the vertical which is done the exact same way for the most part.

the only difference with vertical is you have to adjust the bullet change at the different distances which is very easy. i apologize if im hard to understand, i just woke up and decided to surf TH lol. my sentence fluency is poor atm. anyway, im assuming you are doing something similar the horizontal way, maybe even something more efficient than my way, but the vertical is just about the same aside from adding a few parts for altered bullet trajectory and elevation height. i created this for wc3 a few years ago so i sort of forgot exactly what i did but this is pretty close.

i may take a look at it again later as i never actually finished doing it in sc2 yet and it probably wasnt exactly the best most efficient way either. ^_^
 

wingdnosring

New Member
Reaction score
16
Hehe no problem. I really need to comment more...it seems like most people have trouble following the GUI code...

For bullet collision I compare two things:
1. The height of the bullet vs the unit's supply cost/10.
2. For width I check if The bullet's facing angle - the angle from bullet to target is greater than or equal to the unit's radius.

I'm hoping somebody can come up with a solution for the bizarre jumping bullet effects soon. They ticked me off to the point whre I've stopped workign on my system for a couple days to relieve myself of the frustration.
 

xxxtrickyxxx

(o Y o)
Reaction score
64
haha, its not as much the code maybe... gui for me always looks cluttered and messy.

hm, so your horizontal detection is similar to what I mentioned... i just realized i confused horiz and vert because horiz doesnt need any tangents or sides of angles and stuff. ^_^ thats all for vert as it gets a bit more complex. so yeah, if you want a vert detection youll need to use tan(distance from caster to target / height difference) or something. i can check my old code later if you might want to give it an attempt coding it urself i can give you the basics. im not sure im following your whole height of bullet vs unit supply cost thing though?

when you say bullet, are you refering to the angle of the theoretical path, or are you speaking of a literal entity bullet being moved around. i was under the assumption that was simply an effect. sorry cant help you on the effects stuff, i havent even tried messing with much of that.

hm, i also noticed your camera was really jittery, i am redoing my WASD into a library, it will also support the predeceanse of key pressing you spoke of even though many AAA games these days only have partial predeceanse. so if your holding W and then at the same time press the S key down, youll start going backwards until you let go of the S key or let go of the W key and they press it again etc.
 

onisagi

New Member
Reaction score
6
Using regions along with height, you can create an instant bounding-box collision detection... well more like cylinders.

I like wingdnosring's method, it's definitely more resource friendly than creating attached regions. I'll be sure to give you credit if i ever reuse the idea.

After privately publishing my test map on bnet a few days ago, i've noticed the biggest obstacle for any 3PS or FPS will definitely be the input lag. It's non-existing wen played offline by yourself, but the moment its published and loaded on bnet the whole map acts like its moving at less than 30 fps even with one person. I've always heard ther would be lag, but i didn't think it would be that bad even with just 1 player.

I think solving this problem should take priority... I have some theories as to where the lag comes from and how people might go around it, but couldn't test before beta ended :[. Maybe it'll go away wen SC2 goes retail... xD

wingdnos, i think you should just edit your bullet's default model height to the shooting height of your character. I forgot the exact field name, but its the same field that controls how high altitude a flying unit looks like its flying in the air. Any bullet that is created will "look" like it is created at the correct height, and then yu can do any height adjustments after. Terrain/unit collisions will naturally need to be offset by the added height.

And also... why do your bullets get created so high in the air? doesn't it usually get created at your feet if its not a flying unit? xD
 

wingdnosring

New Member
Reaction score
16
After privately publishing my test map on bnet a few days ago, i've noticed the biggest obstacle for any 3PS or FPS will definitely be the input lag. It's non-existing wen played offline by yourself, but the moment its published and loaded on bnet the whole map acts like its moving at less than 30 fps even with one person. I've always heard ther would be lag, but i didn't think it would be that bad even with just 1 player.

Are you kidding me? That's awful. I: wonder what part of it causes the lag...possibly the mouse-controlled camera?

when you say bullet, are you refering to the angle of the theoretical path, or are you speaking of a literal entity bullet being moved around. i was under the assumption that was simply an effect. sorry cant help you on the effects stuff, i havent even tried messing with much of that.

I mean the actual bullet. The units I create are not just effects, each missile you see is controlled manually and collision is detected for each one individually.

im not sure im following your whole height of bullet vs unit supply cost thing though?

Since there is no real way to set a unit's height without a ton of variables, I opted to use units' supply costs as a height gauge. Basically, any custom enemy you create with my system requires a custom supply cost. If your unit is 0.9 game distance in height, then you set the supplies field to -9. In this way, the user can alter their unit's height via the data editor without needing custom variables and whatnot.

And also... why do your bullets get created so high in the air? doesn't it usually get created at your feet if its not a flying unit? xD

I honestly have no idea why my bullets start so high in the air. I have their height set to 0....that's a big part of the problem.

wingdnos, i think you should just edit your bullet's default model height to the shooting height of your character. I forgot the exact field name, but its the same field that controls how high altitude a flying unit looks like its flying in the air. Any bullet that is created will "look" like it is created at the correct height, and then yu can do any height adjustments after. Terrain/unit collisions will naturally need to be offset by the added height.

I don't know the unit's default height. These bullets ignore terrain height, so simply setting their starting height to 0.6 won't cut it. If the marine is on a cliff, the strting height will be different than on even ground.

The whole thing is quite unfortunate. It drives me nuts that there is so little support via triggers or data editor for models that ignore terrain height.

I didn't realize the beta had ended already. We can still mess with the galaxy editor for a bit though right?
 

xxxtrickyxxx

(o Y o)
Reaction score
64
Yeah, online its pretty bad. I have optimized much in my system like running periodics ONLY when necessary... no *run every 0.00 seconds* 24/7 for every player at all now, but doesn't improve much because its not the million lines of code every second but the time it takes for a button click or key press to send to the client server and back to every player. hopefully the client severs will be much better than they were in beta, but no matter what it will take atleast 300-400+ milliseconds for a key press to fully detect as it takes 150-200ms to send and then again to receive. I believe im somewhat accurate with this? There is no prediction client so 300-400ms is a huge notice without.

Anyway, so your manually sliding a bullet around each shot and detection a collision EVERY loop or did you somehow make use of the new Movers in data editor? Ugh, that will never work on multiplayer if you ever decide to go that route. Bullets will have to be 100% theoretical and use effects to display them. This is why I recommended you use an instant detection since well... aren't bullets near instant anyway? You can not really make a map large enough for bullet travel over long distances to really matter. It is also much less CPU intensive since it only has to fire once and then loop for every player for potential targets. Or if you have lots of AI units, then simply create a parameter of where to pick all the units so it won't pick every unit on the map.
 

wingdnosring

New Member
Reaction score
16
well that sucks. So basically, a proper shooter is impossible with this engine? How lame. I had such big plans for this...

Ah well, it still works well enough solo right? I too have tried avoiding Periodics as much as possible. I only have two really fast ones (fast as in under a second), one for bullet travel and another for WASD movement. Both of those run every 0.03 seconds.

Ah well, I'll keep working on this anyway...you never know, the proper release servers might be better and the modding community may find alternate ways of doing things that work better. If we find some magical solutions to these problems, I can always incorporate them at a later date.

Theoretical bullets will never work as well...
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top